ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ScoringManager.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ScoringManager.hh
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>
36 class G4ScoringMessenger;
38 class G4VHitsCollection;
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 
51 typedef std::vector<G4VScoringMesh*> MeshVec;
52 typedef std::vector<G4VScoringMesh*>::iterator MeshVecItr;
53 typedef std::vector<G4VScoringMesh*>::const_iterator MeshVecConstItr;
54 typedef std::map<G4String,G4VScoreColorMap*> ColorMapDict;
55 typedef std::map<G4String,G4VScoreColorMap*>::iterator ColorMapDictItr;
56 typedef std::map<G4String,G4VScoreColorMap*>::const_iterator ColorMapDictConstItr;
57 typedef std::map<G4int,G4VScoringMesh*> MeshMap;
58 typedef std::map<G4int,G4VScoringMesh*>::iterator MeshMapItr;
59 typedef 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:
85  void Accumulate(G4VHitsCollection* map);
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 = "");
100  G4VScoreColorMap* GetScoreColorMap(const G4String& mapName);
101  void ListScoreColorMaps();
102 
103  private:
109 
112 
116 
118  public:
119  inline void SetCurrentMesh(G4VScoringMesh* scm)
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  {
140  fMeshVec.push_back(scm);
141  SetCurrentMesh(scm);
142  }
143  inline G4VScoringMesh* GetMesh(G4int i) const
144  { return fMeshVec[i]; }
145  inline G4String GetWorldName(G4int i) const
146  { return fMeshVec[i]->GetWorldName(); }
147 
148  public: // with description
150  {
151  if(writer) { delete writer; }
152  writer = sw;
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 
168 private:
169  //Disable copy constructor and assignement operator
172 };
173 
174 
175 
176 
177 #endif
178