File indexing completed on 2024-04-06 12:31:41
0001 #ifndef _TRACKER_FREETRAJECTORYSTATE_H_
0002 #define _TRACKER_FREETRAJECTORYSTATE_H_
0003
0004
0005
0006
0007 #include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
0008 #include "TrackingTools/TrajectoryParametrization/interface/CartesianTrajectoryError.h"
0009 #include "TrackingTools/TrajectoryParametrization/interface/CurvilinearTrajectoryError.h"
0010 #include "DataFormats/TrajectoryState/interface/TrackCharge.h"
0011 #include "TrackingTools/TrajectoryParametrization/interface/TrajectoryStateExceptions.h"
0012
0013 #include <iosfwd>
0014
0015 #include "FWCore/Utilities/interface/Visibility.h"
0016 #include "FWCore/Utilities/interface/Likely.h"
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 class FreeTrajectoryState {
0028 public:
0029
0030
0031
0032 FreeTrajectoryState() : theCurvilinearError(InvalidError()) {}
0033
0034 FreeTrajectoryState(const GlobalTrajectoryParameters& aGlobalParameters)
0035 : theGlobalParameters(aGlobalParameters), theCurvilinearError(InvalidError()) {}
0036
0037 FreeTrajectoryState(const GlobalPoint& aX,
0038 const GlobalVector& aP,
0039 TrackCharge aCharge,
0040 const MagneticField* fieldProvider)
0041 : theGlobalParameters(aX, aP, aCharge, fieldProvider), theCurvilinearError(InvalidError()) {}
0042
0043 FreeTrajectoryState(const GlobalPoint& aX,
0044 const GlobalVector& aP,
0045 TrackCharge aCharge,
0046 const MagneticField* fieldProvider,
0047 GlobalVector fieldValue)
0048 : theGlobalParameters(aX, aP, aCharge, fieldProvider, fieldValue), theCurvilinearError(InvalidError()) {}
0049
0050 FreeTrajectoryState(const GlobalTrajectoryParameters& aGlobalParameters,
0051 const CurvilinearTrajectoryError& aCurvilinearError)
0052 : theGlobalParameters(aGlobalParameters), theCurvilinearError(aCurvilinearError) {}
0053
0054 FreeTrajectoryState(const GlobalTrajectoryParameters& aGlobalParameters,
0055 const CartesianTrajectoryError& aCartesianError)
0056 : theGlobalParameters(aGlobalParameters) {
0057 createCurvilinearError(aCartesianError);
0058 }
0059
0060 FreeTrajectoryState(const GlobalTrajectoryParameters& aGlobalParameters,
0061 const CartesianTrajectoryError&,
0062 const CurvilinearTrajectoryError& aCurvilinearError)
0063 : theGlobalParameters(aGlobalParameters), theCurvilinearError(aCurvilinearError) {}
0064
0065
0066
0067 GlobalPoint position() const { return theGlobalParameters.position(); }
0068 GlobalVector momentum() const { return theGlobalParameters.momentum(); }
0069 TrackCharge charge() const { return theGlobalParameters.charge(); }
0070 double signedInverseMomentum() const { return theGlobalParameters.signedInverseMomentum(); }
0071 double transverseCurvature() const { return theGlobalParameters.transverseCurvature(); }
0072
0073
0074
0075 bool hasCurvilinearError() const { return theCurvilinearError.valid(); }
0076
0077 bool hasError() const { return hasCurvilinearError(); }
0078
0079 const GlobalTrajectoryParameters& parameters() const { return theGlobalParameters; }
0080
0081 CartesianTrajectoryError cartesianError() const {
0082 if UNLIKELY (!hasError())
0083 missingError();
0084 CartesianTrajectoryError aCartesianError;
0085 createCartesianError(aCartesianError);
0086 return aCartesianError;
0087 }
0088
0089 const CurvilinearTrajectoryError& curvilinearError() const {
0090 if UNLIKELY (!hasError())
0091 missingError();
0092 return theCurvilinearError;
0093 }
0094
0095 void rescaleError(double factor);
0096
0097 void setCartesianError(const CartesianTrajectoryError& err) { createCurvilinearError(err); }
0098 void setCartesianError(const AlgebraicSymMatrix66& err) { createCurvilinearError(CartesianTrajectoryError(err)); }
0099
0100 CurvilinearTrajectoryError& setCurvilinearError() { return theCurvilinearError; }
0101
0102 void setCurvilinearError(const CurvilinearTrajectoryError& err) { theCurvilinearError = err; }
0103
0104
0105
0106
0107 private:
0108 void missingError() const;
0109
0110
0111 void createCartesianError(CartesianTrajectoryError& aCartesianError) const;
0112
0113
0114 void createCurvilinearError(CartesianTrajectoryError const& aCartesianError) const;
0115
0116 private:
0117 GlobalTrajectoryParameters theGlobalParameters;
0118 mutable CurvilinearTrajectoryError theCurvilinearError;
0119 };
0120
0121 std::ostream& operator<<(std::ostream& os, const FreeTrajectoryState& fts);
0122
0123 #endif