Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ScoringManager Class Reference

#include <G4ScoringManager.hh>

Public Member Functions

 ~G4ScoringManager ()
 
void RegisterScoreColorMap (G4VScoreColorMap *colorMap)
 
void Accumulate (G4VHitsCollection *map)
 
void Merge (const G4ScoringManager *scMan)
 
G4VScoringMeshFindMesh (G4VHitsCollection *map)
 
G4VScoringMeshFindMesh (const G4String &)
 
void List () const
 
void Dump () const
 
void DrawMesh (const G4String &meshName, const G4String &psName, const G4String &colorMapName, G4int axflg=111)
 
void DrawMesh (const G4String &meshName, const G4String &psName, G4int idxPlane, G4int iColumn, const G4String &colorMapName)
 
void DumpQuantityToFile (const G4String &meshName, const G4String &psName, const G4String &fileName, const G4String &option="")
 
void DumpAllQuantitiesToFile (const G4String &meshName, const G4String &fileName, const G4String &option="")
 
G4VScoreColorMapGetScoreColorMap (const G4String &mapName)
 
void ListScoreColorMaps ()
 
void SetCurrentMesh (G4VScoringMesh *scm)
 
G4VScoringMeshGetCurrentMesh () const
 
void CloseCurrentMesh ()
 
void SetVerboseLevel (G4int vl)
 
G4int GetVerboseLevel () const
 
size_t GetNumberOfMesh () const
 
void RegisterScoringMesh (G4VScoringMesh *scm)
 
G4VScoringMeshGetMesh (G4int i) const
 
G4String GetWorldName (G4int i) const
 
void SetScoreWriter (G4VScoreWriter *sw)
 

Static Public Member Functions

static G4ScoringManagerGetScoringManager ()
 
static G4ScoringManagerGetScoringManagerIfExist ()
 
static void SetReplicaLevel (G4int)
 
static G4int GetReplicaLevel ()
 

Protected Member Functions

 G4ScoringManager ()
 

Detailed Description

Definition at line 62 of file G4ScoringManager.hh.

Constructor & Destructor Documentation

G4ScoringManager::G4ScoringManager ( )
protected

Definition at line 55 of file G4ScoringManager.cc.

56  : verboseLevel(0),fCurrentMesh(nullptr)
57 {
58  fMessenger = new G4ScoringMessenger(this);
59  fQuantityMessenger = new G4ScoreQuantityMessenger(this);
60  fColorMapDict = new ColorMapDict();
61  fDefaultLinearColorMap = new G4DefaultLinearColorMap("defaultLinearColorMap");
62  (*fColorMapDict)[fDefaultLinearColorMap->GetName()] = fDefaultLinearColorMap;
63  G4VScoreColorMap * logColorMap = new G4ScoreLogColorMap("logColorMap");
64  (*fColorMapDict)[logColorMap->GetName()] = logColorMap;
65  writer = new G4VScoreWriter();
66 }
G4String GetName() const
std::map< G4String, G4VScoreColorMap * > ColorMapDict

Here is the call graph for this function:

Here is the caller graph for this function:

G4ScoringManager::~G4ScoringManager ( )

Definition at line 68 of file G4ScoringManager.cc.

69 {
70  if (writer) { delete writer; }
71  delete fDefaultLinearColorMap;
72  delete fColorMapDict;
73  delete fQuantityMessenger;
74  delete fMessenger;
75  fSManager = nullptr;
76 }

Member Function Documentation

void G4ScoringManager::Accumulate ( G4VHitsCollection map)

Definition at line 83 of file G4ScoringManager.cc.

84 {
85  auto sm = FindMesh(map);
86  if(!sm) return;
87  if(verboseLevel>9)
88  { G4cout << "G4ScoringManager::Accumulate() for " << map->GetSDname() << " / " << map->GetName() << G4endl;
89  G4cout << " is calling G4VScoringMesh::Accumulate() of " << sm->GetWorldName() << G4endl; }
90  sm->Accumulate(static_cast<G4THitsMap<double>*>(map));
91 }
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ScoringManager::CloseCurrentMesh ( )
inline

Definition at line 124 of file G4ScoringManager.hh.

125  { fCurrentMesh = 0; }

Here is the caller graph for this function:

void G4ScoringManager::DrawMesh ( const G4String meshName,
const G4String psName,
const G4String colorMapName,
G4int  axflg = 111 
)

Definition at line 130 of file G4ScoringManager.cc.

133 {
134  G4VScoringMesh* mesh = FindMesh(meshName);
135  if(mesh)
136  {
137  G4VScoreColorMap* colorMap = GetScoreColorMap(colorMapName);
138  if(!colorMap)
139  {
140  G4cerr << "WARNING : Score color map <" << colorMapName << "> is not found. Default linear color map is used." << G4endl;
141  colorMap = fDefaultLinearColorMap;
142  }
143  mesh->DrawMesh(psName,colorMap,axflg);
144  } else {
145  G4cerr << "ERROR : G4ScoringManager::DrawMesh() --- <"
146  << meshName << "> is not found. Nothing is done." << G4endl;
147  }
148 }
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ScoringManager::DrawMesh ( const G4String meshName,
const G4String psName,
G4int  idxPlane,
G4int  iColumn,
const G4String colorMapName 
)

