Geant4-11
G4ScoringManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28
29#ifndef G4ScoringManager_h
30#define G4ScoringManager_h 1
31
32#include "globals.hh"
33#include "G4VScoringMesh.hh"
34#include <vector>
35#include <map>
40#include "G4VScoreWriter.hh"
41
42// class description:
43//
44// This is a singleton class which manages the interactive scoring.
45// The user cannot access to the constructor. The pointer of the
46// only existing object can be got via G4ScoringManager::GetScoringManager()
47// static method. The first invokation of this static method makes
48// the singleton object.
49//
50
51typedef std::vector<G4VScoringMesh*> MeshVec;
52typedef std::vector<G4VScoringMesh*>::iterator MeshVecItr;
53typedef std::vector<G4VScoringMesh*>::const_iterator MeshVecConstItr;
54typedef std::map<G4String, G4VScoreColorMap*> ColorMapDict;
55typedef std::map<G4String, G4VScoreColorMap*>::iterator ColorMapDictItr;
56typedef std::map<G4String, G4VScoreColorMap*>::const_iterator
58typedef std::map<G4int, G4VScoringMesh*> MeshMap;
59typedef std::map<G4int, G4VScoringMesh*>::iterator MeshMapItr;
60typedef std::map<G4int, G4VScoringMesh*>::const_iterator MeshMapConstItr;
61
63{
64 public: // with description
66 // Returns the pointer to the singleton object.
67 public:
69
70 public:
71 static void SetReplicaLevel(G4int);
72 static G4int GetReplicaLevel();
73
74 protected:
76
77 public:
79
80 public: // with description
82 // Register a color map. Once registered, it is available by /score/draw and
83 // /score/drawColumn commands.
84
85 public:
87 void Merge(const G4ScoringManager* scMan);
90 void List() const;
91 void Dump() const;
92 void DrawMesh(const G4String& meshName, const G4String& psName,
93 const G4String& colorMapName, G4int axflg = 111);
94 void DrawMesh(const G4String& meshName, const G4String& psName,
95 G4int idxPlane, G4int iColumn, const G4String& colorMapName);
96 void DumpQuantityToFile(const G4String& meshName, const G4String& psName,
97 const G4String& fileName,
98 const G4String& option = "");
99 void DumpAllQuantitiesToFile(const G4String& meshName,
100 const G4String& fileName,
101 const G4String& option = "");
103 void ListScoreColorMaps();
104
105 private:
111
114
118
120
121 public:
122 inline void SetCurrentMesh(G4VScoringMesh* scm) { fCurrentMesh = scm; }
123 inline G4VScoringMesh* GetCurrentMesh() const { return fCurrentMesh; }
124 inline void CloseCurrentMesh() { fCurrentMesh = 0; }
125 inline void SetVerboseLevel(G4int vl)
126 {
127 verboseLevel = vl;
128 for(MeshVecItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++)
129 {
130 (*itr)->SetVerboseLevel(vl);
131 }
132 if(writer)
134 }
135 inline G4int GetVerboseLevel() const { return verboseLevel; }
136 inline size_t GetNumberOfMesh() const { return fMeshVec.size(); }
138 {
140 fMeshVec.push_back(scm);
141 SetCurrentMesh(scm);
142 }
143 inline G4VScoringMesh* GetMesh(G4int i) const { return fMeshVec[i]; }
145 {
146 return fMeshVec[i]->GetWorldName();
147 }
148
149 public: // with description
151 {
152 if(writer)
153 {
154 delete writer;
155 }
156 writer = sw;
157 if(writer)
159 }
160 // Replace score writers.
161
162 public:
163 inline void SetFactor(G4double val = 1.0)
164 {
165 if(writer)
166 writer->SetFactor(val);
167 }
168 inline G4double GetFactor() const
169 {
170 if(writer)
171 {
172 return writer->GetFactor();
173 }
174 else
175 {
176 return -1.0;
177 }
178 }
179
180 private:
181 // Disable copy constructor and assignement operator
184};
185
186#endif
std::map< G4int, G4VScoringMesh * > MeshMap
std::map< G4String, G4VScoreColorMap * >::const_iterator ColorMapDictConstItr
std::vector< G4VScoringMesh * > MeshVec
std::map< G4String, G4VScoreColorMap * > ColorMapDict
std::map< G4int, G4VScoringMesh * >::iterator MeshMapItr
std::vector< G4VScoringMesh * >::const_iterator MeshVecConstItr
std::vector< G4VScoringMesh * >::iterator MeshVecItr
std::map< G4int, G4VScoringMesh * >::const_iterator MeshMapConstItr
std::map< G4String, G4VScoreColorMap * >::iterator ColorMapDictItr
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
ColorMapDict * fColorMapDict
static G4int GetReplicaLevel()
G4VScoreColorMap * fDefaultLinearColorMap
G4VScoringMesh * GetMesh(G4int i) const
G4ScoreQuantityMessenger * fQuantityMessenger
void RegisterScoringMesh(G4VScoringMesh *scm)
void Accumulate(G4VHitsCollection *map)
G4ScoringManager(const G4ScoringManager &)
G4int GetVerboseLevel() const
static void SetReplicaLevel(G4int)
void SetVerboseLevel(G4int vl)
size_t GetNumberOfMesh() const
G4ScoringManager & operator=(const G4ScoringManager &)
G4ScoringMessenger * fMessenger
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
void DumpAllQuantitiesToFile(const G4String &meshName, const G4String &fileName, const G4String &option="")
static G4ThreadLocal G4int replicaLevel
static G4ScoringManager * GetScoringManager()
static G4ThreadLocal G4ScoringManager * fSManager
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
G4String GetWorldName(G4int i) const
void SetCurrentMesh(G4VScoringMesh *scm)
void RegisterScoreColorMap(G4VScoreColorMap *colorMap)
void DrawMesh(const G4String &meshName, const G4String &psName, const G4String &colorMapName, G4int axflg=111)
G4VScoringMesh * fCurrentMesh
void SetFactor(G4double val=1.0)
G4VScoringMesh * GetCurrentMesh() const
G4double GetFactor() const
void SetScoreWriter(G4VScoreWriter *sw)
void Merge(const G4ScoringManager *scMan)
G4VScoreWriter * writer
static G4ScoringManager * GetScoringManagerIfExist()
void DumpQuantityToFile(const G4String &meshName, const G4String &psName, const G4String &fileName, const G4String &option="")
void SetFactor(G4double val=1.0)
G4double GetFactor() const
void SetVerboseLevel(G4int vl)
void SetVerboseLevel(G4int vl)
#define G4ThreadLocal
Definition: tls.hh:77