]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - AliGeant4/AliSteppingAction.cxx
added Configure(); corrected Construct()
[u/mrichter/AliRoot.git] / AliGeant4 / AliSteppingAction.cxx
index 4af7f6fb63431446ab3f6403fb2e02789b5f71a5..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
@@ -140,6 +142,7 @@ void AliSteppingAction::UserSteppingAction(const G4Step* step)
     // detect looping track
     G4ThreeVector newStepPoint = step->GetPreStepPoint()->GetPosition();
     G4double trajectory = (newStepPoint-fKeptStepPoint).mag();
+    G4bool kill = false;
     if (trajectory < fgkTolerance) {
 
       // print looping info
@@ -147,6 +150,22 @@ void AliSteppingAction::UserSteppingAction(const G4Step* step)
         G4cout << "*** Particle is looping. ***" << G4endl;
        if (fStandardVerboseLevel == 0) PrintTrackInfo(track);
       }        
+      kill = true;
+    }
+    
+    if (stepNumber> kMaxNofSteps) { 
+      
+      // print looping info
+      if (fLoopVerboseLevel > 0) {
+        G4cout << "*** Particle reached max step number ("
+              << kMaxNofSteps << "). ***" << G4endl;
+       if (fStandardVerboseLevel == 0) PrintTrackInfo(track);
+      }        
+      kill = true;
+    }
+    
+    if (kill) {
+
       // set loop verbose level 
       fpSteppingManager->SetVerboseLevel(fLoopVerboseLevel);