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

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 ( const fastsim::Particle particle)
protected

Constructor of base class.

Usually constructor of derived classes HelixTrajectory or StraightTrajectory are called.

Definition at line 11 of file Trajectory.cc.

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

Referenced by getMomentum().

12 {
13  position_ = particle.position();
14  momentum_ = particle.momentum();
15 }
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:94
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:95

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

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  }
23  else if(std::abs(particle.momentum().Pt() / (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  }
27  else{
28  LogDebug("FastSim") << "create helix trajectory";
29  return std::unique_ptr<fastsim::Trajectory>(new fastsim::HelixTrajectory(particle, magneticFieldZ));
30  }
31 }
#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::StraightTrajectory, and fastsim::HelixTrajectory.

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(), and Trajectory().

52 {return momentum_;}
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:95
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:94
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 34 of file Trajectory.cc.

References fastsim::SimplifiedGeometry::isForward().

Referenced by getMomentum().

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

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

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

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