]>
Commit | Line | Data |
---|---|---|
676fb573 | 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" | |
4f8bb95c | 9 | #include "AliMCQA.h" |
676fb573 | 10 | |
735712bc | 11 | #include "TG4G3Units.h" |
51fecabd | 12 | |
676fb573 | 13 | AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module) |
14 | : TG4VSensitiveDetector(sdName), | |
4f8bb95c | 15 | fModule(module), |
16 | fModuleID(0), | |
17 | fMCQA(0) | |
676fb573 | 18 | { |
19 | // | |
20 | } | |
21 | ||
22 | AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module, | |
23 | G4int id) | |
24 | : TG4VSensitiveDetector(sdName, id), | |
4f8bb95c | 25 | fModule(module), |
26 | fModuleID(0), | |
27 | fMCQA(0) | |
676fb573 | 28 | { |
29 | // | |
30 | } | |
31 | ||
32 | AliSensitiveDetector::AliSensitiveDetector(const AliSensitiveDetector& right) | |
33 | : TG4VSensitiveDetector(right) | |
34 | { | |
35 | // | |
36 | fModule = right.fModule; | |
676fb573 | 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; | |
676fb573 | 59 | |
60 | return *this; | |
61 | } | |
62 | ||
63 | // public methods | |
64 | ||
4f8bb95c | 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 | ||
9bcb6317 | 76 | void AliSensitiveDetector::UserProcessHits(const G4Track* track, |
77 | const G4Step* step) | |
676fb573 | 78 | { |
9bcb6317 | 79 | // Calls StepManager of associated AliModule. |
676fb573 | 80 | // --- |
81 | ||
82 | // add energy deposit of the current step | |
83 | // directly to AliRun | |
51fecabd | 84 | if (step) |
85 | gAlice->AddEnergyDeposit( | |
735712bc | 86 | fID, step->GetTotalEnergyDeposit()/TG4G3Units::Energy()); |
4f8bb95c | 87 | |
88 | fMCQA->StepManager(fModuleID); | |
676fb573 | 89 | |
103dbacd | 90 | // let AliModule process the step |
676fb573 | 91 | fModule->StepManager(); |
676fb573 | 92 | } |
93 |