19#include "BDSAuxiliaryNavigator.hh"
21#include "BDSGlobalConstants.hh"
22#include "BDSPhysicalVolumeInfoRegistry.hh"
23#include "BDSPhysicalVolumeInfo.hh"
25#include "BDSTrajectoryPoint.hh"
26#include "BDSTrajectoryPointIon.hh"
27#include "BDSTrajectoryPointLocal.hh"
28#include "BDSTrajectoryPointLink.hh"
29#include "BDSPhysicalConstants.hh"
30#include "BDSPhysicsUtilities.hh"
31#include "BDSUtilities.hh"
33#include "BDSProcessMap.hh"
37#include "G4Allocator.hh"
38#include "G4ProcessType.hh"
40#include "G4ThreeVector.hh"
42#include "G4TransportationProcessType.hh"
43#include "G4VProcess.hh"
49G4Allocator<BDSTrajectoryPoint> bdsTrajectoryPointAllocator;
57 G4TrajectoryPoint(G4ThreeVector())
63 G4bool storeExtrasLocal,
64 G4bool storeExtrasLink,
65 G4bool storeExtrasIon):
66 G4TrajectoryPoint(track->GetPosition())
71 const G4VProcess* creatorProcess = track->GetCreatorProcess();
100 track->GetMomentumDirection(),
108 G4double sCentre = info->
GetSPos();
115 if (storeExtrasLocal)
126 G4bool storeExtrasLocal,
127 G4bool storeExtrasLink,
128 G4bool storeExtrasIon):
129 G4TrajectoryPoint(step->GetPostStepPoint()->GetPosition())
133 const G4StepPoint* prePoint = step->GetPreStepPoint();
134 const G4StepPoint* postPoint = step->GetPostStepPoint();
135 const G4VProcess* preProcess = prePoint->GetProcessDefinedStep();
136 const G4VProcess* postProcess = postPoint->GetProcessDefinedStep();
152 preEnergy = prePoint->GetKineticEnergy();
171 G4double sCentre = info->
GetSPos();
178 if (storeExtrasLocal)
181 G4Track* track = step->GetTrack();
190 G4TrajectoryPoint(static_cast<const G4TrajectoryPoint&>(other))
218BDSTrajectoryPoint::~BDSTrajectoryPoint()
247 extraLocal =
nullptr;
254 const G4DynamicParticle* dynamicParticleDef = track->GetDynamicParticle();
255 G4double charge = dynamicParticleDef->GetCharge();
256 G4double rigidity = 0;
258 {rigidity =
BDS::Rigidity(track->GetMomentum().mag(), charge);}
261 dynamicParticleDef->GetMass(),
267 const G4ParticleDefinition* particleDef = track->GetParticleDefinition();
268 const G4DynamicParticle* dynamicParticleDef = track->GetDynamicParticle();
269 G4bool isIon =
BDS::IsIon(dynamicParticleDef);
270 G4int nElectrons = dynamicParticleDef->GetTotalOccupancy();
272 particleDef->GetAtomicMass(),
273 particleDef->GetAtomicNumber(),
286 if (isScatteringPoint)
288 G4cout <<
"Interaction point found at " <<
GetPreS()/CLHEP::m <<
" m - "
292 return isScatteringPoint;
303 return preStep || posStep;
308 out << p.GetPosition();
324 const G4StepPoint* postPoint = step->GetPostStepPoint();
325 const G4VProcess* postProcess = postPoint->GetProcessDefinedStep();
327 G4double totalEnergyDeposit = step->GetTotalEnergyDeposit();
329 G4Track* t = step->GetTrack();
330 if (t->GetCurrentStepNumber() == 1 && t->GetStepLength() < 1e-5 && totalEnergyDeposit < 1e-5)
345 G4int postProcessSubType,
346 G4double totalEnergyDeposit)
351 G4bool notTransportation =
postProcessType != G4ProcessType::fTransportation;
360 G4bool result = initialised && notTransportation && notGeneral && notParallel && notUndefined;
Extra G4Navigator to get coordinate transforms.
BDSStep ConvertToLocal(G4Step const *const step, G4bool useCurvilinear=true) const
static BDSGlobalConstants * Instance()
Access method.
BDSPhysicalVolumeInfo * GetInfo(G4VPhysicalVolume *logicalVolume, G4bool isTunnel=false)
static BDSPhysicalVolumeInfoRegistry * Instance()
Singleton accessor.
A class holding any information pertaining to a particular physical volume in a BDSIM geant4 model.
BDSBeamline * GetBeamlineMassWorld() const
Accessor.
G4double GetSPos() const
Get the s position coordinate of the logical volume.
G4int GetBeamlineMassWorldIndex() const
Accessor.
static BDSProcessMap * Instance()
Singleton accessor.
G4String GetProcessName(const G4int &type, const G4int &subType=-1) const
Despatched function to operator() for getting the name of processes.
A simple class to represent the positions of a step.
G4ThreeVector PostStepPoint() const
Accessor.
G4VPhysicalVolume * VolumeForTransform() const
Accessor.
G4ThreeVector PreStepPoint() const
Accessor.
Extra information recorded for a single piece of energy deposition.
Extra information recorded for a single piece of Trajectory Link information.
Extra information recorded for a single piece of energy deposition.
A Point in a trajectory with extra information.
G4double preS
Global curvilinear S coordinate of pre-step point.
G4ThreeVector postMomentum
Momentum of post-step point.
BDSBeamline * beamline
Beam line (if any) point belongs to (always mass world).
void StoreExtrasIon(const G4Track *track)
Utility function to prepare and fill extra ion variables.
G4int beamlineIndex
Index to beam line element in the mass world beam line.
G4int GetPostProcessType() const
Accessor.
G4double PostPosR() const
Return the transverse local radius in x,y.
G4double postGlobalTime
Time since event started of post-step point.
G4double postEnergy
Kinetic energy of post step point.
G4double PrePosR() const
Return the transverse local radius in x,y.
void StoreExtrasLink(const G4Track *track)
Utility function to prepare and fill extra link variables.
static BDSAuxiliaryNavigator * auxNavigator
G4double GetPreS() const
Accessor.
G4Material * material
Material point for pre-step point.
BDSTrajectoryPoint()
Default constructor.
G4double postWeight
Weight associated with post step point.
G4ThreeVector prePosLocal
Local coordinates of pre-step point.
G4int postProcessSubType
Process sub type of post step point.
G4ThreeVector postPosLocal
Local coordinates of post-step point.
G4int GetPostProcessSubType() const
Accessor.
G4bool NotTransportationLimitedStep() const
Return true if step isn't defined by transportation processes.
G4int preProcessType
Process type of pre-step point.
G4double energyDeposit
Total energy deposited during step.
G4bool IsScatteringPoint() const
G4double preWeight
Weight associated with pre-step point.
G4ThreeVector preMomentum
Momentum of pre-step point.
void InitialiseVariables()
G4int preProcessSubType
Process sub type of pre-step point.
G4double preGlobalTime
Time since event started of pre-step point.
G4double preEnergy
Kinetic energy of pre-step point.
G4double postS
Global curvilinear S coordinate of post step point.
G4int postProcessType
Process type of post step point.
static G4double dEThresholdForScattering
G4double Rigidity(G4double momentumMagnitude, G4double charge)
Calculate the rigidity for a total momentum and charge.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())
G4bool IsIon(const G4ParticleDefinition *particle)
Whether a particle is an ion. A proton is counted NOT as an ion.