updated for major upgrade of TG4StepManager (more in doc/history/g4mc_event_History)
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Oct 2000 10:59:01 +0000 (10:59 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Oct 2000 10:59:01 +0000 (10:59 +0000)
AliGeant4/AliLegoSensitiveDetector.cxx
AliGeant4/AliLegoSensitiveDetector.h
AliGeant4/AliSensitiveDetector.cxx
AliGeant4/AliSensitiveDetector.h
AliGeant4/AliSteppingAction.cxx
AliGeant4/AliSteppingAction.h
AliGeant4/AliTrackingAction.cxx
AliGeant4/AliTrackingAction.h
TGeant4/TG4VSensitiveDetector.cxx
TGeant4/TG4VSensitiveDetector.h

index ef70a34a3d9c57d5ef814510cc1550435f65027f..e188729072132d2e2f7e6b88d3fde5896e06484f 100644 (file)
@@ -6,15 +6,12 @@
 #include "AliLegoSensitiveDetector.h"
 #include "AliLego.h"
 
-#include "TG4StepManager.h"
-
 AliLegoSensitiveDetector::AliLegoSensitiveDetector(
                              G4String name, AliLego* lego, 
                             G4VSensitiveDetector* standardSD)
   : TG4VSensitiveDetector(name),
     fLego(lego),
-    fStandardSD(standardSD),
-    fStepManager(TG4StepManager::Instance())
+    fStandardSD(standardSD)
 {
 //
 }
@@ -26,7 +23,6 @@ AliLegoSensitiveDetector::AliLegoSensitiveDetector(
 //
   fLego = right.fLego;
   fStandardSD = right.fStandardSD;
-  fStepManager = right.fStepManager;
 }
 
 AliLegoSensitiveDetector::AliLegoSensitiveDetector() {
@@ -50,42 +46,19 @@ AliLegoSensitiveDetector::operator=(const AliLegoSensitiveDetector &right)
 
   fLego = right.fLego;
   fStandardSD = right.fStandardSD;
-  fStepManager = right.fStepManager;
   
   return *this;
 }
 
 // public methods
 
-void AliLegoSensitiveDetector::Initialize(G4HCofThisEvent* hc)
-{
-// This method is called at the beginning of event action
-// before user defined BeginOfEventAction() method.
-}
-
-G4bool AliLegoSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*)
+void AliLegoSensitiveDetector::UserProcessHits(const G4Track* track,
+                                               const G4Step* step)
 {
 // Calls StepManager of associated lego.
 // ---
 
   // let lego process step
-  fStepManager->SetStep(step, kPostStepPoint);
   fLego->StepManager();
-
-  return true;
-}
-
-void AliLegoSensitiveDetector::EndOfEvent(G4HCofThisEvent* hce){
-//
 }
 
-//void AliLegoSensitiveDetector::clear()
-//{} 
-
-void AliLegoSensitiveDetector::PrintAll() {
-//
-} 
-
-void AliLegoSensitiveDetector::DrawAll() {
-//
-} 
index b48ccacc39064cba298265e508fdb0b975a20596..ff9a9c522603d52bd48afffd35d6b3cb1ab73b7d 100644 (file)
@@ -13,7 +13,6 @@
 #include <globals.hh>
 
 class AliLego;
-class TG4StepManager;
 
 class G4HCofThisEvent;
 class G4Step;
@@ -32,12 +31,7 @@ class AliLegoSensitiveDetector : public TG4VSensitiveDetector
     AliLegoSensitiveDetector& operator=(const AliLegoSensitiveDetector& right);
 
     // methods
-    virtual void Initialize(G4HCofThisEvent* hc);
-    virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
-    virtual void EndOfEvent(G4HCofThisEvent* hce);
-    //virtual void clear();
-    virtual void PrintAll();
-    virtual void DrawAll();
+    virtual void UserProcessHits(const G4Track* track, const G4Step* step);
     
     // get methods
     G4VSensitiveDetector* GetStandardSD() const;
@@ -49,7 +43,6 @@ class AliLegoSensitiveDetector : public TG4VSensitiveDetector
     // data members
     AliLego*               fLego;        //lego from AliRoot
     G4VSensitiveDetector*  fStandardSD;  //standard sensitive detector
