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