]>
Commit | Line | Data |
---|---|---|
8d3676ae | 1 | // $Id$ |
2 | // Category: digits+hits | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "TG4SDManager.h" | |
7 | #include "TG4VSDConstruction.h" | |
8 | #include "TG4SDServices.h" | |
9 | #include "TG4GeometryManager.h" | |
10 | ||
11 | TG4SDManager* TG4SDManager::fgInstance = 0; | |
12 | ||
13 | //_____________________________________________________________________________ | |
14 | TG4SDManager::TG4SDManager(TG4VSDConstruction* sdConstruction) | |
15 | : fSDConstruction(sdConstruction) { | |
16 | // | |
17 | if (fgInstance) | |
18 | TG4Globals::Exception( | |
19 | "TG4SDManager: attempt to create two instances of singleton."); | |
20 | ||
21 | fgInstance = this; | |
22 | ||
23 | fSDServices = new TG4SDServices(); | |
24 | } | |
25 | ||
26 | //_____________________________________________________________________________ | |
27 | TG4SDManager::~TG4SDManager(){ | |
28 | // | |
29 | ||
30 | delete fSDServices; | |
31 | } | |
32 | ||
33 | // public methods | |
34 | ||
35 | //_____________________________________________________________________________ | |
36 | void TG4SDManager::Initialize() | |
37 | { | |
38 | // Creates sensitive detectors, | |
39 | // sets second indexes for materials (corresponding to G3 tracking | |
40 | // media) and clears remaing G3 tables. | |
41 | // --- | |
42 | ||
43 | fSDConstruction->Construct(); | |
44 | TG4GeometryManager::Instance()->FillMediumIdVector(); | |
45 | } | |
46 | ||
47 | ||
48 | //_____________________________________________________________________________ | |
49 | Int_t TG4SDManager::VolId(const Text_t* volName) const | |
50 | { | |
51 | // Returns the sensitive detector identifier. | |
52 | // --- | |
53 | ||
54 | return fSDServices->GetVolumeID(volName); | |
55 | } | |
56 | ||
57 | ||
58 | //_____________________________________________________________________________ | |
59 | const char* TG4SDManager::VolName(Int_t id) const | |
60 | { | |
61 | // Returns the name of the sensitive detector with the given identifier. | |
62 | // --- | |
63 | ||
64 | return fSDServices->GetVolumeName(id); | |
65 | } | |
66 | ||
67 | ||
68 | //_____________________________________________________________________________ | |
69 | Int_t TG4SDManager::NofVolumes() const | |
70 | { | |
71 | // Returns the total number of sensitive detectors. | |
72 | // --- | |
73 | ||
74 | return fSDServices->NofSensitiveDetectors(); | |
75 | } | |
76 | ||
77 | ||
78 | //_____________________________________________________________________________ | |
79 | Int_t TG4SDManager::VolId2Mate(Int_t volumeId) const | |
80 | { | |
81 | // Return the material number for a given volume id | |
82 | // --- | |
83 | ||
84 | return fSDServices->GetMediumId(volumeId); | |
85 | } | |
86 |