SND@LHC Software
Loading...
Searching...
No Matches
AbsTrackRep.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*/
23#ifndef genfit_AbsTrackRep_h
24#define genfit_AbsTrackRep_h
25
26#include "SharedPlanePtr.h"
27//#include "MaterialInfo.h"
28#include "MaterialProperties.h"
29
30#include <TVector3.h>
31#include <TObject.h>
32#include <TVectorD.h>
33#include <TMatrixD.h>
34#include <TMatrixDSym.h>
35
36
37namespace genfit {
38
51
52class StateOnPlane;
53class MeasuredStateOnPlane;
54class AbsMeasurement;
55
66class AbsTrackRep : public TObject {
67
68 public:
69
71 AbsTrackRep(int pdgCode, char propDir = 0);
72
73 virtual ~AbsTrackRep() {;}
74
76 virtual AbsTrackRep* clone() const = 0;
77
87 virtual double extrapolateToPlane(
88 StateOnPlane& state,
89 const genfit::SharedPlanePtr& plane,
90 bool stopAtBoundary = false,
91 bool calcJacobianNoise = false) const = 0;
92
102 virtual double extrapolateToLine(StateOnPlane& state,
103 const TVector3& linePoint,
104 const TVector3& lineDirection,
105 bool stopAtBoundary = false,
106 bool calcJacobianNoise = false) const = 0;
107
120 virtual double extrapolateToLine(StateOnPlane& state,
121 const TVector3& point1,
122 const TVector3& point2,
123 TVector3& poca,
124 TVector3& dirInPoca,
125 TVector3& poca_onwire,
126 bool stopAtBoundary = false,
127 bool calcJacobianNoise = false) const {
128 TVector3 wireDir(point2 - point1);
129 wireDir.Unit();
130 double retval = this->extrapolateToLine(state, point1, wireDir, stopAtBoundary, calcJacobianNoise);
131 poca = this->getPos(state);
132 dirInPoca = this->getMom(state);
133 dirInPoca.Unit();
134
135 poca_onwire = point1 + wireDir*((poca - point1)*wireDir);
136
137 return retval;
138 }
139
149 virtual double extrapolateToPoint(StateOnPlane& state,
150 const TVector3& point,
151 bool stopAtBoundary = false,
152 bool calcJacobianNoise = false) const = 0;
153
163 virtual double extrapolateToPoint(StateOnPlane& state,
164 const TVector3& point,
165 const TMatrixDSym& G, // weight matrix (metric)
166 bool stopAtBoundary = false,
167 bool calcJacobianNoise = false) const = 0;
168
178 virtual double extrapolateToCylinder(StateOnPlane& state,
179 double radius,
180 const TVector3& linePoint = TVector3(0.,0.,0.),
181 const TVector3& lineDirection = TVector3(0.,0.,1.),
182 bool stopAtBoundary = false,
183 bool calcJacobianNoise = false) const = 0;
184
194 virtual double extrapolateToSphere(StateOnPlane& state,
195 double radius,
196 const TVector3& point = TVector3(0.,0.,0.),
197 bool stopAtBoundary = false,
198 bool calcJacobianNoise = false) const = 0;
199
209 virtual double extrapolateBy(StateOnPlane& state,
210 double step,
211 bool stopAtBoundary = false,
212 bool calcJacobianNoise = false) const = 0;
213
216 const AbsMeasurement* measurement,
217 bool stopAtBoundary = false,
218 bool calcJacobianNoise = false) const;
219
221 virtual unsigned int getDim() const = 0;
222
224 virtual TVector3 getPos(const StateOnPlane& state) const = 0;
225
227 virtual TVector3 getMom(const StateOnPlane& state) const = 0;
228
230 TVector3 getDir(const StateOnPlane& state) const {return getMom(state).Unit();}
231
233 virtual void getPosMom(const StateOnPlane& state, TVector3& pos, TVector3& mom) const = 0;
234
236 void getPosDir(const StateOnPlane& state, TVector3& pos, TVector3& dir) const {getPosMom(state, pos, dir); dir.SetMag(1.);}
237
239 virtual TVectorD get6DState(const StateOnPlane& state) const;
240
242 virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane& state) const = 0;
243
245 virtual void getPosMomCov(const MeasuredStateOnPlane& state, TVector3& pos, TVector3& mom, TMatrixDSym& cov) const = 0;
246
248 virtual void get6DStateCov(const MeasuredStateOnPlane& state, TVectorD& stateVec, TMatrixDSym& cov) const;
249
251 virtual double getMomMag(const StateOnPlane& state) const = 0;
253 virtual double getMomVar(const MeasuredStateOnPlane& state) const = 0;
254
256 int getPDG() const {return pdgCode_;}
257
259 double getPDGCharge() const;
260
265 virtual double getCharge(const StateOnPlane& state) const = 0;
267 virtual double getQop(const StateOnPlane& state) const = 0;
269 double getMass(const StateOnPlane& state) const;
270
272 char getPropDir() const {return propDir_;}
273
275 virtual void getForwardJacobianAndNoise(TMatrixD& jacobian, TMatrixDSym& noise, TVectorD& deltaState) const = 0;
276
278 virtual void getBackwardJacobianAndNoise(TMatrixD& jacobian, TMatrixDSym& noise, TVectorD& deltaState) const = 0;
279
281 virtual std::vector<genfit::MatStep> getSteps() const = 0;
282
284 virtual double getRadiationLenght() const = 0;
285
287 virtual double getTOF() const = 0;
288
293 void calcJacobianNumerically(const genfit::StateOnPlane& origState,
294 const genfit::SharedPlanePtr destPlane,
295 TMatrixD& jacobian) const;
296
298 bool switchPDGSign();
299
301 virtual void setPosMom(StateOnPlane& state, const TVector3& pos, const TVector3& mom) const = 0;
303 virtual void setPosMom(StateOnPlane& state, const TVectorD& state6) const = 0;
305 virtual void setPosMomErr(MeasuredStateOnPlane& state, const TVector3& pos, const TVector3& mom, const TVector3& posErr, const TVector3& momErr) const = 0;
307 virtual void setPosMomCov(MeasuredStateOnPlane& state, const TVector3& pos, const TVector3& mom, const TMatrixDSym& cov6x6) const = 0;
309 virtual void setPosMomCov(MeasuredStateOnPlane& state, const TVectorD& state6, const TMatrixDSym& cov6x6) const = 0;
310
312 virtual void setChargeSign(StateOnPlane& state, double charge) const = 0;
314 virtual void setQop(StateOnPlane& state, double qop) const = 0;
315
317 void setPropDir(int dir) {
318 if (dir>0) propDir_ = 1;
319 else if (dir<0) propDir_ = -1;
320 else propDir_ = 0;
321 };
322
325
327 virtual bool isSameType(const AbsTrackRep* other) = 0;
328
330 virtual bool isSame(const AbsTrackRep* other) = 0;
331
332 virtual void setDebugLvl(unsigned int lvl = 1) {debugLvl_ = lvl;}
333
334 virtual void Print(const Option_t* = "") const;
335
336 protected:
337
339 AbsTrackRep(const AbsTrackRep&);
342
343
348
349 unsigned int debugLvl_;
350
351 public:
352 ClassDef(AbsTrackRep,1)
353
354};
355
356} /* End of namespace genfit */
359#endif // genfit_AbsTrackRep_h
Contains the measurement and covariance in raw detector coordinates.
Abstract base class for a track representation.
Definition AbsTrackRep.h:66
virtual void setPosMom(StateOnPlane &state, const TVectorD &state6) const =0
Set position and momentum of state.
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 bool isSameType(const AbsTrackRep *other)=0
check if other is of same type (e.g. RKTrackRep).
virtual double getMomVar(const MeasuredStateOnPlane &state) const =0
get the variance of the absolute value of the momentum .
int pdgCode_
Particle code.
virtual double getTOF() const =0
Get the time of flight [ns] of the last extrapolation.
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,...
virtual void setDebugLvl(unsigned int lvl=1)
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 std::vector< genfit::MatStep > getSteps() const =0
Get stepsizes and material properties of crossed materials of the last extrapolation.
virtual void setPosMomCov(MeasuredStateOnPlane &state, const TVectorD &state6, const TMatrixDSym &cov6x6) const =0
Set position, momentum and covariance of 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 void setPosMomErr(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TVector3 &posErr, const TVector3 &momErr) const =0
Set position and momentum and error of state.
void calcJacobianNumerically(const genfit::StateOnPlane &origState, const genfit::SharedPlanePtr destPlane, TMatrixD &jacobian) const
Calculate Jacobian of transportation numerically. Slow but accurate. Can be used to validate (semi)an...
virtual double getRadiationLenght() const =0
Get the accumulated X/X0 (path / radiation length) of the material crossed in the last extrapolation.
virtual TVector3 getMom(const StateOnPlane &state) const =0
Get the cartesian momentum vector of a state.
char getPropDir() const
Get propagation direction. (-1, 0, 1) -> (backward, auto, forward).
void setPropDir(int dir)
Set propagation direction. (-1, 0, 1) -> (backward, auto, forward).
virtual void setPosMom(StateOnPlane &state, const TVector3 &pos, const TVector3 &mom) const =0
Set position and momentum of state.
virtual ~AbsTrackRep()
Definition AbsTrackRep.h:73
int getPDG() const
Get the pdg code.
bool switchPDGSign()
try to multiply pdg code with -1. (Switch from particle to anti-particle and vice versa).
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 extrapolateToPoint(StateOnPlane &state, const TVector3 &point, const TMatrixDSym &G, bool stopAtBoundary=false, bool calcJacobianNoise=false) const =0
Extrapolates the state to the POCA to a point in the metric of G, and returns the extrapolation lengt...
virtual double getMomMag(const StateOnPlane &state) const =0
get the magnitude of the momentum in GeV.
AbsTrackRep & operator=(const AbsTrackRep &)
protect from calling assignment operator from outside the class. Use clone() instead!
virtual void Print(const Option_t *="") const
virtual bool isSame(const AbsTrackRep *other)=0
check if other is of same type (e.g. RKTrackRep) and has same pdg code.
virtual void setPosMomCov(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6) const =0
Set position, momentum and covariance of state.
virtual void getForwardJacobianAndNoise(TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const =0
Get the jacobian and noise matrix of the last extrapolation.
virtual void setQop(StateOnPlane &state, double qop) const =0
Set charge/momentum.
double getPDGCharge() const
Get the charge of the particle of the pdg code.
virtual void getBackwardJacobianAndNoise(TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const =0
Get the jacobian and noise matrix of the last extrapolation if it would have been done in opposite di...
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 extrapolateToLine(StateOnPlane &state, const TVector3 &point1, const TVector3 &point2, TVector3 &poca, TVector3 &dirInPoca, TVector3 &poca_onwire, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
Resembles the interface of GFAbsTrackRep in old versions of genfit.
void switchPropDir()
Switch propagation direction. Has no effect if propDir_ is set to 0.
virtual void get6DStateCov(const MeasuredStateOnPlane &state, TVectorD &stateVec, TMatrixDSym &cov) const
Translates MeasuredStateOnPlane into 6D state vector (x, y, z, p_x, p_y, p_z) and 6x6 covariance.
virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane &state) const =0
Get the 6D covariance.
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 void getPosMomCov(const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const =0
Translates MeasuredStateOnPlane into 3D position, momentum and 6x6 covariance.
unsigned int debugLvl_
virtual AbsTrackRep * clone() const =0
Clone the trackRep.
char propDir_
propagation direction (-1, 0, 1) -> (backward, auto, forward)
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,...
Material properties needed e.g. for material effects calculation.
StateOnPlane with additional covariance matrix.
A state with arbitrary dimension defined in a DetPlane.
Matrix inversion tools.
Definition AbsBField.h:29
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
Simple struct containing MaterialProperties and stepsize in the material.
Definition AbsTrackRep.h:42
MaterialProperties materialProperties_
Definition AbsTrackRep.h:43