Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:46:07

0001 #ifndef FASTSIM_TRAJECTORY_H
0002 #define FASTSIM_TRAJECTORY_H
0003 
0004 #include <memory>
0005 
0006 #include "DataFormats/Math/interface/LorentzVector.h"
0007 
0008 ///////////////////////////////////////////////
0009 // Author: L. Vanelderen, S. Kurz
0010 // Date: 29 May 2017
0011 //////////////////////////////////////////////////////////
0012 
0013 namespace fastsim {
0014   class SimplifiedGeometry;
0015   class BarrelSimplifiedGeometry;
0016   class ForwardSimplifiedGeometry;
0017   class Particle;
0018 
0019   //! Definition the generic trajectory of a particle (base class for helix/straight trajectories).
0020   /*!
0021         Mathematical representation of a particle's trajectory. Provides three basic funtions:
0022         - Check if an intersection between a trajectory and a layer exists
0023         - Get the time when this happens (delta time in units of t*c)
0024         - Move the particle along it's trajectory for a given time (delta time in units of t*c)
0025     */
0026   class Trajectory {
0027   public:
0028     //! Calls constructor of derived classes.
0029     /*!
0030             Decides whether a straight (uncharged particle or very high pT charged particle) or a helix trajectory (generic charged particle) is constructed.
0031             \param particle The particle that should be decayed.
0032             \param magneticFieldZ The strenght of the magnetic field at the position of the particle.
0033             \return A StraightTrajectory or a HelixTrajectory
0034         */
0035     static std::unique_ptr<Trajectory> createTrajectory(const fastsim::Particle& particle, const double magneticFieldZ);
0036 
0037     //! Check if trajectory crosses a barrel layer.
0038     /*!
0039             Virtual function since different behavior of straight and helix trajectory.
0040             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.
0041         */
0042     virtual bool crosses(const BarrelSimplifiedGeometry& layer) const = 0;
0043 
0044     //! Simple getter: return position of the particle that was used to create trajectory.
0045     const math::XYZTLorentzVector& getPosition() { return position_; }
0046 
0047     //! Simple getter: return momentum of the particle that was used to create trajectory.
0048     const math::XYZTLorentzVector& getMomentum() { return momentum_; }
0049 
0050     //! Return delta time (t*c) of the next intersection of trajectory and generic layer
0051     /*!
0052             Calculation different for barrel/forward layers and straight/helix trajectory. Chooses which function has to be called.
0053             \param layer A barrel or forward layer.
0054             \param onLayer Specify if the particle already is on the layer (leads to different constraints for forward/barrel layers).
0055             \return t*c [ns * cm/ns] of next intersection (-1 if there is none).
0056         */
0057     double nextCrossingTimeC(const SimplifiedGeometry& layer, bool onLayer = false) const;
0058 
0059     //! Return delta time (t*c) of the next intersection of trajectory and forward layer
0060     /*!
0061             Since only momentum in Z direction matters, same function for straight and helix trajectories.
0062             \param layer A forward layer.
0063             \param onLayer Specify if the particle already is on the layer (in this case there is no solution).
0064             \return t*c [ns * cm/ns] of next intersection (-1 if there is none).
0065         */
0066     double nextCrossingTimeC(const ForwardSimplifiedGeometry& layer, bool onLayer = false) const;
0067 
0068     //! Return delta time (t*c) of the next intersection of trajectory and barrel layer
0069     /*!
0070             Different treatment of intersection of straight/helix layers with barrel layers. Implementation in derived classes.
0071             \param layer A barrel layer.
0072             \param onLayer Specify if the particle already is on the layer (in that case the second solution has to be picked).
0073             \return t*c [ns * cm/ns] of next intersection (-1 if there is none).
0074         */
0075     virtual double nextCrossingTimeC(const BarrelSimplifiedGeometry& layer, bool onLayer = false) const = 0;
0076 
0077     //! Move the particle along the trajectory for a given time.
0078     /*!
0079             \param deltaTimeC Time in units of t*c..
0080         */
0081     virtual void move(double deltaTimeC) = 0;
0082     virtual ~Trajectory();
0083 
0084   protected:
0085     //! Constructor of base class.
0086     /*!
0087             Usually constructor of derived classes HelixTrajectory or StraightTrajectory are called.
0088         */
0089     Trajectory(const fastsim::Particle& particle);
0090 
0091     math::XYZTLorentzVector position_;  //!< position of the particle that was used to create trajectory
0092     math::XYZTLorentzVector momentum_;  //!< momentum of the particle that was used to create trajectory
0093   };
0094 }  // namespace fastsim
0095 
0096 #endif