CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
fastsim::Trajectory Class Referenceabstract

Definition the generic trajectory of a particle (base class for helix/straight trajectories). More...

#include <Trajectory.h>

Inheritance diagram for fastsim::Trajectory:
fastsim::HelixTrajectory fastsim::StraightTrajectory

Public Member Functions

virtual bool crosses (const BarrelSimplifiedGeometry &layer) const =0
 Check if trajectory crosses a barrel layer. More...
 
const math::XYZTLorentzVectorgetMomentum ()
 Simple getter: return momentum of the particle that was used to create trajectory. More...
 
const math::XYZTLorentzVectorgetPosition ()
 Simple getter: return position of the particle that was used to create trajectory. More...
 
virtual void move (double deltaTimeC)=0
 Move the particle along the trajectory for a given time. More...
 
virtual double nextCrossingTimeC (const BarrelSimplifiedGeometry &layer, bool onLayer=false) const =0
 Return delta time (t*c) of the next intersection of trajectory and barrel layer. More...
 
double nextCrossingTimeC (const ForwardSimplifiedGeometry &layer, bool onLayer=false) const
 Return delta time (t*c) of the next intersection of trajectory and forward layer. More...
 
double nextCrossingTimeC (const SimplifiedGeometry &layer, bool onLayer=false) const
 Return delta time (t*c) of the next intersection of trajectory and generic layer. More...
 
virtual ~Trajectory ()
 

Static Public Member Functions

static std::unique_ptr< TrajectorycreateTrajectory (const fastsim::Particle &particle, const double magneticFieldZ)
 Calls constructor of derived classes. More...
 

Protected Member Functions

 Trajectory (const fastsim::Particle &particle)
 Constructor of base class. More...
 

Protected Attributes

math::XYZTLorentzVector momentum_
 momentum of the particle that was used to create trajectory More...
 
math::XYZTLorentzVector position_
 position of the particle that was used to create trajectory More...
 

Detailed Description

Definition the generic trajectory of a particle (base class for helix/straight trajectories).

Mathematical representation of a particle's trajectory. Provides three basic funtions:

Definition at line 26 of file Trajectory.h.

Constructor & Destructor Documentation

◆ ~Trajectory()

Trajectory::~Trajectory ( )
virtual

Definition at line 10 of file Trajectory.cc.

10 {}

◆ Trajectory()

Trajectory::Trajectory ( const fastsim::Particle particle)
protected

Constructor of base class.

Usually constructor of derived classes HelixTrajectory or StraightTrajectory are called.

Definition at line 12 of file Trajectory.cc.

12  {
13  position_ = particle.position();
14  momentum_ = particle.momentum();
15 }

References fastsim::Particle::momentum(), and fastsim::Particle::position().

Member Function Documentation

◆ createTrajectory()

std::unique_ptr< fastsim::Trajectory > Trajectory::createTrajectory ( const fastsim::Particle particle,
const double  magneticFieldZ 
)
static

Calls constructor of derived classes.

Decides whether a straight (uncharged particle or very high pT charged particle) or a helix trajectory (generic charged particle) is constructed.

Parameters
particleThe particle that should be decayed.
magneticFieldZThe strenght of the magnetic field at the position of the particle.
Returns
A StraightTrajectory or a HelixTrajectory

Definition at line 17 of file Trajectory.cc.

18  {
19  if (particle.charge() == 0. || magneticFieldZ == 0.) {
20  LogDebug("FastSim") << "create straight trajectory";
21  return std::unique_ptr<fastsim::Trajectory>(new fastsim::StraightTrajectory(particle));
22  } else if (std::abs(particle.momentum().Pt() /
23  (fastsim::Constants::speedOfLight * 1e-4 * particle.charge() * magneticFieldZ)) > 1e5) {
24  LogDebug("FastSim") << "create straight trajectory (huge radius)";
25  return std::unique_ptr<fastsim::Trajectory>(new fastsim::StraightTrajectory(particle));
26  } else {
27  LogDebug("FastSim") << "create helix trajectory";
28  return std::unique_ptr<fastsim::Trajectory>(new fastsim::HelixTrajectory(particle, magneticFieldZ));
29  }
30 }

References funct::abs(), fastsim::Particle::charge(), MillePedeFileConverter_cfg::e, LogDebug, CaloMaterial_cfi::magneticFieldZ, fastsim::Particle::momentum(), and fastsim::Constants::speedOfLight.

Referenced by fastsim::LayerNavigator::moveParticleToNextLayer().

◆ crosses()

virtual bool fastsim::Trajectory::crosses ( const BarrelSimplifiedGeometry layer) const
pure virtual

Check if trajectory crosses a barrel layer.

Virtual function since different behavior of straight and helix trajectory. This funtion does not exist for forward layers since those are always hit - unless particle has exactly 0 momentum in Z direction which doesn't happen for numerical reasons.

Implemented in fastsim::StraightTrajectory, and fastsim::HelixTrajectory.

◆ getMomentum()

const math::XYZTLorentzVector& fastsim::Trajectory::getMomentum ( )
inline

Simple getter: return momentum of the particle that was used to create trajectory.

Definition at line 48 of file Trajectory.h.

