]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - AliGeant4/AliSensitiveDetector.cxx
Fix for multiple events per file: inhibit decrease of size of fParticleFileMap.
[u/mrichter/AliRoot.git] / AliGeant4 / AliSensitiveDetector.cxx
index 4e6c50cf902498a6a3568d438ae0b8ad342167df..30a167cc46fe85a1221a78f97f73df52aa18d9ab 100644 (file)
@@ -6,13 +6,15 @@
 #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)
 {
 //
 }
@@ -21,7 +23,8 @@ AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module,
                                            G4int id)
   : TG4VSensitiveDetector(sdName, id),
     fModule(module),
-    fStepManager(TG4StepManager::Instance())
+    fModuleID(0),
+    fMCQA(0)
 {
 //
 }
@@ -31,7 +34,6 @@ AliSensitiveDetector::AliSensitiveDetector(const AliSensitiveDetector& right)
 {
 //
   fModule = right.fModule;
-  fStepManager = right.fStepManager;
 }  
   
 AliSensitiveDetector::AliSensitiveDetector(){
@@ -54,66 +56,38 @@ 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();
-
-  return true;
-}
+  if (step) 
+    gAlice->AddEnergyDeposit(
+      fID, step->GetTotalEnergyDeposit()/TG4G3Units::Energy());
+      
+  fMCQA->StepManager(fModuleID);   
 
-void AliSensitiveDetector::EndOfEvent(G4HCofThisEvent* hce){
-//
+  // let AliModule process the step
+  fModule->StepManager();
 }
 
-//void AliSensitiveDetector::clear()
-//{} 
-
-void AliSensitiveDetector::PrintAll() {
-//
-} 
-
-void AliSensitiveDetector::DrawAll() {
-//
-}