110#ifdef G4HEPREPFILEDEBUG
111 G4cout <<
"G4HepRepFileSceneHandler::BeginPrimitives2D() " <<
G4endl;
119#ifdef G4HEPREPFILEDEBUG
120 G4cout <<
"G4HepRepFileSceneHandler::EndPrimitives2D() " <<
G4endl;
126#ifdef G4HEPREPFILEDEBUG
127void G4HepRepFileSceneHandler::PrintThings()
137 G4cout <<
"\n current physical volume: " << pCurrentPV->
GetName()
138 <<
"\n current logical volume: " << pCurrentLV->
GetName()
139 <<
"\n current depth of geometry tree: " << currentDepth;
147#ifdef G4HEPREPFILEDEBUG
148 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Box& box) called for "
206#ifdef G4HEPREPFILEDEBUG
207 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) called for "
215 G4bool linedUpWithAnAxis =
216 (std::fabs(r.
phiX()) <= .001 || std::fabs(r.
phiY()) <= .001 ||
217 std::fabs(r.
phiZ()) <= .001 || std::fabs(r.
phiX() -
pi) <= .001 ||
218 std::fabs(r.
phiY() -
pi) <= .001 || std::fabs(r.
phiZ() -
pi) <= .001);
277#ifdef G4HEPREPFILEDEBUG
278 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) called for "
286 G4bool linedUpWithAnAxis =
287 (std::fabs(r.
phiX()) <= .001 || std::fabs(r.
phiY()) <= .001 ||
288 std::fabs(r.
phiZ()) <= .001 || std::fabs(r.
phiX() -
pi) <= .001 ||
289 std::fabs(r.
phiY() -
pi) <= .001 || std::fabs(r.
phiZ() -
pi) <= .001);
351#ifdef G4HEPREPFILEDEBUG
352 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Trd& trd) called for "
412#ifdef G4HEPREPFILEDEBUG
413 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Trap& trap) called for "
422#ifdef G4HEPREPFILEDEBUG
424 <<
"G4HepRepFileSceneHandler::AddSolid(const G4Sphere& sphere) called for "
433#ifdef G4HEPREPFILEDEBUG
434 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Para& para) called for "
443#ifdef G4HEPREPFILEDEBUG
445 <<
"G4HepRepFileSceneHandler::AddSolid(const G4Torus& torus) called for "
454#ifdef G4HEPREPFILEDEBUG
455 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Polycone& polycone) "
465#ifdef G4HEPREPFILEDEBUG
466 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Polyhedra& polyhedra) "
476#ifdef G4HEPREPFILEDEBUG
477 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Orb& orb) called for "
486#ifdef G4HEPREPFILEDEBUG
487 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4Ellipsoid& ellipsoid) "
497#ifdef G4HEPREPFILEDEBUG
498 G4cout <<
"G4HepRepFileSceneHandler::AddSolid(const G4TessellatedSolid& ) "
508#ifdef G4HEPREPFILEDEBUG
510 <<
"G4HepRepFileSceneHandler::AddSolid(const G4Solid& solid) called for "
519#ifdef G4HEPREPFILEDEBUG
520 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&) "
526 G4Exception(
"G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&)",
535 std::vector<G4AttValue>::iterator iAttVal;
536 std::map<G4String, G4AttDef>::const_iterator iAttDef;
548 <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
549 "\nERROR found during conversion to standard trajectory attributes."
552#ifdef G4HEPREPFILEDEBUG
553 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj): standardised "
557 delete rawTrajAttValues;
576 if(strcmp(
"Trajectories", previousName) != 0)
595 G4String category = iAttDef->second.GetCategory();
596 if(strcmp(category,
"Draw") != 0 &&
597 strcmp(category,
"Physics") != 0 &&
598 strcmp(category,
"Association") != 0 &&
599 strcmp(category,
"PickAction") != 0)
600 category =
"Physics";
602 iAttDef->second.GetDesc(), category,
603 iAttDef->second.GetExtra());
617 std::vector<G4AttValue>* rawPointAttValues =
619 std::vector<G4AttValue>* pointAttValues =
new std::vector<G4AttValue>;
620 std::map<G4String, G4AttDef>* pointAttDefs =
621 new std::map<G4String, G4AttDef>;
625 if(rawPointAttValues)
629 .
Standard(pointAttValues, pointAttDefs);
632 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
633 "\nERROR found during conversion to standard first point "
639 if(pointAttValues && pointAttDefs)
641 for(iAttVal = pointAttValues->begin();
642 iAttVal != pointAttValues->end(); ++iAttVal)
644 iAttDef = pointAttDefs->find(iAttVal->GetName());
645 if(iAttDef != pointAttDefs->end())
650 G4String category = iAttDef->second.GetCategory();
651 if(strcmp(category,
"Draw") != 0 &&
652 strcmp(category,
"Physics") != 0 &&
653 strcmp(category,
"Association") != 0 &&
654 strcmp(category,
"PickAction") != 0)
655 category =
"Physics";
660 if(strcmp(iAttVal->GetName(),
"Aux-X") != 0 &&
661 strcmp(iAttVal->GetName(),
"Aux-Y") != 0 &&
662 strcmp(iAttVal->GetName(),
"Aux-Z") != 0 &&
663 strcmp(iAttVal->GetName(),
"Pos-X") != 0 &&
664 strcmp(iAttVal->GetName(),
"Pos-Y") != 0 &&
665 strcmp(iAttVal->GetName(),
"Pos-Z") != 0)
667 iAttDef->second.GetDesc(), category,
668 iAttDef->second.GetExtra());
672 delete rawPointAttValues;
677 delete pointAttValues;
716 redness = colour.
GetRed();
724 if(redness == 0. && greenness == 0. && blueness == 0.)
732 if(strcmp(
"Trajectory Step Points", previousName) != 0)
754 std::vector<G4AttValue>* rawPointAttValues =
756 std::vector<G4AttValue>* pointAttValues =
new std::vector<G4AttValue>;
757 std::map<G4String, G4AttDef>* pointAttDefs =
758 new std::map<G4String, G4AttDef>;
762 if(rawPointAttValues)
766 .
Standard(pointAttValues, pointAttDefs);
770 <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
771 "\nERROR found during conversion to standard point attributes."
778 for(iAttVal = pointAttValues->begin();
779 iAttVal != pointAttValues->end(); ++iAttVal)
784 if(strcmp(iAttVal->GetName(),
"Aux-X") != 0 &&
785 strcmp(iAttVal->GetName(),
"Aux-Y") != 0 &&
786 strcmp(iAttVal->GetName(),
"Aux-Z") != 0 &&
787 strcmp(iAttVal->GetName(),
"Pos-X") != 0 &&
788 strcmp(iAttVal->GetName(),
"Pos-Y") != 0 &&
789 strcmp(iAttVal->GetName(),
"Pos-Z") != 0)
791 iAttVal->GetValue());
797 delete pointAttValues;
798 delete rawPointAttValues;
826 redness = colour.
GetRed();
834 if(redness == 0. && greenness == 0. && blueness == 0.)
842 if(strcmp(
"Trajectory Auxiliary Points", previousName) != 0)
864 std::vector<G4AttValue>* rawPointAttValues =
866 std::vector<G4AttValue>* pointAttValues =
new std::vector<G4AttValue>;
867 std::map<G4String, G4AttDef>* pointAttDefs =
868 new std::map<G4String, G4AttDef>;
872 if(rawPointAttValues)
876 .
Standard(pointAttValues, pointAttDefs);
880 <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
881 "\nERROR found during conversion to standard point attributes."
888 for(iAttVal = pointAttValues->begin();
889 iAttVal != pointAttValues->end(); ++iAttVal)
894 if(strcmp(iAttVal->GetName(),
"Aux-X") != 0 &&
895 strcmp(iAttVal->GetName(),
"Aux-Y") != 0 &&
896 strcmp(iAttVal->GetName(),
"Aux-Z") != 0 &&
897 strcmp(iAttVal->GetName(),
"Pos-X") != 0 &&
898 strcmp(iAttVal->GetName(),
"Pos-Y") != 0 &&
899 strcmp(iAttVal->GetName(),
"Pos-Z") != 0)
901 iAttVal->GetValue());
907 delete pointAttValues;
908 delete rawPointAttValues;
914 const std::vector<G4ThreeVector>* auxiliaries =
918 for(
size_t iAux = 0; iAux < auxiliaries->size(); ++iAux)
931#ifdef G4HEPREPFILEDEBUG
932 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(G4VHit&) " <<
G4endl;
938 hitAttDefs =
new std::map<G4String, G4AttDef>;
941 std::vector<G4AttValue>::iterator iAttVal;
942 std::map<G4String, G4AttDef>::const_iterator iAttDef;
952 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(hit):"
953 "\nERROR found during conversion to standard hit attributes."
956#ifdef G4HEPREPFILEDEBUG
957 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(hit): standardised "
961 delete rawHitAttValues;
982 if(strcmp(iAttVal->GetName(),
"HitType") == 0)
984 hitType = iAttVal->GetValue();
996 if(strcmp(hitType, previousName) != 0)
1009 iAttDef =
hitAttDefs->find(iAttVal->GetName());
1015 G4String category = iAttDef->second.GetCategory();
1016 if(strcmp(category,
"Draw") != 0 &&
1017 strcmp(category,
"Physics") != 0 &&
1018 strcmp(category,
"Association") != 0 &&
1019 strcmp(category,
"PickAction") != 0)
1020 category =
"Physics";
1022 iAttDef->second.GetDesc(), category,
1023 iAttDef->second.GetExtra());
1047 std::vector<G4AttValue>::iterator iAttVal;
1072 std::vector<G4AttValue>::iterator iAttVal;
1089#ifdef G4HEPREPFILEDEBUG
1090 G4cout <<
"G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& "
1107 G4cout <<
"HepRepFile does not currently support 2D lines." <<
G4endl;
1124 for(
size_t i = 0; i < polyline.size(); i++)
1133#ifdef G4HEPREPFILEDEBUG
1135 <<
"G4HepRepFileSceneHandler::AddPrimitive(const G4Polymarker& line) called"
1150 G4cout <<
"HepRepFile does not currently support 2D lines." <<
G4endl;
1158 if(sizeType ==
world)
1175 for(
size_t i = 0; i < line.size(); i++)
1184#ifdef G4HEPREPFILEDEBUG
1185 G4cout <<
"G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) called:"
1195 G4cout <<
"HepRepFile does not currently support 3D text." <<
G4endl;
1197 <<
"HepRep browsers can directly display text attributes on request."
1199 G4cout <<
"See Application Developers Guide for how to attach attributes "
1200 "to viewable objects."
1209 if(sizeType ==
world)
1224 float redness = colour.
GetRed();
1225 float greenness = colour.
GetGreen();
1226 float blueness = colour.
GetBlue();
1229 if(redness == 0. && greenness == 0. && blueness == 0.)
1246#ifdef G4HEPREPFILEDEBUG
1248 <<
"G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) called:"
1264 G4cout <<
"HepRepFile does not currently support 2D circles." <<
G4endl;
1272 if(sizeType ==
world)
1295#ifdef G4HEPREPFILEDEBUG
1297 <<
"G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) called:"
1313 G4cout <<
"HepRepFile does not currently support 2D squares." <<
G4endl;
1321 if(sizeType ==
world)
1344#ifdef G4HEPREPFILEDEBUG
1345 G4cout <<
"G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& "
1346 "polyhedron) called."
1385 }
while(notLastEdge);
1386 }
while(notLastFace);
1397#ifdef G4HEPREPFILEDEBUG
1398 G4cout <<
"G4HepRepFileSceneHandler::AddHepRepInstance called." <<
G4endl;
1406 G4int currentDepth = 0;
1416#ifdef G4HEPREPFILEDEBUG
1417 G4cout <<
"pCurrentPV:" << pCurrentPV
1449 if(strcmp(
"Text", primName) == 0)
1455 if(strcmp(
"Line", primName) == 0)
1464 strcmp(
"Square", primName) == 0)
1473 strcmp(
"Circle", primName) == 0)
1492 else if(pCurrentPV == 0)
1502 if(strcmp(
"Text", primName) == 0)
1508 if(strcmp(
"Line", primName) == 0)
1545 typedef std::vector<PVNodeID> PVPath;
1547 PVPath::const_reverse_iterator ri = ++drawnPVPath.rbegin();
1548 G4int drawnMotherDepth;
1549 if(ri != drawnPVPath.rend())
1552 drawnMotherDepth = ri->GetNonCulledDepth();
1558 drawnMotherDepth = -1;
1562 while(drawnMotherDepth < (currentDepth - 1))
1564 G4String culledParentName =
"Culled parent of " + pCurrentPV->
GetName();
1629 redness = colour.
GetRed();
1634 if(redness == 0. && greenness == 0. && blueness == 0.)
1643#ifdef G4HEPREPFILEDEBUG
1645 <<
"G4HepRepFileSceneHandler::AddHepRepInstance using default colour."
1654 if(strcmp(primName,
"Point") == 0)
1664#ifdef G4HEPREPFILEDEBUG
1665 G4cout <<
"G4HepRepFileSceneHandler::CheckFileOpen called." <<
G4endl;
1685 G4cout <<
"HepRepFile writing to " << newFileSpec <<
G4endl;
1695 versionString = versionString.substr(1, versionString.size() - 2);
1696 versionString =
" Geant4 version " + versionString +
" " +
G4Date;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
HepGeom::Point3D< G4double > G4Point3D
static constexpr double kg
static constexpr double m
static constexpr double twopi
static constexpr double m3
static constexpr double pi
static const G4String G4Date
static const G4String G4Version
G4GLOB_DLL std::ostream G4cout
G4bool Standard(std::vector< G4AttValue > *standardValues, std::map< G4String, G4AttDef > *standardDefinitions) const
G4double GetYHalfLength() const
G4double GetZHalfLength() const
G4double GetXHalfLength() const
G4double GetGreen() const
G4double GetOuterRadiusPlusZ() const
G4double GetDeltaPhiAngle() const
G4double GetInnerRadiusMinusZ() const
G4double GetInnerRadiusPlusZ() const
G4double GetOuterRadiusMinusZ() const
G4double GetZHalfLength() const
std::map< G4String, G4AttDef > * trajAttDefs
G4HepRepFileSceneHandler(G4VGraphicsSystem &system, const G4String &name)
std::map< G4String, G4AttDef > * hitAttDefs
void AddSolid(const G4Box &)
void ClearTransientStore()
std::vector< G4AttValue > * trajAttValues
void AddHepRepInstance(const char *primName, const G4Visible visible)
G4HepRepFileXMLWriter * hepRepXMLWriter
G4HepRepFileXMLWriter * GetHepRepXMLWriter()
static G4int fSceneIdCount
void AddPrimitive(const G4Polyline &)
G4bool warnedAbout2DMarkers
const G4VisTrajContext * trajContext
void BeginPrimitives2D(const G4Transform3D &objectTransformation)
std::vector< G4AttValue > * hitAttValues
void AddCompound(const G4VTrajectory &)
virtual ~G4HepRepFileSceneHandler()
void addAttValue(const char *name, const char *value)
void addPoint(double x, double y, double z)
void addType(const char *name, int newTypeDepth)
void open(const char *filespec)
void addAttDef(const char *name, const char *desc, const char *type, const char *extra)
virtual G4bool renderCylAsPolygons()
virtual G4String getFileName()
virtual G4double getScale()
virtual G4String getFileDir()
virtual G4bool getCullInvisibles()
virtual G4bool getOverwrite()
static G4HepRepMessenger * GetInstance()
G4VSolid * GetSolid() const
G4bool IsRootRegion() const
G4Region * GetRegion() const
const G4String & GetName() const
const std::vector< G4PhysicalVolumeNodeID > & GetDrawnPVPath() const
G4VPhysicalVolume * GetCurrentPV() const
G4LogicalVolume * GetCurrentLV() const
G4Material * GetCurrentMaterial() const
G4int GetCurrentDepth() const
const G4String & GetName() const
G4double GetYOffset() const
G4double GetXOffset() const
G4double GetXHalfLength2() const
G4double GetYHalfLength2() const
G4double GetXHalfLength1() const
G4double GetYHalfLength1() const
G4double GetZHalfLength() const
G4double GetZHalfLength() const
G4double GetInnerRadius() const
G4double GetOuterRadius() const
G4double GetDeltaPhiAngle() const
static G4String ConvertToString(G4bool boolVal)
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4Point3D GetPosition() const
G4double GetWorldRadius() const
const G4String & GetName() const
virtual void BeginModeling()
const G4Colour & GetTextColour(const G4Text &)
G4Transform3D fObjectTransformation
virtual void EndModeling()
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
virtual void EndPrimitives2D()
const G4VisAttributes * fpVisAttribs
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation=G4Transform3D())
G4bool fReadyForTransients
virtual void AddSolid(const G4Box &)
virtual void AddCompound(const G4VTrajectory &)
virtual G4GeometryType GetEntityType() const =0
const G4VisTrajContext & GetContext() const
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::vector< G4ThreeVector > * GetAuxiliaryPoints() const
virtual const G4ThreeVector GetPosition() const =0
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
virtual G4int GetPointEntries() const =0
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const
virtual void DrawView()=0
virtual void ClearView()=0
const G4Colour & GetColour() const
const G4VTrajectoryModel * CurrentTrajDrawModel() const
static G4VisManager * GetInstance()
G4bool GetDrawAuxPts() const
G4Colour GetStepPtsColour() const
G4double GetStepPtsSize() const
G4Polymarker::MarkerType GetAuxPtsType() const
G4double GetAuxPtsSize() const
G4Colour GetAuxPtsColour() const
G4bool GetAuxPtsVisible() const
G4bool GetStepPtsVisible() const
G4Polymarker::MarkerType GetStepPtsType() const
G4bool GetDrawStepPts() const
const G4VisAttributes * GetVisAttributes() const
G4bool GetNextNormal(G4Normal3D &normal) const
G4bool GetNextVertex(G4Point3D &vertex, G4int &edgeFlag) const
G4int GetNoFacets() const
const char * name(G4int ptype)
static PROLOG_HANDLER error