File indexing completed on 2025-08-05 08:18:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef genfit_StateOnPlane_h
0025 #define genfit_StateOnPlane_h
0026
0027 #include "SharedPlanePtr.h"
0028 #include "AbsTrackRep.h"
0029
0030 #include <TObject.h>
0031 #include <TVectorD.h>
0032
0033 #include <cassert>
0034
0035
0036 namespace genfit {
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047 class StateOnPlane {
0048
0049 public:
0050
0051 StateOnPlane(const genfit::StateOnPlane&) = default;
0052
0053 StateOnPlane(const AbsTrackRep* rep = nullptr);
0054
0055 StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep);
0056 StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo);
0057
0058 StateOnPlane& operator=(StateOnPlane other);
0059 void swap(StateOnPlane& other);
0060
0061 virtual ~StateOnPlane() {}
0062 virtual StateOnPlane* clone() const {return new StateOnPlane(*this);}
0063
0064 const TVectorD& getState() const {return state_;}
0065 TVectorD& getState() {return state_;}
0066 const TVectorD& getAuxInfo() const {return auxInfo_;}
0067 TVectorD& getAuxInfo() {return auxInfo_;}
0068 const SharedPlanePtr& getPlane() const {return sharedPlane_;}
0069 const AbsTrackRep* getRep() const {return rep_;}
0070
0071 void setState(const TVectorD& state) {if(state_.GetNrows() == 0) state_.ResizeTo(state); state_ = state;}
0072 void setPlane(const SharedPlanePtr& plane) {sharedPlane_ = plane;}
0073 void setStatePlane(const TVectorD& state, const SharedPlanePtr& plane) {state_ = state; sharedPlane_ = plane;}
0074 void setAuxInfo(const TVectorD& auxInfo) {if(auxInfo_.GetNrows() == 0) auxInfo_.ResizeTo(auxInfo); auxInfo_ = auxInfo;}
0075 void setRep(const AbsTrackRep* rep) {rep_ = rep;}
0076
0077
0078 double extrapolateToPlane(const SharedPlanePtr& plane,
0079 bool stopAtBoundary = false,
0080 bool calcJacobianNoise = false) {return rep_->extrapolateToPlane(*this, plane, stopAtBoundary, calcJacobianNoise);}
0081 double extrapolateToLine(const TVector3& linePoint,
0082 const TVector3& lineDirection,
0083 bool stopAtBoundary = false,
0084 bool calcJacobianNoise = false) {return rep_->extrapolateToLine(*this, linePoint, lineDirection, stopAtBoundary, calcJacobianNoise);}
0085 double extrapolateToPoint(const TVector3& point,
0086 bool stopAtBoundary = false,
0087 bool calcJacobianNoise = false) {return rep_->extrapolateToPoint(*this, point, stopAtBoundary, calcJacobianNoise);}
0088 double extrapolateToPoint(const TVector3& point,
0089 const TMatrixDSym& G,
0090 bool stopAtBoundary = false,
0091 bool calcJacobianNoise = false) {return rep_->extrapolateToPoint(*this, point, G, stopAtBoundary, calcJacobianNoise);}
0092 double extrapolateToCylinder(double radius,
0093 const TVector3& linePoint = TVector3(0.,0.,0.),
0094 const TVector3& lineDirection = TVector3(0.,0.,1.),
0095 bool stopAtBoundary = false,
0096 bool calcJacobianNoise = false) {return rep_->extrapolateToCylinder(*this, radius, linePoint, lineDirection, stopAtBoundary, calcJacobianNoise);}
0097 double extrapolateToCone(double openingAngle,
0098 const TVector3& conePoint = TVector3(0.,0.,0.),
0099 const TVector3& coneDirection = TVector3(0.,0.,1.),
0100 bool stopAtBoundary = false,
0101 bool calcJacobianNoise = false) {return rep_->extrapolateToCone(*this, openingAngle, conePoint, coneDirection, stopAtBoundary, calcJacobianNoise);}
0102 double extrapolateToSphere(double radius,
0103 const TVector3& point = TVector3(0.,0.,0.),
0104 bool stopAtBoundary = false,
0105 bool calcJacobianNoise = false) {return rep_->extrapolateToSphere(*this, radius, point, stopAtBoundary, calcJacobianNoise);}
0106 double extrapolateBy(double step,
0107 bool stopAtBoundary = false,
0108 bool calcJacobianNoise = false) {return rep_->extrapolateBy(*this, step, stopAtBoundary, calcJacobianNoise);}
0109 double extrapolateToMeasurement(const AbsMeasurement* measurement,
0110 bool stopAtBoundary = false,
0111 bool calcJacobianNoise = false) {return rep_->extrapolateToMeasurement(*this, measurement, stopAtBoundary, calcJacobianNoise);}
0112
0113
0114 TVector3 getPos() const {return rep_->getPos(*this);}
0115 TVector3 getMom() const {return rep_->getMom(*this);}
0116 TVector3 getDir() const {return rep_->getDir(*this);}
0117 void getPosMom(TVector3& pos, TVector3& mom) const {rep_->getPosMom(*this, pos, mom);}
0118 void getPosDir(TVector3& pos, TVector3& dir) const {rep_->getPosDir(*this, pos, dir);}
0119 TVectorD get6DState() const {return rep_->get6DState(*this);}
0120 double getMomMag() const {return rep_->getMomMag(*this);}
0121 int getPDG() const {return rep_->getPDG();}
0122 double getCharge() const {return rep_->getCharge(*this);}
0123 double getQop() const {return rep_->getQop(*this);}
0124 double getMass() const {return rep_->getMass(*this);}
0125 double getTime() const {return rep_->getTime(*this);}
0126
0127 void setPosMom(const TVector3& pos, const TVector3& mom) {rep_->setPosMom(*this, pos, mom);}
0128 void setPosMom(const TVectorD& state6) {rep_->setPosMom(*this, state6);}
0129 void setChargeSign(double charge) {rep_->setChargeSign(*this, charge);}
0130 void setQop(double qop) {rep_->setQop(*this, qop);}
0131 void setTime(double time) {rep_->setTime(*this, time);}
0132
0133
0134 virtual void Print(Option_t* option = "") const;
0135
0136 protected:
0137
0138 TVectorD state_;
0139 TVectorD auxInfo_;
0140 SharedPlanePtr sharedPlane_;
0141
0142 private:
0143
0144
0145
0146 const AbsTrackRep* rep_;
0147
0148 public:
0149 ClassDef(StateOnPlane,2)
0150
0151
0152
0153 };
0154
0155
0156 inline StateOnPlane::StateOnPlane(const AbsTrackRep* rep) :
0157 state_(0), auxInfo_(0), sharedPlane_(), rep_(rep)
0158 {
0159 if (rep != nullptr) {
0160 state_.ResizeTo(rep->getDim());
0161 }
0162 }
0163
0164 inline StateOnPlane::StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep) :
0165 state_(state), auxInfo_(0), sharedPlane_(plane), rep_(rep)
0166 {
0167 assert(rep != nullptr);
0168 assert(sharedPlane_.get() != nullptr);
0169 }
0170
0171 inline StateOnPlane::StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo) :
0172 state_(state), auxInfo_(auxInfo), sharedPlane_(plane), rep_(rep)
0173 {
0174 assert(rep != nullptr);
0175 assert(sharedPlane_.get() != nullptr);
0176 }
0177
0178 inline StateOnPlane& StateOnPlane::operator=(StateOnPlane other) {
0179 swap(other);
0180 return *this;
0181 }
0182
0183 inline void StateOnPlane::swap(StateOnPlane& other) {
0184 this->state_.ResizeTo(other.state_);
0185 std::swap(this->state_, other.state_);
0186 this->auxInfo_.ResizeTo(other.auxInfo_);
0187 std::swap(this->auxInfo_, other.auxInfo_);
0188 this->sharedPlane_.swap(other.sharedPlane_);
0189 std::swap(this->rep_, other.rep_);
0190 }
0191
0192 }
0193
0194
0195 #endif