Definition at line 150 of file G4ScoringManager.cc.

154 {
155  G4VScoringMesh* mesh = FindMesh(meshName);
156  if(mesh)
157  {
158  G4VScoreColorMap* colorMap = GetScoreColorMap(colorMapName);
159  if(!colorMap)
160  {
161  G4cerr << "WARNING : Score color map <" << colorMapName << "> is not found. Default linear color map is used." << G4endl;
162  colorMap = fDefaultLinearColorMap;
163  }
164  mesh->DrawMesh(psName,idxPlane,iColumn,colorMap);
165  } else {
166  G4cerr << "ERROR : G4ScoringManager::DrawMesh() --- <"
167  << meshName << "> is not found. Nothing is done." << G4endl;
168  }
169 }
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

void G4ScoringManager::Dump ( ) const

Definition at line 125 of file G4ScoringManager.cc.

126 {
127  for(auto msh : fMeshVec) msh->Dump();
128 }

Here is the caller graph for this function:

void G4ScoringManager::DumpAllQuantitiesToFile ( const G4String meshName,
const G4String fileName,
const G4String option = "" 
)

Definition at line 186 of file G4ScoringManager.cc.

189 {
190  G4VScoringMesh* mesh = FindMesh(meshName);
191  if(mesh) {
192  writer->SetScoringMesh(mesh);
193  writer->DumpAllQuantitiesToFile(fileName, option);
194  } else {
195  G4cerr << "ERROR : G4ScoringManager::DrawAllQuantitiesToFile() --- <"
196  << meshName << "> is not found. Nothing is done." << G4endl;
197  }
198 }
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
virtual void DumpAllQuantitiesToFile(const G4String &fileName, const G4String &option)
void SetScoringMesh(G4VScoringMesh *sm)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ScoringManager::DumpQuantityToFile ( const G4String meshName,
const G4String psName,
const G4String fileName,
const G4String option = "" 
)

Definition at line 171 of file G4ScoringManager.cc.

175 {
176  G4VScoringMesh* mesh = FindMesh(meshName);
177  if(mesh) {
178  writer->SetScoringMesh(mesh);
179  writer->DumpQuantityToFile(psName, fileName, option);
180  } else {
181  G4cerr << "ERROR : G4ScoringManager::DrawQuantityToFile() --- <"
182  << meshName << "> is not found. Nothing is done." << G4endl;
183  }
184 }
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
void SetScoringMesh(G4VScoringMesh *sm)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
virtual void DumpQuantityToFile(const G4String &psName, const G4String &fileName, const G4String &option)

Here is the call graph for this function:

Here is the caller graph for this function:

G4VScoringMesh * G4ScoringManager::FindMesh ( G4VHitsCollection map)

Definition at line 93 of file G4ScoringManager.cc.

94 {
95  auto colID = map->GetColID();
96  G4VScoringMesh* sm = nullptr;
97  auto msh = fMeshMap.find(colID);
98  if(msh==fMeshMap.end())
99  {
100  auto wName = map->GetSDname();
101  sm = FindMesh(wName);
102  fMeshMap[colID] = sm;
103  }
104  else
105  { sm = (*msh).second; }
106  return sm;
107 }
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
G4int GetColID() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4VScoringMesh * G4ScoringManager::FindMesh ( const G4String wName)

Definition at line 109 of file G4ScoringManager.cc.

