Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Protected Attributes
G4HepRepFileSceneHandler Class Reference

#include <G4HepRepFileSceneHandler.hh>

Inheritance diagram for G4HepRepFileSceneHandler:
G4VSceneHandler G4VGraphicsScene

Public Member Functions

 G4HepRepFileSceneHandler (G4VGraphicsSystem &system, const G4String &name)
 
virtual ~G4HepRepFileSceneHandler ()
 
void AddSolid (const G4Box &)
 
void AddSolid (const G4Cons &)
 
void AddSolid (const G4Tubs &)
 
void AddSolid (const G4Trd &)
 
void AddSolid (const G4Trap &)
 
void AddSolid (const G4Sphere &)
 
void AddSolid (const G4Para &)
 
void AddSolid (const G4Torus &)
 
void AddSolid (const G4Polycone &)
 
void AddSolid (const G4Polyhedra &)
 
void AddSolid (const G4VSolid &)
 
void AddCompound (const G4VTrajectory &)
 
void InitTrajectory ()
 
void AddCompound (const G4VHit &)
 
void InitHit ()
 
void AddCompound (const G4THitsMap< G4double > &hits)
 
void AddCompound (const G4VDigi &digi)
 
void AddPrimitive (const G4Polyline &)
 
void AddPrimitive (const G4Text &)
 
void AddPrimitive (const G4Circle &)
 
void AddPrimitive (const G4Square &)
 
void AddPrimitive (const G4Polyhedron &)
 
void AddPrimitive (const G4Polymarker &)
 
void AddPrimitive (const G4Scale &scale)
 
void BeginModeling ()
 
void EndModeling ()
 
void BeginPrimitives2D (const G4Transform3D &objectTransformation)
 
void EndPrimitives2D ()
 
void ClearTransientStore ()
 
G4HepRepFileXMLWriterGetHepRepXMLWriter ()
 
- Public Member Functions inherited from G4VSceneHandler
 G4VSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4VSceneHandler ()
 
virtual void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &)
 
virtual void PostAddSolid ()
 
virtual void BeginPrimitives (const G4Transform3D &objectTransformation)
 
virtual void EndPrimitives ()
 
virtual const G4VisExtentGetExtent () const
 
const G4StringGetName () const
 
G4int GetSceneHandlerId () const
 
G4int GetViewCount () const
 
G4VGraphicsSystemGetGraphicsSystem () const
 
G4SceneGetScene () const
 
const G4ViewerListGetViewerList () const
 
G4VModelGetModel () const
 
G4VViewerGetCurrentViewer () const
 
G4bool GetMarkForClearingTransientStore () const
 
G4bool IsReadyForTransients () const
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetTransientsDrawnThisRun () const
 
const G4Transform3DGetObjectTransformation () const
 
void SetName (const G4String &)
 
void SetCurrentViewer (G4VViewer *)
 
virtual void SetScene (G4Scene *)
 
G4ViewerListSetViewerList ()
 
void SetModel (G4VModel *)
 
void SetMarkForClearingTransientStore (G4bool)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetTransientsDrawnThisRun (G4bool)
 
void SetObjectTransformation (const G4Transform3D &)
 
const G4ColourGetColour (const G4Visible &)
 
const G4ColourGetColor (const G4Visible &)
 
const G4ColourGetTextColour (const G4Text &)
 
const G4ColourGetTextColor (const G4Text &)
 
G4double GetLineWidth (const G4VisAttributes *)
 
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes *)
 
G4bool GetAuxEdgeVisible (const G4VisAttributes *)
 
G4int GetNoOfSides (const G4VisAttributes *)
 
