2 // Category: digits+hits
4 // See the class description in the header file.
6 #include "TG4SDManager.h"
7 #include "TG4VSDConstruction.h"
8 #include "TG4SDServices.h"
9 #include "TG4Globals.h"
11 TG4SDManager* TG4SDManager::fgInstance = 0;
13 //_____________________________________________________________________________
14 TG4SDManager::TG4SDManager(TG4VSDConstruction* sdConstruction)
15 : fSDConstruction(sdConstruction) {
18 TG4Globals::Exception(
19 "TG4SDManager: attempt to create two instances of singleton.");
23 fSDServices = new TG4SDServices();
26 //_____________________________________________________________________________
27 TG4SDManager::TG4SDManager(const TG4SDManager& right) {
29 TG4Globals::Exception(
30 "Attempt to copy TG4SDManager singleton.");
34 //_____________________________________________________________________________
35 TG4SDManager::TG4SDManager() {
37 TG4Globals::Exception(
38 "TG4SDManager has protected the default constructor.");
42 //_____________________________________________________________________________
43 TG4SDManager::~TG4SDManager(){
51 //_____________________________________________________________________________
52 TG4SDManager& TG4SDManager::operator=(const TG4SDManager& right)
54 // check assignement to self
55 if (this == &right) return *this;
57 TG4Globals::Exception(
58 "Attempt to assign TG4SDManager singleton.");
66 //_____________________________________________________________________________
67 void TG4SDManager::Initialize()
69 // Creates sensitive detectors,
70 // sets second indexes for materials (corresponding to G3 tracking
71 // media) and clears remaing G3 tables.
74 fSDConstruction->Construct();
78 //_____________________________________________________________________________
79 Int_t TG4SDManager::VolId(const Text_t* volName) const
81 // Returns the sensitive detector identifier.
84 return fSDServices->GetVolumeID(volName);
88 //_____________________________________________________________________________
89 const char* TG4SDManager::VolName(Int_t id) const
91 // Returns the name of the sensitive detector with the given identifier.
94 return fSDServices->GetVolumeName(id);
98 //_____________________________________________________________________________
99 Int_t TG4SDManager::NofVolumes() const
101 // Returns the total number of sensitive detectors.
104 return fSDServices->NofSensitiveDetectors();
108 //_____________________________________________________________________________
109 Int_t TG4SDManager::VolId2Mate(Int_t volumeId) const
111 // Return the material number for a given volume id
114 return fSDServices->GetMediumId(volumeId);