Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // G4VScoringMesh 27 // 28 // Class description: 29 // 30 // This class represents a multi-functional de 31 // command-based scorer for parallel world sco 32 // parallel world mesh geometry 33 // 34 // Author: Makoto Asai 35 // ------------------------------------------- 36 #ifndef G4VScoringMesh_h 37 #define G4VScoringMesh_h 1 38 39 #include "globals.hh" 40 #include "G4THitsMap.hh" 41 #include "G4RotationMatrix.hh" 42 #include "G4StatDouble.hh" 43 44 #include <map> 45 46 class G4VPhysicalVolume; 47 class G4LogicalVolume; 48 class G4MultiFunctionalDetector; 49 class G4VPrimitiveScorer; 50 class G4VSDFilter; 51 class G4VScoreColorMap; 52 class G4ParallelWorldProcess; 53 54 class G4VScoringMesh 55 { 56 public: 57 enum class MeshShape 58 { 59 box, 60 cylinder, 61 sphere, 62 realWorldLogVol, 63 probe, 64 undefined = -1 65 }; 66 using EventScore = G4THitsMap<G4double>; 67 using RunScore = G4THitsMap<G4StatDouble 68 using MeshScoreMap = std::map<G4String, RunS 69 70 public: 71 72 G4VScoringMesh(const G4String& wName); 73 virtual ~G4VScoringMesh() = default; 74 75 virtual void Construct(G4VPhysicalVolume* fW 76 virtual void WorkerConstruct(G4VPhysicalVolu 77 78 // list infomration of this mesh 79 virtual void List() const; 80 81 // get the world name 82 // If this ScoringMesh is for parallel world 83 // parallel world If this ScoringMesh is for 84 // returns name of logical volume 85 inline const G4String& GetWorldName() const 86 // get whether this mesh is active or not 87 inline G4bool IsActive() const { return fAct 88 // set an activity of this mesh 89 inline void Activate(G4bool vl = true) { fAc 90 // get the shape of this mesh 91 inline MeshShape GetShape() const { return f 92 // accumulate hits in a registered primitive 93 void Accumulate(G4THitsMap<G4double>* map); 94 void Accumulate(G4THitsMap<G4StatDouble>* ma 95 // merge same kind of meshes 96 void Merge(const G4VScoringMesh* scMesh); 97 // dump information of primitive socrers reg 98 void Dump(); 99 // draw a projected quantity on a current vi 100 void DrawMesh(const G4String& psName, G4VSco 101 G4int axflg = 111); 102 // draw a column of a quantity on a current 103 void DrawMesh(const G4String& psName, G4int 104 G4VScoreColorMap* colorMap); 105 // draw a projected quantity on a current vi 106 virtual void Draw(RunScore* map, G4VScoreCol 107 G4int axflg = 111) = 0; 108 // draw a column of a quantity on a current 109 virtual void DrawColumn(RunScore* map, G4VSc 110 G4int idxProj, G4int 111 // reset registered primitive scorers 112 void ResetScore(); 113 114 // Following set/get methods make sense only 115 // set size of this mesh 116 void SetSize(G4double size[3]); 117 // get size of this mesh 118 G4ThreeVector GetSize() const; 119 // set starting and span angles (used only f 120 void SetAngles(G4double, G4double); 121 // get angles (used only for tube segment) 122 inline G4double GetStartAngle() const { retu 123 inline G4double GetAngleSpan() const { retur 124 // set position of center of this mesh 125 void SetCenterPosition(G4double centerPositi 126 // get position of center of this mesh 127 G4ThreeVector GetTranslation() const { retur 128 // set a rotation angle around the x axis 129 void RotateX(G4double delta); 130 // set a rotation angle around the y axis 131 void RotateY(G4double delta); 132 // set a rotation angle around the z axis 133 void RotateZ(G4double delta); 134 // get a rotation matrix 135 inline G4RotationMatrix GetRotationMatrix() 136 { 137 if(fRotationMatrix != nullptr) 138 return *fRotationMatrix; 139 return G4RotationMatrix::IDENTITY; 140 } 141 142 // set number of segments of this mesh 143 void SetNumberOfSegments(G4int nSegment[3]); 144 // get number of segments of this mesh 145 void GetNumberOfSegments(G4int nSegment[3]); 146 147 // register a primitive scorer to the MFD & 148 // scorer 149 void SetPrimitiveScorer(G4VPrimitiveScorer* 150 // register a filter to a current primtive s 151 void SetFilter(G4VSDFilter* filter); 152 // set a primitive scorer to the current one 153 void SetCurrentPrimitiveScorer(const G4Strin 154 // find registered primitive scorer by the n 155 G4bool FindPrimitiveScorer(const G4String& p 156 // get whether current primitive scorer is s 157 inline G4bool IsCurrentPrimitiveScorerNull() 158 { 159 return fCurrentPS == nullptr; 160 } 161 // get unit of primitive scorer by the name 162 G4String GetPSUnit(const G4String& psname); 163 // get unit of current primitive scorer 164 G4String GetCurrentPSUnit(); 165 // set unit of current primitive scorer 166 void SetCurrentPSUnit(const G4String& unit); 167 // get unit value of primitive scorer by the 168 G4double GetPSUnitValue(const G4String& psna 169 // set PS name to be drawn 170 inline void SetDrawPSName(const G4String& ps 171 172 // get axis names of the hierarchical divisi 173 void GetDivisionAxisNames(G4String divisionA 174 175 // set current primitive scorer to NULL 176 void SetNullToCurrentPrimitiveScorer() { fCu 177 // set verbose level 178 inline void SetVerboseLevel(G4int vl) { verb 179 // get the primitive scorer map 180 inline MeshScoreMap GetScoreMap() const { re 181 // get whether this mesh setup has been read 182 inline G4bool ReadyForQuantity() const { ret 183 184 // protected: 185 // get registered primitive socrer by the na 186 G4VPrimitiveScorer* GetPrimitiveScorer(const 187 188 inline void SetMeshElementLogical(G4LogicalV 189 { 190 fMeshElementLogical = val; 191 } 192 inline G4LogicalVolume* GetMeshElementLogica 193 { 194 return fMeshElementLogical; 195 } 196 197 inline void SetParallelWorldProcess(G4Parall 198 { 199 fParallelWorldProcess = proc; 200 } 201 inline G4ParallelWorldProcess* GetParallelWo 202 { 203 return fParallelWorldProcess; 204 } 205 inline void GeometryHasBeenDestroyed() 206 { 207 fGeometryHasBeenDestroyed = true; 208 fMeshElementLogical = nullptr; 209 } 210 211 // Geometry hirarchy level (bottom = 0) to b 212 // This is used only for real-world scorer 213 inline void SetCopyNumberLevel(G4int val) { 214 inline G4int GetCopyNumberLevel() const { re 215 216 inline G4bool LayeredMassFlg() { return laye 217 218 protected: 219 220 // a pure virtual function to construct this 221 virtual void SetupGeometry(G4VPhysicalVolume 222 223 protected: 224 225 G4String fWorldName; 226 G4VPrimitiveScorer* fCurrentPS; 227 G4bool fConstructed; 228 G4bool fActive; 229 MeshShape fShape; 230 231 G4double fSize[3]; 232 G4double fAngle[2]; 233 G4ThreeVector fCenterPosition; 234 G4RotationMatrix* fRotationMatrix; 235 G4int fNSegment[3]; 236 237 MeshScoreMap fMap; 238 G4MultiFunctionalDetector* fMFD; 239 240 G4int verboseLevel; 241 242 G4bool sizeIsSet; 243 G4bool nMeshIsSet; 244 245 G4String fDrawUnit; 246 G4double fDrawUnitValue; 247 G4String fDrawPSName; 248 249 G4String fDivisionAxisNames[3]; 250 251 G4LogicalVolume* fMeshElementLogical; 252 253 G4ParallelWorldProcess* fParallelWorldProces 254 G4bool fGeometryHasBeenDestroyed; 255 256 G4int copyNumberLevel; 257 258 // This flag may be set to true for Probe sc 259 // There is no public set method for this bo 260 // to true through SetMaterial() method of P 261 G4bool layeredMassFlg; 262 }; 263 264 #endif 265