Geant4-11
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4ScoringManager Class Reference

#include <G4ScoringManager.hh>

Public Member Functions

void Accumulate (G4VHitsCollection *map)
 
void CloseCurrentMesh ()
 
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 Dump () const
 
void DumpAllQuantitiesToFile (const G4String &meshName, const G4String &fileName, const G4String &option="")
 
void DumpQuantityToFile (const G4String &meshName, const G4String &psName, const G4String &fileName, const G4String &option="")
 
G4VScoringMeshFindMesh (const G4String &)
 
G4VScoringMeshFindMesh (G4VHitsCollection *map)
 
G4VScoringMeshGetCurrentMesh () const
 
G4double GetFactor () const
 
G4VScoringMeshGetMesh (G4int i) const
 
size_t GetNumberOfMesh () const
 
G4VScoreColorMapGetScoreColorMap (const G4String &mapName)
 
G4int GetVerboseLevel () const
 
G4String GetWorldName (G4int i) const
 
void List () const
 
void ListScoreColorMaps ()
 
void Merge (const G4ScoringManager *scMan)
 
void RegisterScoreColorMap (G4VScoreColorMap *colorMap)
 
void RegisterScoringMesh (G4VScoringMesh *scm)
 
void SetCurrentMesh (G4VScoringMesh *scm)
 
void SetFactor (G4double val=1.0)
 
void SetScoreWriter (G4VScoreWriter *sw)
 
void SetVerboseLevel (G4int vl)
 
 ~G4ScoringManager ()
 

Static Public Member Functions

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

Protected Member Functions

 G4ScoringManager ()
 

Private Member Functions

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

Private Attributes

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

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 56 of file G4ScoringManager.cc.

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

References fColorMapDict, fDefaultLinearColorMap, fMessenger, fQuantityMessenger, G4VScoreColorMap::GetName(), and writer.

Referenced by GetScoringManager().

◆ ~G4ScoringManager()

G4ScoringManager::~G4ScoringManager ( )

Definition at line 70 of file G4ScoringManager.cc.

71{
72 if(writer)
73 {
74 delete writer;
75 }
77 delete fColorMapDict;
78 delete fQuantityMessenger;
79 delete fMessenger;
80 fSManager = nullptr;
81}
static G4ThreadLocal G4ScoringManager * fSManager

References fColorMapDict, fDefaultLinearColorMap, fMessenger, fQuantityMessenger, fSManager, and writer.

◆ G4ScoringManager() [2/2]

G4ScoringManager::G4ScoringManager ( const G4ScoringManager )
private

Member Function Documentation

◆ Accumulate()

void G4ScoringManager::Accumulate ( G4VHitsCollection map)

Definition at line 86 of file G4ScoringManager.cc.

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

References FindMesh(), G4cout, G4endl, anonymous_namespace{G4QuasiElRatios.cc}::map, G4InuclParticleNames::sm, and verboseLevel.

Referenced by G4RunManager::UpdateScoring().

◆ CloseCurrentMesh()

void G4ScoringManager::CloseCurrentMesh ( )
inline

Definition at line 124 of file G4ScoringManager.hh.

124{ fCurrentMesh = 0; }

References fCurrentMesh.

Referenced by G4ScoringMessenger::SetNewValue().

◆ DrawMesh() [1/2]

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

Definition at line 149 of file G4ScoringManager.cc.

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

References G4VScoringMesh::DrawMesh(), fDefaultLinearColorMap, FindMesh(), G4cerr, G4endl, and GetScoreColorMap().

Referenced by G4ScoringMessenger::SetNewValue().

◆ DrawMesh() [2/2]

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

Definition at line 172 of file G4ScoringManager.cc.

175{
176 G4VScoringMesh* mesh = FindMesh(meshName);
177 if(mesh)
178 {
179 G4VScoreColorMap* colorMap = GetScoreColorMap(colorMapName);
180 if(!colorMap)
181 {
182 G4cerr << "WARNING : Score color map <" << colorMapName
183 << "> is not found. Default linear color map is used." << G4endl;
184 colorMap = fDefaultLinearColorMap;
185 }
186 mesh->DrawMesh(psName, idxPlane, iColumn, colorMap);
187 }
188 else
189 {
190 G4cerr << "ERROR : G4ScoringManager::DrawMesh() --- <" << meshName
191 << "> is not found. Nothing is done." << G4endl;
192 }
193}

References G4VScoringMesh::DrawMesh(), fDefaultLinearColorMap, FindMesh(), G4cerr, G4endl, and GetScoreColorMap().

◆ Dump()

