check for max number of steps moved to TG4SteppingAction
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Feb 2001 14:50:58 +0000 (14:50 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Feb 2001 14:50:58 +0000 (14:50 +0000)
AliGeant4/AliSteppingAction.cxx
AliGeant4/AliSteppingAction.h
AliGeant4/AliSteppingActionMessenger.cxx
AliGeant4/AliSteppingActionMessenger.h

index 8390b244d04c182570e5537172a07bf13d80b0f7..774fffae1143685d94da4a6aac22f44640f72545 100644 (file)
 const G4double AliSteppingAction::fgkTolerance = 1e-6*mm;
 
 AliSteppingAction::AliSteppingAction()
-  : fKeptStepPoint(G4ThreeVector()),
-    fLoopVerboseLevel(1),
-    fStandardVerboseLevel(0),
-    fLoopStepCounter(0)
+  : fKeptStepPoint(G4ThreeVector())
 {
 //
   fMessenger = new AliSteppingActionMessenger(this);
@@ -45,59 +42,6 @@ AliSteppingAction::operator=(const AliSteppingAction &right)
   return *this;
 }
 
-// private methods
-
-void AliSteppingAction::PrintTrackInfo(const G4Track* track) const
-{
-// Prints the track info
-// - taken from private G4TrackingManager::Verbose()
-// and the standard header for verbose tracking
-// - taken from G4SteppingVerbose::TrackingStarted().
-// ---
-
-  // print track info
-  G4cout << G4endl;
-  G4cout << "*******************************************************"
-         << "**************************************************"
-         << G4endl;
-  G4cout << "* G4Track Information: " 
-         << "  Particle = " << track->GetDefinition()->GetParticleName() 
-         << "," 
-        << "   Track ID = " << track->GetTrackID() 
-         << "," 
-        << "   Parent ID = " << track->GetParentID() 
-         << G4endl;
-  G4cout << "*******************************************************"
-         << "**************************************************"
-         << G4endl;
-  G4cout << G4endl;
-      
-  // print header    
-#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
-    G4cout << G4std::setw( 5) << "Step#"  << " "
-           << G4std::setw( 8) << "X"      << "     "
-          << G4std::setw( 8) << "Y"      << "     "  
-          << G4std::setw( 8) << "Z"      << "     "
-          << G4std::setw( 9) << "KineE"  << "     "
-          << G4std::setw( 8) << "dE"     << "     "  
-          << G4std::setw(12) << "StepLeng"   << " "  
-          << G4std::setw(12) << "TrackLeng"  << " "
-          << G4std::setw(12) << "NextVolume" << " "
-          << G4std::setw( 8) << "ProcName"   << G4endl;             
-#else
-    G4cout << G4std::setw( 5) << "Step#"      << " "
-          << G4std::setw( 8) << "X(mm)"      << " "
-          << G4std::setw( 8) << "Y(mm)"      << " "  
-          << G4std::setw( 8) << "Z(mm)"      << " "
-          << G4std::setw( 9) << "KinE(MeV)"  << " "
-          << G4std::setw( 8) << "dE(MeV)"    << " "  
-          << G4std::setw( 8) << "StepLeng"   << " "  
-          << G4std::setw( 9) << "TrackLeng"  << " "
-          << G4std::setw(11) << "NextVolume" << " "
-          << G4std::setw( 8) << "ProcName"   << G4endl;             
-#endif
-}
-
 // public methods
 
 void AliSteppingAction::SteppingAction(const G4Step* step)
@@ -114,28 +58,11 @@ void AliSteppingAction::SteppingAction(const G4Step* step)
 
   // reset parameters at beginning of tracking
   G4int stepNumber = track->GetCurrentStepNumber();
-  if (stepNumber == 0) {
+  if (stepNumber == 1) {
     fKeptStepPoint = G4ThreeVector();
-    fLoopStepCounter = 0;
-    fStandardVerboseLevel = fpSteppingManager->GetverboseLevel();
     return;
   }  
     
-  if (fLoopStepCounter) {
-    // count steps after detecting looping track
-    fLoopStepCounter++;
-    if (fLoopStepCounter == kMaxNofLoopSteps) {
-
-      // stop the looping track
-      track->SetTrackStatus(fStopAndKill);      
-
-      // reset back parameters
-      fpSteppingManager->SetVerboseLevel(fStandardVerboseLevel);
-      fKeptStepPoint = G4ThreeVector();
-      fLoopStepCounter = 0;
-    }  
-  }  
-
   if (stepNumber % kCheckNofSteps == 0) {  
     // detect looping track
     G4ThreeVector newStepPoint = step->GetPreStepPoint()->GetPosition();
@@ -151,17 +78,6 @@ void AliSteppingAction::SteppingAction(const G4Step* step)
       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 
index 44fddba5406b5970251f8e5432bbc83df408e538..4ac36c6d42fd91ed469b5d566108a90cc414de85 100644 (file)
 
 class AliSteppingActionMessenger;
 
-class G4Track;
-
 class AliSteppingAction : public TG4SteppingAction
 {
   enum { 
     kCheckNofSteps = 100,
-    kMaxNofLoopSteps = 5,
-    kMaxNofSteps = 5000
   };
 
   public:
@@ -33,12 +29,6 @@ class AliSteppingAction : public TG4SteppingAction
     // methods
     virtual void SteppingAction(const G4Step* step);
     
-    // set methods
-    void SetLoopVerboseLevel(G4int level);
-    
-    // get methods
-    G4int GetLoopVerboseLevel() const;
-
   protected:
     AliSteppingAction(const AliSteppingAction& right);
 
@@ -46,29 +36,14 @@ class AliSteppingAction : public TG4SteppingAction
     AliSteppingAction& operator=(const AliSteppingAction& right);
 
   private:
-    // methods
-    void PrintTrackInfo(const G4Track* track) const;
-  
     // static data members
-    static const G4double fgkTolerance;    //tolerance used in detecting 
-                                           //of looping particles
+    static const G4double fgkTolerance; //tolerance used in detecting 
+                                        //of looping particles
 
     // data members
-    G4ThreeVector   fKeptStepPoint;        //kept step point
-    G4int           fLoopVerboseLevel;     //tracking verbose level
-                                           //for looping particles
-    G4int           fStandardVerboseLevel; //standard tracking verbose level
-    G4int           fLoopStepCounter;      //loop steps counter
-    AliSteppingActionMessenger*  fMessenger;  //messenger
+    G4ThreeVector  fKeptStepPoint;           //kept step point
+    AliSteppingActionMessenger*  fMessenger; //messenger
 };
 
-// inline methods
-
-inline void AliSteppingAction::SetLoopVerboseLevel(G4int level)
-{ fLoopVerboseLevel = level; }
-
-inline G4int AliSteppingAction::GetLoopVerboseLevel() const
-{ return fLoopVerboseLevel; }
-
 #endif //ALI_STEPPING_ACTION_H
 
index b148006957f02d0c8bf53b821f96bdb7921e37dd..249c83ac40b362bcdef50db28a9875ebf5929ba0 100644 (file)
@@ -21,6 +21,13 @@ AliSteppingActionMessenger::AliSteppingActionMessenger(
   fLoopVerboseCmd->SetDefaultValue(1);
   fLoopVerboseCmd->SetRange("LoopVerboseLevel >= 0 && LoopVerboseLevel <= 5");
   fLoopVerboseCmd->AvailableForStates(Idle);
+
+  fMaxNofStepsCmd = new G4UIcmdWithAnInteger("/aliTracking/maxNofSteps", this);
+  fMaxNofStepsCmd
+    ->SetGuidance("Set tracking verbose level for detected looping tracks.");
+  fMaxNofStepsCmd->SetParameterName("MaxNofSteps", false);
+  fMaxNofStepsCmd->SetRange("MaxNofSteps >= 0");
+  fMaxNofStepsCmd->AvailableForStates(Idle);
 }
 
 AliSteppingActionMessenger::AliSteppingActionMessenger() {
@@ -37,6 +44,7 @@ AliSteppingActionMessenger::AliSteppingActionMessenger(
 AliSteppingActionMessenger::~AliSteppingActionMessenger() {
 //
   delete fLoopVerboseCmd;
+  delete fMaxNofStepsCmd;
 }
 
 // operators
@@ -65,4 +73,8 @@ void AliSteppingActionMessenger::SetNewValue(G4UIcommand* command,
     fSteppingAction
       ->SetLoopVerboseLevel(fLoopVerboseCmd->GetNewIntValue(newValue)); 
   }   
+  else if(command == fMaxNofStepsCmd) { 
+    fSteppingAction
+      ->SetMaxNofSteps(fMaxNofStepsCmd->GetNewIntValue(newValue)); 
+  }   
 }
index 57b9b3082e5b65ae937cdca6bc8cb59026955aed..5475fb875d9d8ca90dbd577281ba85ca277c8ebe 100644 (file)
@@ -38,6 +38,7 @@ class AliSteppingActionMessenger: public G4UImessenger
     // data members
     AliSteppingAction*     fSteppingAction; //associated class  
     G4UIcmdWithAnInteger*  fLoopVerboseCmd; //command: loopVerbose
+    G4UIcmdWithAnInteger*  fMaxNofStepsCmd; //command: maxNofSteps
 };
 
 #endif //ALI_STEPPING_ACTION_MESSENGER_H