]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/AliSensitiveDetector.cxx
Updated class description: added class title, author;
[u/mrichter/AliRoot.git] / AliGeant4 / AliSensitiveDetector.cxx
1 // $Id$ //
2 // Category: digits+hits
3 //
4 // See the class description in the header file.
5
6 #include "AliSensitiveDetector.h"
7 #include "AliModule.h" 
8 #include "AliRun.h"
9 #include "AliMCQA.h"
10
11 #include "TG4G3Units.h"
12
13 //_____________________________________________________________________________
14 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module)
15   : TG4VSensitiveDetector(sdName),
16     fModule(module),
17     fModuleID(0),
18     fMCQA(0)
19 {
20 //
21 }
22
23 //_____________________________________________________________________________
24 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module, 
25                                            G4int id)
26   : TG4VSensitiveDetector(sdName, id),
27     fModule(module),
28     fModuleID(0),
29     fMCQA(0)
30 {
31 //
32 }
33
34 //_____________________________________________________________________________
35 AliSensitiveDetector::AliSensitiveDetector(const AliSensitiveDetector& right)
36   : TG4VSensitiveDetector(right)
37 {
38 //
39   // copy stuff
40   *this = right;
41 }  
42   
43 //_____________________________________________________________________________
44 AliSensitiveDetector::AliSensitiveDetector(){
45 //
46 }
47
48 //_____________________________________________________________________________
49 AliSensitiveDetector::~AliSensitiveDetector() {
50 //
51 }
52
53 // operators
54
55 //_____________________________________________________________________________
56 AliSensitiveDetector& 
57 AliSensitiveDetector::operator=(const AliSensitiveDetector& right)
58 {
59   // check assignement to self
60   if (this == &right) return *this;
61
62   // base class assignement
63   TG4VSensitiveDetector::operator=(right);
64
65   fModule = right.fModule;
66
67   return *this;  
68 }    
69           
70 // public methods
71
72 //_____________________________________________________________________________
73 void AliSensitiveDetector::Initialize(G4HCofThisEvent*HCE) 
74 {
75 // This method is called by G4 kernel at the beginning of event action
76 // before user defined BeginOfEventAction() method.
77 // ---
78
79   fModuleID = gAlice->GetModuleID(fModule->GetName());
80   fMCQA = gAlice->GetMCQA();
81 }  
82   
83   
84 //_____________________________________________________________________________
85 void AliSensitiveDetector::UserProcessHits(const G4Track* track, 
86                                            const G4Step* step)
87 {
88 // Calls StepManager of associated AliModule.
89 // ---
90
91   // add energy deposit of the current step
92   // directly to AliRun
93   if (step) 
94     gAlice->AddEnergyDeposit(
95       fID, step->GetTotalEnergyDeposit()/TG4G3Units::Energy());
96       
97   fMCQA->StepManager(fModuleID);   
98
99   // let AliModule process the step
100   fModule->StepManager();
101 }
102