]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - AliGeant4/AliSensitiveDetector.cxx
Bugfix; Need Init(slice,patch)
[u/mrichter/AliRoot.git] / AliGeant4 / AliSensitiveDetector.cxx
index 4e6c50cf902498a6a3568d438ae0b8ad342167df..6c0313c3fe908dcf8910ac11a887f89f1d122aa7 100644 (file)
@@ -1,49 +1,62 @@
 // $Id$ //
-// Category: geometry
+// Category: digits+hits
 //
+// Author: I. Hrivnacova
+//
+// Class AliSensitiveDetector
+// --------------------------
 // See the class description in the header file.
 
 #include "AliSensitiveDetector.h"
 #include "AliModule.h" 
 #include "AliRun.h"
+#include "AliMCQA.h"
 
-#include "TG4StepManager.h"
+#include "TG4G3Units.h"
 
+//_____________________________________________________________________________
 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module)
   : TG4VSensitiveDetector(sdName),
     fModule(module),
-    fStepManager(TG4StepManager::Instance())
+    fModuleID(0),
+    fMCQA(0)
 {
 //
 }
 
+//_____________________________________________________________________________
 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module, 
                                            G4int id)
   : TG4VSensitiveDetector(sdName, id),
     fModule(module),
-    fStepManager(TG4StepManager::Instance())
+    fModuleID(0),
+    fMCQA(0)
 {
 //
 }
 
+//_____________________________________________________________________________
 AliSensitiveDetector::AliSensitiveDetector(const AliSensitiveDetector& right)
   : TG4VSensitiveDetector(right)
 {
 //
-  fModule = right.fModule;
-  fStepManager = right.fStepManager;
+  // copy stuff
+  *this = right;
 }  
   
+//_____________________________________________________________________________
 AliSensitiveDetector::AliSensitiveDetector(){
 //
 }
 
+//_____________________________________________________________________________
 AliSensitiveDetector::~AliSensitiveDetector() {
 //
 }
 
 // operators
 
+//_____________________________________________________________________________
 AliSensitiveDetector& 
 AliSensitiveDetector::operator=(const AliSensitiveDetector& right)
 {
@@ -54,66 +67,40 @@ AliSensitiveDetector::operator=(const AliSensitiveDetector& right)
   TG4VSensitiveDetector::operator=(right);
 
   fModule = right.fModule;
-  fStepManager = right.fStepManager;
 
   return *this;  
 }    
           
 // public methods
 
-void AliSensitiveDetector::Initialize(G4HCofThisEvent* hc)
+//_____________________________________________________________________________
+void AliSensitiveDetector::Initialize(G4HCofThisEvent*HCE) 
 {
-// This method is called at the beginning of event action
+// This method is called by G4 kernel at the beginning of event action
 // before user defined BeginOfEventAction() method.
-}
+// ---
 
-G4bool AliSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*)
+  fModuleID = gAlice->GetModuleID(fModule->GetName());
+  fMCQA = gAlice->GetMCQA();
+}  
+  
+  
+//_____________________________________________________________________________
+void AliSensitiveDetector::UserProcessHits(const G4Track* track, 
+                                           const G4Step* step)
 {
-// Calls StepManager of associated AliModules.
+// Calls StepManager of associated AliModule.
 // ---
 
   // add energy deposit of the current step
   // directly to AliRun
-  G4int copy;
-  gAlice->AddEnergyDeposit(fID, step->GetTotalEnergyDeposit());
-
-  // parent ID -> shunt
-  G4int parentID
-    = step->GetTrack()->GetParentID();
-  Int_t shunt = 0;
-  if (parentID==0) shunt = 1;
-  fModule->SetIshunt(shunt);
-
-  if ((step->GetPreStepPoint()->GetStepStatus() == fGeomBoundary) ||
-      (step->GetTrack()->GetCurrentStepNumber() == 1) ){
-
-    // if first step or crossing boundary
-    // let AliModule process step in PreStepPoint
-    // (this ensures compatibility with G3 that
-    // makes additional step of zero length) 
-
-    fStepManager->SetStep(step, kPreStepPoint);
-    fModule->StepManager();
-  }  
-
-  // let AliModule process step
-  fStepManager->SetStep(step, kPostStepPoint);
-  fModule->StepManager();
+  if (step) 
+    gAlice->AddEnergyDeposit(
+      fID, step->GetTotalEnergyDeposit()/TG4G3Units::Energy());
+      
+  fMCQA->StepManager(fModuleID);   
 
-  return true;
-}
-
-void AliSensitiveDetector::EndOfEvent(G4HCofThisEvent* hce){
-//
+  // let AliModule process the step
+  fModule->StepManager();
 }
 
-//void AliSensitiveDetector::clear()
-//{} 
-
-void AliSensitiveDetector::PrintAll() {
-//
-} 
-
-void AliSensitiveDetector::DrawAll() {
-//
-}