111 #ifdef G4HEPREPFILEDEBUG
112 G4cout <<
"G4HepRepFileSceneHandler::BeginPrimitives2D() " <<
G4endl;
114 inPrimitives2D =
true;
119 #ifdef G4HEPREPFILEDEBUG
120 G4cout <<
"G4HepRepFileSceneHandler::EndPrimitives2D() " <<
G4endl;
127 #ifdef G4HEPREPFILEDEBUG
128 void G4HepRepFileSceneHandler::PrintThings() {
130 " with transformation "
139 "\n current physical volume: "
141 "\n current logical volume: "
143 "\n current depth of geometry tree: "
152 #ifdef G4HEPREPFILEDEBUG
154 "G4HepRepFileSceneHandler::AddSolid(const G4Box& box) called for "
212 #ifdef G4HEPREPFILEDEBUG
214 "G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) called for "
223 G4bool linedUpWithAnAxis = (std::fabs(r.
phiX())<=.001 ||
224 std::fabs(r.
phiY())<=.001 ||
225 std::fabs(r.
phiZ())<=.001 ||
226 std::fabs(r.
phiX()-
pi)<=.001 ||
227 std::fabs(r.
phiY()-
pi)<=.001 ||
228 std::fabs(r.
phiZ()-
pi)<=.001);
279 #ifdef G4HEPREPFILEDEBUG
281 "G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) called for "
290 G4bool linedUpWithAnAxis = (std::fabs(r.
phiX())<=.001 ||
291 std::fabs(r.
phiY())<=.001 ||
292 std::fabs(r.
phiZ())<=.001 ||
293 std::fabs(r.
phiX()-
pi)<=.001 ||
294 std::fabs(r.
phiY()-
pi)<=.001 ||
295 std::fabs(r.
phiZ()-
pi)<=.001);
348 #ifdef G4HEPREPFILEDEBUG
350 "G4HepRepFileSceneHandler::AddSolid(const G4Trd& trd) called for "
410 #ifdef G4HEPREPFILEDEBUG
412 "G4HepRepFileSceneHandler::AddSolid(const G4Trap& trap) called for "
422 #ifdef G4HEPREPFILEDEBUG
424 "G4HepRepFileSceneHandler::AddSolid(const G4Sphere& sphere) called for "
434 #ifdef G4HEPREPFILEDEBUG
436 "G4HepRepFileSceneHandler::AddSolid(const G4Para& para) called for "
446 #ifdef G4HEPREPFILEDEBUG
448 "G4HepRepFileSceneHandler::AddSolid(const G4Torus& torus) called for "
458 #ifdef G4HEPREPFILEDEBUG
460 "G4HepRepFileSceneHandler::AddSolid(const G4Polycone& polycone) called for "
470 #ifdef G4HEPREPFILEDEBUG
472 "G4HepRepFileSceneHandler::AddSolid(const G4Polyhedra& polyhedra) called for "
482 #ifdef G4HEPREPFILEDEBUG
484 "G4HepRepFileSceneHandler::AddSolid(const G4Orb& orb) called for "
494 #ifdef G4HEPREPFILEDEBUG
496 "G4HepRepFileSceneHandler::AddSolid(const G4Ellipsoid& ellipsoid) called for "
506 #ifdef G4HEPREPFILEDEBUG
508 "G4HepRepFileSceneHandler::AddSolid(const G4Solid& solid) called for "
518 #ifdef G4HEPREPFILEDEBUG
519 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&) " <<
G4endl;
525 (
"G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&)",
531 new std::vector<G4AttValue>;
533 new std::map<G4String,G4AttDef>;
536 std::vector<G4AttValue>::iterator iAttVal;
537 std::map<G4String,G4AttDef>::const_iterator iAttDef;
542 if (rawTrajAttValues) {
546 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
547 "\nERROR found during conversion to standard trajectory attributes."
550 #ifdef G4HEPREPFILEDEBUG
552 "G4HepRepFileSceneHandler::AddCompound(traj): standardised attributes:\n"
555 delete rawTrajAttValues;
573 if (strcmp(
"Trajectories",previousName)!=0) {
587 G4String category = iAttDef->second.GetCategory();
588 if (strcmp(category,
"Draw")!=0 &&
589 strcmp(category,
"Physics")!=0 &&
590 strcmp(category,
"Association")!=0 &&
591 strcmp(category,
"PickAction")!=0)
592 category =
"Physics";
594 category, iAttDef->second.GetExtra());
607 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->
CreateAttValues();
608 std::vector<G4AttValue>* pointAttValues =
609 new std::vector<G4AttValue>;
610 std::map<G4String,G4AttDef>* pointAttDefs =
611 new std::map<G4String,G4AttDef>;
615 if (rawPointAttValues) {
617 aTrajectoryPoint->
GetAttDefs()).Standard(pointAttValues,pointAttDefs);
619 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
620 "\nERROR found during conversion to standard first point attributes." <<
G4endl;
624 if (pointAttValues && pointAttDefs) {
625 for (iAttVal = pointAttValues->begin();
626 iAttVal != pointAttValues->end(); ++iAttVal) {
628 pointAttDefs->find(iAttVal->GetName());
629 if (iAttDef != pointAttDefs->end()) {
632 G4String category = iAttDef->second.GetCategory();
633 if (strcmp(category,
"Draw")!=0 &&
634 strcmp(category,
"Physics")!=0 &&
635 strcmp(category,
"Association")!=0 &&
636 strcmp(category,
"PickAction")!=0)
637 category =
"Physics";
641 if (strcmp(iAttVal->GetName(),
"Aux-X")!=0 &&
642 strcmp(iAttVal->GetName(),
"Aux-Y")!=0 &&
643 strcmp(iAttVal->GetName(),
"Aux-Z")!=0 &&
644 strcmp(iAttVal->GetName(),
"Pos-X")!=0 &&
645 strcmp(iAttVal->GetName(),
"Pos-Y")!=0 &&
646 strcmp(iAttVal->GetName(),
"Pos-Z")!=0)
648 category, iAttDef->second.GetExtra());
652 delete rawPointAttValues;
657 delete pointAttValues;
694 redness = colour.
GetRed();
702 if (redness==0. && greenness==0. && blueness==0.) {
709 if (strcmp(
"Trajectory Step Points",previousName)!=0) {
729 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->
CreateAttValues();
730 std::vector<G4AttValue>* pointAttValues =
731 new std::vector<G4AttValue>;
732 std::map<G4String,G4AttDef>* pointAttDefs =
733 new std::map<G4String,G4AttDef>;
737 if (rawPointAttValues) {
739 aTrajectoryPoint->
GetAttDefs()).Standard(pointAttValues,pointAttDefs);
741 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
742 "\nERROR found during conversion to standard point attributes." <<
G4endl;
746 if (pointAttValues) {
747 for (iAttVal = pointAttValues->begin();
748 iAttVal != pointAttValues->end(); ++iAttVal)
752 if (strcmp(iAttVal->GetName(),
"Aux-X")!=0 &&
753 strcmp(iAttVal->GetName(),
"Aux-Y")!=0 &&
754 strcmp(iAttVal->GetName(),
"Aux-Z")!=0 &&
755 strcmp(iAttVal->GetName(),
"Pos-X")!=0 &&
756 strcmp(iAttVal->GetName(),
"Pos-Y")!=0 &&
757 strcmp(iAttVal->GetName(),
"Pos-Z")!=0)
764 delete pointAttValues;
765 delete rawPointAttValues;
792 redness = colour.
GetRed();
800 if (redness==0. && greenness==0. && blueness==0.) {
807 if (strcmp(
"Trajectory Auxiliary Points",previousName)!=0) {
827 std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->
CreateAttValues();
828 std::vector<G4AttValue>* pointAttValues =
829 new std::vector<G4AttValue>;
830 std::map<G4String,G4AttDef>* pointAttDefs =
831 new std::map<G4String,G4AttDef>;
835 if (rawPointAttValues) {
837 aTrajectoryPoint->
GetAttDefs()).Standard(pointAttValues,pointAttDefs);
839 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(traj):"
840 "\nERROR found during conversion to standard point attributes." <<
G4endl;
844 if (pointAttValues) {
845 for (iAttVal = pointAttValues->begin();
846 iAttVal != pointAttValues->end(); ++iAttVal)
850 if (strcmp(iAttVal->GetName(),
"Aux-X")!=0 &&
851 strcmp(iAttVal->GetName(),
"Aux-Y")!=0 &&
852 strcmp(iAttVal->GetName(),
"Aux-Z")!=0 &&
853 strcmp(iAttVal->GetName(),
"Pos-X")!=0 &&
854 strcmp(iAttVal->GetName(),
"Pos-Y")!=0 &&
855 strcmp(iAttVal->GetName(),
"Pos-Z")!=0)
862 delete pointAttValues;
863 delete rawPointAttValues;
869 const std::vector<G4ThreeVector>* auxiliaries = aTrajectoryPoint->
GetAuxiliaryPoints();
870 if (0 != auxiliaries) {
871 for (
size_t iAux=0; iAux<auxiliaries->size(); ++iAux) {
883 #ifdef G4HEPREPFILEDEBUG
884 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(G4VHit&) " <<
G4endl;
890 new std::vector<G4AttValue>;
892 new std::map<G4String,G4AttDef>;
895 std::vector<G4AttValue>::iterator iAttVal;
896 std::map<G4String,G4AttDef>::const_iterator iAttDef;
900 if (rawHitAttValues) {
904 G4cout <<
"G4HepRepFileSceneHandler::AddCompound(hit):"
905 "\nERROR found during conversion to standard hit attributes."
908 #ifdef G4HEPREPFILEDEBUG
910 "G4HepRepFileSceneHandler::AddCompound(hit): standardised attributes:\n"
913 delete rawHitAttValues;
931 if (strcmp(iAttVal->GetName(),
"HitType")==0) {
932 hitType = iAttVal->GetValue();
944 if (strcmp(hitType,previousName)!=0) {
954 iAttDef =
hitAttDefs->find(iAttVal->GetName());
958 G4String category = iAttDef->second.GetCategory();
959 if (strcmp(category,
"Draw")!=0 &&
960 strcmp(category,
"Physics")!=0 &&
961 strcmp(category,
"Association")!=0 &&
962 strcmp(category,
"PickAction")!=0)
963 category =
"Physics";
965 category, iAttDef->second.GetExtra());
987 std::vector<G4AttValue>::iterator iAttVal;
1010 std::vector<G4AttValue>::iterator iAttVal;
1027 #ifdef G4HEPREPFILEDEBUG
1029 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) called:"
1030 "\n polyline: " << polyline
1042 G4cout <<
"HepRepFile does not currently support 2D lines." <<
G4endl;
1059 for (
size_t i=0; i < polyline.size(); i++) {
1068 #ifdef G4HEPREPFILEDEBUG
1070 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polymarker& line) called"
1082 G4cout <<
"HepRepFile does not currently support 2D lines." <<
G4endl;
1090 if (sizeType==
world)
1107 for (
size_t i=0; i < line.size(); i++) {
1115 #ifdef G4HEPREPFILEDEBUG
1117 "G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) called:"
1125 G4cout <<
"HepRepFile does not currently support 3D text." <<
G4endl;
1126 G4cout <<
"HepRep browsers can directly display text attributes on request." <<
G4endl;
1127 G4cout <<
"See Application Developers Guide for how to attach attributes to viewable objects." <<
G4endl;
1135 if (sizeType==
world)
1150 float redness = colour.
GetRed();
1151 float greenness = colour.
GetGreen();
1152 float blueness = colour.
GetBlue();
1155 if (redness==0. && greenness==0. && blueness==0.) {
1171 #ifdef G4HEPREPFILEDEBUG
1173 "G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) called:"
1186 G4cout <<
"HepRepFile does not currently support 2D circles." <<
G4endl;
1194 if (sizeType==
world)
1217 #ifdef G4HEPREPFILEDEBUG
1219 "G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) called:"
1232 G4cout <<
"HepRepFile does not currently support 2D squares." <<
G4endl;
1240 if (sizeType==
world)
1263 #ifdef G4HEPREPFILEDEBUG
1265 "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called."
1300 }
while (notLastEdge);
1301 }
while (notLastFace);
1312 #ifdef G4HEPREPFILEDEBUG
1314 "G4HepRepFileSceneHandler::AddHepRepInstance called."
1323 G4int currentDepth = 0;
1331 #ifdef G4HEPREPFILEDEBUG
1363 if (strcmp(
"Text",primName)==0) {
1366 if (strcmp(
"Line",primName)==0) {
1371 strcmp(
"Square",primName)==0)
1377 strcmp(
"Circle",primName)==0)
1393 }
else if (pCurrentPV==0) {
1401 if (strcmp(
"Text",primName)==0) {
1404 if (strcmp(
"Line",primName)==0) {
1433 typedef std::vector<PVNodeID>
PVPath;
1435 PVPath::const_reverse_iterator ri = ++drawnPVPath.rbegin();
1436 G4int drawnMotherDepth;
1437 if (ri != drawnPVPath.rend()) {
1439 drawnMotherDepth = ri->GetNonCulledDepth();
1443 drawnMotherDepth = -1;
1447 while (drawnMotherDepth < (currentDepth-1)) {
1448 G4String culledParentName =
"Culled parent of " + pCurrentPV->
GetName();
1452 drawnMotherDepth ++;
1505 redness = colour.
GetRed();
1510 if (redness==0. && greenness==0. && blueness==0.) {
1516 #ifdef G4HEPREPFILEDEBUG
1518 "G4HepRepFileSceneHandler::AddHepRepInstance using default colour."
1527 if (strcmp(primName,
"Point")==0)
1537 #ifdef G4HEPREPFILEDEBUG
1539 "G4HepRepFileSceneHandler::CheckFileOpen called."
1554 G4cout <<
"HepRepFile writing to " << newFileSpec <<
G4endl;
1563 versionString = versionString.substr(1,versionString.size()-2);
1564 versionString =
" Geant4 version " + versionString +
" " +
G4Date;
virtual G4double getScale()
virtual G4bool renderCylAsPolygons()
G4bool GetStepPtsVisible() const
const G4VTrajectoryModel * CurrentTrajDrawModel() const
const G4VisTrajContext & GetContext() const
void BeginPrimitives2D(const G4Transform3D &objectTransformation)
std::vector< G4AttValue > * hitAttValues
G4double GetYHalfLength() const
std::vector< G4AttValue > * trajAttValues
virtual const G4ThreeVector GetPosition() const =0
G4double GetInnerRadiusMinusZ() const
G4Transform3D fObjectTransformation
virtual std::vector< G4AttValue > * CreateAttValues() const
system("rm -rf microbeam.root")
virtual G4bool getCullInvisibles()
void AddCompound(const G4VTrajectory &)
G4double GetWorldRadius() const
std::map< G4String, G4AttDef > * hitAttDefs
G4bool fReadyForTransients
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const
const G4String & GetName() const
G4double GetAuxPtsSize() const
void addPoint(double x, double y, double z)
const G4VisAttributes * GetVisAttributes() const
G4double GetRadlen() const
virtual std::vector< G4AttValue > * CreateAttValues() const
static G4VisManager * GetInstance()
G4double GetStepPtsSize() const
G4Polymarker::MarkerType GetStepPtsType() const
G4Polymarker::MarkerType GetAuxPtsType() const
static constexpr double kg
G4double GetOuterRadiusMinusZ() const
G4double GetDeltaPhiAngle() const
G4double GetOuterRadiusPlusZ() const
G4double GetZHalfLength() const
G4double GetYHalfLength2() const
const G4Colour & GetTextColour(const G4Text &)
G4double GetZHalfLength() const
G4double GetXOffset() const
void addType(const char *name, int newTypeDepth)
virtual std::vector< G4AttValue > * CreateAttValues() const
G4double GetXHalfLength1() const
static const G4String G4Date
const G4String & GetName() const
void AddHepRepInstance(const char *primName, const G4Visible visible)
static constexpr double m
virtual void AddCompound(const G4VTrajectory &)
G4HepRepFileSceneHandler(G4VGraphicsSystem &system, const G4String &name)
static constexpr double m3
void addAttValue(const char *name, const char *value)
G4bool warnedAbout2DMarkers
G4double GetInnerRadius() const
std::vector< PVNodeID > PVPath
virtual int GetPointEntries() const =0
virtual void BeginModeling()
std::map< G4String, G4AttDef > * trajAttDefs
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)
static constexpr double twopi
static const G4String G4Version
G4HepRepFileXMLWriter * GetHepRepXMLWriter()
void AddPrimitive(const G4Polyline &)
G4bool GetNextVertex(G4Point3D &vertex, G4int &edgeFlag) const
G4double GetInnerRadiusPlusZ() const
G4double GetZHalfLength() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetXHalfLength() const
virtual void EndModeling()
G4double GetYHalfLength1() const
G4bool GetDrawAuxPts() const
G4LogicalVolume * GetCurrentLV() const
const G4VisTrajContext * trajContext
G4bool IsRootRegion() const
static G4int fSceneIdCount
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
const G4VisAttributes * fpVisAttribs
G4bool GetAuxPtsVisible() const
G4Material * GetCurrentMaterial() const
G4int GetCurrentDepth() const
static G4String ConvertToString(G4bool boolVal)
static G4HepRepMessenger * GetInstance()
G4Colour GetAuxPtsColour() const
virtual void AddSolid(const G4Box &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4bool GetNextNormal(G4Normal3D &normal) const
G4VPhysicalVolume * GetCurrentPV() const
G4Colour GetStepPtsColour() const
void ClearTransientStore()
G4double GetXHalfLength2() const
G4double GetDeltaPhiAngle() const
G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID
const std::vector< G4PhysicalVolumeNodeID > & GetDrawnPVPath() const
virtual const std::vector< G4ThreeVector > * GetAuxiliaryPoints() const
virtual G4bool getOverwrite()
G4double GetOuterRadius() const
G4GLOB_DLL std::ostream G4cout
void open(const char *filespec)
G4double GetYOffset() const
G4VSolid * GetSolid() const
static PROLOG_HANDLER error
G4Point3D GetPosition() const
G4double GetGreen() const
G4bool GetDrawStepPts() const
static constexpr double pi
G4int GetNoFacets() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
void addAttDef(const char *name, const char *desc, const char *type, const char *extra)
virtual G4GeometryType GetEntityType() const =0
virtual G4String getFileName()
const XML_Char XML_Content * model
HepGeom::Point3D< G4double > G4Point3D
G4HepRepFileXMLWriter * hepRepXMLWriter
G4double GetZHalfLength() const
virtual void EndPrimitives2D()
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
G4Region * GetRegion() const
void AddSolid(const G4Box &)
const G4Colour & GetColour() const
const G4String & GetName() const
virtual ~G4HepRepFileSceneHandler()
const G4String & GetName() const
G4double GetDensity() const
virtual G4String getFileDir()