G4double GetMarkerSize (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerDiameter (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerRadius (const G4VMarker &, MarkerSizeType &)
 
G4ModelingParametersCreateModelingParameters ()
 
void DrawEvent (const G4Event *)
 
void DrawEndOfRunModels ()
 
G4int IncrementViewCount ()
 
virtual void ClearStore ()
 
void AddViewerToList (G4VViewer *pView)
 
void RemoveViewerFromList (G4VViewer *pView)
 
- Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
 
virtual ~G4VGraphicsScene ()
 

Static Protected Attributes

static G4int fSceneIdCount = 0
 

Additional Inherited Members

- Public Types inherited from G4VSceneHandler
enum  MarkerSizeType { world, screen }
 
- Protected Member Functions inherited from G4VSceneHandler
virtual void ProcessScene ()
 
virtual void RequestPrimitives (const G4VSolid &solid)
 
virtual G4VSolidCreateSectionSolid ()
 
virtual G4VSolidCreateCutawaySolid ()
 
void LoadAtts (const G4Visible &, G4AttHolder *)
 
- Protected Attributes inherited from G4VSceneHandler
G4VGraphicsSystemfSystem
 
const G4int fSceneHandlerId
 
G4String fName
 
G4int fViewCount
 
G4ViewerList fViewerList
 
G4VViewerfpViewer
 
G4ScenefpScene
 
G4bool fMarkForClearingTransientStore
 
G4bool fReadyForTransients
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4bool fProcessingSolid
 
G4bool fProcessing2D
 
G4VModelfpModel
 
G4Transform3D fObjectTransformation
 
G4int fNestingDepth
 
const G4VisAttributesfpVisAttribs
 
const G4Transform3D fIdentityTransformation
 

Detailed Description

Definition at line 59 of file G4HepRepFileSceneHandler.hh.

Constructor & Destructor Documentation

G4HepRepFileSceneHandler::G4HepRepFileSceneHandler ( G4VGraphicsSystem system,
const G4String name 
)

Definition at line 70 of file G4HepRepFileSceneHandler.cc.

References GetHepRepXMLWriter().

71  :
72 G4VSceneHandler(system, fSceneIdCount++, name)
73 {
74  hepRepXMLWriter = ((G4HepRepFile*)(&system))->GetHepRepXMLWriter();
75  fileCounter = 0;
76 
77  inPrimitives2D = false;
78  warnedAbout3DText = false;
79  warnedAbout2DMarkers = false;
80  haveVisible = false;
81  drawingTraj = false;
82  doneInitTraj = false;
83  drawingHit = false;
84  doneInitHit = false;
85  trajContext = 0;
86  trajAttValues = 0;
87  trajAttDefs = 0;
88  hitAttValues = 0;
89  hitAttDefs = 0;
90 }
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
G4HepRepFileXMLWriter * GetHepRepXMLWriter()
G4HepRepFileSceneHandler::~G4HepRepFileSceneHandler ( )
virtual

Definition at line 93 of file G4HepRepFileSceneHandler.cc.

93 {}

Member Function Documentation

void G4HepRepFileSceneHandler::AddCompound ( const G4VTrajectory traj)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 485 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttDef(), G4HepRepFileXMLWriter::addAttValue(), G4VSceneHandler::AddCompound(), G4HepRepFileXMLWriter::addInstance(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4HepRepFileXMLWriter::addType(), G4VTrajectoryPoint::CreateAttValues(), G4VTrajectory::CreateAttValues(), FatalException, G4VSceneHandler::fpModel, G4cout, G4endl, G4Exception(), G4VTrajectoryPoint::GetAttDefs(), G4VTrajectory::GetAttDefs(), G4VTrajectoryPoint::GetAuxiliaryPoints(), G4VisTrajContext::GetAuxPtsColour(), G4VisTrajContext::GetAuxPtsSize(), G4VisTrajContext::GetAuxPtsType(), G4VisTrajContext::GetAuxPtsVisible(), G4Colour::GetBlue(), G4VisTrajContext::GetDrawAuxPts(), G4VisTrajContext::GetDrawStepPts(), G4Colour::GetGreen(), G4VTrajectory::GetPoint(), G4VTrajectory::GetPointEntries(), G4VTrajectoryPoint::GetPosition(), G4Colour::GetRed(), G4VisTrajContext::GetStepPtsColour(), G4VisTrajContext::GetStepPtsSize(), G4VisTrajContext::GetStepPtsType(), G4VisTrajContext::GetStepPtsVisible(), InitTrajectory(), G4HepRepFileXMLWriter::prevTypeName, G4Polymarker::squares, CLHEP::Hep3Vector::x(), HepGeom::BasicVector3D< T >::x(), CLHEP::Hep3Vector::y(), HepGeom::BasicVector3D< T >::y(), CLHEP::Hep3Vector::z(), and HepGeom::BasicVector3D< T >::z().

485  {
486 #ifdef G4HEPREPFILEDEBUG
487  G4cout << "G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&) " << G4endl;
488 #endif
489 
490  G4TrajectoriesModel* pTrModel =
491  dynamic_cast<G4TrajectoriesModel*>(fpModel);
492  if (!pTrModel) G4Exception
493  ("G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&)",
494  "vis-HepRep0001", FatalException, "Not a G4TrajectoriesModel.");
495 
496  // Pointers to hold trajectory attribute values and definitions.
497  std::vector<G4AttValue>* rawTrajAttValues = traj.CreateAttValues();
498  trajAttValues =
499  new std::vector<G4AttValue>;
500  trajAttDefs =
501  new std::map<G4String,G4AttDef>;
502 
503  // Iterators to use with attribute values and definitions.
504  std::vector<G4AttValue>::iterator iAttVal;
505  std::map<G4String,G4AttDef>::const_iterator iAttDef;
506  G4int i;
507 
508  // Get trajectory attributes and definitions in standard HepRep style
509  // (uniform units, 3Vectors decomposed).
510  if (rawTrajAttValues) {
511  G4bool error = G4AttCheck(rawTrajAttValues,
512  traj.GetAttDefs()).Standard(trajAttValues,trajAttDefs);
513  if (error) {
514  G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
515  "\nERROR found during conversion to standard trajectory attributes."
516  << G4endl;
517  }
518 #ifdef G4HEPREPFILEDEBUG
519  G4cout <<
520  "G4HepRepFileSceneHandler::AddCompound(traj): standardised attributes:\n"
521  << G4AttCheck(trajAttValues,trajAttDefs) << G4endl;
522 #endif
523  delete rawTrajAttValues;
524  }
525 
526  // Open the HepRep output file if it is not already open.
527  CheckFileOpen();
528 
529  // Add the Event Data Type if it hasn't already been added.
530  if (strcmp("Event Data",hepRepXMLWriter->prevTypeName[0])!=0) {
531  hepRepXMLWriter->addType("Event Data",0);
532  hepRepXMLWriter->addInstance();
533  }
534 
535  // Add the Trajectories Type.
536  G4String previousName = hepRepXMLWriter->prevTypeName[1];
537  hepRepXMLWriter->addType("Trajectories",1);
538 
539  // If this is the first trajectory of this event,
540  // specify attribute values common to all trajectories.
541  if (strcmp("Trajectories",previousName)!=0) {
542  hepRepXMLWriter->addAttValue("Layer",100);
543 
544  // Take all Trajectory attDefs from first trajectory.
545  // Would rather be able to get these attDefs without needing a reference from any
546  // particular trajectory, but don't know how to do that.
547  // Write out trajectory attribute definitions.
548  if (trajAttValues && trajAttDefs) {
549  for (iAttVal = trajAttValues->begin();
550  iAttVal != trajAttValues->end(); ++iAttVal) {
551  iAttDef = trajAttDefs->find(iAttVal->GetName());
552  if (iAttDef != trajAttDefs->end()) {
553  // Protect against incorrect use of Category. Anything value other than the
554  // standard ones will be considered to be in the physics category.
555  G4String category = iAttDef->second.GetCategory();
556  if (strcmp(category,"Draw")!=0 &&
557  strcmp(category,"Physics")!=0 &&
558  strcmp(category,"Association")!=0 &&
559  strcmp(category,"PickAction")!=0)
560  category = "Physics";
561  hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(),
562  category, iAttDef->second.GetExtra());
563  }
564  }
565  }
566 
567  // Take all TrajectoryPoint attDefs from first point of first trajectory.
568  // Would rather be able to get these attDefs without needing a reference from any
569  // particular point, but don't know how to do that.
570  if ((trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())
571  && traj.GetPointEntries()>0) {
572  G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
573 
574  // Pointers to hold trajectory point attribute values and definitions.
575  std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues();
576  std::vector<G4AttValue>* pointAttValues =
577  new std::vector<G4AttValue>;
578  std::map<G4String,G4AttDef>* pointAttDefs =
579  new std::map<G4String,G4AttDef>;
580 
581  // Get first trajectory point's attributes and definitions in standard HepRep style
582  // (uniform units, 3Vectors decomposed).
583  if (rawPointAttValues) {
584  G4bool error = G4AttCheck(rawPointAttValues,
585  aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs);
586  if (error) {
587  G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
588  "\nERROR found during conversion to standard first point attributes." << G4endl;
589  }
590 
591  // Write out point attribute definitions.
592  if (pointAttValues && pointAttDefs) {
593  for (iAttVal = pointAttValues->begin();
594  iAttVal != pointAttValues->end(); ++iAttVal) {
595  iAttDef =
596  pointAttDefs->find(iAttVal->GetName());
597  if (iAttDef != pointAttDefs->end()) {
598  // Protect against incorrect use of Category. Anything value other than the
599  // standard ones will be considered to be in the physics category.
600  G4String category = iAttDef->second.GetCategory();
601  if (strcmp(category,"Draw")!=0 &&
602  strcmp(category,"Physics")!=0 &&
603  strcmp(category,"Association")!=0 &&
604  strcmp(category,"PickAction")!=0)
605  category = "Physics";
606  // Do not write out the Aux or Pos attribute. Aux does not conform to the HepRep rule
607  // that each object can have only one instance of a given AttValue.
608  // Both of these attributes are redundant to actual position information of the point.
609  if (strcmp(iAttVal->GetName(),"Aux-X")!=0 &&
610  strcmp(iAttVal->GetName(),"Aux-Y")!=0 &&
611  strcmp(iAttVal->GetName(),"Aux-Z")!=0 &&
612  strcmp(iAttVal->GetName(),"Pos-X")!=0 &&
613  strcmp(iAttVal->GetName(),"Pos-Y")!=0 &&
614  strcmp(iAttVal->GetName(),"Pos-Z")!=0)
615  hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(),
616  category, iAttDef->second.GetExtra());
617  }
618  }
619  }
620  delete rawPointAttValues;
621  }
622 
623  // Clean up point attributes.
624  if (pointAttValues)
625  delete pointAttValues;
626  if (pointAttDefs)
627  delete pointAttDefs;
628  }
629  } // end of special treatment for when this is the first trajectory.
630 
631  // Now that we have written out all of the attributes that are based on the
632  // trajectory's particulars, call base class to deconstruct trajectory into polyline and/or points
633  // (or nothing if trajectory is to be filtered out).
634  // If base class calls for drawing points, no points will actually be drawn there since we
635  // instead need to do point drawing from here (in order to obtain the points attributes,
636  // not available from AddPrimitive(...point). Instead, such a call will just serve to set the
637  // flag that tells us that point drawing was requested for this trajectory (depends on several
638  // factors including trajContext and filtering).
639  drawingTraj = true;
640  doneInitTraj = false;
642  drawingTraj = false;
643 
644  // Draw step points.
645  if (trajContext->GetDrawStepPts()) {
646  if (!doneInitTraj)
647  InitTrajectory();
648  // Create Trajectory Points as a subType of Trajectories.
649  // Note that we should create this heprep type even if there are no actual points.
650  // This allows the user to tell that points don't exist (admittedly odd) rather
651  // than that they were omitted by the drawing mode.
652  previousName = hepRepXMLWriter->prevTypeName[2];
653  hepRepXMLWriter->addType("Trajectory Step Points",2);
654 
655  float redness;
656  float greenness;
657  float blueness;
658  G4int markSize;
659  G4bool visible;
660  G4bool square;
661  G4Colour colour = trajContext->GetStepPtsColour();
662  redness = colour.GetRed();
663  greenness = colour.GetGreen();
664  blueness = colour.GetBlue();
665  markSize = (G4int) trajContext->GetStepPtsSize();
666  visible = (G4int) trajContext->GetStepPtsVisible();
667  square = (trajContext->GetStepPtsType()==G4Polymarker::squares);
668 
669  // Avoiding drawing anything black on black.
670  if (redness==0. && greenness==0. && blueness==0.) {
671  redness = 1.;
672  greenness = 1.;
673  blueness = 1.;
674  }
675 
676  // Specify attributes common to all trajectory points.
677  if (strcmp("Trajectory Step Points",previousName)!=0) {
678  hepRepXMLWriter->addAttValue("DrawAs","Point");
679  hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness);
680  hepRepXMLWriter->addAttValue("MarkSize",markSize);
681  hepRepXMLWriter->addAttValue("Layer",110);
682  hepRepXMLWriter->addAttValue("Visibility",visible);
683  if (square)
684  hepRepXMLWriter->addAttValue("MarkName","square");
685  else
686  hepRepXMLWriter->addAttValue("MarkName","dot");
687  }
688 
689  // Loop over all points on this trajectory.
690  for (i = 0; i < traj.GetPointEntries(); i++) {
691  G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
692 
693  // Each point is a separate instance of the type Trajectory Points.
694  hepRepXMLWriter->addInstance();
695 
696  // Pointers to hold trajectory point attribute values and definitions.
697  std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues();
698  std::vector<G4AttValue>* pointAttValues =
699  new std::vector<G4AttValue>;
700  std::map<G4String,G4AttDef>* pointAttDefs =
701  new std::map<G4String,G4AttDef>;
702 
703  // Get trajectory point attributes and definitions in standard HepRep style
704  // (uniform units, 3Vectors decomposed).
705  if (rawPointAttValues) {
706  G4bool error = G4AttCheck(rawPointAttValues,
707  aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs);
708  if (error) {
709  G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
710  "\nERROR found during conversion to standard point attributes." << G4endl;
711  }
712 
713  // Write out point attribute values.
714  if (pointAttValues) {
715  for (iAttVal = pointAttValues->begin();
716  iAttVal != pointAttValues->end(); ++iAttVal)
717  // Do not write out the Aux or Pos attribute. Aux does not conform to the HepRep rule
718  // that each object can have only one instance of a given AttValue.
719  // Both of these attributes are redundant to actual position information of the point.
720  if (strcmp(iAttVal->GetName(),"Aux-X")!=0 &&
721  strcmp(iAttVal->GetName(),"Aux-Y")!=0 &&
722  strcmp(iAttVal->GetName(),"Aux-Z")!=0 &&
723  strcmp(iAttVal->GetName(),"Pos-X")!=0 &&
724  strcmp(iAttVal->GetName(),"Pos-Y")!=0 &&
725  strcmp(iAttVal->GetName(),"Pos-Z")!=0)
726  hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
727  }
728  }
729 
730  // Clean up point attributes.
731  delete pointAttDefs;
732  delete pointAttValues;
733  delete rawPointAttValues;
734 
735  // Each trajectory point is made of a single primitive, a point.
736  hepRepXMLWriter->addPrimitive();
737  G4Point3D vertex = aTrajectoryPoint->GetPosition();
738  hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
739  }
740  }
741 
742  // Draw Auxiliary Points
743  if (trajContext->GetDrawAuxPts()) {
744  if (!doneInitTraj)
745  InitTrajectory();
746  // Create Trajectory Points as a subType of Trajectories.
747  // Note that we should create this heprep type even if there are no actual points.
748  // This allows the user to tell that points don't exist (admittedly odd) rather
749  // than that they were omitted by the drawing mode.
750  previousName = hepRepXMLWriter->prevTypeName[2];
751  hepRepXMLWriter->addType("Trajectory Auxiliary Points",2);
752 
753  float redness;
754  float greenness;
755  float blueness;
756  G4int markSize;
757  G4bool visible;
758  G4bool square;
759  G4Colour colour = trajContext->GetAuxPtsColour();
760  redness = colour.GetRed();
761  greenness = colour.GetGreen();
762  blueness = colour.GetBlue();
763  markSize = (G4int) trajContext->GetAuxPtsSize();
764  visible = (G4int) trajContext->GetAuxPtsVisible();
765  square = (trajContext->GetAuxPtsType()==G4Polymarker::squares);
766 
767  // Avoiding drawing anything black on black.
768  if (redness==0. && greenness==0. && blueness==0.) {
769  redness = 1.;
770  greenness = 1.;
771  blueness = 1.;
772  }
773 
774  // Specify attributes common to all trajectory points.
775  if (strcmp("Trajectory Auxiliary Points",previousName)!=0) {
776  hepRepXMLWriter->addAttValue("DrawAs","Point");
777  hepRepXMLWriter->addAttValue("MarkColor", redness, greenness, blueness);
778  hepRepXMLWriter->addAttValue("MarkSize",markSize);
779  hepRepXMLWriter->addAttValue("Layer",110);
780  hepRepXMLWriter->addAttValue("Visibility",visible);
781  if (square)
782  hepRepXMLWriter->addAttValue("MarkName","Square");
783  else
784  hepRepXMLWriter->addAttValue("MarkName","Dot");
785  }
786 
787  // Loop over all points on this trajectory.
788  for (i = 0; i < traj.GetPointEntries(); i++) {
789  G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
790 
791  // Each point is a separate instance of the type Trajectory Points.
792  hepRepXMLWriter->addInstance();
793 
794  // Pointers to hold trajectory point attribute values and definitions.
795  std::vector<G4AttValue>* rawPointAttValues = aTrajectoryPoint->CreateAttValues();
796  std::vector<G4AttValue>* pointAttValues =
797  new std::vector<G4AttValue>;
798  std::map<G4String,G4AttDef>* pointAttDefs =
799  new std::map<G4String,G4AttDef>;
800 
801  // Get trajectory point attributes and definitions in standard HepRep style
802  // (uniform units, 3Vectors decomposed).
803  if (rawPointAttValues) {
804  G4bool error = G4AttCheck(rawPointAttValues,
805  aTrajectoryPoint->GetAttDefs()).Standard(pointAttValues,pointAttDefs);
806  if (error) {
807  G4cout << "G4HepRepFileSceneHandler::AddCompound(traj):"
808  "\nERROR found during conversion to standard point attributes." << G4endl;
809  }
810 
811  // Write out point attribute values.
812  if (pointAttValues) {
813  for (iAttVal = pointAttValues->begin();
814  iAttVal != pointAttValues->end(); ++iAttVal)
815  // Do not write out the Aux or Pos attribute. Aux does not conform to the HepRep rule
816  // that each object can have only one instance of a given AttValue.
817  // Both of these attributes are redundant to actual position information of the point.
818  if (strcmp(iAttVal->GetName(),"Aux-X")!=0 &&
819  strcmp(iAttVal->GetName(),"Aux-Y")!=0 &&
820  strcmp(iAttVal->GetName(),"Aux-Z")!=0 &&
821  strcmp(iAttVal->GetName(),"Pos-X")!=0 &&
822  strcmp(iAttVal->GetName(),"Pos-Y")!=0 &&
823  strcmp(iAttVal->GetName(),"Pos-Z")!=0)
824  hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
825  }
826  }
827 
828  // Clean up point attributes.
829  delete pointAttDefs;
830  delete pointAttValues;
831  delete rawPointAttValues;
832 
833  // Each trajectory point is made of a single primitive, a point.
834  G4Point3D vertex = aTrajectoryPoint->GetPosition();
835 
836  // Loop over auxiliary points associated with this Trajectory Point.
837  const std::vector<G4ThreeVector>* auxiliaries = aTrajectoryPoint->GetAuxiliaryPoints();
838  if (0 != auxiliaries) {
839  for (size_t iAux=0; iAux<auxiliaries->size(); ++iAux) {
840  const G4ThreeVector auxPos((*auxiliaries)[iAux]);
841  hepRepXMLWriter->addPrimitive();
842  hepRepXMLWriter->addPoint(auxPos.x(), auxPos.y(), auxPos.z());
843  }
844  }
845  }
846  }
847 }
G4double GetStepPtsSize() const
virtual const std::vector< G4ThreeVector > * GetAuxiliaryPoints() const
G4double GetAuxPtsSize() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
void addAttValue(const char *name, const char *value)
G4double GetBlue() const
Definition: G4Colour.hh:141
G4Colour GetAuxPtsColour() const
G4Polymarker::MarkerType GetAuxPtsType() const
int G4int
Definition: G4Types.hh:78
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual std::vector< G4AttValue > * CreateAttValues() const
G4bool GetAuxPtsVisible() const
virtual int GetPointEntries() const =0
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
G4double GetRed() const
Definition: G4Colour.hh:139
void addAttDef(const char *name, const char *desc, const char *type, const char *extra)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
bool G4bool
Definition: G4Types.hh:79
G4double GetGreen() const
Definition: G4Colour.hh:140
G4bool GetDrawStepPts() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual const G4ThreeVector GetPosition() const =0
G4Colour GetStepPtsColour() const
virtual void AddCompound(const G4VTrajectory &)
virtual std::vector< G4AttValue > * CreateAttValues() const
G4Polymarker::MarkerType GetStepPtsType() const
#define G4endl
Definition: G4ios.hh:61
void addType(const char *name, int newTypeDepth)
G4bool GetDrawAuxPts() const
G4bool GetStepPtsVisible() const
void G4HepRepFileSceneHandler::AddCompound ( const G4VHit hit)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 850 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttDef(), G4HepRepFileXMLWriter::addAttValue(), G4VSceneHandler::AddCompound(), G4HepRepFileXMLWriter::addInstance(), G4HepRepFileXMLWriter::addType(), G4VHit::CreateAttValues(), G4cout, G4endl, G4VHit::GetAttDefs(), and G4HepRepFileXMLWriter::prevTypeName.

