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