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 29 of file Trajectory.h.

Constructor & Destructor Documentation

Trajectory::~Trajectory ( )
virtual

Definition at line 10 of file Trajectory.cc.

Referenced by getMomentum().

10 {}
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(), momentum_, fastsim::Particle::position(), and position_.

Referenced by getMomentum().

13 {
14  position_ = particle.position();
15  momentum_ = particle.momentum();
16 }
const math::XYZTLorentzVector & position() const
Return position of the particle.
Definition: Particle.h:142
math::XYZTLorentzVector position_
position of the particle that was used to create trajectory
Definition: Trajectory.h:95
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:145
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:96

Member Function Documentation

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 18 of file Trajectory.cc.

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

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

19 {
20  if(particle.charge() == 0. || magneticFieldZ == 0.){
21  LogDebug("FastSim") << "create straight trajectory";
22  return std::unique_ptr<fastsim::Trajectory>(new fastsim::StraightTrajectory(particle));
23  }
24  else if(std::abs(particle.momentum().Pt() / (fastsim::Constants::speedOfLight * 1e-4 * particle.charge() * magneticFieldZ)) > 1e5){
25  LogDebug("FastSim") << "create straight trajectory (huge radius)";
26  return std::unique_ptr<fastsim::Trajectory>(new fastsim::StraightTrajectory(particle));
27  }
28  else{
29  LogDebug("FastSim") << "create helix trajectory";
30  return std::unique_ptr<fastsim::Trajectory>(new fastsim::HelixTrajectory(particle, magneticFieldZ));
31  }
32 }
#define LogDebug(id)
static double constexpr speedOfLight
Speed of light [cm / ns].
Definition: Constants.h:16
Mathematical representation of a straight trajectory.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double charge() const
Return charge of the particle.
Definition: Particle.h:139
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:145
Mathematical representation of a helix.
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::HelixTrajectory, and fastsim::StraightTrajectory.

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

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

Definition at line 52 of file Trajectory.h.

References momentum_, move(), nextCrossingTimeC(), Trajectory(), and ~Trajectory().

52 {return momentum_;}
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:96
const math::XYZTLorentzVector& fastsim::Trajectory::getPosition ( )
inline

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

Definition at line 49 of file Trajectory.h.

References position_.

49 {return position_;}
math::XYZTLorentzVector position_
position of the particle that was used to create trajectory
Definition: Trajectory.h:95
virtual void fastsim::Trajectory::move ( double  deltaTimeC)
pure virtual
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 35 of file Trajectory.cc.

References fastsim::SimplifiedGeometry::isForward().

Referenced by getMomentum().

36 {
37  if(layer.isForward())
38  {
39  return this->nextCrossingTimeC(static_cast<const fastsim::ForwardSimplifiedGeometry &>(layer), onLayer);
40  }
41  else
42  {
43  return this->nextCrossingTimeC(static_cast<const fastsim::BarrelSimplifiedGeometry &>(layer), onLayer);
44  }
45 }
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:35
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 48 of file Trajectory.cc.

References fastsim::ForwardSimplifiedGeometry::getZ(), momentum_, and position_.

49 {
50  if(onLayer)
51  {
52  return -1;
53  }
54  // t = (z - z_0) / v_z
55  // substitute: v_z = p_z / E * c ( note: extra * c absorbed in p_z units)
56  // => t*c = (z - z_0) / p_z * E
57  double deltaTimeC = (layer.getZ() - position_.Z()) / momentum_.Z() * momentum_.E();
58  return deltaTimeC > 0. ? deltaTimeC : -1.;
59 }
math::XYZTLorentzVector position_
position of the particle that was used to create trajectory
Definition: Trajectory.h:95
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:96
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::HelixTrajectory, and fastsim::StraightTrajectory.

Member Data Documentation

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