850  {
851 #ifdef G4HEPREPFILEDEBUG
852  G4cout << "G4HepRepFileSceneHandler::AddCompound(G4VHit&) " << G4endl;
853 #endif
854 
855  // Pointers to hold hit attribute values and definitions.
856  std::vector<G4AttValue>* rawHitAttValues = hit.CreateAttValues();
857  hitAttValues =
858  new std::vector<G4AttValue>;
859  hitAttDefs =
860  new std::map<G4String,G4AttDef>;
861 
862  // Iterators to use with attribute values and definitions.
863  std::vector<G4AttValue>::iterator iAttVal;
864  std::map<G4String,G4AttDef>::const_iterator iAttDef;
865 
866  // Get hit attributes and definitions in standard HepRep style
867  // (uniform units, 3Vectors decomposed).
868  if (rawHitAttValues) {
869  G4bool error = G4AttCheck(rawHitAttValues,
870  hit.GetAttDefs()).Standard(hitAttValues,hitAttDefs);
871  if (error) {
872  G4cout << "G4HepRepFileSceneHandler::AddCompound(hit):"
873  "\nERROR found during conversion to standard hit attributes."
874  << G4endl;
875  }
876 #ifdef G4HEPREPFILEDEBUG
877  G4cout <<
878  "G4HepRepFileSceneHandler::AddCompound(hit): standardised attributes:\n"
879  << G4AttCheck(hitAttValues,hitAttDefs) << G4endl;
880 #endif
881  delete rawHitAttValues;
882  }
883 
884  // Open the HepRep output file if it is not already open.
885  CheckFileOpen();
886 
887  // Add the Event Data Type if it hasn't already been added.
888  if (strcmp("Event Data",hepRepXMLWriter->prevTypeName[0])!=0) {
889  hepRepXMLWriter->addType("Event Data",0);
890  hepRepXMLWriter->addInstance();
891  }
892 
893  // Find out the current HitType.
894  G4String hitType = "Hits";
895  if (hitAttValues) {
896  G4bool found = false;
897  for (iAttVal = hitAttValues->begin();
898  iAttVal != hitAttValues->end() && !found; ++iAttVal) {
899  if (strcmp(iAttVal->GetName(),"HitType")==0) {
900  hitType = iAttVal->GetValue();
901  found = true;
902  }
903  }
904  }
905 
906  // Add the Hits Type.
907  G4String previousName = hepRepXMLWriter->prevTypeName[1];
908  hepRepXMLWriter->addType(hitType,1);
909 
910  // If this is the first hit of this event,
911  // specify attribute values common to all hits.
912  if (strcmp(hitType,previousName)!=0) {
913  hepRepXMLWriter->addAttValue("Layer",130);
914 
915  // Take all Hit attDefs from first hit.
916  // Would rather be able to get these attDefs without needing a reference from any
917  // particular hit, but don't know how to do that.
918  // Write out hit attribute definitions.
919  if (hitAttValues && hitAttDefs) {
920  for (iAttVal = hitAttValues->begin();
921  iAttVal != hitAttValues->end(); ++iAttVal) {
922  iAttDef = hitAttDefs->find(iAttVal->GetName());
923  if (iAttDef != hitAttDefs->end()) {
924  // Protect against incorrect use of Category. Anything value other than the
925  // standard ones will be considered to be in the physics category.
926  G4String category = iAttDef->second.GetCategory();
927  if (strcmp(category,"Draw")!=0 &&
928  strcmp(category,"Physics")!=0 &&
929  strcmp(category,"Association")!=0 &&
930  strcmp(category,"PickAction")!=0)
931  category = "Physics";
932  hepRepXMLWriter->addAttDef(iAttVal->GetName(), iAttDef->second.GetDesc(),
933  category, iAttDef->second.GetExtra());
934  }
935  }
936  }
937  } // end of special treatment for when this is the first hit.
938 
939  // Now that we have written out all of the attributes that are based on the
940  // hit's particulars, call base class to deconstruct hit into a primitives.
941  drawingHit = true;
942  doneInitHit = false;
943  G4VSceneHandler::AddCompound(hit); // Invoke default action.
944  drawingHit = false;
945 }
void addAttValue(const char *name, const char *value)
G4GLOB_DLL std::ostream G4cout
void addAttDef(const char *name, const char *desc, const char *type, const char *extra)
bool G4bool
Definition: G4Types.hh:79
virtual void AddCompound(const G4VTrajectory &)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
Definition: G4VHit.hh:60
virtual std::vector< G4AttValue > * CreateAttValues() const
Definition: G4VHit.hh:67
#define G4endl
Definition: G4ios.hh:61
void addType(const char *name, int newTypeDepth)
void G4HepRepFileSceneHandler::AddCompound ( const G4THitsMap< G4double > &  hits)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 83 of file G4HepRepFileSceneHandler.hh.

