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 G4ScoringManager_h
00031 #define G4ScoringManager_h 1
00032
00033 #include "globals.hh"
00034 #include "G4VScoringMesh.hh"
00035 #include <vector>
00036 #include <map>
00037 class G4ScoringMessenger;
00038 class G4ScoreQuantityMessenger;
00039 class G4VHitsCollection;
00040 class G4VScoreColorMap;
00041 #include "G4VScoreWriter.hh"
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 typedef std::vector<G4VScoringMesh*> MeshVec;
00053 typedef std::vector<G4VScoringMesh*>::iterator MeshVecItr;
00054 typedef std::vector<G4VScoringMesh*>::const_iterator MeshVecConstItr;
00055 typedef std::map<G4String,G4VScoreColorMap*> ColorMapDict;
00056 typedef std::map<G4String,G4VScoreColorMap*>::iterator ColorMapDictItr;
00057 typedef std::map<G4String,G4VScoreColorMap*>::const_iterator ColorMapDictConstItr;
00058
00059
00060 class G4ScoringManager
00061 {
00062 public:
00063 static G4ScoringManager* GetScoringManager();
00064
00065 public:
00066 static G4ScoringManager* GetScoringManagerIfExist();
00067
00068 public:
00069 static void SetReplicaLevel(G4int);
00070 static G4int GetReplicaLevel();
00071
00072 protected:
00073 G4ScoringManager();
00074
00075 public:
00076 ~G4ScoringManager();
00077
00078 public:
00079 void RegisterScoreColorMap(G4VScoreColorMap* colorMap);
00080
00081
00082
00083 public:
00084 void Accumulate(G4VHitsCollection* map);
00085 G4VScoringMesh* FindMesh(const G4String&);
00086 void List() const;
00087 void Dump() const;
00088 void DrawMesh(const G4String& meshName, const G4String& psName,
00089 const G4String& colorMapName, G4int axflg=111);
00090 void DrawMesh(const G4String& meshName, const G4String& psName,
00091 G4int idxPlane, G4int iColumn, const G4String& colorMapName);
00092 void DumpQuantityToFile(const G4String& meshName, const G4String& psName,
00093 const G4String& fileName, const G4String& option = "");
00094 void DumpAllQuantitiesToFile(const G4String& meshName,
00095 const G4String& fileName,
00096 const G4String& option = "");
00097 G4VScoreColorMap* GetScoreColorMap(const G4String& mapName);
00098 void ListScoreColorMaps();
00099
00100 private:
00101 static G4ScoringManager * fSManager;
00102 static G4int replicaLevel;
00103 G4int verboseLevel;
00104 G4ScoringMessenger* fMessenger;
00105 G4ScoreQuantityMessenger* fQuantityMessenger;
00106
00107 MeshVec fMeshVec;
00108 G4VScoringMesh* fCurrentMesh;
00109
00110 G4VScoreWriter * writer;
00111 G4VScoreColorMap * fDefaultLinearColorMap;
00112 ColorMapDict * fColorMapDict;
00113
00114 public:
00115 inline void SetCurrentMesh(G4VScoringMesh* scm)
00116 { fCurrentMesh = scm; }
00117 inline G4VScoringMesh* GetCurrentMesh() const
00118 { return fCurrentMesh; }
00119 inline void CloseCurrentMesh()
00120 { fCurrentMesh = 0; }
00121 inline void SetVerboseLevel(G4int vl)
00122 {
00123 verboseLevel = vl;
00124 for(MeshVecItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
00125 (*itr)->SetVerboseLevel(vl);
00126 }
00127 if(writer) writer->SetVerboseLevel(vl);
00128 }
00129 inline G4int GetVerboseLevel() const
00130 { return verboseLevel; }
00131 inline size_t GetNumberOfMesh() const
00132 { return fMeshVec.size(); }
00133 inline void RegisterScoringMesh(G4VScoringMesh * scm)
00134 {
00135 scm->SetVerboseLevel(verboseLevel);
00136 fMeshVec.push_back(scm);
00137 SetCurrentMesh(scm);
00138 }
00139 inline G4VScoringMesh* GetMesh(G4int i) const
00140 { return fMeshVec[i]; }
00141 inline G4String GetWorldName(G4int i) const
00142 { return fMeshVec[i]->GetWorldName(); }
00143
00144 public:
00145 inline void SetScoreWriter(G4VScoreWriter * sw)
00146 {
00147 if(writer) { delete writer; }
00148 writer = sw;
00149 if(writer) writer->SetVerboseLevel(verboseLevel);
00150 }
00151
00152 };
00153
00154
00155
00156
00157 #endif
00158