Geant4_10
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 68735 2013-04-05 09:49:13Z 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;
43 
44 #include <map>
45 
47 typedef std::map<G4String,G4THitsMap<G4double>* > MeshScoreMap;
48 // class description:
49 //
50 // This class represents a parallel world for interactive scoring purposes.
51 //
52 
54 {
55  public:
56  G4VScoringMesh(const G4String& wName);
57  virtual ~G4VScoringMesh();
58 
59  public: // with description
60  // a pure virtual function to construct this mesh geometry
61  virtual void Construct(G4VPhysicalVolume* fWorldPhys)=0;
62 
63  virtual void WorkerConstruct(G4VPhysicalVolume* fWorldPhys);
64 
65  // list infomration of this mesh
66  virtual void List() const;
67 
68  public: // with description
69  // get the world name
70  inline const G4String& GetWorldName() const
71  { return fWorldName; }
72  // get whether this mesh is active or not
73  inline G4bool IsActive() const
74  { return fActive; }
75  // set an activity of this mesh
76  inline void Activate(G4bool vl = true)
77  { fActive = vl; }
78  // get the shape of this mesh
79  inline MeshShape GetShape() const
80  { return fShape; }
81  // accumulate hits in a registered primitive scorer
82  void Accumulate(G4THitsMap<G4double> * map);
83  // merge same kind of meshes
84  void Merge(const G4VScoringMesh * scMesh);
85  // dump information of primitive socrers registered in this mesh
86  void Dump();
87  // draw a projected quantity on a current viewer
88  void DrawMesh(const G4String& psName,G4VScoreColorMap* colorMap,G4int axflg=111);
89  // draw a column of a quantity on a current viewer
90  void DrawMesh(const G4String& psName,G4int idxPlane,G4int iColumn,G4VScoreColorMap* colorMap);
91  // draw a projected quantity on a current viewer
92  virtual void Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg=111) = 0;
93  // draw a column of a quantity on a current viewer
94  virtual void DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
95  G4int idxProj, G4int idxColumn) = 0;
96  // reset registered primitive scorers
97  void ResetScore();
98 
99  // set size of this mesh
100  void SetSize(G4double size[3]);
101  // get size of this mesh
102  G4ThreeVector GetSize() const;
103  // set position of center of this mesh
104  void SetCenterPosition(G4double centerPosition[3]);
105  // get position of center of this mesh
107  // set a rotation angle around the x axis
108  void RotateX(G4double delta);
109  // set a rotation angle around the y axis
110  void RotateY(G4double delta);
111  // set a rotation angle around the z axis
112  void RotateZ(G4double delta);
113  // get a rotation matrix
115  if(fRotationMatrix) return *fRotationMatrix;
116  else return G4RotationMatrix::IDENTITY;
117  }
118  // set number of segments of this mesh
119  void SetNumberOfSegments(G4int nSegment[3]);
120  // get number of segments of this mesh
121  void GetNumberOfSegments(G4int nSegment[3]);
122 
123  // register a primitive scorer to the MFD & set it to the current primitive scorer
125  // register a filter to a current primtive scorer
126  void SetFilter(G4VSDFilter * filter);
127  // set a primitive scorer to the current one by the name
129  // find registered primitive scorer by the name
130  G4bool FindPrimitiveScorer(const G4String & psname);
131  // get whether current primitive scorer is set or not
133  if(fCurrentPS == NULL) return true;
134  else return false;
135  }
136  // get unit of primitive scorer by the name
137  G4String GetPSUnit(const G4String & psname);
138  // get unit of current primitive scorer
140  // set unit of current primitive scorer
141  void SetCurrentPSUnit(const G4String& unit);
142  // get unit value of primitive scorer by the name
143  G4double GetPSUnitValue(const G4String & psname);
144  // set PS name to be drawn
145  void SetDrawPSName(const G4String & psname) {fDrawPSName = psname;}
146 
147  // get axis names of the hierarchical division in the divided order
148  void GetDivisionAxisNames(G4String divisionAxisNames[3]);
149 
150  // set current primitive scorer to NULL
152  // set verbose level
153  inline void SetVerboseLevel(G4int vl)
154  { verboseLevel = vl; }
155  // get the primitive scorer map
156  inline MeshScoreMap GetScoreMap() const
157  { return fMap; }
158  // get whether this mesh setup has been ready
159  inline G4bool ReadyForQuantity() const
160  { return (sizeIsSet && nMeshIsSet); }
161 
162 protected:
163  // get registered primitive socrer by the name
165 
166 protected:
172 
177 
178  std::map<G4String, G4THitsMap<G4double>* > fMap;
180 
182 
185 
189 
191 
193 
194 public:
196  { fMeshElementLogical = val; }
198  { return fMeshElementLogical; }
199 };
200 
201 #endif
202 
void GetNumberOfSegments(G4int nSegment[3])
pid_t filter
Definition: tracer.cxx:30
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)
G4ThreeVector fCenterPosition
void Merge(const G4VScoringMesh *scMesh)
G4bool FindPrimitiveScorer(const G4String &psname)
std::map< G4String, G4THitsMap< G4double > * > MeshScoreMap
void RotateY(G4double delta)
G4VPrimitiveScorer * GetPrimitiveScorer(const G4String &name)
void SetPrimitiveScorer(G4VPrimitiveScorer *ps)
void SetMeshElementLogical(G4LogicalVolume *val)
void SetCurrentPrimitiveScorer(const G4String &name)
G4MultiFunctionalDetector * fMFD
void SetSize(G4double size[3])
G4double GetPSUnitValue(const G4String &psname)
void Accumulate(G4THitsMap< G4double > *map)
void RotateX(G4double delta)
const XML_Char * name
Definition: expat.h:151
virtual void Construct(G4VPhysicalVolume *fWorldPhys)=0
G4double fSize[3]
void SetFilter(G4VSDFilter *filter)
virtual void WorkerConstruct(G4VPhysicalVolume *fWorldPhys)
G4ThreeVector GetSize() const
G4String GetPSUnit(const G4String &psname)
int G4int
Definition: G4Types.hh:78
void SetNullToCurrentPrimitiveScorer()
G4bool IsCurrentPrimitiveScorerNull()
static DLL_API const HepRotation IDENTITY
Definition: Rotation.h:369
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
void SetCurrentPSUnit(const G4String &unit)
virtual ~G4VScoringMesh()
void RotateZ(G4double delta)
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])
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