Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ScoringManager Class Reference

#include <G4ScoringManager.hh>

Public Member Functions

 ~G4ScoringManager ()
 
void RegisterScoreColorMap (G4VScoreColorMap *colorMap)
 
void Accumulate (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 60 of file G4ScoringManager.hh.

Constructor & Destructor Documentation

◆ G4ScoringManager()

G4ScoringManager::G4ScoringManager ( )
protected

Definition at line 55 of file G4ScoringManager.cc.

56 : verboseLevel(0),fCurrentMesh(0)
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}
std::map< G4String, G4VScoreColorMap * > ColorMapDict
G4String GetName() const

Referenced by GetScoringManager().

◆ ~G4ScoringManager()

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 delete fSManager;
76}

Member Function Documentation

◆ Accumulate()

void G4ScoringManager::Accumulate ( G4VHitsCollection map)

Definition at line 83 of file G4ScoringManager.cc.

84{
85 G4String wName = map->GetSDname();
86 G4VScoringMesh* sm = FindMesh(wName);
87 if(sm == 0) return;
88 if(verboseLevel>9)
89 { G4cout << "G4ScoringManager::Accumulate() for " << map->GetSDname() << " / " << map->GetName() << G4endl;
90 G4cout << " is calling G4VScoringMesh::Accumulate() of " << sm->GetWorldName() << G4endl; }
91 sm->Accumulate(static_cast<G4THitsMap<double>*>(map));
92}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
G4VScoringMesh * FindMesh(const G4String &)

Referenced by G4RunManager::UpdateScoring().

◆ CloseCurrentMesh()

void G4ScoringManager::CloseCurrentMesh ( )
inline

Definition at line 119 of file G4ScoringManager.hh.

120 { fCurrentMesh = 0; }

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

128{
129 G4VScoringMesh* mesh = FindMesh(meshName);
130 if(mesh)
131 {
132 G4VScoreColorMap* colorMap = GetScoreColorMap(colorMapName);
133 if(!colorMap)
134 {
135 G4cerr << "WARNING : Score color map <" << colorMapName << "> is not found. Default linear color map is used." << G4endl;
136 colorMap = fDefaultLinearColorMap;
137 }
138 mesh->DrawMesh(psName,colorMap,axflg);
139 } else {
140 G4cerr << "ERROR : G4ScoringManager::DrawMesh() --- <"
141 << meshName << "> is not found. Nothing is done." << G4endl;
142 }
143}
G4DLLIMPORT std::ostream G4cerr
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)

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

149{
150 G4VScoringMesh* mesh = FindMesh(meshName);
151 if(mesh)
152 {
153 G4VScoreColorMap* colorMap = GetScoreColorMap(colorMapName);
154 if(!colorMap)
155 {
156 G4cerr << "WARNING : Score color map <" << colorMapName << "> is not found. Default linear color map is used." << G4endl;
157 colorMap = fDefaultLinearColorMap;
158 }
159 mesh->DrawMesh(psName,idxPlane,iColumn,colorMap);
160 } else {
161 G4cerr << "ERROR : G4ScoringManager::DrawMesh() --- <"
162 << meshName << "> is not found. Nothing is done." << G4endl;
163 }
164}

◆ Dump()

void G4ScoringManager::Dump ( ) const

Definition at line 118 of file G4ScoringManager.cc.

119{
120 for(MeshVecConstItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
121 (*itr)->Dump();
122 }
123}
std::vector< G4VScoringMesh * >::const_iterator MeshVecConstItr

Referenced by G4ScoringMessenger::SetNewValue().

◆ DumpAllQuantitiesToFile()

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

Definition at line 181 of file G4ScoringManager.cc.

184{
185 G4VScoringMesh* mesh = FindMesh(meshName);
186 if(mesh) {
187 writer->SetScoringMesh(mesh);
188 writer->DumpAllQuantitiesToFile(fileName, option);
189 } else {
190 G4cerr << "ERROR : G4ScoringManager::DrawAllQuantitiesToFile() --- <"
191 << meshName << "> is not found. Nothing is done." << G4endl;
192 }
193}
virtual void DumpAllQuantitiesToFile(const G4String &fileName, const G4String &option)
void SetScoringMesh(G4VScoringMesh *sm)

Referenced by G4ScoringMessenger::SetNewValue().

◆ DumpQuantityToFile()

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

Definition at line 166 of file G4ScoringManager.cc.

170{
171 G4VScoringMesh* mesh = FindMesh(meshName);
172 if(mesh) {
173 writer->SetScoringMesh(mesh);
174 writer->DumpQuantityToFile(psName, fileName, option);
175 } else {
176 G4cerr << "ERROR : G4ScoringManager::DrawQuantityToFile() --- <"
177 << meshName << "> is not found. Nothing is done." << G4endl;
178 }
179}
virtual void DumpQuantityToFile(const G4String &psName, const G4String &fileName, const G4String &option)

Referenced by G4ScoringMessenger::SetNewValue().

◆ FindMesh()

G4VScoringMesh * G4ScoringManager::FindMesh ( const G4String wName)

Definition at line 94 of file G4ScoringManager.cc.

