]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/AliSensitiveDetector.cxx
New&delete used for array with variable size
[u/mrichter/AliRoot.git] / AliGeant4 / AliSensitiveDetector.cxx
1 // $Id$ //
2 // Category: geometry
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 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module)
14   : TG4VSensitiveDetector(sdName),
15     fModule(module),
16     fModuleID(0),
17     fMCQA(0)
18 {
19 //
20 }
21
22 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module, 
23                                            G4int id)
24   : TG4VSensitiveDetector(sdName, id),
25     fModule(module),
26     fModuleID(0),
27     fMCQA(0)
28 {
29 //
30 }
31
32 AliSensitiveDetector::AliSensitiveDetector(const AliSensitiveDetector& right)
33   : TG4VSensitiveDetector(right)
34 {
35 //
36   // copy stuff
37   *this = right;
38 }  
39   
40 AliSensitiveDetector::AliSensitiveDetector(){
41 //
42 }
43
44 AliSensitiveDetector::~AliSensitiveDetector() {
45 //
46 }
47
48 // operators
49
50 AliSensitiveDetector& 
51 AliSensitiveDetector::operator=(const AliSensitiveDetector& right)
52 {
53   // check assignement to self
54   if (this == &right) return *this;
55
56   // base class assignement
57   TG4VSensitiveDetector::operator=(right);
58
59   fModule = right.fModule;
60
61   return *this;  
62 }    
63           
64 // public methods
65
66 void AliSensitiveDetector::Initialize(G4HCofThisEvent*HCE) 
67 {
68 // This method is called by G4 kernel at the beginning of event action
69 // before user defined BeginOfEventAction() method.
70 // ---
71
72   fModuleID = gAlice->GetModuleID(fModule->GetName());
73   fMCQA = gAlice->GetMCQA();
74 }  
75   
76   
77 void AliSensitiveDetector::UserProcessHits(const G4Track* track, 
78                                            const G4Step* step)
79 {
80 // Calls StepManager of associated AliModule.
81 // ---
82
83   // add energy deposit of the current step
84   // directly to AliRun
85   if (step) 
86     gAlice->AddEnergyDeposit(
87       fID, step->GetTotalEnergyDeposit()/TG4G3Units::Energy());
88       
89   fMCQA->StepManager(fModuleID);   
90
91   // let AliModule process the step
92   fModule->StepManager();
93 }
94