]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/AliSensitiveDetector.cxx
added unit to energy deposit
[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
10 #include "TG3Units.h"
11
12 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module)
13   : TG4VSensitiveDetector(sdName),
14     fModule(module)
15 {
16 //
17 }
18
19 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module, 
20                                            G4int id)
21   : TG4VSensitiveDetector(sdName, id),
22     fModule(module)
23 {
24 //
25 }
26
27 AliSensitiveDetector::AliSensitiveDetector(const AliSensitiveDetector& right)
28   : TG4VSensitiveDetector(right)
29 {
30 //
31   fModule = right.fModule;
32 }  
33   
34 AliSensitiveDetector::AliSensitiveDetector(){
35 //
36 }
37
38 AliSensitiveDetector::~AliSensitiveDetector() {
39 //
40 }
41
42 // operators
43
44 AliSensitiveDetector& 
45 AliSensitiveDetector::operator=(const AliSensitiveDetector& right)
46 {
47   // check assignement to self
48   if (this == &right) return *this;
49
50   // base class assignement
51   TG4VSensitiveDetector::operator=(right);
52
53   fModule = right.fModule;
54
55   return *this;  
56 }    
57           
58 // public methods
59
60 void AliSensitiveDetector::UserProcessHits(const G4Track* track, 
61                                            const G4Step* step)
62 {
63 // Calls StepManager of associated AliModule.
64 // ---
65
66   // add energy deposit of the current step
67   // directly to AliRun
68   if (step) 
69     gAlice->AddEnergyDeposit(
70       fID, step->GetTotalEnergyDeposit()/TG3Units::Energy());
71
72   // parent ID -> shunt
73   G4int parentID = track->GetParentID();
74   Int_t shunt = 0;
75   if (parentID==0) shunt = 1;
76   fModule->SetIshunt(shunt);
77
78   fModule->StepManager();
79 }
80