9#include <simulation/kernel/ExtMagFieldLimitProcess.h>
10#include <G4TransportationManager.hh>
11#include <G4FieldManager.hh>
14#include <G4ForceCondition.hh>
16#include <framework/logging/Logger.h>
20using namespace Belle2::Simulation;
23 G4VDiscreteProcess(processName),
24 m_stepLimit(kInfinity)
26 m_field = G4TransportationManager::GetTransportationManager()->GetFieldManager()->GetDetectorField();
30 G4ForceCondition* condition =
nullptr;
50 *condition = NotForced;
51 G4double stepLength = kInfinity;
53 G4ThreeVector trkPosi = aTrack.GetPosition();
54 G4double pos1[3] = { trkPosi.x(), trkPosi.y(), trkPosi.z() };
55 G4double h1[3] = { 0.0, 0.0, 0.0 };
56 m_field->GetFieldValue(pos1, h1);
57 G4ThreeVector BVec(h1[0], h1[1], h1[2]);
58 G4double pmag = aTrack.GetMomentum().mag();
59 G4double BPerpMom = BVec.cross(aTrack.GetMomentum()).mag() / pmag;
60 if (BPerpMom != 0.0) {
63 B2DEBUG(300,
"ExtMagFieldLimitProcess::PostStepGetPhysicalInteractionLength() stepLength "
64 << stepLength <<
" B " << BPerpMom <<
" BVec " << BVec <<
" pmag " << pmag);
71 aParticleChange.Initialize(track);
72 return &aParticleChange;
ExtMagFieldLimitProcess(const G4String &processName="ExtMagFieldLimitProcess")
constructor
G4double m_stepLimit
Stores the step limit.
~ExtMagFieldLimitProcess()
destructor
const G4Field * m_field
Stores the pointer to the magnetic field class.
G4double GetMeanFreePath(const G4Track &, G4double, G4ForceCondition *)
Returns the mean free path (always infinity!) after each step.
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double, G4ForceCondition *)
Returns the step length after each step.
G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
Do nothing special after the particle has stepped.
Abstract base class for different kinds of events.