CMS 3D CMS Logo

Trajectory.cc
Go to the documentation of this file.
9 
11 
13 {
14  position_ = particle.position();
15  momentum_ = particle.momentum();
16 }
17 
18 std::unique_ptr<fastsim::Trajectory> fastsim::Trajectory::createTrajectory(const fastsim::Particle & particle, double magneticFieldZ)
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 }
33 
34 
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 }
46 
47 
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 }
60 
61 
#define LogDebug(id)
Implementation of a forward detector layer (disk).
Implementation of a generic detector layer (base class for forward/barrel layers).
const math::XYZTLorentzVector & position() const
Return position of the particle.
Definition: Particle.h:142
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
static double constexpr speedOfLight
Speed of light [cm / ns].
Definition: Constants.h:16
virtual bool isForward() const =0
Returns false/true depending if the object is a (non-abstract) barrel/forward layer.
const double getZ() const
Return z-position of the forward layer.
math::XYZTLorentzVector position_
position of the particle that was used to create trajectory
Definition: Trajectory.h:95
Mathematical representation of a straight trajectory.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Trajectory(const fastsim::Particle &particle)
Constructor of base class.
Definition: Trajectory.cc:12
virtual ~Trajectory()
Definition: Trajectory.cc:10
double charge() const
Return charge of the particle.
Definition: Particle.h:139
static std::unique_ptr< Trajectory > createTrajectory(const fastsim::Particle &particle, const double magneticFieldZ)
Calls constructor of derived classes.
Definition: Trajectory.cc:18
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:145
Mathematical representation of a helix.
Definition of a generic FastSim Particle which can be propagated through the detector (formerly Parti...
Definition: Particle.h:19
math::XYZTLorentzVector momentum_
momentum of the particle that was used to create trajectory
Definition: Trajectory.h:96