File indexing completed on 2025-01-18 09:59:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef G4VScoringMesh_h
0030 #define G4VScoringMesh_h 1
0031
0032 #include "globals.hh"
0033 #include "G4THitsMap.hh"
0034 #include "G4RotationMatrix.hh"
0035 #include "G4StatDouble.hh"
0036
0037 class G4VPhysicalVolume;
0038 class G4LogicalVolume;
0039 class G4MultiFunctionalDetector;
0040 class G4VPrimitiveScorer;
0041 class G4VSDFilter;
0042 class G4VScoreColorMap;
0043 class G4ParallelWorldProcess;
0044
0045 #include <map>
0046
0047
0048
0049
0050
0051
0052
0053
0054 class G4VScoringMesh
0055 {
0056 public:
0057 enum class MeshShape
0058 {
0059 box,
0060 cylinder,
0061 sphere,
0062 realWorldLogVol,
0063 probe,
0064 undefined = -1
0065 };
0066 using EventScore = G4THitsMap<G4double>;
0067 using RunScore = G4THitsMap<G4StatDouble>;
0068 using MeshScoreMap = std::map<G4String, RunScore*>;
0069
0070 public:
0071 G4VScoringMesh(const G4String& wName);
0072 virtual ~G4VScoringMesh() = default;
0073
0074 public:
0075 virtual void Construct(G4VPhysicalVolume* fWorldPhys);
0076 virtual void WorkerConstruct(G4VPhysicalVolume* fWorldPhys);
0077
0078
0079 virtual void List() const;
0080
0081
0082
0083
0084
0085 inline const G4String& GetWorldName() const { return fWorldName; }
0086
0087 inline G4bool IsActive() const { return fActive; }
0088
0089 inline void Activate(G4bool vl = true) { fActive = vl; }
0090
0091 inline MeshShape GetShape() const { return fShape; }
0092
0093 void Accumulate(G4THitsMap<G4double>* map);
0094 void Accumulate(G4THitsMap<G4StatDouble>* map);
0095
0096 void Merge(const G4VScoringMesh* scMesh);
0097
0098 void Dump();
0099
0100 void DrawMesh(const G4String& psName, G4VScoreColorMap* colorMap,
0101 G4int axflg = 111);
0102
0103 void DrawMesh(const G4String& psName, G4int idxPlane, G4int iColumn,
0104 G4VScoreColorMap* colorMap);
0105
0106 virtual void Draw(RunScore* map, G4VScoreColorMap* colorMap,
0107 G4int axflg = 111) = 0;
0108
0109 virtual void DrawColumn(RunScore* map, G4VScoreColorMap* colorMap,
0110 G4int idxProj, G4int idxColumn) = 0;
0111
0112 void ResetScore();
0113
0114
0115
0116 void SetSize(G4double size[3]);
0117
0118 G4ThreeVector GetSize() const;
0119
0120 void SetAngles(G4double, G4double);
0121
0122 inline G4double GetStartAngle() const { return fAngle[0]; }
0123 inline G4double GetAngleSpan() const { return fAngle[1]; }
0124
0125 void SetCenterPosition(G4double centerPosition[3]);
0126
0127 G4ThreeVector GetTranslation() const { return fCenterPosition; }
0128
0129 void RotateX(G4double delta);
0130
0131 void RotateY(G4double delta);
0132
0133 void RotateZ(G4double delta);
0134
0135 G4RotationMatrix GetRotationMatrix() const
0136 {
0137 if(fRotationMatrix != nullptr)
0138 return *fRotationMatrix;
0139 return G4RotationMatrix::IDENTITY;
0140 }
0141
0142
0143 void SetNumberOfSegments(G4int nSegment[3]);
0144
0145 void GetNumberOfSegments(G4int nSegment[3]);
0146
0147
0148
0149 void SetPrimitiveScorer(G4VPrimitiveScorer* ps);
0150
0151 void SetFilter(G4VSDFilter* filter);
0152
0153 void SetCurrentPrimitiveScorer(const G4String& name);
0154
0155 G4bool FindPrimitiveScorer(const G4String& psname);
0156
0157 G4bool IsCurrentPrimitiveScorerNull()
0158 {
0159 return fCurrentPS == nullptr;
0160 }
0161
0162 G4String GetPSUnit(const G4String& psname);
0163
0164 G4String GetCurrentPSUnit();
0165
0166 void SetCurrentPSUnit(const G4String& unit);
0167
0168 G4double GetPSUnitValue(const G4String& psname);
0169
0170 void SetDrawPSName(const G4String& psname) { fDrawPSName = psname; }
0171
0172
0173 void GetDivisionAxisNames(G4String divisionAxisNames[3]);
0174
0175
0176 void SetNullToCurrentPrimitiveScorer() { fCurrentPS = nullptr; }
0177
0178 inline void SetVerboseLevel(G4int vl) { verboseLevel = vl; }
0179
0180 inline MeshScoreMap GetScoreMap() const { return fMap; }
0181
0182 inline G4bool ReadyForQuantity() const { return (sizeIsSet && nMeshIsSet); }
0183
0184
0185
0186 G4VPrimitiveScorer* GetPrimitiveScorer(const G4String& name);
0187
0188 inline void SetMeshElementLogical(G4LogicalVolume* val)
0189 {
0190 fMeshElementLogical = val;
0191 }
0192 inline G4LogicalVolume* GetMeshElementLogical() const
0193 {
0194 return fMeshElementLogical;
0195 }
0196
0197 inline void SetParallelWorldProcess(G4ParallelWorldProcess* proc)
0198 {
0199 fParallelWorldProcess = proc;
0200 }
0201 inline G4ParallelWorldProcess* GetParallelWorldProcess() const
0202 {
0203 return fParallelWorldProcess;
0204 }
0205 inline void GeometryHasBeenDestroyed()
0206 {
0207 fGeometryHasBeenDestroyed = true;
0208 fMeshElementLogical = nullptr;
0209 }
0210
0211
0212
0213 inline void SetCopyNumberLevel(G4int val) { copyNumberLevel = val; }
0214 inline G4int GetCopyNumberLevel() const { return copyNumberLevel; }
0215
0216 G4bool LayeredMassFlg() { return layeredMassFlg; }
0217
0218 protected:
0219
0220 virtual void SetupGeometry(G4VPhysicalVolume* fWorldPhys) = 0;
0221
0222 protected:
0223 G4String fWorldName;
0224 G4VPrimitiveScorer* fCurrentPS;
0225 G4bool fConstructed;
0226 G4bool fActive;
0227 MeshShape fShape;
0228
0229 G4double fSize[3];
0230 G4double fAngle[2];
0231 G4ThreeVector fCenterPosition;
0232 G4RotationMatrix* fRotationMatrix;
0233 G4int fNSegment[3];
0234
0235 MeshScoreMap fMap;
0236 G4MultiFunctionalDetector* fMFD;
0237
0238 G4int verboseLevel;
0239
0240 G4bool sizeIsSet;
0241 G4bool nMeshIsSet;
0242
0243 G4String fDrawUnit;
0244 G4double fDrawUnitValue;
0245 G4String fDrawPSName;
0246
0247 G4String fDivisionAxisNames[3];
0248
0249 G4LogicalVolume* fMeshElementLogical;
0250
0251 G4ParallelWorldProcess* fParallelWorldProcess;
0252 G4bool fGeometryHasBeenDestroyed;
0253
0254 G4int copyNumberLevel;
0255
0256
0257
0258
0259 G4bool layeredMassFlg;
0260 };
0261
0262 #endif