48 { return momentum_; }

References momentum_.

◆ getPosition()

const math::XYZTLorentzVector& fastsim::Trajectory::getPosition ( )
inline

Simple getter: return position of the particle that was used to create trajectory.

Definition at line 45 of file Trajectory.h.

45 { return position_; }

References position_.

◆ move()

virtual void fastsim::Trajectory::move ( double  deltaTimeC)
pure virtual

Move the particle along the trajectory for a given time.

Parameters
deltaTimeCTime in units of t*c..

Implemented in fastsim::StraightTrajectory, and fastsim::HelixTrajectory.

◆ nextCrossingTimeC() [1/3]

virtual double fastsim::Trajectory::nextCrossingTimeC ( const BarrelSimplifiedGeometry layer,
bool  onLayer = false 
) const
pure virtual

Return delta time (t*c) of the next intersection of trajectory and barrel layer.

Different treatment of intersection of straight/helix layers with barrel layers. Implementation in derived classes.

Parameters
layerA barrel layer.
onLayerSpecify if the particle already is on the layer (in that case the second solution has to be picked).
Returns
t*c [ns * cm/ns] of next intersection (-1 if there is none).

Implemented in fastsim::StraightTrajectory, and fastsim::HelixTrajectory.

◆ nextCrossingTimeC() [2/3]

double Trajectory::nextCrossingTimeC ( const ForwardSimplifiedGeometry layer,
bool  onLayer = false 
) const

Return delta time (t*c) of the next intersection of trajectory and forward layer.

Since only momentum in Z direction matters, same function for straight and helix trajectories.

Parameters
layerA forward layer.
onLayerSpecify if the particle already is on the layer (in this case there is no solution).
Returns
t*c [ns * cm/ns] of next intersection (-1 if there is none).

Definition at line 40 of file Trajectory.cc.

40  {
41  if (onLayer) {
42  return -1;
43  }
44  // t = (z - z_0) / v_z
45  // substitute: v_z = p_z / E * c ( note: extra * c absorbed in p_z units)
46  // => t*c = (z - z_0) / p_z * E
47  double deltaTimeC = (layer.getZ() - position_.Z()) / momentum_.Z() * momentum_.E();
48  return deltaTimeC > 0. ? deltaTimeC : -1.;
49 }

References fastsim::ForwardSimplifiedGeometry::getZ().

◆ nextCrossingTimeC() [3/3]

double Trajectory::nextCrossingTimeC ( const SimplifiedGeometry layer,
bool  onLayer = false 
) const

Return delta time (t*c) of the next intersection of trajectory and generic layer.

Calculation different for barrel/forward layers and straight/helix trajectory. Chooses which function has to be called.

Parameters
layerA barrel or forward layer.
onLayerSpecify if the particle already is on the layer (leads to different constraints for forward/barrel layers).
Returns
t*c [ns * cm/ns] of next intersection (-1 if there is none).

Definition at line 32 of file Trajectory.cc.

32  {
33  if (layer.isForward()) {
34  return this->nextCrossingTimeC(static_cast<const fastsim::ForwardSimplifiedGeometry &>(layer), onLayer);
35  } else {
36  return this->nextCrossingTimeC(static_cast<const fastsim::BarrelSimplifiedGeometry &>(layer), onLayer);
37  }
38 }

References fastsim::SimplifiedGeometry::isForward().

Member Data Documentation

◆ momentum_

math::XYZTLorentzVector fastsim::Trajectory::momentum_
protected

momentum of the particle that was used to create trajectory

Definition at line 92 of file Trajectory.h.

Referenced by getMomentum(), and fastsim::StraightTrajectory::nextCrossingTimeC().

◆ position_

math::XYZTLorentzVector fastsim::Trajectory::position_
protected

position of the particle that was used to create trajectory

Definition at line 91 of file Trajectory.h.

Referenced by getPosition(), and fastsim::StraightTrajectory::nextCrossingTimeC().

fastsim::Trajectory::position_
math::XYZTLorentzVector position_
position of the particle that was used to create trajectory
Definition: Trajectory.h:91
fastsim::Trajectory::nextCrossingTimeC
double nextCrossingTimeC(const SimplifiedGeometry &layer, bool onLayer=false) const
Return delta time (t*c) of the next intersection of trajectory and generic layer.
Definition: Trajectory.cc:32
fastsim::Constants::speedOfLight
static constexpr double speedOfLight
Speed of light [cm / ns].
Definition: Constants.h:12
fastsim::Particle::momentum
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:143
fastsim::Trajectory::momentum_
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:92
fastsim::Particle::position
const math::XYZTLorentzVector & position() const
Return position of the particle.
Definition: Particle.h:140
fastsim::HelixTrajectory
Mathematical representation of a helix.
Definition: HelixTrajectory.h:18
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
fastsim::Particle::charge
double charge() const
Return charge of the particle.
Definition: Particle.h:137
CaloMaterial_cfi.magneticFieldZ
magneticFieldZ
Definition: CaloMaterial_cfi.py:112
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
fastsim::StraightTrajectory
Mathematical representation of a straight trajectory.
Definition: StraightTrajectory.h:16
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37