References G4VSceneHandler::AddCompound().

83  {
85  }
virtual void AddCompound(const G4VTrajectory &)
void G4HepRepFileSceneHandler::AddCompound ( const G4VDigi digi)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 86 of file G4HepRepFileSceneHandler.hh.

References G4VSceneHandler::AddCompound().

86  {
88  }
virtual void AddCompound(const G4VTrajectory &)
void G4HepRepFileSceneHandler::AddPrimitive ( const G4Polyline polyline)
virtual

Implements G4VSceneHandler.

Definition at line 994 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), InitHit(), InitTrajectory(), G4VisAttributes::IsVisible(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

994  {
995 #ifdef G4HEPREPFILEDEBUG
996  G4cout <<
997  "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyline& polyline) called:"
998  "\n polyline: " << polyline
999  << G4endl;
1000  PrintThings();
1001 #endif
1002 
1004 
1005  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
1006  return;
1007 
1008  if (inPrimitives2D) {
1009  if (!warnedAbout2DMarkers) {
1010  G4cout << "HepRepFile does not currently support 2D lines." << G4endl;
1011  warnedAbout2DMarkers = true;
1012  }
1013  return;
1014  }
1015 
1016  if (drawingTraj)
1017  InitTrajectory();
1018 
1019  if (drawingHit)
1020  InitHit();
1021 
1022  haveVisible = true;
1023  AddHepRepInstance("Line", polyline);
1024 
1025  hepRepXMLWriter->addPrimitive();
1026 
1027  for (size_t i=0; i < polyline.size(); i++) {
1028  G4Point3D vertex = (fObjectTransformation) * polyline[i];
1029  hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
1030  }
1031 }
G4bool IsVisible() const
G4Transform3D fObjectTransformation
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
const G4VisAttributes * fpVisAttribs
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::AddPrimitive ( const G4Text text)
virtual

Implements G4VSceneHandler.

Definition at line 1082 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPrimitive(), G4cout, G4endl, G4Colour::GetBlue(), G4Colour::GetGreen(), G4VSceneHandler::GetMarkerSize(), G4Colour::GetRed(), G4Text::GetText(), G4VSceneHandler::GetTextColour(), G4Text::GetXOffset(), G4Text::GetYOffset(), and G4VSceneHandler::world.

1082  {
1083 #ifdef G4HEPREPFILEDEBUG
1084  G4cout <<
1085  "G4HepRepFileSceneHandler::AddPrimitive(const G4Text& text) called:"
1086  "\n text: " << text.GetText()
1087  << G4endl;
1088  PrintThings();
1089 #endif
1090 
1091  if (!inPrimitives2D) {
1092  if (!warnedAbout3DText) {
1093  G4cout << "HepRepFile does not currently support 3D text." << G4endl;
1094  G4cout << "HepRep browsers can directly display text attributes on request." << G4endl;
1095  G4cout << "See Application Developers Guide for how to attach attributes to viewable objects." << G4endl;
1096  warnedAbout3DText = true;
1097  }
1098  return;
1099  }
1100 
1101  MarkerSizeType sizeType;
1102  G4double size = GetMarkerSize (text, sizeType);
1103  if (sizeType==world)
1104  size = 12.;
1105 
1106  haveVisible = true;
1107  AddHepRepInstance("Text", text);
1108 
1109  hepRepXMLWriter->addAttValue("VAlign", "Top");
1110  hepRepXMLWriter->addAttValue("HAlign", "Left");
1111  hepRepXMLWriter->addAttValue("FontName", "Arial");
1112  hepRepXMLWriter->addAttValue("FontStyle", "Plain");
1113  hepRepXMLWriter->addAttValue("FontSize", (G4int) size);
1114  hepRepXMLWriter->addAttValue("FontHasBanner", "TRUE");
1115  hepRepXMLWriter->addAttValue("FontBannerColor", "0,0,0");
1116 
1117  const G4Colour& colour = GetTextColour(text);
1118  float redness = colour.GetRed();
1119  float greenness = colour.GetGreen();
1120  float blueness = colour.GetBlue();
1121 
1122  // Avoiding drawing anything black on black.
1123  if (redness==0. && greenness==0. && blueness==0.) {
1124  redness = 1.;
1125  greenness = 1.;
1126  blueness = 1.;
1127  }
1128  hepRepXMLWriter->addAttValue("FontColor",redness,greenness,blueness);
1129 
1130  hepRepXMLWriter->addPrimitive();
1131 
1132  hepRepXMLWriter->addAttValue("Text", text.GetText());
1133  hepRepXMLWriter->addAttValue("VPos", .99-text.GetYOffset());
1134  hepRepXMLWriter->addAttValue("HPos", text.GetXOffset());
1135 }
void addAttValue(const char *name, const char *value)
G4double GetBlue() const
Definition: G4Colour.hh:141
int G4int
Definition: G4Types.hh:78
G4double GetYOffset() const
G4GLOB_DLL std::ostream G4cout
G4double GetRed() const
Definition: G4Colour.hh:139
G4double GetGreen() const
Definition: G4Colour.hh:140
G4double GetXOffset() const
G4String GetText() const
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
const G4Colour & GetTextColour(const G4Text &)
void G4HepRepFileSceneHandler::AddPrimitive ( const G4Circle circle)
virtual

Implements G4VSceneHandler.

Definition at line 1138 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4VMarker::GetWorldRadius(), InitHit(), G4VisAttributes::IsVisible(), G4VSceneHandler::world, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

1138  {
1139 #ifdef G4HEPREPFILEDEBUG
1140  G4cout <<
1141  "G4HepRepFileSceneHandler::AddPrimitive(const G4Circle& circle) called:"
1142  "\n radius: " << circle.GetWorldRadius()
1143  << G4endl;
1144  PrintThings();
1145 #endif
1146 
1148 
1149  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
1150  return;
1151 
1152  if (inPrimitives2D) {
1153  if (!warnedAbout2DMarkers) {
1154  G4cout << "HepRepFile does not currently support 2D circles." << G4endl;
1155  warnedAbout2DMarkers = true;
1156  }
1157  return;
1158  }
1159 
1160  MarkerSizeType sizeType;
1161  G4double size = GetMarkerSize (circle, sizeType);
1162  if (sizeType==world)
1163  size = 4.;
1164 
1165  if (drawingTraj)
1166  return;
1167 
1168  if (drawingHit)
1169  InitHit();
1170 
1171  haveVisible = true;
1172  AddHepRepInstance("Point", circle);
1173 
1174  hepRepXMLWriter->addAttValue("MarkName", "Dot");
1175  hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
1176 
1177  hepRepXMLWriter->addPrimitive();
1178 
1179  G4Point3D center = (fObjectTransformation) * circle.GetPosition();
1180  hepRepXMLWriter->addPoint(center.x(), center.y(), center.z());
1181 }
G4double GetWorldRadius() const
void addAttValue(const char *name, const char *value)
G4bool IsVisible() const
G4Transform3D fObjectTransformation
G4Point3D GetPosition() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
const G4VisAttributes * fpVisAttribs
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4HepRepFileSceneHandler::AddPrimitive ( const G4Square square)
virtual

Implements G4VSceneHandler.

Definition at line 1184 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4VMarker::GetWorldRadius(), InitHit(), G4VisAttributes::IsVisible(), G4VSceneHandler::world, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

1184  {
1185 #ifdef G4HEPREPFILEDEBUG
1186  G4cout <<
1187  "G4HepRepFileSceneHandler::AddPrimitive(const G4Square& square) called:"
1188  "\n side: " << square.GetWorldRadius()
1189  << G4endl;
1190  PrintThings();
1191 #endif
1192 
1194 
1195  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
1196  return;
1197 
1198  if (inPrimitives2D) {
1199  if (!warnedAbout2DMarkers) {
1200  G4cout << "HepRepFile does not currently support 2D squares." << G4endl;
1201  warnedAbout2DMarkers = true;
1202  }
1203  return;
1204  }
1205 
1206  MarkerSizeType sizeType;
1207  G4double size = GetMarkerSize (square, sizeType);
1208  if (sizeType==world)
1209  size = 4.;
1210 
1211  if (drawingTraj)
1212  return;
1213 
1214  if (drawingHit)
1215  InitHit();
1216 
1217  haveVisible = true;
1218  AddHepRepInstance("Point", square);
1219 
1220  hepRepXMLWriter->addAttValue("MarkName", "Square");
1221  hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
1222 
1223  hepRepXMLWriter->addPrimitive();
1224 
1225  G4Point3D center = (fObjectTransformation) * square.GetPosition();
1226  hepRepXMLWriter->addPoint(center.x(), center.y(), center.z());
1227 }
G4double GetWorldRadius() const
void addAttValue(const char *name, const char *value)
G4bool IsVisible() const
G4Transform3D fObjectTransformation
G4Point3D GetPosition() const
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
const G4VisAttributes * fpVisAttribs
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4HepRepFileSceneHandler::AddPrimitive ( const G4Polyhedron polyhedron)
virtual

Implements G4VSceneHandler.

Definition at line 1230 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), HepPolyhedron::GetNextNormal(), HepPolyhedron::GetNextVertex(), HepPolyhedron::GetNoFacets(), InitHit(), G4VisAttributes::IsVisible(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

1230  {
1231 #ifdef G4HEPREPFILEDEBUG
1232  G4cout <<
1233  "G4HepRepFileSceneHandler::AddPrimitive(const G4Polyhedron& polyhedron) called."
1234  << G4endl;
1235  PrintThings();
1236 #endif
1237 
1239 
1240  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
1241  return;
1242 
1243  if(polyhedron.GetNoFacets()==0)return;
1244 
1245  if (drawingTraj)
1246  return;
1247 
1248  if (drawingHit)
1249  InitHit();
1250 
1251  haveVisible = true;
1252  AddHepRepInstance("Polygon", polyhedron);
1253 
1254  G4Normal3D surfaceNormal;
1255  G4Point3D vertex;
1256 
1257  G4bool notLastFace;
1258  do {
1259  hepRepXMLWriter->addPrimitive();
1260  notLastFace = polyhedron.GetNextNormal (surfaceNormal);
1261 
1262  G4int edgeFlag = 1;
1263  G4bool notLastEdge;
1264  do {
1265  notLastEdge = polyhedron.GetNextVertex (vertex, edgeFlag);
1266  vertex = (fObjectTransformation) * vertex;
1267  hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
1268  } while (notLastEdge);
1269  } while (notLastFace);
1270 }
G4bool GetNextNormal(G4Normal3D &normal) const
G4bool IsVisible() const
G4Transform3D fObjectTransformation
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
bool G4bool
Definition: G4Types.hh:79
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
const G4VisAttributes * fpVisAttribs
#define G4endl
Definition: G4ios.hh:61
G4bool GetNextVertex(G4Point3D &vertex, G4int &edgeFlag) const
G4int GetNoFacets() const
void G4HepRepFileSceneHandler::AddPrimitive ( const G4Polymarker line)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1035 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSceneHandler::GetMarkerSize(), InitHit(), G4VisAttributes::IsVisible(), G4VSceneHandler::world, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

1035  {
1036 #ifdef G4HEPREPFILEDEBUG
1037  G4cout <<
1038  "G4HepRepFileSceneHandler::AddPrimitive(const G4Polymarker& line) called"
1039  << G4endl;
1040  PrintThings();
1041 #endif
1042 
1044 
1045  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
1046  return;
1047 
1048  if (inPrimitives2D) {
1049  if (!warnedAbout2DMarkers) {
1050  G4cout << "HepRepFile does not currently support 2D lines." << G4endl;
1051  warnedAbout2DMarkers = true;
1052  }
1053  return;
1054  }
1055 
1056  MarkerSizeType sizeType;
1057  G4double size = GetMarkerSize (line, sizeType);
1058  if (sizeType==world)
1059  size = 4.;
1060 
1061  if (drawingTraj)
1062  return;
1063 
1064  if (drawingHit)
1065  InitHit();
1066 
1067  haveVisible = true;
1068  AddHepRepInstance("Point", line);
1069 
1070  hepRepXMLWriter->addAttValue("MarkName", "Dot");
1071  hepRepXMLWriter->addAttValue("MarkSize", (G4int) size);
1072 
1073  hepRepXMLWriter->addPrimitive();
1074 
1075  for (size_t i=0; i < line.size(); i++) {
1076  G4Point3D vertex = (fObjectTransformation) * line[i];
1077  hepRepXMLWriter->addPoint(vertex.x(), vertex.y(), vertex.z());
1078  }
1079 }
void addAttValue(const char *name, const char *value)
G4bool IsVisible() const
G4Transform3D fObjectTransformation
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
const G4VisAttributes * fpVisAttribs
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4HepRepFileSceneHandler::AddPrimitive ( const G4Scale scale)
inlinevirtual

Reimplemented from G4VSceneHandler.

Definition at line 108 of file G4HepRepFileSceneHandler.hh.

References G4VSceneHandler::AddPrimitive().

108  {
110  }
virtual void AddPrimitive(const G4Polyline &)=0
void G4HepRepFileSceneHandler::AddSolid ( const G4Box box)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 151 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Box::GetXHalfLength(), G4Box::GetYHalfLength(), G4Box::GetZHalfLength(), InitHit(), G4VisAttributes::IsVisible(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

151  {
152 #ifdef G4HEPREPFILEDEBUG
153  G4cout <<
154  "G4HepRepFileSceneHandler::AddSolid(const G4Box& box) called for "
155  << box.GetName()
156  << G4endl;
157  PrintThings();
158 #endif
159 
160  if (drawingTraj)
161  return;
162 
163  if (drawingHit)
164  InitHit();
165 
166  haveVisible = false;
167  AddHepRepInstance("Prism", NULL);
168 
170 
171  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
172  return;
173 
174  hepRepXMLWriter->addPrimitive();
175 
176  G4double dx = box.GetXHalfLength();
177  G4double dy = box.GetYHalfLength();
178  G4double dz = box.GetZHalfLength();
179 
180  G4Point3D vertex1(G4Point3D( dx, dy,-dz));
181  G4Point3D vertex2(G4Point3D( dx,-dy,-dz));
182  G4Point3D vertex3(G4Point3D(-dx,-dy,-dz));
183  G4Point3D vertex4(G4Point3D(-dx, dy,-dz));
184  G4Point3D vertex5(G4Point3D( dx, dy, dz));
185  G4Point3D vertex6(G4Point3D( dx,-dy, dz));
186  G4Point3D vertex7(G4Point3D(-dx,-dy, dz));
187  G4Point3D vertex8(G4Point3D(-dx, dy, dz));
188 
189  vertex1 = (fObjectTransformation) * vertex1;
190  vertex2 = (fObjectTransformation) * vertex2;
191  vertex3 = (fObjectTransformation) * vertex3;
192  vertex4 = (fObjectTransformation) * vertex4;
193  vertex5 = (fObjectTransformation) * vertex5;
194  vertex6 = (fObjectTransformation) * vertex6;
195  vertex7 = (fObjectTransformation) * vertex7;
196  vertex8 = (fObjectTransformation) * vertex8;
197 
198  hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
199  hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
200  hepRepXMLWriter->addPoint(vertex3.x(), vertex3.y(), vertex3.z());
201  hepRepXMLWriter->addPoint(vertex4.x(), vertex4.y(), vertex4.z());
202  hepRepXMLWriter->addPoint(vertex5.x(), vertex5.y(), vertex5.z());
203  hepRepXMLWriter->addPoint(vertex6.x(), vertex6.y(), vertex6.z());
204  hepRepXMLWriter->addPoint(vertex7.x(), vertex7.y(), vertex7.z());
205  hepRepXMLWriter->addPoint(vertex8.x(), vertex8.y(), vertex8.z());
206 }
G4String GetName() const
G4double GetXHalfLength() const
G4bool IsVisible() const
G4Transform3D fObjectTransformation
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
G4double GetZHalfLength() const
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
G4double GetYHalfLength() const
const G4VisAttributes * fpVisAttribs
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void G4HepRepFileSceneHandler::AddSolid ( const G4Cons cons)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 209 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::AddSolid(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4Cons::GetDeltaPhiAngle(), G4Cons::GetInnerRadiusMinusZ(), G4Cons::GetInnerRadiusPlusZ(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Cons::GetOuterRadiusMinusZ(), G4Cons::GetOuterRadiusPlusZ(), G4HepRepMessenger::getScale(), G4Cons::GetZHalfLength(), InitHit(), G4VisAttributes::IsVisible(), CLHEP::HepRotation::phiX(), CLHEP::HepRotation::phiY(), CLHEP::HepRotation::phiZ(), python.hepunit::pi, G4HepRepMessenger::renderCylAsPolygons(), python.hepunit::twopi, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

209  {
210 #ifdef G4HEPREPFILEDEBUG
211  G4cout <<
212  "G4HepRepFileSceneHandler::AddSolid(const G4Cons& cons) called for "
213  << cons.GetName()
214  << G4endl;
215  PrintThings();
216 #endif
217 
218  // HepRApp does not correctly represent the end faces of cones at
219  // non-standard angles, let the base class convert these solids to polygons.
221  G4bool linedUpWithAnAxis = (std::fabs(r.phiX())<=.001 ||
222  std::fabs(r.phiY())<=.001 ||
223  std::fabs(r.phiZ())<=.001 ||
224  std::fabs(r.phiX()-pi)<=.001 ||
225  std::fabs(r.phiY()-pi)<=.001 ||
226  std::fabs(r.phiZ()-pi)<=.001);
227  //G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle Z:" << r.phiZ() << G4endl;
228  //G4cout << "linedUpWithAnAxis:" << linedUpWithAnAxis << G4endl;
229 
230  // HepRep does not have a primitive for a cut cone,
231  // so if this cone is cut, let the base class convert this
232  // solid to polygons.
234  if (cons.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons())
235  {
236  G4VSceneHandler::AddSolid(cons); // Invoke default action.
237  } else {
238 
239  if (drawingTraj)
240  return;
241 
242  if (drawingHit)
243  InitHit();
244 
245  haveVisible = false;
246  AddHepRepInstance("Cylinder", NULL);
247 
248  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
249  return;
250 
251  G4Point3D vertex1(G4Point3D( 0., 0., -cons.GetZHalfLength()));
252  G4Point3D vertex2(G4Point3D( 0., 0., cons.GetZHalfLength()));
253 
254  vertex1 = (fObjectTransformation) * vertex1;
255  vertex2 = (fObjectTransformation) * vertex2;
256 
257  // Outer cylinder.
258  hepRepXMLWriter->addPrimitive();
259  hepRepXMLWriter->addAttValue("Radius1",messenger->getScale() * cons.GetOuterRadiusMinusZ());
260  hepRepXMLWriter->addAttValue("Radius2",messenger->getScale() * cons.GetOuterRadiusPlusZ());
261  hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
262  hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
263 
264  // Inner cylinder.
265  hepRepXMLWriter->addPrimitive();
266  hepRepXMLWriter->addAttValue("Radius1",messenger->getScale() * cons.GetInnerRadiusMinusZ());
267  hepRepXMLWriter->addAttValue("Radius2",messenger->getScale() * cons.GetInnerRadiusPlusZ());
268  hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
269  hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
270  }
271 }
G4String GetName() const
virtual G4double getScale()
virtual void AddSolid(const G4Box &)
virtual G4bool renderCylAsPolygons()
void addAttValue(const char *name, const char *value)
G4bool IsVisible() const
G4Transform3D fObjectTransformation
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
G4double GetOuterRadiusMinusZ() const
double phiY() const
Definition: Rotation.cc:133
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
bool G4bool
Definition: G4Types.hh:79
CLHEP::HepRotation getRotation() const
double phiX() const
Definition: Rotation.cc:129
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
G4double GetInnerRadiusPlusZ() const
const G4VisAttributes * fpVisAttribs
double phiZ() const
Definition: Rotation.cc:137
#define G4endl
Definition: G4ios.hh:61
G4double GetInnerRadiusMinusZ() const
G4double GetOuterRadiusPlusZ() const
G4double GetZHalfLength() const
G4double GetDeltaPhiAngle() const
void G4HepRepFileSceneHandler::AddSolid ( const G4Tubs tubs)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 274 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttValue(), G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::AddSolid(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4Tubs::GetDeltaPhiAngle(), G4Tubs::GetInnerRadius(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Tubs::GetOuterRadius(), G4HepRepMessenger::getScale(), G4Tubs::GetZHalfLength(), InitHit(), G4VisAttributes::IsVisible(), CLHEP::HepRotation::phiX(), CLHEP::HepRotation::phiY(), CLHEP::HepRotation::phiZ(), python.hepunit::pi, G4HepRepMessenger::renderCylAsPolygons(), python.hepunit::twopi, HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

274  {
275 #ifdef G4HEPREPFILEDEBUG
276  G4cout <<
277  "G4HepRepFileSceneHandler::AddSolid(const G4Tubs& tubs) called for "
278  << tubs.GetName()
279  << G4endl;
280  PrintThings();
281 #endif
282 
283  // HepRApp does not correctly represent the end faces of cylinders at
284  // non-standard angles, let the base class convert these solids to polygons.
286  G4bool linedUpWithAnAxis = (std::fabs(r.phiX())<=.001 ||
287  std::fabs(r.phiY())<=.001 ||
288  std::fabs(r.phiZ())<=.001 ||
289  std::fabs(r.phiX()-pi)<=.001 ||
290  std::fabs(r.phiY()-pi)<=.001 ||
291  std::fabs(r.phiZ()-pi)<=.001);
292  //G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle Z:" << r.phiZ() << G4endl;
293  //G4cout << "linedUpWithAnAxis:" << linedUpWithAnAxis << G4endl;
294 
295  // HepRep does not have a primitive for a cut cylinder,
296  // so if this cylinder is cut, let the base class convert this
297  // solid to polygons.
299  if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons())
300  {
301  G4VSceneHandler::AddSolid(tubs); // Invoke default action.
302  } else {
303 
304  if (drawingTraj)
305  return;
306 
307  if (drawingHit)
308  InitHit();
309 
310  haveVisible = false;
311  AddHepRepInstance("Cylinder", NULL);
312 
313  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
314  return;
315 
316  G4Point3D vertex1(G4Point3D( 0., 0., -tubs.GetZHalfLength()));
317  G4Point3D vertex2(G4Point3D( 0., 0., tubs.GetZHalfLength()));
318 
319  vertex1 = (fObjectTransformation) * vertex1;
320  vertex2 = (fObjectTransformation) * vertex2;
321 
322  // Outer cylinder.
323  hepRepXMLWriter->addPrimitive();
324  hepRepXMLWriter->addAttValue("Radius1", messenger->getScale() * tubs.GetOuterRadius());
325  hepRepXMLWriter->addAttValue("Radius2", messenger->getScale() * tubs.GetOuterRadius());
326  hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
327  hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
328 
329  // Inner cylinder.
330  if (tubs.GetInnerRadius() != 0.) {
331  hepRepXMLWriter->addPrimitive();
332  hepRepXMLWriter->addAttValue("Radius1", messenger->getScale() * tubs.GetInnerRadius());
333  hepRepXMLWriter->addAttValue("Radius2", messenger->getScale() * tubs.GetInnerRadius());
334  hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
335  hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
336  }
337  }
338 }
G4String GetName() const
virtual G4double getScale()
virtual void AddSolid(const G4Box &)
virtual G4bool renderCylAsPolygons()
void addAttValue(const char *name, const char *value)
G4bool IsVisible() const
G4Transform3D fObjectTransformation
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
double phiY() const
Definition: Rotation.cc:133
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
G4double GetDeltaPhiAngle() const
bool G4bool
Definition: G4Types.hh:79
CLHEP::HepRotation getRotation() const
double phiX() const
Definition: Rotation.cc:129
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
G4double GetInnerRadius() const
const G4VisAttributes * fpVisAttribs
double phiZ() const
Definition: Rotation.cc:137
G4double GetZHalfLength() const
#define G4endl
Definition: G4ios.hh:61
G4double GetOuterRadius() const
void G4HepRepFileSceneHandler::AddSolid ( const G4Trd trd)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 341 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addPoint(), G4HepRepFileXMLWriter::addPrimitive(), G4VSceneHandler::fObjectTransformation, G4VSceneHandler::fpVisAttribs, G4cout, G4endl, G4HepRepMessenger::getCullInvisibles(), G4HepRepMessenger::GetInstance(), G4VSolid::GetName(), G4Trd::GetXHalfLength1(), G4Trd::GetXHalfLength2(), G4Trd::GetYHalfLength1(), G4Trd::GetYHalfLength2(), G4Trd::GetZHalfLength(), InitHit(), G4VisAttributes::IsVisible(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

341  {
342 #ifdef G4HEPREPFILEDEBUG
343  G4cout <<
344  "G4HepRepFileSceneHandler::AddSolid(const G4Trd& trd) called for "
345  << trd.GetName()
346  << G4endl;
347  PrintThings();
348 #endif
349 
350  if (drawingTraj)
351  return;
352 
353  if (drawingHit)
354  InitHit();
355 
356  haveVisible = false;
357  AddHepRepInstance("Prism", NULL);
358 
360 
361  if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles())
362  return;
363 
364  hepRepXMLWriter->addPrimitive();
365 
366  G4double dx1 = trd.GetXHalfLength1();
367  G4double dy1 = trd.GetYHalfLength1();
368  G4double dx2 = trd.GetXHalfLength2();
369  G4double dy2 = trd.GetYHalfLength2();
370  G4double dz = trd.GetZHalfLength();
371 
372  G4Point3D vertex1(G4Point3D( dx1, dy1,-dz));
373  G4Point3D vertex2(G4Point3D( dx1,-dy1,-dz));
374  G4Point3D vertex3(G4Point3D(-dx1,-dy1,-dz));
375  G4Point3D vertex4(G4Point3D(-dx1, dy1,-dz));
376  G4Point3D vertex5(G4Point3D( dx2, dy2, dz));
377  G4Point3D vertex6(G4Point3D( dx2,-dy2, dz));
378  G4Point3D vertex7(G4Point3D(-dx2,-dy2, dz));
379  G4Point3D vertex8(G4Point3D(-dx2, dy2, dz));
380 
381  vertex1 = (fObjectTransformation) * vertex1;
382  vertex2 = (fObjectTransformation) * vertex2;
383  vertex3 = (fObjectTransformation) * vertex3;
384  vertex4 = (fObjectTransformation) * vertex4;
385  vertex5 = (fObjectTransformation) * vertex5;
386  vertex6 = (fObjectTransformation) * vertex6;
387  vertex7 = (fObjectTransformation) * vertex7;
388  vertex8 = (fObjectTransformation) * vertex8;
389 
390  hepRepXMLWriter->addPoint(vertex1.x(), vertex1.y(), vertex1.z());
391  hepRepXMLWriter->addPoint(vertex2.x(), vertex2.y(), vertex2.z());
392  hepRepXMLWriter->addPoint(vertex3.x(), vertex3.y(), vertex3.z());
393  hepRepXMLWriter->addPoint(vertex4.x(), vertex4.y(), vertex4.z());
394  hepRepXMLWriter->addPoint(vertex5.x(), vertex5.y(), vertex5.z());
395  hepRepXMLWriter->addPoint(vertex6.x(), vertex6.y(), vertex6.z());
396  hepRepXMLWriter->addPoint(vertex7.x(), vertex7.y(), vertex7.z());
397  hepRepXMLWriter->addPoint(vertex8.x(), vertex8.y(), vertex8.z());
398 }
G4String GetName() const
G4double GetYHalfLength1() const
G4bool IsVisible() const
G4Transform3D fObjectTransformation
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
G4double GetZHalfLength() const
G4double GetXHalfLength2() const
G4GLOB_DLL std::ostream G4cout
void addPoint(double x, double y, double z)
virtual G4bool getCullInvisibles()
static G4HepRepMessenger * GetInstance()
G4double GetYHalfLength2() const
const G4VisAttributes * fpVisAttribs
#define G4endl
Definition: G4ios.hh:61
G4double GetXHalfLength1() const
double G4double
Definition: G4Types.hh:76
void G4HepRepFileSceneHandler::AddSolid ( const G4Trap trap)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 401 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

401  {
402 #ifdef G4HEPREPFILEDEBUG
403  G4cout <<
404  "G4HepRepFileSceneHandler::AddSolid(const G4Trap& trap) called for "
405  << trap.GetName()
406  << G4endl;
407  PrintThings();
408 #endif
409  G4VSceneHandler::AddSolid(trap); // Invoke default action.
410 }
G4String GetName() const
virtual void AddSolid(const G4Box &)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::AddSolid ( const G4Sphere sphere)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 413 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

413  {
414 #ifdef G4HEPREPFILEDEBUG
415  G4cout <<
416  "G4HepRepFileSceneHandler::AddSolid(const G4Sphere& sphere) called for "
417  << sphere.GetName()
418  << G4endl;
419  PrintThings();
420 #endif
421  G4VSceneHandler::AddSolid(sphere); // Invoke default action.
422 }
G4String GetName() const
virtual void AddSolid(const G4Box &)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::AddSolid ( const G4Para para)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 425 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

425  {
426 #ifdef G4HEPREPFILEDEBUG
427  G4cout <<
428  "G4HepRepFileSceneHandler::AddSolid(const G4Para& para) called for "
429  << para.GetName()
430  << G4endl;
431  PrintThings();
432 #endif
433  G4VSceneHandler::AddSolid(para); // Invoke default action.
434 }
G4String GetName() const
virtual void AddSolid(const G4Box &)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::AddSolid ( const G4Torus torus)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 437 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

437  {
438 #ifdef G4HEPREPFILEDEBUG
439  G4cout <<
440  "G4HepRepFileSceneHandler::AddSolid(const G4Torus& torus) called for "
441  << torus.GetName()
442  << G4endl;
443  PrintThings();
444 #endif
445  G4VSceneHandler::AddSolid(torus); // Invoke default action.
446 }
G4String GetName() const
virtual void AddSolid(const G4Box &)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::AddSolid ( const G4Polycone polycone)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 449 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

449  {
450 #ifdef G4HEPREPFILEDEBUG
451  G4cout <<
452  "G4HepRepFileSceneHandler::AddSolid(const G4Polycone& polycone) called for "
453  << polycone.GetName()
454  << G4endl;
455  PrintThings();
456 #endif
457  G4VSceneHandler::AddSolid(polycone); // Invoke default action.
458 }
G4String GetName() const
virtual void AddSolid(const G4Box &)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::AddSolid ( const G4Polyhedra polyhedra)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 461 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

461  {
462 #ifdef G4HEPREPFILEDEBUG
463  G4cout <<
464  "G4HepRepFileSceneHandler::AddSolid(const G4Polyhedra& polyhedra) called for "
465  << polyhedra.GetName()
466  << G4endl;
467  PrintThings();
468 #endif
469  G4VSceneHandler::AddSolid(polyhedra); // Invoke default action.
470 }
G4String GetName() const
virtual void AddSolid(const G4Box &)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::AddSolid ( const G4VSolid solid)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 473 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::AddSolid(), G4cout, G4endl, and G4VSolid::GetName().

473  {
474 #ifdef G4HEPREPFILEDEBUG
475  G4cout <<
476  "G4HepRepFileSceneHandler::AddSolid(const G4Solid& solid) called for "
477  << solid.GetName()
478  << G4endl;
479  PrintThings();
480 #endif
481  G4VSceneHandler::AddSolid(solid); // Invoke default action.
482 }
G4String GetName() const
virtual void AddSolid(const G4Box &)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::BeginModeling ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 96 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::BeginModeling(), G4VisManager::CurrentTrajDrawModel(), and G4VTrajectoryModel::GetContext().

96  {
97  G4VisManager* visManager = G4VisManager::GetInstance();
98  const G4VTrajectoryModel* model = visManager->CurrentTrajDrawModel();
99  trajContext = & model->GetContext();
100 
101  G4VSceneHandler::BeginModeling(); // Required: see G4VSceneHandler.hh.
102 }
virtual void BeginModeling()
const G4VTrajectoryModel * CurrentTrajDrawModel() const
const G4VisTrajContext & GetContext() const
const XML_Char XML_Content * model
void G4HepRepFileSceneHandler::BeginPrimitives2D ( const G4Transform3D objectTransformation)
virtual

Reimplemented from G4VSceneHandler.

Definition at line 110 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::BeginPrimitives2D(), G4cout, and G4endl.

110  {
111 #ifdef G4HEPREPFILEDEBUG
112  G4cout << "G4HepRepFileSceneHandler::BeginPrimitives2D() " << G4endl;
113 #endif
114  inPrimitives2D = true;
115  G4VSceneHandler::BeginPrimitives2D(objectTransformation);
116 }
G4GLOB_DLL std::ostream G4cout
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)
#define G4endl
Definition: G4ios.hh:61
void G4HepRepFileSceneHandler::ClearTransientStore ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 1548 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::fpViewer.

1548  {
1549  // This is typically called after an update and before drawing hits
1550  // of the next event. To simulate the clearing of "transients"
1551  // (hits, etc.) the detector is redrawn...
1552  if (fpViewer) {
1553  fpViewer -> SetView();
1554  fpViewer -> ClearView();
1555  fpViewer -> DrawView();
1556  }
1557 }
G4VViewer * fpViewer
void G4HepRepFileSceneHandler::EndModeling ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 105 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::EndModeling().

105  {
106  G4VSceneHandler::EndModeling(); // Required: see G4VSceneHandler.hh.
107 }
virtual void EndModeling()
void G4HepRepFileSceneHandler::EndPrimitives2D ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 118 of file G4HepRepFileSceneHandler.cc.

References G4VSceneHandler::EndPrimitives2D(), G4cout, and G4endl.

118  {
119 #ifdef G4HEPREPFILEDEBUG
120  G4cout << "G4HepRepFileSceneHandler::EndPrimitives2D() " << G4endl;
121 #endif
123  inPrimitives2D = false;
124 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
virtual void EndPrimitives2D()
G4HepRepFileXMLWriter * G4HepRepFileSceneHandler::GetHepRepXMLWriter ( )

Definition at line 1273 of file G4HepRepFileSceneHandler.cc.

Referenced by G4HepRepFileSceneHandler().

1273  {
1274  return hepRepXMLWriter;
1275 }
void G4HepRepFileSceneHandler::InitHit ( )

Definition at line 971 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttValue(), and G4HepRepFileXMLWriter::addInstance().

Referenced by AddPrimitive(), and AddSolid().

971  {
972  if (!doneInitHit) {
973  // For every hit, add an instance of Type Hit.
974  hepRepXMLWriter->addInstance();
975 
976  // Write out the hit's attribute values.
977  if (hitAttValues) {
978  std::vector<G4AttValue>::iterator iAttVal;
979  for (iAttVal = hitAttValues->begin();
980  iAttVal != hitAttValues->end(); ++iAttVal)
981  hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
982  delete hitAttValues;
983  }
984 
985  // Clean up hit attributes.
986  if (hitAttDefs)
987  delete hitAttDefs;
988 
989  doneInitHit = true;
990  }
991 }
void addAttValue(const char *name, const char *value)
void G4HepRepFileSceneHandler::InitTrajectory ( )

Definition at line 948 of file G4HepRepFileSceneHandler.cc.

References G4HepRepFileXMLWriter::addAttValue(), and G4HepRepFileXMLWriter::addInstance().

Referenced by AddCompound(), and AddPrimitive().

948  {
949  if (!doneInitTraj) {
950  // For every trajectory, add an instance of Type Trajectory.
951  hepRepXMLWriter->addInstance();
952 
953  // Write out the trajectory's attribute values.
954  if (trajAttValues) {
955  std::vector<G4AttValue>::iterator iAttVal;
956  for (iAttVal = trajAttValues->begin();
957  iAttVal != trajAttValues->end(); ++iAttVal)
958  hepRepXMLWriter->addAttValue(iAttVal->GetName(), iAttVal->GetValue());
959  delete trajAttValues;
960  }
961 
962  // Clean up trajectory attributes.
963  if (trajAttDefs)
964  delete trajAttDefs;
965 
966  doneInitTraj = true;
967  }
968 }
void addAttValue(const char *name, const char *value)

Field Documentation

G4int G4HepRepFileSceneHandler::fSceneIdCount = 0
staticprotected

Definition at line 136 of file G4HepRepFileSceneHandler.hh.


The documentation for this class was generated from the following files: