Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions
G4ScoringManager Class Reference

#include <G4ScoringManager.hh>

Public Member Functions

 ~G4ScoringManager ()
 
void RegisterScoreColorMap (G4VScoreColorMap *colorMap)
 
void Accumulate (G4VHitsCollection *map)
 
void Merge (const G4ScoringManager *scMan)
 
G4VScoringMesh * FindMesh (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="")
 
G4VScoreColorMap * GetScoreColorMap (const G4String &mapName)
 
void ListScoreColorMaps ()
 
void SetCurrentMesh (G4VScoringMesh *scm)
 
G4VScoringMesh * GetCurrentMesh () const
 
void CloseCurrentMesh ()
 
void SetVerboseLevel (G4int vl)
 
G4int GetVerboseLevel () const
 
size_t GetNumberOfMesh () const
 
void RegisterScoringMesh (G4VScoringMesh *scm)
 
G4VScoringMesh * GetMesh (G4int i) const
 
G4String GetWorldName (G4int i) const
 
void SetScoreWriter (G4VScoreWriter *sw)
 

Static Public Member Functions

static G4ScoringManager * GetScoringManager ()
 
static G4ScoringManager * GetScoringManagerIfExist ()
 
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 ( )
protected

Definition at line 55 of file G4ScoringManager.cc.

References G4VScoreColorMap::GetName().

Referenced by GetScoringManager().

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 }
G4String GetName() const
std::map< G4String, G4VScoreColorMap * > ColorMapDict
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 = 0;
76 }

Member Function Documentation

void G4ScoringManager::Accumulate ( G4VHitsCollection *  map)

Definition at line 83 of file G4ScoringManager.cc.

References G4VScoringMesh::Accumulate(), FindMesh(), G4cout, G4endl, G4VHitsCollection::GetName(), G4VHitsCollection::GetSDname(), G4VScoringMesh::GetWorldName(), and G4InuclParticleNames::sm.

Referenced by G4RunManager::UpdateScoring().

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 }
const G4String & GetWorldName() const
void Accumulate(G4THitsMap< G4double > *map)
G4GLOB_DLL std::ostream G4cout
G4VScoringMesh * FindMesh(const G4String &)
#define G4endl
Definition: G4ios.hh:61
void G4ScoringManager::CloseCurrentMesh ( )
inline

Definition at line 120 of file G4ScoringManager.hh.

Referenced by G4ScoringMessenger::SetNewValue().

121  { fCurrentMesh = 0; }
void G4ScoringManager::DrawMesh ( const G4String &  meshName,
const G4String &  psName,
const G4String &  colorMapName,
G4int  axflg = 111 
)

Definition at line 125 of file G4ScoringManager.cc.

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

Referenced by G4ScoringMessenger::SetNewValue().

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 }
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
G4VScoringMesh * FindMesh(const G4String &)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
void G4ScoringManager::DrawMesh ( const G4String &  meshName,
const G4String &  psName,
G4int  idxPlane,
G4int  iColumn,
const G4String &  colorMapName 
)

Definition at line 145 of file G4ScoringManager.cc.

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

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 }
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
G4VScoringMesh * FindMesh(const G4String &)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
void G4ScoringManager::Dump ( ) const

Definition at line 118 of file G4ScoringManager.cc.

Referenced by G4ScoringMessenger::SetNewValue().

119 {
120  for(MeshVecConstItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
121  (*itr)->Dump();
122  }
123 }
std::vector< G4VScoringMesh * >::const_iterator MeshVecConstItr
void G4ScoringManager::DumpAllQuantitiesToFile ( const G4String &  meshName,
const G4String &  fileName,
const G4String &  option = "" 
)

Definition at line 181 of file G4ScoringManager.cc.

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

Referenced by G4ScoringMessenger::SetNewValue().

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)
G4VScoringMesh * FindMesh(const G4String &)
void SetScoringMesh(G4VScoringMesh *sm)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
void G4ScoringManager::DumpQuantityToFile ( const G4String &  meshName,
const G4String &  psName,
const G4String &  fileName,
const G4String &  option = "" 
)

Definition at line 166 of file G4ScoringManager.cc.

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

