]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4VSensitiveDetector.cxx
numbering of SDs changed to start from 1 (required in printing tables of energy depos...
[u/mrichter/AliRoot.git] / TGeant4 / TG4VSensitiveDetector.cxx
1 // $Id$ //
2 // Category: geometry
3 //
4 // See the class description in the header file.
5
6 #include "TG4VSensitiveDetector.h"
7 #include "TG4StepManager.h"
8
9 G4int TG4VSensitiveDetector::fgSDCounter = 0;
10
11 TG4VSensitiveDetector::TG4VSensitiveDetector(G4String sdName)
12   : G4VSensitiveDetector(sdName),
13     fStepManager(TG4StepManager::Instance())
14 {
15 //
16   fID = ++fgSDCounter;
17 }
18
19 TG4VSensitiveDetector::TG4VSensitiveDetector(G4String sdName, G4int id)
20   : G4VSensitiveDetector(sdName),
21     fID(id),
22     fStepManager(TG4StepManager::Instance())
23
24 {
25 //
26   ++fgSDCounter;
27 }
28
29 TG4VSensitiveDetector::TG4VSensitiveDetector(
30                                     const TG4VSensitiveDetector& right)
31   : G4VSensitiveDetector(right)
32 {                                   
33 //
34   fID = right.fID;
35   fStepManager = right.fStepManager;
36
37   ++fgSDCounter;;
38 }
39
40 TG4VSensitiveDetector::TG4VSensitiveDetector()
41   : G4VSensitiveDetector("") 
42 {
43 //
44 }
45
46 TG4VSensitiveDetector::~TG4VSensitiveDetector() {
47 //
48 }
49
50 // operators
51
52 TG4VSensitiveDetector& TG4VSensitiveDetector::operator=(
53                                     const TG4VSensitiveDetector &right)
54 {
55   // check assignement to self
56   if (this == &right) return *this;
57
58   // base class assignement
59   TG4VSensitiveDetector::operator=(right);
60   
61   fID = right.fID;
62   fStepManager = right.fStepManager;
63   
64   return *this;
65 }
66
67 // public methods
68
69 G4bool TG4VSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*)
70 {
71 // Calls StepManager of associated AliModule.
72 // ---
73
74   // let AliModule process step
75   fStepManager->SetStep(step, kNormalStep);
76   UserProcessHits(step->GetTrack(), step);
77
78   return true;
79 }
80
81 G4bool TG4VSensitiveDetector::ProcessHitsOnBoundary(G4Step* step)
82 {
83 // Calls StepManager of associated AliModule
84 // when crossing a geometrical boundary.
85 // ---
86
87   fStepManager->SetStep(step, kBoundary);
88   UserProcessHits(step->GetTrack(), step);
89
90   return true;
91 }
92