Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:51

0001 #ifndef TrajectoryStateClosestToPoint_H
0002 #define TrajectoryStateClosestToPoint_H
0003 
0004 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0005 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
0006 #include "TrackingTools/TrajectoryParametrization/interface/PerigeeTrajectoryParameters.h"
0007 #include "TrackingTools/TrajectoryParametrization/interface/PerigeeTrajectoryError.h"
0008 #include "TrackingTools/TrajectoryState/interface/PerigeeConversions.h"
0009 
0010 /**
0011  * Trajectory state defined at a given point on the helix, which is 
0012  * the point of closest approach to the reference point.
0013  * In addition to the FreeTrajectoryState at that point, it also 
0014  * gives the perigee parameters.
0015  * This state can also be invalid, e.g. in case the propagation was not successful.
0016  */
0017 
0018 class TrajectoryStateClosestToPoint {
0019   typedef TrajectoryStateOnSurface TSOS;
0020   typedef FreeTrajectoryState FTS;
0021   /// parameter dimension
0022 
0023 public:
0024   TrajectoryStateClosestToPoint() : valid(false), theFTSavailable(false), errorIsAvailable(false) {}
0025 
0026   /**
0027    * Public constructor, which is used to convert perigee 
0028    * parameters to a FreeTrajectoryState. For the case where
0029    * no error is provided.
0030    */
0031   TrajectoryStateClosestToPoint(const PerigeeTrajectoryParameters& perigeeParameters,
0032                                 double pt,
0033                                 const GlobalPoint& referencePoint,
0034                                 const MagneticField* field)
0035       : theField(field),
0036         theRefPoint(referencePoint),
0037         theParameters(perigeeParameters),
0038         thePt(pt),
0039         valid(true),
0040         theFTSavailable(false),
0041         errorIsAvailable(false) {}
0042 
0043   /**
0044    * Public constructor, which is used to convert perigee 
0045    * parameters to a FreeTrajectoryState. For the case where
0046    * an error is provided.
0047    */
0048   TrajectoryStateClosestToPoint(const PerigeeTrajectoryParameters& perigeeParameters,
0049                                 double pt,
0050                                 const PerigeeTrajectoryError& perigeeError,
0051                                 const GlobalPoint& referencePoint,
0052                                 const MagneticField* field)
0053       : theField(field),
0054         theRefPoint(referencePoint),
0055         theParameters(perigeeParameters),
0056         thePt(pt),
0057         thePerigeeError(perigeeError),
0058         valid(true),
0059         theFTSavailable(false),
0060         errorIsAvailable(true) {}
0061 
0062   /**
0063    * returns the reference point which used to construct the state.
0064    * It is thus the point with respect to which the impact parameters
0065    * are defined.
0066    */
0067   const GlobalPoint& referencePoint() const { return theRefPoint; }
0068 
0069   /**
0070    * returns the perigee parameters at the p.c.a. to the reference 
0071    *  point.
0072    */
0073   const PerigeeTrajectoryParameters& perigeeParameters() const { return theParameters; }
0074 
0075   /**
0076    * returns the transverse momentum magnitude
0077    */
0078   double pt() const { return thePt; }
0079 
0080   /**
0081    * returns the error of the perigee parameters if it is 
0082    * available
0083    */
0084   const PerigeeTrajectoryError& perigeeError() const { return thePerigeeError; }
0085 
0086   /**
0087    * returns the state defined at the point of closest approach to the
0088    * reference point.
0089    */
0090   GlobalPoint position() const { return PerigeeConversions::positionFromPerigee(theParameters, theRefPoint); }
0091 
0092   GlobalVector momentum() const { return PerigeeConversions::momentumFromPerigee(theParameters, thePt, theRefPoint); }
0093 
0094   TrackCharge charge() const { return theParameters.charge(); }
0095 
0096   const FreeTrajectoryState& theState() const {
0097     if (!theFTSavailable)
0098       calculateFTS();
0099     return theFTS;
0100   }
0101 
0102   /**
0103    * tells whether the error of the perigee parameters 
0104    * is available.
0105    */
0106   bool hasError() const { return errorIsAvailable; }
0107 
0108   /**
0109    * Tells whether the state is valid or not
0110    */
0111   bool isValid() const { return valid; }
0112 
0113   friend class TrajectoryStateClosestToPointBuilder;
0114 
0115   /**
0116    * Use the appropriate TrajectoryStateClosestToPointBuilder to
0117    * get access to this constructor
0118    */
0119 
0120   TrajectoryStateClosestToPoint(const FTS& originalFTS, const GlobalPoint& referencePoint);
0121 
0122   void calculateFTS() const;
0123 
0124 private:
0125   const MagneticField* theField;
0126 
0127   mutable FTS theFTS;
0128 
0129   GlobalPoint theRefPoint;
0130   PerigeeTrajectoryParameters theParameters;
0131   double thePt;
0132   PerigeeTrajectoryError thePerigeeError;
0133   bool valid;
0134   mutable bool theFTSavailable;
0135   bool errorIsAvailable;
0136 };
0137 #endif