Go to the documentation of this file.00001 #ifndef TrajectoryStateClosestToPoint_H
00002 #define TrajectoryStateClosestToPoint_H
00003
00004 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00005 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00006 #include "TrackingTools/TrajectoryParametrization/interface/PerigeeTrajectoryParameters.h"
00007 #include "TrackingTools/TrajectoryParametrization/interface/PerigeeTrajectoryError.h"
00008 #include "TrackingTools/TrajectoryState/interface/PerigeeConversions.h"
00009
00018 class TrajectoryStateClosestToPoint
00019 {
00020 typedef TrajectoryStateOnSurface TSOS;
00021 typedef FreeTrajectoryState FTS;
00023
00024 public:
00025
00026 TrajectoryStateClosestToPoint():
00027 valid(false), theFTSavailable(false), errorIsAvailable(false) {}
00028
00034 TrajectoryStateClosestToPoint(const PerigeeTrajectoryParameters& perigeeParameters, double pt,
00035 const GlobalPoint& referencePoint, const MagneticField* field):
00036 theField(field), theRefPoint(referencePoint),
00037 theParameters(perigeeParameters), thePt( pt ),
00038 valid(true), theFTSavailable(false), errorIsAvailable(false)
00039 {}
00040
00046 TrajectoryStateClosestToPoint(const PerigeeTrajectoryParameters& perigeeParameters, double pt,
00047 const PerigeeTrajectoryError& perigeeError, const GlobalPoint& referencePoint,
00048 const MagneticField* field):
00049 theField(field), theRefPoint(referencePoint),
00050 theParameters(perigeeParameters), thePt( pt ), thePerigeeError(perigeeError),
00051 valid(true), theFTSavailable(false), errorIsAvailable(true){}
00052
00053
00059 const GlobalPoint & referencePoint() const {
00060 return theRefPoint;
00061 }
00062
00063
00068 const PerigeeTrajectoryParameters & perigeeParameters() const {
00069 return theParameters;
00070 }
00071
00075 double pt() const {
00076 return thePt;
00077 }
00078
00083 const PerigeeTrajectoryError & perigeeError() const {
00084 return thePerigeeError;
00085 }
00086
00091 GlobalPoint position() const {
00092 return PerigeeConversions::positionFromPerigee(theParameters, theRefPoint);
00093 }
00094
00095
00096 GlobalVector momentum() const {
00097 return PerigeeConversions::momentumFromPerigee(theParameters, thePt, theRefPoint);
00098 }
00099
00100
00101 TrackCharge charge() const {
00102 return theParameters.charge();
00103 }
00104
00105
00106 const FreeTrajectoryState & theState() const {
00107 if (!theFTSavailable) calculateFTS();
00108 return theFTS;
00109 }
00110
00111
00116 bool hasError() const {
00117 return errorIsAvailable;
00118 }
00119
00123 bool isValid() const {
00124 return valid;
00125 }
00126
00127
00128
00129 friend class TrajectoryStateClosestToPointBuilder;
00130
00136 TrajectoryStateClosestToPoint(const FTS& originalFTS, const GlobalPoint& referencePoint);
00137
00138 void calculateFTS() const;
00139
00140 private:
00141
00142 const MagneticField* theField;
00143
00144 mutable FTS theFTS;
00145
00146 GlobalPoint theRefPoint;
00147 PerigeeTrajectoryParameters theParameters;
00148 double thePt;
00149 PerigeeTrajectoryError thePerigeeError;
00150 bool valid;
00151 mutable bool theFTSavailable;
00152 bool errorIsAvailable;
00153
00154 };
00155 #endif