Geant4  10.02.p03
G4ScoringManager Class Reference

#include <G4ScoringManager.hh>

Collaboration diagram for G4ScoringManager:

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 ()
 

Private Member Functions

 G4ScoringManager (const G4ScoringManager &)
 
G4ScoringManageroperator= (const G4ScoringManager &)
 

Private Attributes

G4int verboseLevel
 
G4ScoringMessengerfMessenger
 
G4ScoreQuantityMessengerfQuantityMessenger
 
MeshVec fMeshVec
 
G4VScoringMeshfCurrentMesh
 
G4VScoreWriterwriter
 
G4VScoreColorMapfDefaultLinearColorMap
 
ColorMapDictfColorMapDict
 
MeshMap fMeshMap
 

Static Private Attributes

static G4ThreadLocal G4ScoringManagerfSManager = nullptr
 
static G4ThreadLocal G4int replicaLevel = 3
 

Detailed Description

Definition at line 62 of file G4ScoringManager.hh.

Constructor & Destructor Documentation

◆ G4ScoringManager() [1/2]

G4ScoringManager::G4ScoringManager ( )
protected

Definition at line 55 of file G4ScoringManager.cc.

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

◆ ~G4ScoringManager()

G4ScoringManager::~G4ScoringManager ( )

Definition at line 68 of file G4ScoringManager.cc.

69 {
70  if (writer) { delete writer; }
72  delete fColorMapDict;
73  delete fQuantityMessenger;
74  delete fMessenger;
75  fSManager = nullptr;
76 }
G4ScoringMessenger * fMessenger
ColorMapDict * fColorMapDict
G4VScoreColorMap * fDefaultLinearColorMap
G4ScoreQuantityMessenger * fQuantityMessenger
static G4ThreadLocal G4ScoringManager * fSManager
G4VScoreWriter * writer

◆ G4ScoringManager() [2/2]

G4ScoringManager::G4ScoringManager ( const G4ScoringManager )
private

Member Function Documentation

◆ Accumulate()

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:

◆ CloseCurrentMesh()

void G4ScoringManager::CloseCurrentMesh ( )
inline

Definition at line 124 of file G4ScoringManager.hh.

125  { fCurrentMesh = 0; }
G4VScoringMesh * fCurrentMesh
Here is the caller graph for this function:

◆ DrawMesh() [1/2]

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)
G4VScoreColorMap * fDefaultLinearColorMap
#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:

◆ DrawMesh() [2/2]

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)
G4VScoreColorMap * fDefaultLinearColorMap
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:

◆ Dump()

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:

◆ DumpAllQuantitiesToFile()

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
G4VScoreWriter * writer
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DumpQuantityToFile()

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
G4VScoreWriter * writer
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:

◆ FindMesh() [1/2]

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)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindMesh() [2/2]

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

◆ GetCurrentMesh()

G4VScoringMesh* G4ScoringManager::GetCurrentMesh ( ) const
inline

Definition at line 122 of file G4ScoringManager.hh.

123  { return fCurrentMesh; }
G4VScoringMesh * fCurrentMesh
Here is the caller graph for this function:

◆ GetMesh()

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:

◆ GetNumberOfMesh()

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:

◆ GetReplicaLevel()

G4int G4ScoringManager::GetReplicaLevel ( )
static

Definition at line 80 of file G4ScoringManager.cc.

81 { return replicaLevel; }
static G4ThreadLocal G4int replicaLevel
Here is the caller graph for this function:

◆ GetScoreColorMap()

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 }
ColorMapDict * fColorMapDict
std::map< G4String, G4VScoreColorMap * >::iterator ColorMapDictItr
Here is the caller graph for this function:

◆ GetScoringManager()

G4ScoringManager * G4ScoringManager::GetScoringManager ( )
static

Definition at line 43 of file G4ScoringManager.cc.

44 {
45  if(!fSManager)
46  {
48  }
49  return fSManager;
50 }
static G4ThreadLocal G4ScoringManager * fSManager
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetScoringManagerIfExist()

