const G4double AliSteppingAction::fgkTolerance = 1e-6*mm;
AliSteppingAction::AliSteppingAction()
- : fKeptStepPoint(G4ThreeVector()),
- fLoopVerboseLevel(1),
- fStandardVerboseLevel(0),
- fLoopStepCounter(0)
+ : fKeptStepPoint(G4ThreeVector())
{
//
fMessenger = new AliSteppingActionMessenger(this);
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)
// 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();
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
class AliSteppingActionMessenger;
-class G4Track;
-
class AliSteppingAction : public TG4SteppingAction
{
enum {
kCheckNofSteps = 100,
- kMaxNofLoopSteps = 5,
- kMaxNofSteps = 5000
};
public:
// methods
virtual void SteppingAction(const G4Step* step);
- // set methods
- void SetLoopVerboseLevel(G4int level);
-
- // get methods
- G4int GetLoopVerboseLevel() const;
-
protected:
AliSteppingAction(const AliSteppingAction& right);
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
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() {
AliSteppingActionMessenger::~AliSteppingActionMessenger() {
//
delete fLoopVerboseCmd;
+ delete fMaxNofStepsCmd;
}
// operators
fSteppingAction
->SetLoopVerboseLevel(fLoopVerboseCmd->GetNewIntValue(newValue));
}
+ else if(command == fMaxNofStepsCmd) {
+ fSteppingAction
+ ->SetMaxNofSteps(fMaxNofStepsCmd->GetNewIntValue(newValue));
+ }
}