source: trunk/source/digits_hits/utils/include/G4ScoringManager.hh@ 1321

Last change on this file since 1321 was 1228, checked in by garnier, 16 years ago

update geant4.9.3 tag

File size: 5.6 KB
Line 
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// $Id: G4ScoringManager.hh,v 1.23 2007/11/14 20:41:17 asaim Exp $
28// GEANT4 tag $Name: geant4-09-03 $
29//
30
31#ifndef G4ScoringManager_h
32#define G4ScoringManager_h 1
33
34#include "globals.hh"
35#include "G4VScoringMesh.hh"
36#include <vector>
37#include <map>
38class G4ScoringMessenger;
39class G4ScoreQuantityMessenger;
40class G4VHitsCollection;
41class G4VScoreColorMap;
42#include "G4VScoreWriter.hh"
43
44// class description:
45//
46// This is a singleton class which manages the interactive scoring.
47// The user cannot access to the constructor. The pointer of the
48// only existing object can be got via G4ScoringManager::GetScoringManager()
49// static method. The first invokation of this static method makes
50// the singleton object.
51//
52
53typedef std::vector<G4VScoringMesh*> MeshVec;
54typedef std::vector<G4VScoringMesh*>::iterator MeshVecItr;
55typedef std::vector<G4VScoringMesh*>::const_iterator MeshVecConstItr;
56typedef std::map<G4String,G4VScoreColorMap*> ColorMapDict;
57typedef std::map<G4String,G4VScoreColorMap*>::iterator ColorMapDictItr;
58typedef std::map<G4String,G4VScoreColorMap*>::const_iterator ColorMapDictConstItr;
59
60
61class G4ScoringManager
62{
63 public: // with description
64 static G4ScoringManager* GetScoringManager();
65 // Returns the pointer to the singleton object.
66 public:
67 static G4ScoringManager* GetScoringManagerIfExist();
68
69 public:
70 static void SetReplicaLevel(G4int);
71 static G4int GetReplicaLevel();
72
73 protected:
74 G4ScoringManager();
75
76 public:
77 ~G4ScoringManager();
78
79 public: // with description
80 void RegisterScoreColorMap(G4VScoreColorMap* colorMap);
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 G4VScoringMesh* FindMesh(G4String);
87 void List() const;
88 void Dump() const;
89 void DrawMesh(G4String meshName,G4String psName,G4String colorMapName,G4int axflg=111);
90 void DrawMesh(G4String meshName,G4String psName,G4int idxPlane,G4int iColumn,G4String colorMapName);
91 void DumpQuantityToFile(G4String meshName, G4String psName,G4String fileName, G4String option = "");
92 void DumpAllQuantitiesToFile(G4String meshName, G4String fileName, G4String option = "");
93 G4VScoreColorMap* GetScoreColorMap(G4String mapName);
94 void ListScoreColorMaps();
95
96 private:
97 static G4ScoringManager * fSManager;
98 static G4int replicaLevel;
99 G4int verboseLevel;
100 G4ScoringMessenger* fMessenger;
101 G4ScoreQuantityMessenger* fQuantityMessenger;
102
103 MeshVec fMeshVec;
104 G4VScoringMesh* fCurrentMesh;
105
106 G4VScoreWriter * writer;
107 G4VScoreColorMap * fDefaultLinearColorMap;
108 ColorMapDict * fColorMapDict;
109
110 public:
111 inline void SetCurrentMesh(G4VScoringMesh* cm)
112 { fCurrentMesh = cm; }
113 inline G4VScoringMesh* GetCurrentMesh() const
114 { return fCurrentMesh; }
115 inline void CloseCurrentMesh()
116 { fCurrentMesh = 0; }
117 inline void SetVerboseLevel(G4int vl)
118 {
119 verboseLevel = vl;
120 for(MeshVecItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
121 (*itr)->SetVerboseLevel(vl);
122 }
123 if(writer) writer->SetVerboseLevel(vl);
124 }
125 inline G4int GetVerboseLevel() const
126 { return verboseLevel; }
127 inline size_t GetNumberOfMesh() const
128 { return fMeshVec.size(); }
129 inline void RegisterScoringMesh(G4VScoringMesh * sm)
130 {
131 sm->SetVerboseLevel(verboseLevel);
132 fMeshVec.push_back(sm);
133 SetCurrentMesh(sm);
134 }
135 inline G4VScoringMesh* GetMesh(G4int i) const
136 { return fMeshVec[i]; }
137 inline G4String GetWorldName(G4int i) const
138 { return fMeshVec[i]->GetWorldName(); }
139
140 public: // with description
141 inline void SetScoreWriter(G4VScoreWriter * sw)
142 {
143 if(writer) { delete writer; }
144 writer = sw;
145 if(writer) writer->SetVerboseLevel(verboseLevel);
146 }
147 // Replace score writers.
148};
149
150
151
152
153#endif
154
Note: See TracBrowser for help on using the repository browser.