Go to the documentation of this file.00001 #ifndef _TRACKER_FREETRAJECTORYSTATE_H_
00002 #define _TRACKER_FREETRAJECTORYSTATE_H_
00003
00004
00005
00006
00007 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
00008 #include "TrackingTools/TrajectoryParametrization/interface/CartesianTrajectoryError.h"
00009 #include "TrackingTools/TrajectoryParametrization/interface/CurvilinearTrajectoryError.h"
00010 #include "DataFormats/TrajectoryState/interface/TrackCharge.h"
00011 #include "TrackingTools/TrajectoryParametrization/interface/TrajectoryStateExceptions.h"
00012
00013 #include <iosfwd>
00014
00015
00016 #include "FWCore/Utilities/interface/Visibility.h"
00017 #include "FWCore/Utilities/interface/Likely.h"
00018
00019
00029 class FreeTrajectoryState {
00030 public:
00031
00032
00033
00034 FreeTrajectoryState():
00035 theCurvilinearError(InvalidError()) {}
00036
00037 FreeTrajectoryState(const GlobalTrajectoryParameters& aGlobalParameters) :
00038 theGlobalParameters(aGlobalParameters),
00039 theCurvilinearError(InvalidError())
00040 {}
00041
00042 FreeTrajectoryState(const GlobalPoint& aX,
00043 const GlobalVector& aP,
00044 TrackCharge aCharge,
00045 const MagneticField* fieldProvider) :
00046 theGlobalParameters(aX, aP, aCharge, fieldProvider),
00047 theCurvilinearError(InvalidError())
00048 {}
00049
00050
00051 FreeTrajectoryState(const GlobalTrajectoryParameters& aGlobalParameters,
00052 const CurvilinearTrajectoryError& aCurvilinearError) :
00053 theGlobalParameters(aGlobalParameters),
00054 theCurvilinearError(aCurvilinearError)
00055 {}
00056
00057
00058
00059 FreeTrajectoryState(const GlobalTrajectoryParameters& aGlobalParameters,
00060 const CartesianTrajectoryError& aCartesianError) :
00061 theGlobalParameters(aGlobalParameters)
00062 { createCurvilinearError(aCartesianError); }
00063
00064 FreeTrajectoryState(const GlobalTrajectoryParameters& aGlobalParameters,
00065 const CartesianTrajectoryError&,
00066 const CurvilinearTrajectoryError& aCurvilinearError) :
00067 theGlobalParameters(aGlobalParameters),
00068 theCurvilinearError(aCurvilinearError)
00069 {}
00070
00071
00072
00073 GlobalPoint position() const {
00074 return theGlobalParameters.position();
00075 }
00076 GlobalVector momentum() const {
00077 return theGlobalParameters.momentum();
00078 }
00079 TrackCharge charge() const {
00080 return theGlobalParameters.charge();
00081 }
00082 double signedInverseMomentum() const {
00083 return theGlobalParameters.signedInverseMomentum();
00084 }
00085 double transverseCurvature() const {
00086 return theGlobalParameters.transverseCurvature();
00087 }
00088
00089
00090
00091 bool hasCurvilinearError() const {return theCurvilinearError.valid();}
00092
00093 bool hasError() const {
00094 return hasCurvilinearError();
00095 }
00096
00097
00098 const GlobalTrajectoryParameters& parameters() const {
00099 return theGlobalParameters;
00100 }
00101
00102
00103 CartesianTrajectoryError cartesianError() const {
00104 if unlikely(!hasError()) missingError();
00105 CartesianTrajectoryError aCartesianError;
00106 createCartesianError(aCartesianError);
00107 return aCartesianError;
00108 }
00109
00110 const CurvilinearTrajectoryError& curvilinearError() const {
00111 if unlikely(!hasError()) missingError();
00112 return theCurvilinearError;
00113 }
00114
00115 void rescaleError(double factor);
00116
00117
00118 void setCartesianError(const CartesianTrajectoryError &err) {
00119 createCurvilinearError(err);
00120 }
00121 void setCartesianError(const AlgebraicSymMatrix66 &err) {
00122 createCurvilinearError(CartesianTrajectoryError(err));
00123 }
00124
00125 void setCurvilinearError(const CurvilinearTrajectoryError &err) {
00126 theCurvilinearError = err;
00127 }
00128 void setCurvilinearError(const AlgebraicSymMatrix55 &err) {
00129 theCurvilinearError = CurvilinearTrajectoryError(err);
00130 }
00131
00132 private:
00133
00134
00135 void missingError() const;
00136
00137
00138 void createCartesianError(CartesianTrajectoryError & aCartesianError) const;
00139
00140
00141
00142 void createCurvilinearError(CartesianTrajectoryError const & aCartesianError) const;
00143
00144 private:
00145
00146 GlobalTrajectoryParameters theGlobalParameters;
00147 mutable CurvilinearTrajectoryError theCurvilinearError;
00148
00149 };
00150
00151 std::ostream& operator<<(std::ostream& os, const FreeTrajectoryState& fts);
00152
00153 #endif