110 {
111  G4VScoringMesh* sm = nullptr;
112  for(auto msh : fMeshVec)
113  { if(msh->GetWorldName()==wName) return msh; }
114  if(!sm && verboseLevel>9)
115  { G4cout << "WARNING : G4ScoringManager::FindMesh() --- <" << wName << "> is not found. Null returned." << G4endl; }
116  return nullptr;
117 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4VScoringMesh* G4ScoringManager::GetCurrentMesh ( ) const
inline

Definition at line 122 of file G4ScoringManager.hh.

123  { return fCurrentMesh; }

Here is the caller graph for this function:

G4VScoringMesh* G4ScoringManager::GetMesh ( G4int  i) const
inline

Definition at line 144 of file G4ScoringManager.hh.

145  { return fMeshVec[i]; }

Here is the caller graph for this function:

size_t G4ScoringManager::GetNumberOfMesh ( ) const
inline

Definition at line 136 of file G4ScoringManager.hh.

137  { return fMeshVec.size(); }

Here is the caller graph for this function:

G4int G4ScoringManager::GetReplicaLevel ( )
static

Definition at line 80 of file G4ScoringManager.cc.

81 { return replicaLevel; }

Here is the caller graph for this function:

G4VScoreColorMap * G4ScoringManager::GetScoreColorMap ( const G4String mapName)

Definition at line 213 of file G4ScoringManager.cc.

214 {
215  ColorMapDictItr mItr = fColorMapDict->find(mapName);
216  if(mItr == fColorMapDict->end()) { return nullptr; }
217  return (mItr->second);
218 }
std::map< G4String, G4VScoreColorMap * >::iterator ColorMapDictItr

Here is the caller graph for this function:

G4ScoringManager * G4ScoringManager::GetScoringManager ( )
static

Definition at line 43 of file G4ScoringManager.cc.

44 {
45  if(!fSManager)
46  {
47  fSManager = new G4ScoringManager;
48  }
49  return fSManager;
50 }

Here is the call graph for this function:

Here is the caller graph for this function:

G4ScoringManager * G4ScoringManager::GetScoringManagerIfExist ( )
static

Definition at line 52 of file G4ScoringManager.cc.

53 { return fSManager; }

Here is the caller graph for this function:

G4int G4ScoringManager::GetVerboseLevel ( ) const
inline

Definition at line 134 of file G4ScoringManager.hh.

135  { return verboseLevel; }

Here is the caller graph for this function:

G4String G4ScoringManager::GetWorldName ( G4int  i) const
inline

Definition at line 146 of file G4ScoringManager.hh.

147  { return fMeshVec[i]->GetWorldName(); }

Here is the caller graph for this function:

void G4ScoringManager::List ( ) const

Definition at line 119 of file G4ScoringManager.cc.

120 {
121  G4cout << "G4ScoringManager has " << GetNumberOfMesh() << " scoring meshes." << G4endl;
122  for(auto msh : fMeshVec) msh->List();
123 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
size_t GetNumberOfMesh() const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ScoringManager::ListScoreColorMaps ( )

Definition at line 220 of file G4ScoringManager.cc.

221 {
222  G4cout << "Registered Score Color Maps -------------------------------------------------------" << G4endl;
223  ColorMapDictItr mItr = fColorMapDict->begin();
224  for(;mItr!=fColorMapDict->end();mItr++)
225  { G4cout << " " << mItr->first; }
226  G4cout << G4endl;
227 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
std::map< G4String, G4VScoreColorMap * >::iterator ColorMapDictItr

Here is the caller graph for this function:

void G4ScoringManager::Merge ( const G4ScoringManager scMan)

Definition at line 229 of file G4ScoringManager.cc.

230 {
231  for(size_t i = 0; i< GetNumberOfMesh() ; i++)
232  {
233  G4VScoringMesh* fMesh = GetMesh(i);
234  G4VScoringMesh* scMesh = mgr->GetMesh(i);
235  fMesh->Merge(scMesh);
236  }
237 }
void Merge(const G4VScoringMesh *scMesh)
size_t GetNumberOfMesh() const
G4VScoringMesh * GetMesh(G4int i) const

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ScoringManager::RegisterScoreColorMap ( G4VScoreColorMap colorMap)

Definition at line 200 of file G4ScoringManager.cc.

201 {
202  if(fColorMapDict->find(colorMap->GetName()) != fColorMapDict->end())
203  {
204  G4cerr << "ERROR : G4ScoringManager::RegisterScoreColorMap -- "
205  << colorMap->GetName() << " has already been registered. Method ignored." << G4endl;
206  }
207  else
208  {
209  (*fColorMapDict)[colorMap->GetName()] = colorMap;
210  }
211 }
G4String GetName() const
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

void G4ScoringManager::RegisterScoringMesh ( G4VScoringMesh scm)
inline

Definition at line 138 of file G4ScoringManager.hh.

139  {
140  scm->SetVerboseLevel(verboseLevel);
141  fMeshVec.push_back(scm);
142  SetCurrentMesh(scm);
143  }
void SetCurrentMesh(G4VScoringMesh *scm)
void SetVerboseLevel(G4int vl)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ScoringManager::SetCurrentMesh ( G4VScoringMesh scm)
inline

Definition at line 120 of file G4ScoringManager.hh.

121  { fCurrentMesh = scm; }

Here is the caller graph for this function:

void G4ScoringManager::SetReplicaLevel ( G4int  lvl)
static

Definition at line 78 of file G4ScoringManager.cc.

79 { replicaLevel = lvl; }
void G4ScoringManager::SetScoreWriter ( G4VScoreWriter sw)
inline

Definition at line 150 of file G4ScoringManager.hh.

151  {
152  if(writer) { delete writer; }
153  writer = sw;
154  if(writer) writer->SetVerboseLevel(verboseLevel);
155  }
void SetVerboseLevel(G4int vl)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ScoringManager::SetVerboseLevel ( G4int  vl)
inline

Definition at line 126 of file G4ScoringManager.hh.

127  {
128  verboseLevel = vl;
129  for(MeshVecItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
130  (*itr)->SetVerboseLevel(vl);
131  }
132  if(writer) writer->SetVerboseLevel(vl);
133  }
std::vector< G4VScoringMesh * >::iterator MeshVecItr
void SetVerboseLevel(G4int vl)

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files: