Geant4-11
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//
28
29#ifndef G4VScoringMesh_h
30#define G4VScoringMesh_h 1
31
32#include "globals.hh"
33#include "G4THitsMap.hh"
34#include "G4RotationMatrix.hh"
35#include "G4StatDouble.hh"
36
38class G4LogicalVolume;
41class G4VSDFilter;
44
45#include <map>
46
47// class description:
48//
49// This class represents a multi-functional detector to be used by
50// command-based scorer For parallel world scorer, this class creates a
51// parallel world mesh geometry
52//
53
55{
56 public:
57 enum class MeshShape
58 {
59 box,
60 cylinder,
61 sphere,
62 realWorldLogVol,
63 probe,
64 undefined = -1
65 };
68 using MeshScoreMap = std::map<G4String, RunScore*>;
69
70 public:
71 G4VScoringMesh(const G4String& wName);
72 virtual ~G4VScoringMesh();
73
74 public: // with description
75 virtual void Construct(G4VPhysicalVolume* fWorldPhys);
76 virtual void WorkerConstruct(G4VPhysicalVolume* fWorldPhys);
77
78 protected:
79 // a pure virtual function to construct this mesh geometry
80 virtual void SetupGeometry(G4VPhysicalVolume* fWorldPhys) = 0;
81
82 public: // with description
83 // list infomration of this mesh
84 virtual void List() const;
85
86 public: // with description
87 // get the world name
88 // If this ScoringMesh is for parallel world, it returns the name of the
89 // parallel world If this ScoringMesh is for real world logical volume, it
90 // returns name of logical volume
91 inline const G4String& GetWorldName() const { return fWorldName; }
92 // get whether this mesh is active or not
93 inline G4bool IsActive() const { return fActive; }
94 // set an activity of this mesh
95 inline void Activate(G4bool vl = true) { fActive = vl; }
96 // get the shape of this mesh
97 inline MeshShape GetShape() const { return fShape; }
98 // accumulate hits in a registered primitive scorer
101 // merge same kind of meshes
102 void Merge(const G4VScoringMesh* scMesh);
103 // dump information of primitive socrers registered in this mesh
104 void Dump();
105 // draw a projected quantity on a current viewer
106 void DrawMesh(const G4String& psName, G4VScoreColorMap* colorMap,
107 G4int axflg = 111);
108 // draw a column of a quantity on a current viewer
109 void DrawMesh(const G4String& psName, G4int idxPlane, G4int iColumn,
110 G4VScoreColorMap* colorMap);
111 // draw a projected quantity on a current viewer
112 virtual void Draw(RunScore* map, G4VScoreColorMap* colorMap,
113 G4int axflg = 111) = 0;
114 // draw a column of a quantity on a current viewer
115 virtual void DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
116 G4int idxProj, G4int idxColumn) = 0;
117 // reset registered primitive scorers
118 void ResetScore();
119
120 // Following set/get methods make sense only for parallel world scoring mesh
121 // set size of this mesh
122 void SetSize(G4double size[3]);
123 // get size of this mesh
124 G4ThreeVector GetSize() const;
125 // set starting and span angles (used only for tube segment)
127 // get angles (used only for tube segment)
128 inline G4double GetStartAngle() const { return fAngle[0]; }
129 inline G4double GetAngleSpan() const { return fAngle[1]; }
130 // set position of center of this mesh
131 void SetCenterPosition(G4double centerPosition[3]);
132 // get position of center of this mesh
134 // set a rotation angle around the x axis
135 void RotateX(G4double delta);
136 // set a rotation angle around the y axis
137 void RotateY(G4double delta);
138 // set a rotation angle around the z axis
139 void RotateZ(G4double delta);
140 // get a rotation matrix
142 {
144 return *fRotationMatrix;
145 else
147 }
148
149 // set number of segments of this mesh
150 void SetNumberOfSegments(G4int nSegment[3]);
151 // get number of segments of this mesh
152 void GetNumberOfSegments(G4int nSegment[3]);
153
154 // register a primitive scorer to the MFD & set it to the current primitive
155 // scorer
157 // register a filter to a current primtive scorer
158 void SetFilter(G4VSDFilter* filter);
159 // set a primitive scorer to the current one by the name
161 // find registered primitive scorer by the name
162 G4bool FindPrimitiveScorer(const G4String& psname);
163 // get whether current primitive scorer is set or not
165 {
166 if(fCurrentPS == nullptr)
167 return true;
168 else
169 return false;
170 }
171 // get unit of primitive scorer by the name
172 G4String GetPSUnit(const G4String& psname);
173 // get unit of current primitive scorer
175 // set unit of current primitive scorer
176 void SetCurrentPSUnit(const G4String& unit);
177 // get unit value of primitive scorer by the name
178 G4double GetPSUnitValue(const G4String& psname);
179 // set PS name to be drawn
180 void SetDrawPSName(const G4String& psname) { fDrawPSName = psname; }
181
182 // get axis names of the hierarchical division in the divided order
183 void GetDivisionAxisNames(G4String divisionAxisNames[3]);
184
185 // set current primitive scorer to NULL
187 // set verbose level
188 inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
189 // get the primitive scorer map
190 inline MeshScoreMap GetScoreMap() const { return fMap; }
191 // get whether this mesh setup has been ready
192 inline G4bool ReadyForQuantity() const { return (sizeIsSet && nMeshIsSet); }
193
194 // protected:
195 // get registered primitive socrer by the name
197
198 protected:
204
210
213
215
218
222
224
226
227 public:
229 {
231 }
233 {
234 return fMeshElementLogical;
235 }
236
237 protected:
240
241 public:
243 {
245 }
247 {
249 }
251 {
253 fMeshElementLogical = nullptr;
254 }
255
256 protected:
258
259 public:
260 // Geometry hirarchy level (bottom = 0) to be used as the copy number
261 // This is used only for real-world scorer
262 inline void SetCopyNumberLevel(G4int val) { copyNumberLevel = val; }
263 inline G4int GetCopyNumberLevel() const { return copyNumberLevel; }
264
265 protected:
266 // This flag may be set to true for Probe scoring mesh.
267 // There is no public set method for this boolean flag, but it should be set
268 // to true through SetMaterial() method of Probe scoring mesh.
270
271 public:
273};
274
275#endif
static constexpr double ps
Definition: G4SIunits.hh:157
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
static DLL_API const HepRotation IDENTITY
Definition: Rotation.h:366
void SetVerboseLevel(G4int vl)
void Activate(G4bool vl=true)
void SetFilter(G4VSDFilter *filter)
G4bool ReadyForQuantity() const
void SetNullToCurrentPrimitiveScorer()
G4RotationMatrix * fRotationMatrix
G4ThreeVector GetTranslation() const
G4ThreeVector GetSize() const
MeshShape GetShape() const
virtual void SetupGeometry(G4VPhysicalVolume *fWorldPhys)=0
virtual void List() const
G4LogicalVolume * GetMeshElementLogical() const
G4double fDrawUnitValue
virtual void WorkerConstruct(G4VPhysicalVolume *fWorldPhys)
G4String fDrawPSName
G4double GetStartAngle() const
G4bool IsActive() const
void SetDrawPSName(const G4String &psname)
G4bool fGeometryHasBeenDestroyed
MeshScoreMap fMap
void GeometryHasBeenDestroyed()
void RotateY(G4double delta)
void GetNumberOfSegments(G4int nSegment[3])
G4RotationMatrix GetRotationMatrix() const
G4int GetCopyNumberLevel() const
G4double GetPSUnitValue(const G4String &psname)
G4ParallelWorldProcess * GetParallelWorldProcess() const
G4String GetPSUnit(const G4String &psname)
void SetAngles(G4double, G4double)
void SetCurrentPSUnit(const G4String &unit)
void SetParallelWorldProcess(G4ParallelWorldProcess *proc)
G4MultiFunctionalDetector * fMFD
void SetCurrentPrimitiveScorer(const G4String &name)
const G4String & GetWorldName() const
G4String fDivisionAxisNames[3]
G4LogicalVolume * fMeshElementLogical
void SetPrimitiveScorer(G4VPrimitiveScorer *ps)
std::map< G4String, RunScore * > MeshScoreMap
G4VPrimitiveScorer * fCurrentPS
G4double fAngle[2]
G4String GetCurrentPSUnit()
void GetDivisionAxisNames(G4String divisionAxisNames[3])
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
void Accumulate(G4THitsMap< G4double > *map)
void SetNumberOfSegments(G4int nSegment[3])
G4double fSize[3]
G4VScoringMesh(const G4String &wName)
G4ParallelWorldProcess * fParallelWorldProcess
G4double GetAngleSpan() const
MeshScoreMap GetScoreMap() const
void Merge(const G4VScoringMesh *scMesh)
virtual ~G4VScoringMesh()
virtual void Draw(RunScore *map, G4VScoreColorMap *colorMap, G4int axflg=111)=0
G4bool IsCurrentPrimitiveScorerNull()
void SetCenterPosition(G4double centerPosition[3])
void SetCopyNumberLevel(G4int val)
void RotateX(G4double delta)
virtual void Construct(G4VPhysicalVolume *fWorldPhys)
void SetSize(G4double size[3])
virtual void DrawColumn(RunScore *map, G4VScoreColorMap *colorMap, G4int idxProj, G4int idxColumn)=0
G4bool FindPrimitiveScorer(const G4String &psname)
void SetMeshElementLogical(G4LogicalVolume *val)
void RotateZ(G4double delta)
G4bool LayeredMassFlg()
G4VPrimitiveScorer * GetPrimitiveScorer(const G4String &name)
G4ThreeVector fCenterPosition
const char * name(G4int ptype)