24 #ifndef genfit_StateOnPlane_h
25 #define genfit_StateOnPlane_h
27 #include "SharedPlanePtr.h"
28 #include "AbsTrackRep.h"
64 const TVectorD& getState()
const {
return state_;}
65 TVectorD& getState() {
return state_;}
66 const TVectorD& getAuxInfo()
const {
return auxInfo_;}
67 TVectorD& getAuxInfo() {
return auxInfo_;}
71 void setState(
const TVectorD& state) {
if(state_.GetNrows() == 0) state_.ResizeTo(state); state_ = state;}
73 void setStatePlane(
const TVectorD& state,
const SharedPlanePtr& plane) {state_ = state; sharedPlane_ = plane;}
74 void setAuxInfo(
const TVectorD& auxInfo) {
if(auxInfo_.GetNrows() == 0) auxInfo_.ResizeTo(auxInfo); auxInfo_ = auxInfo;}
79 bool stopAtBoundary =
false,
80 bool calcJacobianNoise =
false) {
return rep_->
extrapolateToPlane(*
this, plane, stopAtBoundary, calcJacobianNoise);}
81 double extrapolateToLine(
const TVector3& linePoint,
82 const TVector3& lineDirection,
83 bool stopAtBoundary =
false,
84 bool calcJacobianNoise =
false) {
return rep_->
extrapolateToLine(*
this, linePoint, lineDirection, stopAtBoundary, calcJacobianNoise);}
85 double extrapolateToPoint(
const TVector3& point,
86 bool stopAtBoundary =
false,
87 bool calcJacobianNoise =
false) {
return rep_->
extrapolateToPoint(*
this, point, stopAtBoundary, calcJacobianNoise);}
88 double extrapolateToPoint(
const TVector3& point,
90 bool stopAtBoundary =
false,
91 bool calcJacobianNoise =
false) {
return rep_->
extrapolateToPoint(*
this, point, G, stopAtBoundary, calcJacobianNoise);}
92 double extrapolateToCylinder(
double radius,
93 const TVector3& linePoint = TVector3(0.,0.,0.),
94 const TVector3& lineDirection = TVector3(0.,0.,1.),
95 bool stopAtBoundary =
false,
96 bool calcJacobianNoise =
false) {
return rep_->
extrapolateToCylinder(*
this, radius, linePoint, lineDirection, stopAtBoundary, calcJacobianNoise);}
97 double extrapolateToCone(
double openingAngle,
98 const TVector3& conePoint = TVector3(0.,0.,0.),
99 const TVector3& coneDirection = TVector3(0.,0.,1.),
100 bool stopAtBoundary =
false,
101 bool calcJacobianNoise =
false) {
return rep_->
extrapolateToCone(*
this, openingAngle, conePoint, coneDirection, stopAtBoundary, calcJacobianNoise);}
102 double extrapolateToSphere(
double radius,
103 const TVector3& point = TVector3(0.,0.,0.),
104 bool stopAtBoundary =
false,
105 bool calcJacobianNoise =
false) {
return rep_->
extrapolateToSphere(*
this, radius, point, stopAtBoundary, calcJacobianNoise);}
106 double extrapolateBy(
double step,
107 bool stopAtBoundary =
false,
108 bool calcJacobianNoise =
false) {
return rep_->
extrapolateBy(*
this, step, stopAtBoundary, calcJacobianNoise);}
109 double extrapolateToMeasurement(
const AbsMeasurement* measurement,
110 bool stopAtBoundary =
false,
114 TVector3 getPos()
const {
return rep_->
getPos(*
this);}
115 TVector3 getMom()
const {
return rep_->
getMom(*
this);}
116 TVector3 getDir()
const {
return rep_->
getDir(*
this);}
117 void getPosMom(TVector3& pos, TVector3& mom)
const {
rep_->
getPosMom(*
this, pos, mom);}
118 void getPosDir(TVector3& pos, TVector3& dir)
const {
rep_->
getPosDir(*
this, pos, dir);}
123 double getQop()
const {
return rep_->
getQop(*
this);}
124 double getMass()
const {
return rep_->
getMass(*
this);}
125 double getTime()
const {
return rep_->
getTime(*
this);}
127 void setPosMom(
const TVector3& pos,
const TVector3& mom) {
rep_->
setPosMom(*
this, pos, mom);}
128 void setPosMom(
const TVectorD& state6) {
rep_->
setPosMom(*
this, state6);}
130 void setQop(
double qop) {
rep_->
setQop(*
this, qop);}
131 void setTime(
double time) {
rep_->
setTime(*
this, time);}
134 virtual void Print(Option_t* option =
"")
const;
156 inline StateOnPlane::StateOnPlane(
const AbsTrackRep* rep) :
157 state_(0), auxInfo_(0), sharedPlane_(), rep_(rep)
159 if (rep !=
nullptr) {
160 state_.ResizeTo(rep->
getDim());
165 state_(state), auxInfo_(0), sharedPlane_(plane), rep_(rep)
167 assert(rep !=
nullptr);
168 assert(sharedPlane_.get() !=
nullptr);
171 inline StateOnPlane::StateOnPlane(
const TVectorD& state,
const SharedPlanePtr& plane,
const AbsTrackRep* rep,
const TVectorD& auxInfo) :
172 state_(state), auxInfo_(auxInfo), sharedPlane_(plane), rep_(rep)
174 assert(rep !=
nullptr);
175 assert(sharedPlane_.get() !=
nullptr);
178 inline StateOnPlane& StateOnPlane::operator=(StateOnPlane other) {
183 inline void StateOnPlane::swap(StateOnPlane& other) {
184 this->state_.ResizeTo(other.state_);
185 std::swap(this->state_, other.state_);
186 this->auxInfo_.ResizeTo(other.auxInfo_);
187 std::swap(this->auxInfo_, other.auxInfo_);
188 this->sharedPlane_.swap(other.sharedPlane_);
189 std::swap(this->
rep_, other.rep_);
Contains the measurement and covariance in raw detector coordinates.
Abstract base class for a track representation.
virtual void setTime(StateOnPlane &state, double time) const =0
Set time at which the state was defined.
double extrapolateToMeasurement(StateOnPlane &state, const AbsMeasurement *measurement, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
extrapolate to an AbsMeasurement
virtual unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
virtual double extrapolateToLine(StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the POCA to a line, and returns the extrapolation length and,...
virtual TVectorD get6DState(const StateOnPlane &state) const
Get the 6D state vector (x, y, z, p_x, p_y, p_z).
virtual double getTime(const StateOnPlane &) const =0
Get the time corresponding to the StateOnPlane. Extrapolation.
virtual double extrapolateToPoint(StateOnPlane &state, const TVector3 &point, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the POCA to a point, and returns the extrapolation length and,...
virtual TVector3 getMom(const StateOnPlane &state) const =0
Get the cartesian momentum vector of a state.
double getMass(const StateOnPlane &state) const
Get tha particle mass in GeV/c^2.
virtual double getMomMag(const StateOnPlane &state) const =0
get the magnitude of the momentum in GeV.
virtual double getCharge(const StateOnPlane &state) const =0
Get the (fitted) charge of a state.
virtual double getQop(const StateOnPlane &state) const =0
Get charge over momentum.
void getPosDir(const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
Get cartesian position and direction vector of a state.
virtual void setChargeSign(StateOnPlane &state, double charge) const =0
Set the sign of the charge according to charge.
virtual void setQop(StateOnPlane &state, double qop) const =0
Set charge/momentum.
virtual void setPosMom(StateOnPlane &state, const TVector3 &pos, const TVector3 &mom) const =0
Set position and momentum of state.
virtual double extrapolateToSphere(StateOnPlane &state, double radius, const TVector3 &point=TVector3(0., 0., 0.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the sphere surface, and returns the extrapolation length and,...
virtual double extrapolateToCone(StateOnPlane &state, double radius, const TVector3 &linePoint=TVector3(0., 0., 0.), const TVector3 &lineDirection=TVector3(0., 0., 1.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the cone surface, and returns the extrapolation length and,...
virtual double extrapolateBy(StateOnPlane &state, double step, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state by step (cm) and returns the extrapolation length and, via reference,...
virtual double extrapolateToPlane(StateOnPlane &state, const genfit::SharedPlanePtr &plane, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to plane, and returns the extrapolation length and, via reference,...
int getPDG() const
Get the pdg code.
TVector3 getDir(const StateOnPlane &state) const
Get the direction vector of a state.
virtual TVector3 getPos(const StateOnPlane &state) const =0
Get the cartesian position of a state.
virtual double extrapolateToCylinder(StateOnPlane &state, double radius, const TVector3 &linePoint=TVector3(0., 0., 0.), const TVector3 &lineDirection=TVector3(0., 0., 1.), bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the cylinder surface, and returns the extrapolation length and,...
virtual void getPosMom(const StateOnPlane &state, TVector3 &pos, TVector3 &mom) const =0
Get cartesian position and momentum vector of a state.
A state with arbitrary dimension defined in a DetPlane.
const AbsTrackRep * rep_
Shared ownership. '!' in order to silence ROOT, custom streamer writes and reads this.
Defines for I/O streams used for error and debug printing.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.