Geant4  10.01.p03
G4DigiManager.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 // $Id: G4DigiManager.hh 80987 2014-05-19 10:50:22Z gcosmo $
28 //
29 
30 #ifndef G4DigiManager_h
31 #define G4DigiManager_h 1
32 
33 #include "globals.hh"
34 class G4Event;
35 #include "G4VDigitizerModule.hh"
36 class G4VHitsCollection;
37 class G4VDigiCollection;
38 class G4DMmessenger;
39 #include "G4DCtable.hh"
40 class G4RunManager;
41 class G4SDManager;
42 //#include "g4rw/tpordvec.h"
43 #include <vector>
44 
45 // class description:
46 //
47 // This is a singleton class which manages the digitizer modules.
48 // The user cannot access to the constructor. The pointer of the
49 // only existing object can be got via G4DigiManager::GetDMpointer()
50 // static method. The first invokation in the program makes the
51 // singleton object.
52 //
53 
55 {
56  public: // with description
57  static G4DigiManager* GetDMpointer();
58  // Returns the pointer to the singleton object
59  public:
61 
62  protected:
63  G4DigiManager();
64 
65  public:
67 
68  public: // with description
70  // Registers the user's digitizer mudule. This method must be invoked when
71  // the user construct his/her digitizer module(s).
72  void Digitize(G4String mName);
73  // Invokes Digitize() method of specified digitizer module. This is a kind
74  // of service method. The user can invoke Digitize() method of a particular
75  // module without knowing the pointer of the module object. The argument
76  // "mName" is the name of the module, which is defined at the constructor
77  // of the concrete digitizer module.
79  // Returns the pointer to the digitizer module object with the given name.
80  // Null will be returned if the name is not defined.
81  const G4VHitsCollection* GetHitsCollection(G4int HCID, G4int eventID = 0);
82  const G4VDigiCollection* GetDigiCollection(G4int DCID, G4int eventID = 0);
83  // These two methods return the pointer to the hits and digi collection
84  // object, respectively. "HCID" and "DCID" are the ID numbers of hits and
85  // digi collections, which can be obtained vir the next two methods.
86  // If "eventID" is greater than zero, corresponding hits or digi collection
87  // of "eventID" prevuois event is returned so that event overlap can be
88  // handled. To do this, necessary number of events must be set to G4RunManager
89  // by G4RunManager::SetNumberOfEventsToBeStored() method previously to the
90  // event loop.
93  // Returns the ID number of hits and digi collections, respectively. "HCname"
94  // and "DCname" can be the collection name if it is unique, or can be detector
95  // or module name and the collection name connected by "/".
96  void SetDigiCollection(G4int DCID, G4VDigiCollection* aDC);
97  // This method must exclusively used by the base class of G4VDigitizerModule.
98  // To set digi collection, the user must use SetDigiCollection of G4VDigitizerModule.
99 
100  public:
101  void SetVerboseLevel(G4int vl);
102  void List() const;
103 
104  private:
107  std::vector<G4VDigitizerModule*> DMtable;
112 
113  public:
114  inline G4int GetVerboseLevel() const
115  { return verboseLevel; }
117  { return DCtable->entries(); }
118  inline G4int GetModuleCapacity() const
119  { return DMtable.size(); }
120  inline G4DCtable* GetDCtable() const
121  { return DCtable; }
122  inline void RestoreDCtable(G4DCtable* dc)
123  {
124  if(DCtable) delete DCtable;
125  DCtable = dc;
126  }
127  private:
128  //Disable copy constructor and assignement operator
131 };
132 
133 
134 
135 
136 #endif
137 
std::vector< G4VDigitizerModule * > DMtable
G4int entries() const
Definition: G4DCtable.hh:66
static G4DigiManager * GetDMpointer()
G4DigiManager & operator=(const G4DigiManager &)
void SetVerboseLevel(G4int vl)
#define G4ThreadLocal
Definition: tls.hh:89
const G4VHitsCollection * GetHitsCollection(G4int HCID, G4int eventID=0)
int G4int
Definition: G4Types.hh:78
G4int GetVerboseLevel() const
G4DCtable * GetDCtable() const
G4int GetHitsCollectionID(G4String HCname)
static G4DigiManager * GetDMpointerIfExist()
void Digitize(G4String mName)
void SetDigiCollection(G4int DCID, G4VDigiCollection *aDC)
G4SDManager * SDManager
void AddNewModule(G4VDigitizerModule *DM)
G4int GetDigiCollectionID(G4String DCname)
G4DCtable * DCtable
static G4ThreadLocal G4DigiManager * fDManager
G4RunManager * runManager
G4int GetCollectionCapacity() const
void RestoreDCtable(G4DCtable *dc)
G4DMmessenger * theMessenger
void List() const
const G4VDigiCollection * GetDigiCollection(G4int DCID, G4int eventID=0)
G4int GetModuleCapacity() const
G4VDigitizerModule * FindDigitizerModule(G4String mName)