void G4ScoringManager::Dump ( ) const

Definition at line 143 of file G4ScoringManager.cc.

144{
145 for(auto msh : fMeshVec)
146 msh->Dump();
147}

References fMeshVec.

Referenced by G4ScoringMessenger::SetNewValue().

◆ DumpAllQuantitiesToFile()

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

Definition at line 213 of file G4ScoringManager.cc.

216{
217 G4VScoringMesh* mesh = FindMesh(meshName);
218 if(mesh)
219 {
220 writer->SetScoringMesh(mesh);
221 writer->DumpAllQuantitiesToFile(fileName, option);
222 }
223 else
224 {
225 G4cerr << "ERROR : G4ScoringManager::DrawAllQuantitiesToFile() --- <"
226 << meshName << "> is not found. Nothing is done." << G4endl;
227 }
228}
virtual void DumpAllQuantitiesToFile(const G4String &fileName, const G4String &option)
void SetScoringMesh(G4VScoringMesh *sm)

References G4VScoreWriter::DumpAllQuantitiesToFile(), FindMesh(), G4cerr, G4endl, G4VScoreWriter::SetScoringMesh(), and writer.

Referenced by G4ScoringMessenger::SetNewValue().

◆ DumpQuantityToFile()

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

Definition at line 195 of file G4ScoringManager.cc.

199{
200 G4VScoringMesh* mesh = FindMesh(meshName);
201 if(mesh)
202 {
203 writer->SetScoringMesh(mesh);
204 writer->DumpQuantityToFile(psName, fileName, option);
205 }
206 else
207 {
208 G4cerr << "ERROR : G4ScoringManager::DrawQuantityToFile() --- <" << meshName
209 << "> is not found. Nothing is done." << G4endl;
210 }
211}
virtual void DumpQuantityToFile(const G4String &psName, const G4String &fileName, const G4String &option)

References G4VScoreWriter::DumpQuantityToFile(), FindMesh(), G4cerr, G4endl, G4VScoreWriter::SetScoringMesh(), and writer.

Referenced by G4ScoringMessenger::SetNewValue().

◆ FindMesh() [1/2]

G4VScoringMesh * G4ScoringManager::FindMesh ( const G4String wName)

Definition at line 119 of file G4ScoringManager.cc.

120{
121 G4VScoringMesh* sm = nullptr;
122 for(auto msh : fMeshVec)
123 {
124 if(msh->GetWorldName() == wName)
125 return msh;
126 }
127 if(!sm && verboseLevel > 9)
128 {
129 G4cout << "WARNING : G4ScoringManager::FindMesh() --- <" << wName
130 << "> is not found. Null returned." << G4endl;
131 }
132 return nullptr;
133}

References fMeshVec, G4cout, G4endl, G4InuclParticleNames::sm, and verboseLevel.

◆ FindMesh() [2/2]

G4VScoringMesh * G4ScoringManager::FindMesh ( G4VHitsCollection map)

Definition at line 101 of file G4ScoringManager.cc.

102{
103 auto colID = map->GetColID();
104 G4VScoringMesh* sm = nullptr;
105 auto msh = fMeshMap.find(colID);
106 if(msh == fMeshMap.end())
107 {
108 auto wName = map->GetSDname();
109 sm = FindMesh(wName);
110 fMeshMap[colID] = sm;
111 }
112 else
113 {
114 sm = (*msh).second;
115 }
116 return sm;
117}

References FindMesh(), fMeshMap, anonymous_namespace{G4QuasiElRatios.cc}::map, and G4InuclParticleNames::sm.

Referenced by Accumulate(), G4GMocrenFileSceneHandler::AddSolid(), DrawMesh(), DumpAllQuantitiesToFile(), DumpQuantityToFile(), FindMesh(), and G4ScoringMessenger::SetNewValue().

◆ GetCurrentMesh()

G4VScoringMesh * G4ScoringManager::GetCurrentMesh ( ) const
inline

Definition at line 123 of file G4ScoringManager.hh.

123{ return fCurrentMesh; }

References fCurrentMesh.

Referenced by G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ GetFactor()

G4double G4ScoringManager::GetFactor ( ) const
inline

Definition at line 168 of file G4ScoringManager.hh.

169 {
170 if(writer)
171 {
172 return writer->GetFactor();
173 }
174 else
175 {
176 return -1.0;
177 }
178 }
G4double GetFactor() const

References G4VScoreWriter::GetFactor(), and writer.

◆ GetMesh()

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

◆ GetNumberOfMesh()

size_t G4ScoringManager::GetNumberOfMesh ( ) const
inline

