]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TGeant4/TG4SDManager.cxx
Cosmetic
[u/mrichter/AliRoot.git] / TGeant4 / TG4SDManager.cxx
CommitLineData
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"
9f5eaf0b 9#include "TG4Globals.h"
8d3676ae 10
11TG4SDManager* TG4SDManager::fgInstance = 0;
12
13//_____________________________________________________________________________
14TG4SDManager::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
9f5eaf0b 26//_____________________________________________________________________________
27TG4SDManager::TG4SDManager(const TG4SDManager& right) {
28//
29 TG4Globals::Exception(
30 "Attempt to copy TG4SDManager singleton.");
31}
32
33
34//_____________________________________________________________________________
35TG4SDManager::TG4SDManager() {
36//
37 TG4Globals::Exception(
38 "TG4SDManager has protected the default constructor.");
39}
40
41
8d3676ae 42//_____________________________________________________________________________
43TG4SDManager::~TG4SDManager(){
44//
45
46 delete fSDServices;
47}
48
9f5eaf0b 49// operators
50
51//_____________________________________________________________________________
52TG4SDManager& TG4SDManager::operator=(const TG4SDManager& right)
53{
54 // check assignement to self
55 if (this == &right) return *this;
56
57 TG4Globals::Exception(
58 "Attempt to assign TG4SDManager singleton.");
59
60 return *this;
61}
62
63
8d3676ae 64// public methods
65
66//_____________________________________________________________________________
67void TG4SDManager::Initialize()
68{
69// Creates sensitive detectors,
70// sets second indexes for materials (corresponding to G3 tracking
71// media) and clears remaing G3 tables.
72// ---
73
74 fSDConstruction->Construct();
8d3676ae 75}
76
77
78//_____________________________________________________________________________
79Int_t TG4SDManager::VolId(const Text_t* volName) const
80{
81// Returns the sensitive detector identifier.
82// ---
83
84 return fSDServices->GetVolumeID(volName);
85}
86
87
88//_____________________________________________________________________________
89const char* TG4SDManager::VolName(Int_t id) const
90{
91// Returns the name of the sensitive detector with the given identifier.
92// ---
93
94 return fSDServices->GetVolumeName(id);
95}
96
97
98//_____________________________________________________________________________
99Int_t TG4SDManager::NofVolumes() const
100{
101// Returns the total number of sensitive detectors.
102// ---
103
104 return fSDServices->NofSensitiveDetectors();
105}
106
107
108//_____________________________________________________________________________
109Int_t TG4SDManager::VolId2Mate(Int_t volumeId) const
110{
111// Return the material number for a given volume id
112// ---
113
114 return fSDServices->GetMediumId(volumeId);
115}
116