-    TG4StepManager*        fStepManager; //TG4StepManager
 };
 
 // inline methods
index 4e6c50cf902498a6a3568d438ae0b8ad342167df..92393c13573bcad4ab94b7658fb0dc852e978cb2 100644 (file)
@@ -7,12 +7,9 @@
 #include "AliModule.h" 
 #include "AliRun.h"
 
-#include "TG4StepManager.h"
-
 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module)
   : TG4VSensitiveDetector(sdName),
-    fModule(module),
-    fStepManager(TG4StepManager::Instance())
+    fModule(module)
 {
 //
 }
@@ -20,8 +17,7 @@ AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module)
 AliSensitiveDetector::AliSensitiveDetector(G4String sdName, AliModule* module, 
                                            G4int id)
   : TG4VSensitiveDetector(sdName, id),
-    fModule(module),
-    fStepManager(TG4StepManager::Instance())
+    fModule(module)
 {
 //
 }
@@ -31,7 +27,6 @@ AliSensitiveDetector::AliSensitiveDetector(const AliSensitiveDetector& right)
 {
 //
   fModule = right.fModule;
-  fStepManager = right.fStepManager;
 }  
   
 AliSensitiveDetector::AliSensitiveDetector(){
@@ -54,66 +49,28 @@ AliSensitiveDetector::operator=(const AliSensitiveDetector& right)
   TG4VSensitiveDetector::operator=(right);
 
   fModule = right.fModule;
-  fStepManager = right.fStepManager;
 
   return *this;  
 }    
           
 // public methods
 
-void AliSensitiveDetector::Initialize(G4HCofThisEvent* hc)
-{
-// This method is called at the beginning of event action
-// before user defined BeginOfEventAction() method.
-}
-
-G4bool AliSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*)
+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());
+  if (step) gAlice->AddEnergyDeposit(fID, step->GetTotalEnergyDeposit());
 
   // parent ID -> shunt
-  G4int parentID
-    = step->GetTrack()->GetParentID();
+  G4int parentID = track->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;
 }
 
-void AliSensitiveDetector::EndOfEvent(G4HCofThisEvent* hce){
-//
-}
-
-//void AliSensitiveDetector::clear()
-//{} 
-
-void AliSensitiveDetector::PrintAll() {
-//
-} 
-
-void AliSensitiveDetector::DrawAll() {
-//
-} 
index e06fda8fc6e04750d70e69f2630c211d1a27608f..382261559a1025289186893b70584fd31b15091f 100644 (file)
@@ -13,7 +13,6 @@
 #include <globals.hh>
 
 class AliModule;
-class TG4StepManager;
 
 class G4HCofThisEvent;
 class G4Step;
@@ -32,12 +31,7 @@ class AliSensitiveDetector : public TG4VSensitiveDetector
     AliSensitiveDetector& operator=(const AliSensitiveDetector& right);
   
     // methods
-    virtual void Initialize(G4HCofThisEvent* hc);
-    virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
-    virtual void EndOfEvent(G4HCofThisEvent* hce);
-    //virtual void clear();
-    virtual void PrintAll();
-    virtual void DrawAll();
+    virtual void UserProcessHits(const G4Track* track, const G4Step* step);
     
   protected:  
     AliSensitiveDetector();
@@ -45,7 +39,6 @@ class AliSensitiveDetector : public TG4VSensitiveDetector
   private:
     // data members
     AliModule*       fModule;      //AliModule
-    TG4StepManager*  fStepManager; //TG4StepManager
 };
 
 #endif //ALI_SENSITIVE_DETECTOR_H
index e3a68181f4b00a51706f02b1cd218ebce062efdf..0a29a454e3d33720fa993f89a7da2c7c04e70220 100644 (file)
@@ -98,9 +98,11 @@ void AliSteppingAction::PrintTrackInfo(const G4Track* track) const
 #endif
 }
 
+#include "AliMC.h"
+
 // public methods
 
