SND@LHC Software
Loading...
Searching...
No Matches
StateOnPlane.h
Go to the documentation of this file.
1/* Copyright 2008-2010, Technische Universitaet Muenchen,
2 Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
3
4 This file is part of GENFIT.
5
6 GENFIT is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 GENFIT is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18*/
19
24#ifndef genfit_StateOnPlane_h
25#define genfit_StateOnPlane_h
26
27#include "SharedPlanePtr.h"
28#include "AbsTrackRep.h"
29
30#include <TObject.h>
31#include <TVectorD.h>
32
33
34namespace genfit {
35
45class StateOnPlane : public TObject {
46
47 public:
48
49
50 StateOnPlane(const AbsTrackRep* rep = NULL);
51 StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep);
52 StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo);
53
55 void swap(StateOnPlane& other); // nothrow
56
57 virtual ~StateOnPlane() {}
58
59 const TVectorD& getState() const {return state_;}
60 TVectorD& getState() {return state_;}
61 const TVectorD& getAuxInfo() const {return auxInfo_;}
62 TVectorD& getAuxInfo() {return auxInfo_;}
63 const SharedPlanePtr& getPlane() const {return sharedPlane_;}
64 const AbsTrackRep* getRep() const {return rep_;}
65
66 void setState(const TVectorD& state) {if(state_.GetNrows() == 0) state_.ResizeTo(state); state_ = state;}
67 void setPlane(const SharedPlanePtr& plane) {sharedPlane_ = plane;}
68 void setStatePlane(const TVectorD& state, const SharedPlanePtr& plane) {state_ = state; sharedPlane_ = plane;}
69 void setAuxInfo(const TVectorD& auxInfo) {if(auxInfo_.GetNrows() == 0) auxInfo_.ResizeTo(auxInfo); auxInfo_ = auxInfo;}
70 void setRep(const AbsTrackRep* rep) {rep_ = rep;}
71
72 // Shortcuts to TrackRep functions
74 bool stopAtBoundary = false,
75 bool calcJacobianNoise = false) {return rep_->extrapolateToPlane(*this, plane, stopAtBoundary, calcJacobianNoise);}
76 double extrapolateToLine(const TVector3& linePoint,
77 const TVector3& lineDirection,
78 bool stopAtBoundary = false,
79 bool calcJacobianNoise = false) {return rep_->extrapolateToLine(*this, linePoint, lineDirection, stopAtBoundary, calcJacobianNoise);}
80 double extrapolateToPoint(const TVector3& point,
81 bool stopAtBoundary = false,
82 bool calcJacobianNoise = false) {return rep_->extrapolateToPoint(*this, point, stopAtBoundary, calcJacobianNoise);}
83 double extrapolateToPoint(const TVector3& point,
84 const TMatrixDSym& G, // weight matrix (metric)
85 bool stopAtBoundary = false,
86 bool calcJacobianNoise = false) {return rep_->extrapolateToPoint(*this, point, G, stopAtBoundary, calcJacobianNoise);}
87 double extrapolateToCylinder(double radius,
88 const TVector3& linePoint = TVector3(0.,0.,0.),
89 const TVector3& lineDirection = TVector3(0.,0.,1.),
90 bool stopAtBoundary = false,
91 bool calcJacobianNoise = false) {return rep_->extrapolateToCylinder(*this, radius, linePoint, lineDirection, stopAtBoundary, calcJacobianNoise);}
92 double extrapolateToSphere(double radius,
93 const TVector3& point = TVector3(0.,0.,0.),
94 bool stopAtBoundary = false,
95 bool calcJacobianNoise = false) {return rep_->extrapolateToSphere(*this, radius, point, stopAtBoundary, calcJacobianNoise);}
96 double extrapolateBy(double step,
97 bool stopAtBoundary = false,
98 bool calcJacobianNoise = false) {return rep_->extrapolateBy(*this, step, stopAtBoundary, calcJacobianNoise);}
99 double extrapolateToMeasurement(const AbsMeasurement* measurement,
100 bool stopAtBoundary = false,
101 bool calcJacobianNoise = false) {return rep_->extrapolateToMeasurement(*this, measurement, stopAtBoundary, calcJacobianNoise);}
102
103
104 TVector3 getPos() const {return rep_->getPos(*this);}
105 TVector3 getMom() const {return rep_->getMom(*this);}
106 TVector3 getDir() const {return rep_->getDir(*this);}
107 void getPosMom(TVector3& pos, TVector3& mom) const {rep_->getPosMom(*this, pos, mom);}
108 void getPosDir(TVector3& pos, TVector3& dir) const {rep_->getPosDir(*this, pos, dir);}
109 TVectorD get6DState() const {return rep_->get6DState(*this);}
110 double getMomMag() const {return rep_->getMomMag(*this);}
111 int getPDG() const {return rep_->getPDG();}
112 double getCharge() const {return rep_->getCharge(*this);}
113 double getQop() const {return rep_->getQop(*this);}
114 double getMass() const {return rep_->getMass(*this);}
115
116 void setPosMom(const TVector3& pos, const TVector3& mom) {rep_->setPosMom(*this, pos, mom);}
117 void setPosMom(const TVectorD& state6) {rep_->setPosMom(*this, state6);}
118 void setChargeSign(double charge) {rep_->setChargeSign(*this, charge);}
119 void setQop(double qop) {rep_->setQop(*this, qop);}
120
121
122 virtual void Print(Option_t* option = "") const;
123
124 protected:
125
126 TVectorD state_; // state vector
127 TVectorD auxInfo_; // auxiliary information (e.g. charge, flight direction etc.)
129
130 private:
131
135
136 public:
137 ClassDef(StateOnPlane,1)
138
139};
140
141
143 state_(0), auxInfo_(0), sharedPlane_(), rep_(rep)
144{
145 if (rep != NULL) {
146 state_.ResizeTo(rep->getDim());
147 }
148}
149
150inline StateOnPlane::StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep) :
151 state_(state), auxInfo_(0), sharedPlane_(plane), rep_(rep)
152{
153 assert(rep != NULL);
154 assert(sharedPlane_.get() != NULL);
155}
156
157inline StateOnPlane::StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo) :
158 state_(state), auxInfo_(auxInfo), sharedPlane_(plane), rep_(rep)
159{
160 assert(rep != NULL);
161 assert(sharedPlane_.get() != NULL);
162}
163
165 swap(other);
166 return *this;
167}
168
169inline void StateOnPlane::swap(StateOnPlane& other) {
170 this->state_.ResizeTo(other.state_);
171 std::swap(this->state_, other.state_);
172 this->auxInfo_.ResizeTo(other.auxInfo_);
173 std::swap(this->auxInfo_, other.auxInfo_);
174 this->sharedPlane_.swap(other.sharedPlane_);
175 std::swap(this->rep_, other.rep_);
176}
177
178} /* End of namespace genfit */
181#endif // genfit_StateOnPlane_h
Contains the measurement and covariance in raw detector coordinates.
Abstract base class for a track representation.
Definition AbsTrackRep.h:66
virtual void getPosMom(const StateOnPlane &state, TVector3 &pos, TVector3 &mom) const =0
Get cartesian position and momentum vector of a state.
double extrapolateToMeasurement(StateOnPlane &state, const AbsMeasurement *measurement, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
extrapolate to an AbsMeasurement
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,...
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,...
TVector3 getDir(const StateOnPlane &state) const
Get the direction vector of a state.
void getPosDir(const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
Get cartesian position and direction vector of a state.
virtual double getQop(const StateOnPlane &state) const =0
Get charge over momentum.
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 TVector3 getMom(const StateOnPlane &state) const =0
Get the cartesian momentum vector of a state.
virtual void setPosMom(StateOnPlane &state, const TVector3 &pos, const TVector3 &mom) const =0
Set position and momentum of state.
int getPDG() const
Get the pdg code.
virtual double getCharge(const StateOnPlane &state) const =0
Get the (fitted) charge of a state. This is not always equal the pdg charge (e.g. if the charge sign ...
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,...
double getMass(const StateOnPlane &state) const
Get tha particle mass in GeV/c^2.
virtual void setChargeSign(StateOnPlane &state, double charge) const =0
Set the sign of the charge according to charge.
virtual TVector3 getPos(const StateOnPlane &state) const =0
Get the cartesian position of a state.
virtual double getMomMag(const StateOnPlane &state) const =0
get the magnitude of the momentum in GeV.
virtual void setQop(StateOnPlane &state, double qop) const =0
Set charge/momentum.
virtual TVectorD get6DState(const StateOnPlane &state) const
Get the 6D state vector (x, y, z, p_x, p_y, p_z).
virtual unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
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 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,...
A state with arbitrary dimension defined in a DetPlane.
void setPlane(const SharedPlanePtr &plane)
TVectorD & getAuxInfo()
TVector3 getMom() const
TVector3 getPos() const
double extrapolateToLine(const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false)
void setPosMom(const TVectorD &state6)
double extrapolateBy(double step, bool stopAtBoundary=false, bool calcJacobianNoise=false)
TVectorD & getState()
double extrapolateToPoint(const TVector3 &point, const TMatrixDSym &G, bool stopAtBoundary=false, bool calcJacobianNoise=false)
void setChargeSign(double charge)
const TVectorD & getState() const
double extrapolateToCylinder(double radius, const TVector3 &linePoint=TVector3(0., 0., 0.), const TVector3 &lineDirection=TVector3(0., 0., 1.), bool stopAtBoundary=false, bool calcJacobianNoise=false)
double extrapolateToSphere(double radius, const TVector3 &point=TVector3(0., 0., 0.), bool stopAtBoundary=false, bool calcJacobianNoise=false)
double extrapolateToPlane(const SharedPlanePtr &plane, bool stopAtBoundary=false, bool calcJacobianNoise=false)
virtual void Print(Option_t *option="") const
double getCharge() const
SharedPlanePtr sharedPlane_
TVector3 getDir() const
const AbsTrackRep * rep_
Shared ownership. '!' in order to silence ROOT, custom streamer writes and reads this.
double extrapolateToPoint(const TVector3 &point, bool stopAtBoundary=false, bool calcJacobianNoise=false)
void getPosDir(TVector3 &pos, TVector3 &dir) const
TVectorD get6DState() const
StateOnPlane & operator=(StateOnPlane other)
StateOnPlane(const AbsTrackRep *rep=NULL)
void setPosMom(const TVector3 &pos, const TVector3 &mom)
void setAuxInfo(const TVectorD &auxInfo)
void swap(StateOnPlane &other)
double getQop() const
double extrapolateToMeasurement(const AbsMeasurement *measurement, bool stopAtBoundary=false, bool calcJacobianNoise=false)
double getMass() const
void setState(const TVectorD &state)
void getPosMom(TVector3 &pos, TVector3 &mom) const
double getMomMag() const
void setRep(const AbsTrackRep *rep)
void setStatePlane(const TVectorD &state, const SharedPlanePtr &plane)
const AbsTrackRep * getRep() const
const TVectorD & getAuxInfo() const
void setQop(double qop)
const SharedPlanePtr & getPlane() const
Matrix inversion tools.
Definition AbsBField.h:29
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.