]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/AliSensitiveDetector.cxx
moving TG4G3Cut/Control, TG4G3Cut/ControlVector from physics commented
[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   fModule = right.fModule;
37 }  
38   
39 AliSensitiveDetector::AliSensitiveDetector(){
40 //
41 }
42
43 AliSensitiveDetector::~AliSensitiveDetector() {
44 //
45 }
46
47 // operators
48
49 AliSensitiveDetector& 
50 AliSensitiveDetector::operator=(const AliSensitiveDetector& right)
51 {
52   // check assignement to self
53   if (this == &right) return *this;
54
55   // base class assignement
56   TG4VSensitiveDetector::operator=(right);
57
58   fModule = right.fModule;
59
60   return *this;  
61 }    
62           
63 // public methods
64
65 void AliSensitiveDetector::Initialize(G4HCofThisEvent*HCE) 
66 {
67 // This method is called by G4 kernel at the beginning of event action
68 // before user defined BeginOfEventAction() method.
69 // ---
70
71   fModuleID = gAlice->GetModuleID(fModule->GetName());
72   fMCQA = gAlice->GetMCQA();
73 }  
74   
75   
76 void AliSensitiveDetector::UserProcessHits(const G4Track* track, 
77                                            const G4Step* step)
78 {
79 // Calls StepManager of associated AliModule.
80 // ---
81
82   // add energy deposit of the current step
83   // directly to AliRun
84   if (step) 
85     gAlice->AddEnergyDeposit(
86       fID, step->GetTotalEnergyDeposit()/TG4G3Units::Energy());
87       
88   fMCQA->StepManager(fModuleID);   
89
90   // let AliModule process the step
91   fModule->StepManager();
92 }
93