GENFIT Rev: NoNumberAvailable
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
23
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#include <cassert>
34
35
36namespace genfit {
37
48
49 public:
50
52
53 StateOnPlane(const AbsTrackRep* rep = nullptr);
55 StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep);
56 StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo);
57
59 void swap(StateOnPlane& other); // nothrow
60
61 virtual ~StateOnPlane() {}
62 virtual StateOnPlane* clone() const {return new StateOnPlane(*this);}
63
64 const TVectorD& getState() const {return state_;}
65 TVectorD& getState() {return state_;}
66 const TVectorD& getAuxInfo() const {return auxInfo_;}
67 TVectorD& getAuxInfo() {return auxInfo_;}
68 const SharedPlanePtr& getPlane() const {return sharedPlane_;}
69 const AbsTrackRep* getRep() const {return rep_;}
70
71 void setState(const TVectorD& state) {if(state_.GetNrows() == 0) state_.ResizeTo(state); state_ = state;}
72 void setPlane(const SharedPlanePtr& plane) {sharedPlane_ = plane;}
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;}
75 void setRep(const AbsTrackRep* rep) {rep_ = rep;}
76
77 // Shortcuts to TrackRep functions
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,
89 const TMatrixDSym& G, // weight matrix (metric)
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,
111 bool calcJacobianNoise = false) {return rep_->extrapolateToMeasurement(*this, measurement, stopAtBoundary, calcJacobianNoise);}
112
113
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);}
119 TVectorD get6DState() const {return rep_->get6DState(*this);}
120 double getMomMag() const {return rep_->getMomMag(*this);}
121 int getPDG() const {return rep_->getPDG();}
122 double getCharge() const {return rep_->getCharge(*this);}
123 double getQop() const {return rep_->getQop(*this);}
124 double getMass() const {return rep_->getMass(*this);}
125 double getTime() const {return rep_->getTime(*this);}
126
127 void setPosMom(const TVector3& pos, const TVector3& mom) {rep_->setPosMom(*this, pos, mom);}
128 void setPosMom(const TVectorD& state6) {rep_->setPosMom(*this, state6);}
129 void setChargeSign(double charge) {rep_->setChargeSign(*this, charge);}
130 void setQop(double qop) {rep_->setQop(*this, qop);}
131 void setTime(double time) {rep_->setTime(*this, time);}
132
133
134 virtual void Print(Option_t* option = "") const;
135
136 protected:
137
138 TVectorD state_; // state vector
139 TVectorD auxInfo_; // auxiliary information (e.g. charge, flight direction etc.)
141
142 private:
143
147
148 public:
149 ClassDef(StateOnPlane,2)
150 // Version history:
151 // ver 2: no longer derives from TObject (the TObject parts were not
152 // streamed, so no compatibility issues arise.)
153};
154
155
157 state_(0), auxInfo_(0), sharedPlane_(), rep_(rep)
158{
159 if (rep != nullptr) {
160 state_.ResizeTo(rep->getDim());
161 }
162}
163
164inline StateOnPlane::StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep) :
165 state_(state), auxInfo_(0), sharedPlane_(plane), rep_(rep)
166{
167 assert(rep != nullptr);
168 assert(sharedPlane_.get() != nullptr);
169}
170
171inline StateOnPlane::StateOnPlane(const TVectorD& state, const SharedPlanePtr& plane, const AbsTrackRep* rep, const TVectorD& auxInfo) :
172 state_(state), auxInfo_(auxInfo), sharedPlane_(plane), rep_(rep)
173{
174 assert(rep != nullptr);
175 assert(sharedPlane_.get() != nullptr);
176}
177
179 swap(other);
180 return *this;
181}
182
183inline 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_);
190}
191
192} /* End of namespace genfit */
194
195#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 unsigned int getDim() const =0
Get the dimension of the state vector used by the track representation.
A state with arbitrary dimension defined in a DetPlane.
void setPlane(const SharedPlanePtr &plane)
TVectorD & getAuxInfo()
TVector3 getMom() const
double extrapolateToCone(double openingAngle, const TVector3 &conePoint=TVector3(0., 0., 0.), const TVector3 &coneDirection=TVector3(0., 0., 1.), bool stopAtBoundary=false, bool calcJacobianNoise=false)
TVector3 getPos() const
double extrapolateToLine(const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary=false, bool calcJacobianNoise=false)
double getTime() const
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)
virtual StateOnPlane * clone() const
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
StateOnPlane(const genfit::StateOnPlane &)=default
TVectorD get6DState() const
StateOnPlane & operator=(StateOnPlane other)
void setPosMom(const TVector3 &pos, const TVector3 &mom)
void setAuxInfo(const TVectorD &auxInfo)
void swap(StateOnPlane &other)
double getQop() const
void setTime(double time)
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
Defines for I/O streams used for error and debug printing.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.