95{
96 G4VScoringMesh* sm = 0;
97 for(MeshVecItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
98 G4String smName = (*itr)->GetWorldName();
99 if(wName == smName) {
100 sm = *itr;
101 break;
102 }
103 }
104 if(!sm && verboseLevel>9)
105 { G4cout << "WARNING : G4ScoringManager::FindMesh() --- <" << wName << "> is not found. Null returned." << G4endl; }
106
107 return sm;
108}
std::vector< G4VScoringMesh * >::iterator MeshVecItr

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

◆ GetCurrentMesh()

G4VScoringMesh * G4ScoringManager::GetCurrentMesh ( ) const
inline

Definition at line 117 of file G4ScoringManager.hh.

118 { return fCurrentMesh; }

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

◆ GetMesh()

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

◆ GetNumberOfMesh()

size_t G4ScoringManager::GetNumberOfMesh ( ) const
inline

◆ GetReplicaLevel()

G4int G4ScoringManager::GetReplicaLevel ( )
static

Definition at line 80 of file G4ScoringManager.cc.

81{ return replicaLevel; }

◆ GetScoreColorMap()

G4VScoreColorMap * G4ScoringManager::GetScoreColorMap ( const G4String mapName)

Definition at line 208 of file G4ScoringManager.cc.

209{
210 ColorMapDictItr mItr = fColorMapDict->find(mapName);
211 if(mItr == fColorMapDict->end()) { return 0; }
212 return (mItr->second);
213}
std::map< G4String, G4VScoreColorMap * >::iterator ColorMapDictItr

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

◆ GetScoringManager()

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}

Referenced by G4GMocrenFileSceneHandler::AddSolid().

◆ GetScoringManagerIfExist()

G4ScoringManager * G4ScoringManager::GetScoringManagerIfExist ( )
static

◆ GetVerboseLevel()

G4int G4ScoringManager::GetVerboseLevel ( ) const
inline

Definition at line 129 of file G4ScoringManager.hh.

130 { return verboseLevel; }

Referenced by G4ScoringMessenger::GetCurrentValue().

◆ GetWorldName()

G4String G4ScoringManager::GetWorldName ( G4int  i) const
inline

Definition at line 141 of file G4ScoringManager.hh.

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

Referenced by G4RunManager::ConstructScoringWorlds().

◆ List()

void G4ScoringManager::List ( ) const

Definition at line 110 of file G4ScoringManager.cc.

111{
112 G4cout << "G4ScoringManager has " << GetNumberOfMesh() << " scoring meshes." << G4endl;
113 for(MeshVecConstItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
114 (*itr)->List();
115 }
116}
size_t GetNumberOfMesh() const

Referenced by G4ScoringMessenger::SetNewValue().

◆ ListScoreColorMaps()

void G4ScoringManager::ListScoreColorMaps ( )

Definition at line 215 of file G4ScoringManager.cc.

216{
217 G4cout << "Registered Score Color Maps -------------------------------------------------------" << G4endl;
218 ColorMapDictItr mItr = fColorMapDict->begin();
219 for(;mItr!=fColorMapDict->end();mItr++)
220 { G4cout << " " << mItr->first; }
221 G4cout << G4endl;
222}

Referenced by G4ScoringMessenger::SetNewValue().

◆ RegisterScoreColorMap()

void G4ScoringManager::RegisterScoreColorMap ( G4VScoreColorMap colorMap)

Definition at line 195 of file G4ScoringManager.cc.

196{
197 if(fColorMapDict->find(colorMap->GetName()) != fColorMapDict->end())
198 {
199 G4cerr << "ERROR : G4ScoringManager::RegisterScoreColorMap -- "
200 << colorMap->GetName() << " has already been registered. Method ignored." << G4endl;
201 }
202 else
203 {
204 (*fColorMapDict)[colorMap->GetName()] = colorMap;
205 }
206}

◆ RegisterScoringMesh()

void G4ScoringManager::RegisterScoringMesh ( G4VScoringMesh scm)
inline

Definition at line 133 of file G4ScoringManager.hh.

134 {
135 scm->SetVerboseLevel(verboseLevel);
136 fMeshVec.push_back(scm);
137 SetCurrentMesh(scm);
138 }
void SetCurrentMesh(G4VScoringMesh *scm)
void SetVerboseLevel(G4int vl)

Referenced by G4ScoringMessenger::SetNewValue().

◆ SetCurrentMesh()

void G4ScoringManager::SetCurrentMesh ( G4VScoringMesh scm)
inline

Definition at line 115 of file G4ScoringManager.hh.

116 { fCurrentMesh = scm; }

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

◆ SetReplicaLevel()

void G4ScoringManager::SetReplicaLevel ( G4int  lvl)
static

Definition at line 78 of file G4ScoringManager.cc.

79{ replicaLevel = lvl; }

◆ SetScoreWriter()

void G4ScoringManager::SetScoreWriter ( G4VScoreWriter sw)
inline

Definition at line 145 of file G4ScoringManager.hh.

146 {
147 if(writer) { delete writer; }
148 writer = sw;
149 if(writer) writer->SetVerboseLevel(verboseLevel);
150 }
void SetVerboseLevel(G4int vl)

◆ SetVerboseLevel()

void G4ScoringManager::SetVerboseLevel ( G4int  vl)
inline

Definition at line 121 of file G4ScoringManager.hh.

122 {
123 verboseLevel = vl;
124 for(MeshVecItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
125 (*itr)->SetVerboseLevel(vl);
126 }
127 if(writer) writer->SetVerboseLevel(vl);
128 }

Referenced by G4ScoringMessenger::SetNewValue().


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