-void AliSteppingAction::UserSteppingAction(const G4Step* step)
+void AliSteppingAction::SteppingAction(const G4Step* step)
 {
 // After processing the given number of steps (kCheckNofSteps)
 // the particle position is compared with the previus one
index dd2b351fa0628f2150feae104f359a2c0e6249d1..44fddba5406b5970251f8e5432bbc83df408e538 100644 (file)
@@ -7,7 +7,8 @@
 #ifndef ALI_STEPPING_ACTION_H
 #define ALI_STEPPING_ACTION_H
 
-#include <G4UserSteppingAction.hh>
+#include "TG4SteppingAction.h"
+
 #include <G4ThreeVector.hh>
 #include <globals.hh>
 
@@ -15,7 +16,7 @@ class AliSteppingActionMessenger;
 
 class G4Track;
 
-class AliSteppingAction : public G4UserSteppingAction
+class AliSteppingAction : public TG4SteppingAction
 {
   enum { 
     kCheckNofSteps = 100,
@@ -30,7 +31,7 @@ class AliSteppingAction : public G4UserSteppingAction
     virtual ~AliSteppingAction();
 
     // methods
-    virtual void UserSteppingAction(const G4Step* step);
+    virtual void SteppingAction(const G4Step* step);
     
     // set methods
     void SetLoopVerboseLevel(G4int level);
index 0a484ea9f95dbdf7a055b00f2a9308f506ae5335..0f873110d5b68ad79cc6699f219c215978538987 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "AliTrackingAction.h"
 #include "AliTrackingActionMessenger.h"
+#include "AliSensitiveDetector.h"
 #include "AliRun.h"
 #include "AliGlobals.h"  
 #include "TG4StepManager.h"
 #include <G4Track.hh>
 #include <G4Event.hh>
 #include <G4SDManager.hh>
+#include <G4VSensitiveDetector.hh>
 #include <G4VHitsCollection.hh>
 
 #include <TParticle.h>
-#include <TTree.h>
 
 // static data members
 AliTrackingAction* AliTrackingAction::fgInstance = 0;
@@ -94,7 +95,7 @@ void AliTrackingAction::PrepareNewEvent()
   pStepManager->SetSteppingManager(pG4StepManager);
 }
 
-void AliTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
+void AliTrackingAction::PreTrackingAction(const G4Track* aTrack)
 {
 // Called by G4 kernel before starting tracking.
 // ---
@@ -126,10 +127,10 @@ void AliTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
     //  by AlStackingAction in ClassifyNewTrack() method)
     G4String origin = "secondary"; 
     SaveParticle(aTrack, origin);
-  };
+  }
 }
 