Referenced by G4ScoringMessenger::SetNewValue().

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 }
G4VScoringMesh * FindMesh(const G4String &)
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)
G4VScoringMesh * G4ScoringManager::FindMesh ( const G4String &  wName)

Definition at line 94 of file G4ScoringManager.cc.

References G4cout, G4endl, and G4InuclParticleNames::sm.

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

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
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4VScoringMesh* G4ScoringManager::GetCurrentMesh ( ) const
inline

Definition at line 118 of file G4ScoringManager.hh.

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

119  { return fCurrentMesh; }
G4VScoringMesh* G4ScoringManager::GetMesh ( G4int  i) const
inline
size_t G4ScoringManager::GetNumberOfMesh ( ) const
inline
G4int G4ScoringManager::GetReplicaLevel ( )
static

Definition at line 80 of file G4ScoringManager.cc.

81 { return replicaLevel; }
G4VScoreColorMap * G4ScoringManager::GetScoreColorMap ( const G4String &  mapName)

Definition at line 208 of file G4ScoringManager.cc.

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

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
G4ScoringManager * G4ScoringManager::GetScoringManager ( )
static

Definition at line 43 of file G4ScoringManager.cc.

References G4ScoringManager().

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

44 {
45  if(!fSManager)
46  {
47  fSManager = new G4ScoringManager;
48  }
49  return fSManager;
50 }
G4ScoringManager * G4ScoringManager::GetScoringManagerIfExist ( )
static
G4int G4ScoringManager::GetVerboseLevel ( ) const
inline

Definition at line 130 of file G4ScoringManager.hh.

Referenced by G4ScoringMessenger::GetCurrentValue().

131  { return verboseLevel; }
G4String G4ScoringManager::GetWorldName ( G4int  i) const
inline

Definition at line 142 of file G4ScoringManager.hh.

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

143  { return fMeshVec[i]->GetWorldName(); }
void G4ScoringManager::List ( ) const

Definition at line 110 of file G4ScoringManager.cc.

References G4cout, G4endl, and GetNumberOfMesh().

Referenced by G4ScoringMessenger::SetNewValue().

111 {
112  G4cout << "G4ScoringManager has " << GetNumberOfMesh() << " scoring meshes." << G4endl;
113  for(MeshVecConstItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
114  (*itr)->List();
115  }
116 }
std::vector< G4VScoringMesh * >::const_iterator MeshVecConstItr
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
size_t GetNumberOfMesh() const
void G4ScoringManager::ListScoreColorMaps ( )

Definition at line 215 of file G4ScoringManager.cc.

References G4cout, and G4endl.

Referenced by G4ScoringMessenger::SetNewValue().

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 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
std::map< G4String, G4VScoreColorMap * >::iterator ColorMapDictItr
void G4ScoringManager::Merge ( const G4ScoringManager *  scMan)

Definition at line 224 of file G4ScoringManager.cc.

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

Referenced by G4MTRunManager::MergeScores().

225 {
226  for(size_t i = 0; i< GetNumberOfMesh() ; i++)
227  {
228  G4VScoringMesh* fMesh = GetMesh(i);
229  G4VScoringMesh* scMesh = mgr->GetMesh(i);
230  fMesh->Merge(scMesh);
231  }
232 }
void Merge(const G4VScoringMesh *scMesh)
size_t GetNumberOfMesh() const
G4VScoringMesh * GetMesh(G4int i) const
void G4ScoringManager::RegisterScoreColorMap ( G4VScoreColorMap *  colorMap)

Definition at line 195 of file G4ScoringManager.cc.

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

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 }
G4String GetName() const
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr
void G4ScoringManager::RegisterScoringMesh ( G4VScoringMesh *  scm)
inline

Definition at line 134 of file G4ScoringManager.hh.

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

Referenced by G4ScoringMessenger::SetNewValue().

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

Definition at line 116 of file G4ScoringManager.hh.

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

117  { fCurrentMesh = scm; }
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 146 of file G4ScoringManager.hh.

References G4VScoreWriter::SetVerboseLevel().

Referenced by main().

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

Definition at line 122 of file G4ScoringManager.hh.

References G4VScoreWriter::SetVerboseLevel().

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

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

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