G4ScoringManager * G4ScoringManager::GetScoringManagerIfExist ( )
static

Definition at line 52 of file G4ScoringManager.cc.

53 { return fSManager; }
static G4ThreadLocal G4ScoringManager * fSManager
Here is the caller graph for this function:

◆ GetVerboseLevel()

G4int G4ScoringManager::GetVerboseLevel ( ) const
inline

Definition at line 134 of file G4ScoringManager.hh.

135  { return verboseLevel; }
Here is the caller graph for this function:

◆ GetWorldName()

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:

◆ List()

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 }
size_t GetNumberOfMesh() const
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:

◆ ListScoreColorMaps()

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 }
ColorMapDict * fColorMapDict
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:

◆ Merge()

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:

◆ operator=()

G4ScoringManager& G4ScoringManager::operator= ( const G4ScoringManager )
private
Here is the caller graph for this function:

◆ RegisterScoreColorMap()

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 }
ColorMapDict * fColorMapDict
G4String GetName() const
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
Here is the call graph for this function:

◆ RegisterScoringMesh()

void G4ScoringManager::RegisterScoringMesh ( G4VScoringMesh scm)
inline

Definition at line 138 of file G4ScoringManager.hh.

139  {
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:

◆ SetCurrentMesh()

void G4ScoringManager::SetCurrentMesh ( G4VScoringMesh scm)
inline

Definition at line 120 of file G4ScoringManager.hh.

121  { fCurrentMesh = scm; }
G4VScoringMesh * fCurrentMesh
Here is the caller graph for this function:

◆ SetReplicaLevel()

void G4ScoringManager::SetReplicaLevel ( G4int  lvl)
static

Definition at line 78 of file G4ScoringManager.cc.

79 { replicaLevel = lvl; }
static G4ThreadLocal G4int replicaLevel

◆ SetScoreWriter()

void G4ScoringManager::SetScoreWriter ( G4VScoreWriter sw)
inline

Definition at line 150 of file G4ScoringManager.hh.

151  {
152  if(writer) { delete writer; }
153  writer = sw;
155  }
void SetVerboseLevel(G4int vl)
G4VScoreWriter * writer
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetVerboseLevel()

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)
G4VScoreWriter * writer
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fColorMapDict

ColorMapDict* G4ScoringManager::fColorMapDict
private

Definition at line 116 of file G4ScoringManager.hh.

◆ fCurrentMesh

G4VScoringMesh* G4ScoringManager::fCurrentMesh
private

Definition at line 112 of file G4ScoringManager.hh.

◆ fDefaultLinearColorMap

G4VScoreColorMap* G4ScoringManager::fDefaultLinearColorMap
private

Definition at line 115 of file G4ScoringManager.hh.

◆ fMeshMap

MeshMap G4ScoringManager::fMeshMap
private

Definition at line 118 of file G4ScoringManager.hh.

◆ fMeshVec

MeshVec G4ScoringManager::fMeshVec
private

Definition at line 111 of file G4ScoringManager.hh.

◆ fMessenger

G4ScoringMessenger* G4ScoringManager::fMessenger
private

Definition at line 108 of file G4ScoringManager.hh.

◆ fQuantityMessenger

G4ScoreQuantityMessenger* G4ScoringManager::fQuantityMessenger
private

Definition at line 109 of file G4ScoringManager.hh.

◆ fSManager

G4ThreadLocal G4ScoringManager * G4ScoringManager::fSManager = nullptr
staticprivate

Definition at line 105 of file G4ScoringManager.hh.

◆ replicaLevel

G4ThreadLocal G4int G4ScoringManager::replicaLevel = 3
staticprivate

Definition at line 106 of file G4ScoringManager.hh.

◆ verboseLevel

G4int G4ScoringManager::verboseLevel
private

Definition at line 107 of file G4ScoringManager.hh.

◆ writer

G4VScoreWriter* G4ScoringManager::writer
private

Definition at line 114 of file G4ScoringManager.hh.


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