-void AliTrackingAction::PostUserTrackingAction(const G4Track* aTrack)
+void AliTrackingAction::PostTrackingAction(const G4Track* aTrack)
 {
 // Called by G4 kernel after finishing tracking.
 // ---
index aa0134446e6623a129f4a12e17a72c9262ccda8d..f998be25b8de8f3ed3fcb27556a76d06275349cc 100644 (file)
@@ -6,7 +6,8 @@
 #ifndef ALI_TRACKING_ACTION_H
 #define ALI_TRACKING_ACTION_H
 
-#include <G4UserTrackingAction.hh>
+#include "TG4TrackingAction.h"
+
 #include <globals.hh>
 
 #include <TClonesArray.h>
@@ -15,7 +16,7 @@ class AliTrackingActionMessenger;
 
 class G4Track;
 
-class AliTrackingAction : public G4UserTrackingAction 
+class AliTrackingAction : public TG4TrackingAction 
 {
   public:
     AliTrackingAction();
@@ -28,8 +29,8 @@ class AliTrackingAction : public G4UserTrackingAction
 
     // methods
     void PrepareNewEvent();
-    virtual void PreUserTrackingAction(const G4Track* aTrack);
-    virtual void PostUserTrackingAction(const G4Track* aTrack);
+    virtual void PreTrackingAction(const G4Track* aTrack);
+    virtual void PostTrackingAction(const G4Track* aTrack);
     void SaveParticle(const G4Track* track, G4String processName);
     void SaveAndDestroyTrack();
 
index 962ac3589f371e3f4cb1e832ba476a3a6bc9df54..1b04cbbb98d4e1113f9a6ea1f37df940634027a3 100644 (file)
@@ -4,13 +4,13 @@
 // See the class description in the header file.
 
 #include "TG4VSensitiveDetector.h"
-
 #include "TG4StepManager.h"
 
 G4int TG4VSensitiveDetector::fgSDCounter = 0;
 
 TG4VSensitiveDetector::TG4VSensitiveDetector(G4String sdName)
-  : G4VSensitiveDetector(sdName)
+  : G4VSensitiveDetector(sdName),
+    fStepManager(TG4StepManager::Instance())
 {
 //
   fID = fgSDCounter++;
@@ -18,7 +18,9 @@ TG4VSensitiveDetector::TG4VSensitiveDetector(G4String sdName)
 
 TG4VSensitiveDetector::TG4VSensitiveDetector(G4String sdName, G4int id)
   : G4VSensitiveDetector(sdName),
-    fID(id)
+    fID(id),
+    fStepManager(TG4StepManager::Instance())
+
 {
 //
   fgSDCounter++;
@@ -30,6 +32,7 @@ TG4VSensitiveDetector::TG4VSensitiveDetector(
 {                                  
 //
   fID = right.fID;
+  fStepManager = right.fStepManager;
 
   fgSDCounter++;;
 }
@@ -56,6 +59,34 @@ TG4VSensitiveDetector& TG4VSensitiveDetector::operator=(
   TG4VSensitiveDetector::operator=(right);
   
   fID = right.fID;
+  fStepManager = right.fStepManager;
   
   return *this;
 }
+
+// public methods
+
+G4bool TG4VSensitiveDetector::ProcessHits(G4Step* step, G4TouchableHistory*)
+{
+// Calls StepManager of associated AliModule.
+// ---
+
+  // let AliModule process step
+  fStepManager->SetStep(step, kNormalStep);
+  UserProcessHits(step->GetTrack(), step);
+
+  return true;
+}
+
+G4bool TG4VSensitiveDetector::ProcessHitsOnBoundary(G4Step* step)
+{
+// Calls StepManager of associated AliModule
+// when crossing a geometrical boundary.
+// ---
+
+  fStepManager->SetStep(step, kBoundary);
+  UserProcessHits(step->GetTrack(), step);
+
+  return true;
+}
+
index 380049f1312eccdd79503572161331c19c7c5ade..624d0c5b4a7ecd5a8295757d1fbcfc85c057c08a 100644 (file)
@@ -1,7 +1,10 @@
 // $Id$
 // Category: geometry
 //
-// This class adds integer identifier data member to G4VSensitiveDetector
+// This class adds integer identifier data member to G4VSensitiveDetector.
+// It also takes care of setting step status (kBoundary, kNormalStep)
+// and passing G4Step to TG4StepManager before calling user derived
+// sensitive detector class. 
 
 #ifndef TG4V_SENSITIVE_DETECTOR_H
 #define TG4V_SENSITIVE_DETECTOR_H
@@ -9,6 +12,8 @@
 #include <G4VSensitiveDetector.hh>
 #include <globals.hh>
 
+class TG4StepManager;
+
 class TG4VSensitiveDetector : public G4VSensitiveDetector
 {
   public:
@@ -22,6 +27,13 @@ class TG4VSensitiveDetector : public G4VSensitiveDetector
     // operators
     TG4VSensitiveDetector& operator=(const TG4VSensitiveDetector &right);
 
+    // methods
+    virtual void UserProcessHits(const G4Track* track, const G4Step* step) = 0;
+                   // the following methods should not
+                  // be overwritten in a derived class
+    virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory* history);
+    virtual G4bool ProcessHitsOnBoundary(G4Step* step);
     // static get method
     static G4int GetTotalNofSensitiveDetectors();
 
@@ -32,7 +44,8 @@ class TG4VSensitiveDetector : public G4VSensitiveDetector
     TG4VSensitiveDetector(); 
 
     // data members
-    G4int  fID;                //sensitive detector ID
+    G4int  fID;                    //sensitive detector ID
+    TG4StepManager*  fStepManager; //TG4StepManager
     
   private:          
     // data members