Geant4  10.02.p02
G4VScoringMesh.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4VScoringMesh.hh 97466 2016-06-03 09:59:34Z gcosmo $
28 //
29 
30 #ifndef G4VScoringMesh_h
31 #define G4VScoringMesh_h 1
32 
33 #include "globals.hh"
34 #include "G4THitsMap.hh"
35 #include "G4RotationMatrix.hh"
36 
37 class G4VPhysicalVolume;
38 class G4LogicalVolume;
40 class G4VPrimitiveScorer;
41 class G4VSDFilter;
42 class G4VScoreColorMap;
44 
45 #include <map>
46 
48 typedef std::map<G4String,G4THitsMap<G4double>* > MeshScoreMap;
49 // class description:
50 //
51 // This class represents a parallel world for interactive scoring purposes.
52 //
53 
55 {
56  public:
57  G4VScoringMesh(const G4String& wName);
58  virtual ~G4VScoringMesh();
59 
60  public: // with description
61  // a pure virtual function to construct this mesh geometry
62  void Construct(G4VPhysicalVolume* fWorldPhys);
63 
64  void WorkerConstruct(G4VPhysicalVolume* fWorldPhys);
65 
66  protected:
67  virtual void SetupGeometry(G4VPhysicalVolume * fWorldPhys) = 0;
68 
69  public: // with description
70  // list infomration of this mesh
71  virtual void List() const;
72 
73  public: // with description
74  // get the world name
75  inline const G4String& GetWorldName() const
76  { return fWorldName; }
77  // get whether this mesh is active or not
78  inline G4bool IsActive() const
79  { return fActive; }
80  // set an activity of this mesh
81  inline void Activate(G4bool vl = true)
82  { fActive = vl; }
83  // get the shape of this mesh
84  inline MeshShape GetShape() const
85  { return fShape; }
86  // accumulate hits in a registered primitive scorer
87  void Accumulate(G4THitsMap<G4double> * map);
88  // merge same kind of meshes
89  void Merge(const G4VScoringMesh * scMesh);
90  // dump information of primitive socrers registered in this mesh
91  void Dump();
92  // draw a projected quantity on a current viewer
93  void DrawMesh(const G4String& psName,G4VScoreColorMap* colorMap,G4int axflg=111);
94  // draw a column of a quantity on a current viewer
95  void DrawMesh(const G4String& psName,G4int idxPlane,G4int iColumn,G4VScoreColorMap* colorMap);
96  // draw a projected quantity on a current viewer
97  virtual void Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg=111) = 0;
98  // draw a column of a quantity on a current viewer
99  virtual void DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
100  G4int idxProj, G4int idxColumn) = 0;
101  // reset registered primitive scorers
102  void ResetScore();
103 
104  // set size of this mesh
105  void SetSize(G4double size[3]);
106  // get size of this mesh
107  G4ThreeVector GetSize() const;
108  // set position of center of this mesh
109  void SetCenterPosition(G4double centerPosition[3]);
110  // get position of center of this mesh
112  // set a rotation angle around the x axis
113  void RotateX(G4double delta);
114  // set a rotation angle around the y axis
115  void RotateY(G4double delta);
116  // set a rotation angle around the z axis
117  void RotateZ(G4double delta);
118  // get a rotation matrix
120  if(fRotationMatrix) return *fRotationMatrix;
121  else return G4RotationMatrix::IDENTITY;
122  }
123  // set number of segments of this mesh
124  void SetNumberOfSegments(G4int nSegment[3]);
125  // get number of segments of this mesh
126  void GetNumberOfSegments(G4int nSegment[3]);
127 
128  // register a primitive scorer to the MFD & set it to the current primitive scorer
130  // register a filter to a current primtive scorer
131  void SetFilter(G4VSDFilter * filter);
132  // set a primitive scorer to the current one by the name
134  // find registered primitive scorer by the name
135  G4bool FindPrimitiveScorer(const G4String & psname);
136  // get whether current primitive scorer is set or not
138  if(fCurrentPS == nullptr) return true;
139  else return false;
140  }
141  // get unit of primitive scorer by the name
142  G4String GetPSUnit(const G4String & psname);
143  // get unit of current primitive scorer
145  // set unit of current primitive scorer
146  void SetCurrentPSUnit(const G4String& unit);
147  // get unit value of primitive scorer by the name
148  G4double GetPSUnitValue(const G4String & psname);
149  // set PS name to be drawn
150  void SetDrawPSName(const G4String & psname) {fDrawPSName = psname;}
151 
152  // get axis names of the hierarchical division in the divided order
153  void GetDivisionAxisNames(G4String divisionAxisNames[3]);
154 
155  // set current primitive scorer to NULL
157  // set verbose level
158  inline void SetVerboseLevel(G4int vl)
159  { verboseLevel = vl; }
160  // get the primitive scorer map
161  inline MeshScoreMap GetScoreMap() const
162  { return fMap; }
163  // get whether this mesh setup has been ready
164  inline G4bool ReadyForQuantity() const
165  { return (sizeIsSet && nMeshIsSet); }
166 
167 protected:
168  // get registered primitive socrer by the name
170 
171 protected:
177 
182 
183  std::map<G4String, G4THitsMap<G4double>* > fMap;
185 
187 
190 
194 
196 
198 
199 public:
201  { fMeshElementLogical = val; }
203  { return fMeshElementLogical; }
204 
205 protected:
208 public:
210  { fParallelWorldProcess = proc; }
212  { return fParallelWorldProcess; }
214  {
215  fGeometryHasBeenDestroyed = true;
216  fMeshElementLogical = nullptr;
217  }
218 };
219 
220 #endif
221 
void GetNumberOfSegments(G4int nSegment[3])
const G4String & GetWorldName() const
G4VScoringMesh(const G4String &wName)
G4RotationMatrix GetRotationMatrix() const
void Activate(G4bool vl=true)
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
void SetParallelWorldProcess(G4ParallelWorldProcess *proc)
G4ThreeVector fCenterPosition
void Merge(const G4VScoringMesh *scMesh)
G4bool FindPrimitiveScorer(const G4String &psname)
std::map< G4String, G4THitsMap< G4double > * > MeshScoreMap
CLHEP::Hep3Vector G4ThreeVector
void RotateY(G4double delta)
G4VPrimitiveScorer * GetPrimitiveScorer(const G4String &name)
CLHEP::HepRotation G4RotationMatrix
void GeometryHasBeenDestroyed()
void SetPrimitiveScorer(G4VPrimitiveScorer *ps)
void SetMeshElementLogical(G4LogicalVolume *val)
void SetCurrentPrimitiveScorer(const G4String &name)
G4String name
Definition: TRTMaterials.hh:40
G4MultiFunctionalDetector * fMFD
void SetSize(G4double size[3])
G4double GetPSUnitValue(const G4String &psname)
void Accumulate(G4THitsMap< G4double > *map)
void RotateX(G4double delta)
G4double fSize[3]
void SetFilter(G4VSDFilter *filter)
void WorkerConstruct(G4VPhysicalVolume *fWorldPhys)
G4ThreeVector GetSize() const
G4String GetPSUnit(const G4String &psname)
int G4int
Definition: G4Types.hh:78
void Construct(G4VPhysicalVolume *fWorldPhys)
G4ParallelWorldProcess * fParallelWorldProcess
void SetNullToCurrentPrimitiveScorer()
G4bool IsCurrentPrimitiveScorerNull()
G4double fDrawUnitValue
MeshShape GetShape() const
virtual void List() const
G4RotationMatrix * fRotationMatrix
bool G4bool
Definition: G4Types.hh:79
G4ThreeVector GetTranslation() const
virtual void DrawColumn(std::map< G4int, G4double * > *map, G4VScoreColorMap *colorMap, G4int idxProj, G4int idxColumn)=0
G4bool ReadyForQuantity() const
virtual void SetupGeometry(G4VPhysicalVolume *fWorldPhys)=0
void SetCurrentPSUnit(const G4String &unit)
virtual ~G4VScoringMesh()
void RotateZ(G4double delta)
G4bool fGeometryHasBeenDestroyed
G4LogicalVolume * fMeshElementLogical
virtual void Draw(std::map< G4int, G4double * > *map, G4VScoreColorMap *colorMap, G4int axflg=111)=0
void SetCenterPosition(G4double centerPosition[3])
G4VPrimitiveScorer * fCurrentPS
void GetDivisionAxisNames(G4String divisionAxisNames[3])
G4ParallelWorldProcess * GetParallelWorldProcess() const
MeshScoreMap GetScoreMap() const
G4LogicalVolume * GetMeshElementLogical() const
MeshShape
G4String GetCurrentPSUnit()
G4String fDivisionAxisNames[3]
G4bool IsActive() const
double G4double
Definition: G4Types.hh:76
void SetDrawPSName(const G4String &psname)
void SetNumberOfSegments(G4int nSegment[3])
std::map< G4String, G4THitsMap< G4double > * > fMap
void SetVerboseLevel(G4int vl)
G4String fDrawPSName