File indexing completed on 2025-09-18 09:16:08
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
0030
0031
0032
0033
0034
0035
0036 #ifndef G4VScoringMesh_h
0037 #define G4VScoringMesh_h 1
0038
0039 #include "globals.hh"
0040 #include "G4THitsMap.hh"
0041 #include "G4RotationMatrix.hh"
0042 #include "G4StatDouble.hh"
0043
0044 #include <map>
0045
0046 class G4VPhysicalVolume;
0047 class G4LogicalVolume;
0048 class G4MultiFunctionalDetector;
0049 class G4VPrimitiveScorer;
0050 class G4VSDFilter;
0051 class G4VScoreColorMap;
0052 class G4ParallelWorldProcess;
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
0072 G4VScoringMesh(const G4String& wName);
0073 virtual ~G4VScoringMesh() = default;
0074
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 inline 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 inline 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 inline 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 inline G4bool LayeredMassFlg() { return layeredMassFlg; }
0217
0218 protected:
0219
0220
0221 virtual void SetupGeometry(G4VPhysicalVolume* fWorldPhys) = 0;
0222
0223 protected:
0224
0225 G4String fWorldName;
0226 G4VPrimitiveScorer* fCurrentPS;
0227 G4bool fConstructed;
0228 G4bool fActive;
0229 MeshShape fShape;
0230
0231 G4double fSize[3];
0232 G4double fAngle[2];
0233 G4ThreeVector fCenterPosition;
0234 G4RotationMatrix* fRotationMatrix;
0235 G4int fNSegment[3];
0236
0237 MeshScoreMap fMap;
0238 G4MultiFunctionalDetector* fMFD;
0239
0240 G4int verboseLevel;
0241
0242 G4bool sizeIsSet;
0243 G4bool nMeshIsSet;
0244
0245 G4String fDrawUnit;
0246 G4double fDrawUnitValue;
0247 G4String fDrawPSName;
0248
0249 G4String fDivisionAxisNames[3];
0250
0251 G4LogicalVolume* fMeshElementLogical;
0252
0253 G4ParallelWorldProcess* fParallelWorldProcess;
0254 G4bool fGeometryHasBeenDestroyed;
0255
0256 G4int copyNumberLevel;
0257
0258
0259
0260
0261 G4bool layeredMassFlg;
0262 };
0263
0264 #endif