◆ GetReplicaLevel()

G4int G4ScoringManager::GetReplicaLevel ( )
static

Definition at line 84 of file G4ScoringManager.cc.

84{ return replicaLevel; }
static G4ThreadLocal G4int replicaLevel

References replicaLevel.

Referenced by G4ScoringBox::SetupGeometry(), and G4ScoringCylinder::SetupGeometry().

◆ GetScoreColorMap()

G4VScoreColorMap * G4ScoringManager::GetScoreColorMap ( const G4String mapName)

Definition at line 244 of file G4ScoringManager.cc.

245{
246 ColorMapDictItr mItr = fColorMapDict->find(mapName);
247 if(mItr == fColorMapDict->end())
248 {
249 return nullptr;
250 }
251 return (mItr->second);
252}
std::map< G4String, G4VScoreColorMap * >::iterator ColorMapDictItr

References fColorMapDict.

Referenced by DrawMesh(), and G4ScoringMessenger::SetNewValue().

◆ GetScoringManager()

G4ScoringManager * G4ScoringManager::GetScoringManager ( )
static

Definition at line 42 of file G4ScoringManager.cc.

43{
44 if(!fSManager)
45 {
47 }
48 return fSManager;
49}

References fSManager, and G4ScoringManager().

Referenced by G4GMocrenFileSceneHandler::AddSolid(), and G4WorkerRunManager::G4WorkerRunManager().

◆ GetScoringManagerIfExist()

G4ScoringManager * G4ScoringManager::GetScoringManagerIfExist ( )
static

◆ GetVerboseLevel()

G4int G4ScoringManager::GetVerboseLevel ( ) const
inline

Definition at line 135 of file G4ScoringManager.hh.

135{ return verboseLevel; }

References verboseLevel.

Referenced by G4ScoringMessenger::GetCurrentValue().

◆ GetWorldName()

G4String G4ScoringManager::GetWorldName ( G4int  i) const
inline

Definition at line 144 of file G4ScoringManager.hh.

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

References fMeshVec.

Referenced by G4RunManager::ConstructScoringWorlds(), and G4WorkerRunManager::ConstructScoringWorlds().

◆ List()

void G4ScoringManager::List ( ) const

Definition at line 135 of file G4ScoringManager.cc.

136{
137 G4cout << "G4ScoringManager has " << GetNumberOfMesh() << " scoring meshes."
138 << G4endl;
139 for(auto msh : fMeshVec)
140 msh->List();
141}
size_t GetNumberOfMesh() const

References fMeshVec, G4cout, G4endl, and GetNumberOfMesh().

Referenced by G4ScoringMessenger::SetNewValue().

◆ ListScoreColorMaps()

void G4ScoringManager::ListScoreColorMaps ( )

Definition at line 254 of file G4ScoringManager.cc.

255{
256 G4cout << "Registered Score Color Maps "
257 "-------------------------------------------------------"
258 << G4endl;
259 ColorMapDictItr mItr = fColorMapDict->begin();
260 for(; mItr != fColorMapDict->end(); mItr++)
261 {
262 G4cout << " " << mItr->first;
263 }
264 G4cout << G4endl;
265}

References fColorMapDict, G4cout, and G4endl.

Referenced by G4ScoringMessenger::SetNewValue().

◆ Merge()

void G4ScoringManager::Merge ( const G4ScoringManager scMan)

Definition at line 267 of file G4ScoringManager.cc.

268{
269 for(size_t i = 0; i < GetNumberOfMesh(); i++)
270 {
271 G4VScoringMesh* fMesh = GetMesh(i);
272 G4VScoringMesh* scMesh = mgr->GetMesh(i);
273 fMesh->Merge(scMesh);
274 }
275}
G4VScoringMesh * GetMesh(G4int i) const
void Merge(const G4VScoringMesh *scMesh)

References GetMesh(), GetNumberOfMesh(), and G4VScoringMesh::Merge().

Referenced by G4MTRunManager::MergeScores(), and G4TaskRunManager::MergeScores().

◆ operator=()

G4ScoringManager & G4ScoringManager::operator= ( const G4ScoringManager )
private

◆ RegisterScoreColorMap()

void G4ScoringManager::RegisterScoreColorMap ( G4VScoreColorMap colorMap)

Definition at line 230 of file G4ScoringManager.cc.

231{
232 if(fColorMapDict->find(colorMap->GetName()) != fColorMapDict->end())
233 {
234 G4cerr << "ERROR : G4ScoringManager::RegisterScoreColorMap -- "
235 << colorMap->GetName()
236 << " has already been registered. Method ignored." << G4endl;
237 }
238 else
239 {
240 (*fColorMapDict)[colorMap->GetName()] = colorMap;
241 }
242}

