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...
 
double nextCrossingTimeC (const SimplifiedGeometry &layer, bool onLayer=false) const
 Return delta time (t*c) of the next intersection of trajectory and generic 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...
 
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...
 
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.

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

12  {
13  position_ = particle.position();
14  momentum_ = particle.momentum();
15 }
const math::XYZTLorentzVector & position() const
Return position of the particle.
Definition: Particle.h:140
math::XYZTLorentzVector position_
position of the particle that was used to create trajectory
Definition: Trajectory.h:91
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:143
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:92

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.

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

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

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 }
static double constexpr speedOfLight
Speed of light [cm / ns].
Definition: Constants.h:12
Mathematical representation of a straight trajectory.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:143
double charge() const
Return charge of the particle.
Definition: Particle.h:137
Mathematical representation of a helix.
#define LogDebug(id)

◆ 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.

References momentum_.

48 { return momentum_; }
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:92

◆ 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.

References position_.

45 { return position_; }
math::XYZTLorentzVector position_
position of the particle that was used to create trajectory
Definition: Trajectory.h:91

◆ 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]

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 }
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

◆ 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 }
math::XYZTLorentzVector position_
position of the particle that was used to create trajectory
Definition: Trajectory.h:91
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:92

◆ nextCrossingTimeC() [3/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.

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().