00001 #ifndef BasicMultiTrajectoryState_H 00002 #define BasicMultiTrajectoryState_H 00003 00004 #include "TrackingTools/TrajectoryState/interface/BasicTrajectoryState.h" 00005 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" 00006 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" 00007 #include "FWCore/Utilities/interface/Exception.h" 00008 #include "TrackingTools/GsfTools/interface/MultiTrajectoryStateCombiner.h" 00009 00010 class BasicMultiTrajectoryState : public BasicTrajectoryState { 00011 00012 typedef TrajectoryStateOnSurface TSOS; 00013 00014 public: 00015 00016 BasicMultiTrajectoryState( const std::vector<TSOS>& tsvec); 00017 00018 BasicMultiTrajectoryState() {} 00019 00020 bool isValid() const { return !theStates.empty() && theStates.front().isValid();} 00021 00022 bool hasError() const { 00023 if (isValid()) return theStates.front().hasError(); 00024 return false; 00025 } 00026 00027 const GlobalTrajectoryParameters& globalParameters() const { 00028 checkCombinedState(); 00029 return theCombinedState.globalParameters(); 00030 } 00031 00032 GlobalPoint globalPosition() const { 00033 checkCombinedState(); 00034 return theCombinedState.globalPosition(); 00035 } 00036 00037 GlobalVector globalMomentum() const { 00038 checkCombinedState(); 00039 return theCombinedState.globalMomentum(); 00040 } 00041 00042 GlobalVector globalDirection() const { 00043 checkCombinedState(); 00044 return theCombinedState.globalDirection(); 00045 } 00046 00047 TrackCharge charge() const { 00048 checkCombinedState(); 00049 return theCombinedState.charge(); 00050 } 00051 00052 double signedInverseMomentum() const { 00053 checkCombinedState(); 00054 return theCombinedState.signedInverseMomentum(); 00055 } 00056 00057 double transverseCurvature() const { 00058 checkCombinedState(); 00059 return theCombinedState.transverseCurvature(); 00060 } 00061 00062 const CartesianTrajectoryError& cartesianError() const { 00063 checkCombinedState(); 00064 return theCombinedState.cartesianError(); 00065 } 00066 00067 const CurvilinearTrajectoryError& curvilinearError() const { 00068 checkCombinedState(); 00069 return theCombinedState.curvilinearError(); 00070 } 00071 00072 FreeTrajectoryState* freeTrajectoryState(bool withErrors = true) const { 00073 checkCombinedState(); 00074 return theCombinedState.freeTrajectoryState(withErrors); 00075 } 00076 00077 const MagneticField* magneticField() const; 00078 00079 const LocalTrajectoryParameters& localParameters() const { 00080 checkCombinedState(); 00081 return theCombinedState.localParameters(); 00082 } 00083 00084 LocalPoint localPosition() const { 00085 checkCombinedState(); 00086 return theCombinedState.localPosition(); 00087 } 00088 00089 LocalVector localMomentum() const { 00090 checkCombinedState(); 00091 return theCombinedState.localMomentum(); 00092 } 00093 00094 LocalVector localDirection() const { 00095 checkCombinedState(); 00096 return theCombinedState.localDirection(); 00097 } 00098 00099 const LocalTrajectoryError& localError() const { 00100 checkCombinedState(); 00101 return theCombinedState.localError(); 00102 } 00103 00104 const Surface& surface() const { 00105 if (!isValid()) 00106 throw cms::Exception("LogicError") 00107 << "surface() called for invalid MultiTrajectoryState"; 00108 return theStates.front().surface(); 00109 } 00110 00111 double weight() const; 00112 00119 void rescaleError(double factor); 00120 00121 virtual BasicMultiTrajectoryState* clone() const { 00122 return new BasicMultiTrajectoryState(*this); 00123 } 00124 00125 virtual std::vector<TrajectoryStateOnSurface> components() const { 00126 return theStates; 00127 } 00128 00130 virtual SurfaceSide surfaceSide() const; 00131 00132 private: 00133 00134 std::vector<TSOS> theStates; 00135 00136 mutable TSOS theCombinedState; 00137 mutable bool theCombinedStateUp2Date; 00138 MultiTrajectoryStateCombiner theCombiner; 00139 00140 void checkCombinedState() const; 00141 00142 }; 00143 00144 #endif