References fColorMapDict, G4cerr, G4endl, and G4VScoreColorMap::GetName().

◆ RegisterScoringMesh()

void G4ScoringManager::RegisterScoringMesh ( G4VScoringMesh scm)
inline

Definition at line 137 of file G4ScoringManager.hh.

138 {
140 fMeshVec.push_back(scm);
141 SetCurrentMesh(scm);
142 }
void SetCurrentMesh(G4VScoringMesh *scm)
void SetVerboseLevel(G4int vl)

References fMeshVec, SetCurrentMesh(), G4VScoringMesh::SetVerboseLevel(), and verboseLevel.

Referenced by G4ScoringMessenger::SetNewValue().

◆ SetCurrentMesh()

void G4ScoringManager::SetCurrentMesh ( G4VScoringMesh scm)
inline

Definition at line 122 of file G4ScoringManager.hh.

122{ fCurrentMesh = scm; }

References fCurrentMesh.

Referenced by RegisterScoringMesh(), and G4ScoringMessenger::SetNewValue().

◆ SetFactor()

void G4ScoringManager::SetFactor ( G4double  val = 1.0)
inline

Definition at line 163 of file G4ScoringManager.hh.

164 {
165 if(writer)
166 writer->SetFactor(val);
167 }
void SetFactor(G4double val=1.0)

References G4VScoreWriter::SetFactor(), and writer.

Referenced by G4ScoringMessenger::SetNewValue().

◆ SetReplicaLevel()

void G4ScoringManager::SetReplicaLevel ( G4int  lvl)
static

Definition at line 83 of file G4ScoringManager.cc.

83{ replicaLevel = lvl; }

References replicaLevel.

◆ SetScoreWriter()

void G4ScoringManager::SetScoreWriter ( G4VScoreWriter sw)
inline

Definition at line 150 of file G4ScoringManager.hh.

151 {
152 if(writer)
153 {
154 delete writer;
155 }
156 writer = sw;
157 if(writer)
159 }
void SetVerboseLevel(G4int vl)

References G4VScoreWriter::SetVerboseLevel(), verboseLevel, and writer.

◆ SetVerboseLevel()

void G4ScoringManager::SetVerboseLevel ( G4int  vl)
inline

Definition at line 125 of file G4ScoringManager.hh.

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

References fMeshVec, G4VScoreWriter::SetVerboseLevel(), verboseLevel, and writer.

Referenced by G4ScoringMessenger::SetNewValue().

Field Documentation

◆ fColorMapDict

ColorMapDict* G4ScoringManager::fColorMapDict
private

◆ fCurrentMesh

G4VScoringMesh* G4ScoringManager::fCurrentMesh
private

Definition at line 113 of file G4ScoringManager.hh.

Referenced by CloseCurrentMesh(), GetCurrentMesh(), and SetCurrentMesh().

◆ fDefaultLinearColorMap

G4VScoreColorMap* G4ScoringManager::fDefaultLinearColorMap
private

Definition at line 116 of file G4ScoringManager.hh.

Referenced by DrawMesh(), G4ScoringManager(), and ~G4ScoringManager().

◆ fMeshMap

MeshMap G4ScoringManager::fMeshMap
private

Definition at line 119 of file G4ScoringManager.hh.

Referenced by FindMesh().

◆ fMeshVec

MeshVec G4ScoringManager::fMeshVec
private

◆ fMessenger

G4ScoringMessenger* G4ScoringManager::fMessenger
private

Definition at line 109 of file G4ScoringManager.hh.

Referenced by G4ScoringManager(), and ~G4ScoringManager().

◆ fQuantityMessenger

G4ScoreQuantityMessenger* G4ScoringManager::fQuantityMessenger
private

Definition at line 110 of file G4ScoringManager.hh.

Referenced by G4ScoringManager(), and ~G4ScoringManager().

◆ fSManager

G4ThreadLocal G4ScoringManager * G4ScoringManager::fSManager = nullptr
staticprivate

◆ replicaLevel

G4ThreadLocal G4int G4ScoringManager::replicaLevel = 3
staticprivate

Definition at line 107 of file G4ScoringManager.hh.

Referenced by GetReplicaLevel(), and SetReplicaLevel().

◆ verboseLevel

G4int G4ScoringManager::verboseLevel
private

◆ writer

G4VScoreWriter* G4ScoringManager::writer
private

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