00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef G4VScoringMesh_h
00031 #define G4VScoringMesh_h 1
00032
00033 #include "globals.hh"
00034 #include "G4THitsMap.hh"
00035 #include "G4RotationMatrix.hh"
00036
00037 class G4VPhysicalVolume;
00038 class G4MultiFunctionalDetector;
00039 class G4VPrimitiveScorer;
00040 class G4VSDFilter;
00041 class G4VScoreColorMap;
00042
00043 #include <map>
00044
00045 enum MeshShape { boxMesh, cylinderMesh, sphereMesh };
00046 typedef std::map<G4String,G4THitsMap<G4double>* > MeshScoreMap;
00047
00048
00049
00050
00051
00052 class G4VScoringMesh
00053 {
00054 public:
00055 G4VScoringMesh(const G4String& wName);
00056 virtual ~G4VScoringMesh();
00057
00058 public:
00059
00060 virtual void Construct(G4VPhysicalVolume* fWorldPhys)=0;
00061
00062 virtual void List() const;
00063
00064 public:
00065
00066 inline const G4String& GetWorldName() const
00067 { return fWorldName; }
00068
00069 inline G4bool IsActive() const
00070 { return fActive; }
00071
00072 inline void Activate(G4bool vl = true)
00073 { fActive = vl; }
00074
00075 inline MeshShape GetShape() const
00076 { return fShape; }
00077
00078 inline void Accumulate(G4THitsMap<G4double> * map);
00079
00080 void Dump();
00081
00082 void DrawMesh(const G4String& psName,G4VScoreColorMap* colorMap,G4int axflg=111);
00083
00084 void DrawMesh(const G4String& psName,G4int idxPlane,G4int iColumn,G4VScoreColorMap* colorMap);
00085
00086 virtual void Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg=111) = 0;
00087
00088 virtual void DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
00089 G4int idxProj, G4int idxColumn) = 0;
00090
00091 void ResetScore();
00092
00093
00094 void SetSize(G4double size[3]);
00095
00096 G4ThreeVector GetSize() const;
00097
00098 void SetCenterPosition(G4double centerPosition[3]);
00099
00100 G4ThreeVector GetTranslation() const {return fCenterPosition;}
00101
00102 void RotateX(G4double delta);
00103
00104 void RotateY(G4double delta);
00105
00106 void RotateZ(G4double delta);
00107
00108 G4RotationMatrix GetRotationMatrix() const {
00109 if(fRotationMatrix) return *fRotationMatrix;
00110 else return G4RotationMatrix::IDENTITY;
00111 }
00112
00113 void SetNumberOfSegments(G4int nSegment[3]);
00114
00115 void GetNumberOfSegments(G4int nSegment[3]);
00116
00117
00118 void SetPrimitiveScorer(G4VPrimitiveScorer * ps);
00119
00120 void SetFilter(G4VSDFilter * filter);
00121
00122 void SetCurrentPrimitiveScorer(const G4String & name);
00123
00124 G4bool FindPrimitiveScorer(const G4String & psname);
00125
00126 G4bool IsCurrentPrimitiveScorerNull() {
00127 if(fCurrentPS == NULL) return true;
00128 else return false;
00129 }
00130
00131 G4String GetPSUnit(const G4String & psname);
00132
00133 G4String GetCurrentPSUnit();
00134
00135 void SetCurrentPSUnit(const G4String& unit);
00136
00137 G4double GetPSUnitValue(const G4String & psname);
00138
00139 void SetDrawPSName(const G4String & psname) {fDrawPSName = psname;}
00140
00141
00142 void GetDivisionAxisNames(G4String divisionAxisNames[3]);
00143
00144
00145 void SetNullToCurrentPrimitiveScorer() {fCurrentPS = NULL;}
00146
00147 inline void SetVerboseLevel(G4int vl)
00148 { verboseLevel = vl; }
00149
00150 MeshScoreMap GetScoreMap() {return fMap;}
00151
00152 inline G4bool ReadyForQuantity() const
00153 { return (sizeIsSet && nMeshIsSet); }
00154
00155 protected:
00156
00157 G4VPrimitiveScorer * GetPrimitiveScorer(const G4String & name);
00158
00159 protected:
00160 G4String fWorldName;
00161 G4VPrimitiveScorer * fCurrentPS;
00162 G4bool fConstructed;
00163 G4bool fActive;
00164 MeshShape fShape;
00165
00166 G4double fSize[3];
00167 G4ThreeVector fCenterPosition;
00168 G4RotationMatrix * fRotationMatrix;
00169 G4int fNSegment[3];
00170
00171 std::map<G4String, G4THitsMap<G4double>* > fMap;
00172 G4MultiFunctionalDetector * fMFD;
00173
00174 G4int verboseLevel;
00175
00176 G4bool sizeIsSet;
00177 G4bool nMeshIsSet;
00178
00179 G4String fDrawUnit;
00180 G4double fDrawUnitValue;
00181 G4String fDrawPSName;
00182
00183 G4String fDivisionAxisNames[3];
00184 };
00185
00186 void G4VScoringMesh::Accumulate(G4THitsMap<G4double> * map)
00187 {
00188 G4String psName = map->GetName();
00189 std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
00190 *(fMapItr->second) += *map;
00191
00192 if(verboseLevel > 9) {
00193 G4cout << G4endl;
00194 G4cout << "G4VScoringMesh::Accumulate()" << G4endl;
00195 G4cout << " PS name : " << psName << G4endl;
00196 if(fMapItr == fMap.end()) {
00197 G4cout << " "
00198 << psName << " was not found." << G4endl;
00199 } else {
00200 G4cout << " map size : " << map->GetSize() << G4endl;
00201 map->PrintAllHits();
00202 }
00203 G4cout << G4endl;
00204 }
00205 }
00206
00207 #endif
00208