Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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 ColorMapDictConstItr;
57typedef std::map<G4int,G4VScoringMesh*> MeshMap;
58typedef std::map<G4int,G4VScoringMesh*>::iterator MeshMapItr;
59typedef std::map<G4int,G4VScoringMesh*>::const_iterator MeshMapConstItr;
60
62{
63 public: // with description
65 // Returns the pointer to the singleton object.
66 public:
68
69 public:
70 static void SetReplicaLevel(G4int);
71 static G4int GetReplicaLevel();
72
73 protected:
75
76 public:
78
79 public: // with description
81 // Register a color map. Once registered, it is available by /score/draw and /score/drawColumn
82 // commands.
83
84 public:
86 void Merge(const G4ScoringManager* scMan);
89 void List() const;
90 void Dump() const;
91 void DrawMesh(const G4String& meshName, const G4String& psName,
92 const G4String& colorMapName, G4int axflg=111);
93 void DrawMesh(const G4String& meshName, const G4String& psName,
94 G4int idxPlane, G4int iColumn, const G4String& colorMapName);
95 void DumpQuantityToFile(const G4String& meshName, const G4String& psName,
96 const G4String& fileName, const G4String& option = "");
97 void DumpAllQuantitiesToFile(const G4String& meshName,
98 const G4String& fileName,
99 const G4String& option = "");
101 void ListScoreColorMaps();
102
103 private:
104 static G4ThreadLocal G4ScoringManager * fSManager;
105 static G4ThreadLocal G4int replicaLevel;
106 G4int verboseLevel;
107 G4ScoringMessenger* fMessenger;
108 G4ScoreQuantityMessenger* fQuantityMessenger;
109
110 MeshVec fMeshVec;
111 G4VScoringMesh* fCurrentMesh;
112
113 G4VScoreWriter * writer;
114 G4VScoreColorMap * fDefaultLinearColorMap;
115 ColorMapDict * fColorMapDict;
116
117 MeshMap fMeshMap;
118 public:
120 { fCurrentMesh = scm; }
122 { return fCurrentMesh; }
123 inline void CloseCurrentMesh()
124 { fCurrentMesh = 0; }
125 inline void SetVerboseLevel(G4int vl)
126 {
127 verboseLevel = vl;
128 for(MeshVecItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
129 (*itr)->SetVerboseLevel(vl);
130 }
131 if(writer) writer->SetVerboseLevel(vl);
132 }
133 inline G4int GetVerboseLevel() const
134 { return verboseLevel; }
135 inline size_t GetNumberOfMesh() const
136 { return fMeshVec.size(); }
138 {
139 scm->SetVerboseLevel(verboseLevel);
140 fMeshVec.push_back(scm);
141 SetCurrentMesh(scm);
142 }
143 inline G4VScoringMesh* GetMesh(G4int i) const
144 { return fMeshVec[i]; }
146 { return fMeshVec[i]->GetWorldName(); }
147
148 public: // with description
150 {
151 if(writer) { delete writer; }
152 writer = sw;
153 if(writer) writer->SetVerboseLevel(verboseLevel);
154 }
155 // Replace score writers.
156
157 public:
158 inline void SetFactor(G4double val=1.0)
159 { if(writer) writer->SetFactor(val); }
160 inline G4double GetFactor() const
161 {
162 if(writer)
163 { return writer->GetFactor(); }
164 else
165 { return -1.0; }
166 }
167
168private:
169 //Disable copy constructor and assignement operator
171 G4ScoringManager& operator=(const G4ScoringManager&);
172};
173
174
175
176
177#endif
178
std::map< G4String, G4VScoreColorMap * >::const_iterator ColorMapDictConstItr
std::vector< G4VScoringMesh * > MeshVec
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
std::map< G4int, G4VScoringMesh * > MeshMap
std::map< G4String, G4VScoreColorMap * > ColorMapDict
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
static G4int GetReplicaLevel()
G4VScoringMesh * GetMesh(G4int i) const
void RegisterScoringMesh(G4VScoringMesh *scm)
void Accumulate(G4VHitsCollection *map)
G4int GetVerboseLevel() const
static void SetReplicaLevel(G4int)
void SetVerboseLevel(G4int vl)
size_t GetNumberOfMesh() const
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
void DumpAllQuantitiesToFile(const G4String &meshName, const G4String &fileName, const G4String &option="")
static G4ScoringManager * GetScoringManager()
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)
void SetFactor(G4double val=1.0)
G4VScoringMesh * GetCurrentMesh() const
G4double GetFactor() const
void SetScoreWriter(G4VScoreWriter *sw)
void Merge(const G4ScoringManager *scMan)
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