110 #ifdef G4HEPREPFILEDEBUG
111 G4cout <<
"G4HepRepFileSceneHandler::BeginPrimitives2D() " <<
G4endl;
113 inPrimitives2D =
true;
118 #ifdef G4HEPREPFILEDEBUG
119 G4cout <<
"G4HepRepFileSceneHandler::EndPrimitives2D() " <<
G4endl;
126 #ifdef G4HEPREPFILEDEBUG
127 void G4HepRepFileSceneHandler::PrintThings() {
129 " with transformation "
138 "\n current physical volume: "
140 "\n current logical volume: "
142 "\n current depth of geometry tree: "
151 #ifdef G4HEPREPFILEDEBUG
153 "G4HepRepFileSceneHandler::AddSolid(const G4Box& box) called for "
211 #ifdef G4HEPREPFILEDEBUG
213 "G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) called for "
222 G4bool linedUpWithAnAxis = (std::fabs(r.
phiX())<=.001 ||
223 std::fabs(r.
phiY())<=.001 ||
224 std::fabs(r.
phiZ())<=.001 ||
225 std::fabs(r.
phiX()-
pi)<=.001 ||
226 std::fabs(r.
phiY()-
pi)<=.001 ||
227 std::fabs(r.
phiZ()-
pi)<=.001);
278 #ifdef G4HEPREPFILEDEBUG
280 "G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) called for "
289 G4bool linedUpWithAnAxis = (std::fabs(r.
phiX())<=.001 ||
290 std::fabs(r.
phiY())<=.001 ||
291 std::fabs(r.
phiZ())<=.001 ||
292 std::fabs(r.
phiX()-
pi)<=.001 ||
293 std::fabs(r.
phiY()-
pi)<=.001 ||
294 std::fabs(r.
phiZ()-
pi)<=.001);
347 #ifdef G4HEPREPFILEDEBUG
349 "G4HepRepFileSceneHandler::AddSolid(const G4Trd& trd) called for "
409 #ifdef G4HEPREPFILEDEBUG
411 "G4HepRepFileSceneHandler::AddSolid(const G4Trap& trap) called for "
421 #ifdef G4HEPREPFILEDEBUG
423 "G4HepRepFileSceneHandler::AddSolid(const G4Sphere& sphere) called for "
433 #ifdef G4HEPREPFILEDEBUG
435 "G4HepRepFileSceneHandler::AddSolid(const G4Para& para) called for "
445 #ifdef G4HEPREPFILEDEBUG
447 "G4HepRepFileSceneHandler::AddSolid(const G4Torus& torus) called for "
457 #ifdef G4HEPREPFILEDEBUG
459 "G4HepRepFileSceneHandler::AddSolid(const G4Polycone& polycone) called for "
469 #ifdef G4HEPREPFILEDEBUG
471 "G4HepRepFileSceneHandler::AddSolid(const G4Polyhedra& polyhedra) called for "
481 #ifdef G4HEPREPFILEDEBUG
483 "G4HepRepFileSceneHandler::AddSolid(const G4Orb& orb) called for "
493 #ifdef G4HEPREPFILEDEBUG
495 "G4HepRepFileSceneHandler::AddSolid(const G4Ellipsoid& ellipsoid) called for "
505 #ifdef G4HEPREPFILEDEBUG
507 "G4HepRepFileSceneHandler::AddSolid(const G4TessellatedSolid& ) called for "
517 #ifdef G4HEPREPFILEDEBUG
519 "G4HepRepFileSceneHandler::AddSolid(const G4Solid& solid) called for "
529 #ifdef G4HEPREPFILEDEBUG
530 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&) " <<
G4endl;
536 (
"G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&)",
542 new std::vector<G4AttValue>;
544 new std::map<G4String,G4AttDef>;
547 std::vector<G4AttValue>::iterator iAttVal;
548 std::map<G4String,G4AttDef>::const_iterator iAttDef;
553 if (rawTrajAttValues) {
557 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
558 "\nERROR found during conversion to standard trajectory attributes."
561 #ifdef G4HEPREPFILEDEBUG
563 "G4HepRepFileSceneHandler::AddCompound(traj): standardised attributes:\n"
566 delete rawTrajAttValues;
584 if (strcmp(
"Trajectories",previousName)!=0) {
598 G4String category = iAttDef->second.GetCategory();
599 if (strcmp(category,
"Draw")!=0 &&
600 strcmp(category,
"Physics")!=0 &&
601 strcmp(category,
"Association")!=0 &&
602 strcmp(category,
"PickAction")!=0)
603 category =
"Physics";
605 category, iAttDef->second.GetExtra());
618 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->
CreateAttValues();
619 std::vector<G4AttValue>* pointAttValues =
620 new std::vector<G4AttValue>;
621 std::map<G4String,G4AttDef>* pointAttDefs =
622 new std::map<G4String,G4AttDef>;
626 if (rawPointAttValues) {
628 aTrajectoryPoint->
GetAttDefs()).Standard(pointAttValues,pointAttDefs);
630 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
631 "\nERROR found during conversion to standard first point attributes." <<
G4endl;
635 if (pointAttValues && pointAttDefs) {
636 for (iAttVal = pointAttValues->begin();
637 iAttVal != pointAttValues->end(); ++iAttVal) {
639 pointAttDefs->find(iAttVal->GetName());
640 if (iAttDef != pointAttDefs->end()) {
643 G4String category = iAttDef->second.GetCategory();
644 if (strcmp(category,
"Draw")!=0 &&
645 strcmp(category,
"Physics")!=0 &&
646 strcmp(category,
"Association")!=0 &&
647 strcmp(category,
"PickAction")!=0)
648 category =
"Physics";
652 if (strcmp(iAttVal->GetName(),
"Aux-X")!=0 &&
653 strcmp(iAttVal->GetName(),
"Aux-Y")!=0 &&
654 strcmp(iAttVal->GetName(),
"Aux-Z")!=0 &&
655 strcmp(iAttVal->GetName(),
"Pos-X")!=0 &&
656 strcmp(iAttVal->GetName(),
"Pos-Y")!=0 &&
657 strcmp(iAttVal->GetName(),
"Pos-Z")!=0)
659 category, iAttDef->second.GetExtra());
663 delete rawPointAttValues;
668 delete pointAttValues;
705 redness = colour.
GetRed();
713 if (redness==0. && greenness==0. && blueness==0.) {
720 if (strcmp(
"Trajectory Step Points",previousName)!=0) {
740 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->
CreateAttValues();
741 std::vector<G4AttValue>* pointAttValues =
742 new std::vector<G4AttValue>;
743 std::map<G4String,G4AttDef>* pointAttDefs =
744 new std::map<G4String,G4AttDef>;
748 if (rawPointAttValues) {
750 aTrajectoryPoint->
GetAttDefs()).Standard(pointAttValues,pointAttDefs);
752 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
753 "\nERROR found during conversion to standard point attributes." <<
G4endl;
757 if (pointAttValues) {
758 for (iAttVal = pointAttValues->begin();
759 iAttVal != pointAttValues->end(); ++iAttVal)
763 if (strcmp(iAttVal->GetName(),
"Aux-X")!=0 &&
764 strcmp(iAttVal->GetName(),
"Aux-Y")!=0 &&
765 strcmp(iAttVal->GetName(),
"Aux-Z")!=0 &&
766 strcmp(iAttVal->GetName(),
"Pos-X")!=0 &&
767 strcmp(iAttVal->GetName(),
"Pos-Y")!=0 &&
768 strcmp(iAttVal->GetName(),
"Pos-Z")!=0)
775 delete pointAttValues;
776 delete rawPointAttValues;
803 redness = colour.
GetRed();
811 if (redness==0. && greenness==0. && blueness==0.) {
818 if (strcmp(
"Trajectory Auxiliary Points",previousName)!=0) {
838 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->
CreateAttValues();
839 std::vector<G4AttValue>* pointAttValues =
840 new std::vector<G4AttValue>;
841 std::map<G4String,G4AttDef>* pointAttDefs =
842 new std::map<G4String,G4AttDef>;
846 if (rawPointAttValues) {
848 aTrajectoryPoint->
GetAttDefs()).Standard(pointAttValues,pointAttDefs);
850 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
851 "\nERROR found during conversion to standard point attributes." <<
G4endl;
855 if (pointAttValues) {
856 for (iAttVal = pointAttValues->begin();
857 iAttVal != pointAttValues->end(); ++iAttVal)
861 if (strcmp(iAttVal->GetName(),
"Aux-X")!=0 &&
862 strcmp(iAttVal->GetName(),
"Aux-Y")!=0 &&
863 strcmp(iAttVal->GetName(),
"Aux-Z")!=0 &&
864 strcmp(iAttVal->GetName(),
"Pos-X")!=0 &&
865 strcmp(iAttVal->GetName(),
"Pos-Y")!=0 &&
866 strcmp(iAttVal->GetName(),
"Pos-Z")!=0)
873 delete pointAttValues;
874 delete rawPointAttValues;
880 const std::vector<G4ThreeVector>* auxiliaries = aTrajectoryPoint->
GetAuxiliaryPoints();
881 if (0 != auxiliaries) {
882 for (
size_t iAux=0; iAux<auxiliaries->size(); ++iAux) {
894 #ifdef G4HEPREPFILEDEBUG
895 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(G4VHit&) " <<
G4endl;
901 new std::vector<G4AttValue>;
903 new std::map<G4String,G4AttDef>;
906 std::vector<G4AttValue>::iterator iAttVal;
907 std::map<G4String,G4AttDef>::const_iterator iAttDef;
911 if (rawHitAttValues) {
915 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(hit):"
916 "\nERROR found during conversion to standard hit attributes."
919 #ifdef G4HEPREPFILEDEBUG
921 "G4HepRepFileSceneHandler::AddCompound(hit): standardised attributes:\n"
924 delete rawHitAttValues;
942 if (strcmp(iAttVal->GetName(),
"HitType")==0) {
943 hitType = iAttVal->GetValue();
955 if (strcmp(hitType,previousName)!=0) {
965 iAttDef =
hitAttDefs->find(iAttVal->GetName());
969 G4String category = iAttDef->second.GetCategory();
970 if (strcmp(category,
"Draw")!=0 &&
971 strcmp(category,
"Physics")!=0 &&
972 strcmp(category,
"Association")!=0 &&
973 strcmp(category,
"PickAction")!=0)
974 category =
"Physics";
976 category, iAttDef->second.GetExtra());
998 std::vector<G4AttValue>::iterator iAttVal;
1021 std::vector<G4AttValue>::iterator iAttVal;
1038 #ifdef G4HEPREPFILEDEBUG
1040 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) called:"
1041 "\n polyline: " << polyline
1053 G4cout <<
"HepRepFile does not currently support 2D lines." <<
G4endl;
1070 for (
size_t i=0; i < polyline.size(); i++) {
1079 #ifdef G4HEPREPFILEDEBUG
1081 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polymarker& line) called"
1093 G4cout <<
"HepRepFile does not currently support 2D lines." <<
G4endl;
1101 if (sizeType==
world)
1118 for (
size_t i=0; i < line.size(); i++) {
1126 #ifdef G4HEPREPFILEDEBUG
1128 "G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) called:"
1136 G4cout <<
"HepRepFile does not currently support 3D text." <<
G4endl;
1137 G4cout <<
"HepRep browsers can directly display text attributes on request." <<
G4endl;
1138 G4cout <<
"See Application Developers Guide for how to attach attributes to viewable objects." <<
G4endl;
1146 if (sizeType==
world)
1161 float redness = colour.
GetRed();
1162 float greenness = colour.
GetGreen();
1163 float blueness = colour.
GetBlue();
1166 if (redness==0. && greenness==0. && blueness==0.) {
1182 #ifdef G4HEPREPFILEDEBUG
1184 "G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) called:"
1197 G4cout <<
"HepRepFile does not currently support 2D circles." <<
G4endl;
1205 if (sizeType==
world)
1228 #ifdef G4HEPREPFILEDEBUG
1230 "G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) called:"
1243 G4cout <<
"HepRepFile does not currently support 2D squares." <<
G4endl;
1251 if (sizeType==
world)
1274 #ifdef G4HEPREPFILEDEBUG
1276 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called."
1311 }
while (notLastEdge);
1312 }
while (notLastFace);
1323 #ifdef G4HEPREPFILEDEBUG
1325 "G4HepRepFileSceneHandler::AddHepRepInstance called."
1334 G4int currentDepth = 0;
1342 #ifdef G4HEPREPFILEDEBUG
1374 if (strcmp(
"Text",primName)==0) {
1377 if (strcmp(
"Line",primName)==0) {
1382 strcmp(
"Square",primName)==0)
1388 strcmp(
"Circle",primName)==0)
1404 }
else if (pCurrentPV==0) {
1412 if (strcmp(
"Text",primName)==0) {
1415 if (strcmp(
"Line",primName)==0) {
1444 typedef std::vector<PVNodeID>
PVPath;
1446 PVPath::const_reverse_iterator ri = ++drawnPVPath.rbegin();
1447 G4int drawnMotherDepth;
1448 if (ri != drawnPVPath.rend()) {
1450 drawnMotherDepth = ri->GetNonCulledDepth();
1454 drawnMotherDepth = -1;
1458 while (drawnMotherDepth < (currentDepth-1)) {
1459 G4String culledParentName =
"Culled parent of " + pCurrentPV->
GetName();
1463 drawnMotherDepth ++;
1516 redness = colour.
GetRed();
1521 if (redness==0. && greenness==0. && blueness==0.) {
1527 #ifdef G4HEPREPFILEDEBUG
1529 "G4HepRepFileSceneHandler::AddHepRepInstance using default colour."
1538 if (strcmp(primName,
"Point")==0)
1548 #ifdef G4HEPREPFILEDEBUG
1550 "G4HepRepFileSceneHandler::CheckFileOpen called."
1565 G4cout <<
"HepRepFile writing to " << newFileSpec <<
G4endl;
1574 versionString = versionString.substr(1,versionString.size()-2);
1575 versionString =
" Geant4 version " + versionString +
" " +
G4Date;