File indexing completed on 2024-04-06 12:31:41
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
0012
0013
0014
0015
0016
0017
0018 class TrajectoryStateClosestToPoint {
0019 typedef TrajectoryStateOnSurface TSOS;
0020 typedef FreeTrajectoryState FTS;
0021
0022
0023 public:
0024 TrajectoryStateClosestToPoint() : valid(false), theFTSavailable(false), errorIsAvailable(false) {}
0025
0026
0027
0028
0029
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
0045
0046
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
0064
0065
0066
0067 const GlobalPoint& referencePoint() const { return theRefPoint; }
0068
0069
0070
0071
0072
0073 const PerigeeTrajectoryParameters& perigeeParameters() const { return theParameters; }
0074
0075
0076
0077
0078 double pt() const { return thePt; }
0079
0080
0081
0082
0083
0084 const PerigeeTrajectoryError& perigeeError() const { return thePerigeeError; }
0085
0086
0087
0088
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
0104
0105
0106 bool hasError() const { return errorIsAvailable; }
0107
0108
0109
0110
0111 bool isValid() const { return valid; }
0112
0113 friend class TrajectoryStateClosestToPointBuilder;
0114
0115
0116
0117
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