61 : geometry_(&geometry),
65 previousForwardLayer_(
nullptr) {
76 throw cms::Exception(
"FastSimulation") <<
"If layer is provided, particle must be on layer." 77 <<
"\n Layer: " << *layer <<
"\n Particle: " << particle;
88 bool particleMovesInwards =
107 if (particleMovesInwards) {
115 if (particle.
position().Pt() < layer->getRadius()) {
135 if (particle.
position().Z() < layer->getZ()) {
151 if (!particleMovesInwards) {
156 if (particleMovesInwards) {
186 <<
"\n particle between ForwardLayers: " 195 std::vector<const fastsim::SimplifiedGeometry*>
layers;
215 double deltaTimeC = -1;
216 for (
auto _layer : layers) {
217 double tempDeltaTime =
218 trajectory->nextCrossingTimeC(*_layer, particle.
isOnLayer(_layer->isForward(), _layer->index()));
220 if (tempDeltaTime > 0 && (layer ==
nullptr || tempDeltaTime < deltaTimeC || deltaTimeC < 0)) {
222 deltaTimeC = tempDeltaTime;
227 double properDeltaTimeC = deltaTimeC / particle.
gamma();
232 trajectory->move(deltaTimeC);
233 particle.
position() = trajectory->getPosition();
234 particle.
momentum() = trajectory->getMomentum();
246 trajectory->move(deltaTimeC);
247 particle.
position() = trajectory->getPosition();
248 particle.
momentum() = trajectory->getMomentum();
Implementation of a generic detector layer (base class for forward/barrel layers).
const BarrelSimplifiedGeometry * previousBarrelLayer_
Pointer to the previous (opposite direction of the particle's momentum) barrel layer.
const math::XYZTLorentzVector & position() const
Return position of the particle.
LayerNavigator(const Geometry &geometry)
Constructor.
const std::vector< std::unique_ptr< ForwardSimplifiedGeometry > > & forwardLayers() const
Return the vector of forward layers (disks).
const BarrelSimplifiedGeometry * nextLayer(const BarrelSimplifiedGeometry *layer) const
Helps to navigate through the vector of barrel layers.
double remainingProperLifeTimeC() const
Return the particle's remaining proper lifetime[in ct].
virtual bool isForward() const =0
Returns false/true depending if the object is a (non-abstract) barrel/forward layer.
void setRemainingProperLifeTimeC(double remainingProperLifeTimeC)
Set the particle's remaining proper lifetime if not stable [in ct].
bool moveParticleToNextLayer(Particle &particle, const SimplifiedGeometry *&layer)
Move particle along its trajectory to the next intersection with any of the tracker layers...
const BarrelSimplifiedGeometry * nextBarrelLayer_
Pointer to the next (direction of the particle's momentum) barrel layer.
const Geometry *const geometry_
The geometry of the tracker material.
void resetOnLayer()
Reset layer this particle is currently on (i.e. particle is not on a layer anyomre) ...
virtual const double getMagneticFieldZ(const math::XYZTLorentzVector &position) const =0
Return magnetic field (field only has Z component!) on the layer.
Abs< T >::type abs(const T &t)
const BarrelSimplifiedGeometry * previousLayer(const BarrelSimplifiedGeometry *layer) const
Helps to navigate through the vector of barrel layers.
const ForwardSimplifiedGeometry * previousForwardLayer_
Pointer to the previous (opposite direction of the particle's momentum) forward layer.
Definition the tracker geometry (vectors of forward/barrel layers).
const std::vector< std::unique_ptr< BarrelSimplifiedGeometry > > & barrelLayers() const
Return the vector of barrel layers.
const ForwardSimplifiedGeometry * nextForwardLayer_
Pointer to the next (direction of the particle's momentum) forward layer.
int index() const
Return index of this layer (layers are numbered according to their position in the detector)...
bool isStable() const
Returns true if particle is considered stable.
void setOnLayer(bool isForward, int index)
Set layer this particle is currently on.
static std::unique_ptr< Trajectory > createTrajectory(const fastsim::Particle &particle, const double magneticFieldZ)
Calls constructor of derived classes.
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
double gamma() const
Return Lorentz' gamma factor.
Definition of a generic FastSim Particle which can be propagated through the detector (formerly Parti...
bool isOnLayer(bool isForward, int index)
Check if particle is on layer.
double getMagneticFieldZ(const math::XYZTLorentzVector &position) const
Initializes the tracker geometry.
static const std::string MESSAGECATEGORY