PandaRoot
AbsTrackRep.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /* Copyright 2008-2010, Technische Universitaet Muenchen,
14  Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
15 
16  This file is part of GENFIT.
17 
18  GENFIT is free software: you can redistribute it and/or modify
19  it under the terms of the GNU Lesser General Public License as published
20  by the Free Software Foundation, either version 3 of the License, or
21  (at your option) any later version.
22 
23  GENFIT is distributed in the hope that it will be useful,
24  but WITHOUT ANY WARRANTY; without even the implied warranty of
25  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  GNU Lesser General Public License for more details.
27 
28  You should have received a copy of the GNU Lesser General Public License
29  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
30 */
35 #ifndef genfit_AbsTrackRep_h
36 #define genfit_AbsTrackRep_h
37 
38 #include "SharedPlanePtr.h"
39 //#include "MaterialInfo.h"
40 #include "MaterialProperties.h"
41 
42 #include <TVector3.h>
43 #include <TObject.h>
44 #include <TVectorD.h>
45 #include <TMatrixD.h>
46 #include <TMatrixDSym.h>
47 
48 namespace genfit {
49 
53 struct MatStep {
55  double stepSize_;
56 
57  MatStep() { stepSize_ = 0; }
58 };
59 
60 class StateOnPlane;
62 class AbsMeasurement;
63 
74 class AbsTrackRep : public TObject {
75 
76  public:
77  AbsTrackRep();
78  AbsTrackRep(int pdgCode, char propDir = 0);
79 
80  virtual ~AbsTrackRep() { ; }
81 
83  virtual AbsTrackRep *clone() const = 0;
84 
94  virtual double extrapolateToPlane(StateOnPlane &state, const genfit::SharedPlanePtr &plane, bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
95 
105  virtual double
106  extrapolateToLine(StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
107 
120  virtual double extrapolateToLine(StateOnPlane &state, const TVector3 &point1, const TVector3 &point2, TVector3 &poca, TVector3 &dirInPoca, TVector3 &poca_onwire,
121  bool stopAtBoundary = false, bool calcJacobianNoise = false) const
122  {
123  TVector3 wireDir(point2 - point1);
124  wireDir.Unit();
125  double retval = this->extrapolateToLine(state, point1, wireDir, stopAtBoundary, calcJacobianNoise);
126  poca = this->getPos(state);
127  dirInPoca = this->getMom(state);
128  dirInPoca.Unit();
129 
130  poca_onwire = point1 + wireDir * ((poca - point1) * wireDir);
131 
132  return retval;
133  }
134 
144  virtual double extrapolateToPoint(StateOnPlane &state, const TVector3 &point, bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
145 
155  virtual double extrapolateToPoint(StateOnPlane &state, const TVector3 &point,
156  const TMatrixDSym &G, // weight matrix (metric)
157  bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
158 
168  virtual double extrapolateToCylinder(StateOnPlane &state, double radius, const TVector3 &linePoint = TVector3(0., 0., 0.), const TVector3 &lineDirection = TVector3(0., 0., 1.),
169  bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
170 
180  virtual double
181  extrapolateToSphere(StateOnPlane &state, double radius, const TVector3 &point = TVector3(0., 0., 0.), bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
182 
192  virtual double extrapolateBy(StateOnPlane &state, double step, bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
193 
195  double extrapolateToMeasurement(StateOnPlane &state, const AbsMeasurement *measurement, bool stopAtBoundary = false, bool calcJacobianNoise = false) const;
196 
198  virtual unsigned int getDim() const = 0;
199 
201  virtual TVector3 getPos(const StateOnPlane &state) const = 0;
202 
204  virtual TVector3 getMom(const StateOnPlane &state) const = 0;
205 
207  TVector3 getDir(const StateOnPlane &state) const { return getMom(state).Unit(); }
208 
210  virtual void getPosMom(const StateOnPlane &state, TVector3 &pos, TVector3 &mom) const = 0;
211 
213  void getPosDir(const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
214  {
215  getPosMom(state, pos, dir);
216  dir.SetMag(1.);
217  }
218 
220  virtual TVectorD get6DState(const StateOnPlane &state) const;
221 
223  virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane &state) const = 0;
224 
226  virtual void getPosMomCov(const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const = 0;
227 
229  virtual void get6DStateCov(const MeasuredStateOnPlane &state, TVectorD &stateVec, TMatrixDSym &cov) const;
230 
232  virtual double getMomMag(const StateOnPlane &state) const = 0;
234  virtual double getMomVar(const MeasuredStateOnPlane &state) const = 0;
235 
237  int getPDG() const { return pdgCode_; }
238 
240  double getPDGCharge() const;
241 
246  virtual double getCharge(const StateOnPlane &state) const = 0;
248  virtual double getQop(const StateOnPlane &state) const = 0;
250  double getMass(const StateOnPlane &state) const;
251 
253  char getPropDir() const { return propDir_; }
254 
256  virtual void getForwardJacobianAndNoise(TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const = 0;
257 
259  virtual void getBackwardJacobianAndNoise(TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const = 0;
260 
262  virtual std::vector<genfit::MatStep> getSteps() const = 0;
263 
265  virtual double getRadiationLenght() const = 0;
266 
268  // should keep this up to date with the time of flight.
269  virtual double getTime(const StateOnPlane &) const = 0;
270 
275  void calcJacobianNumerically(const genfit::StateOnPlane &origState, const genfit::SharedPlanePtr destPlane, TMatrixD &jacobian) const;
276 
278  bool switchPDGSign();
279 
281  virtual void setPosMom(StateOnPlane &state, const TVector3 &pos, const TVector3 &mom) const = 0;
283  virtual void setPosMom(StateOnPlane &state, const TVectorD &state6) const = 0;
285  virtual void setPosMomErr(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TVector3 &posErr, const TVector3 &momErr) const = 0;
287  virtual void setPosMomCov(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6) const = 0;
289  virtual void setPosMomCov(MeasuredStateOnPlane &state, const TVectorD &state6, const TMatrixDSym &cov6x6) const = 0;
290 
292  virtual void setChargeSign(StateOnPlane &state, double charge) const = 0;
294  virtual void setQop(StateOnPlane &state, double qop) const = 0;
296  virtual void setTime(StateOnPlane &state, double time) const = 0;
297 
299  void setPropDir(int dir)
300  {
301  if (dir > 0)
302  propDir_ = 1;
303  else if (dir < 0)
304  propDir_ = -1;
305  else
306  propDir_ = 0;
307  };
308 
310  void switchPropDir() { propDir_ = -1 * propDir_; }
311 
313  virtual bool isSameType(const AbsTrackRep *other) = 0;
314 
316  virtual bool isSame(const AbsTrackRep *other) = 0;
317 
318  virtual void setDebugLvl(unsigned int lvl = 1) { debugLvl_ = lvl; }
319 
320  virtual void Print(const Option_t * = "") const;
321 
322  protected:
324  AbsTrackRep(const AbsTrackRep &);
326  AbsTrackRep &operator=(const AbsTrackRep &);
327 
329  int pdgCode_;
331  char propDir_;
332 
333  unsigned int debugLvl_;
334 
335  public:
336  ClassDef(AbsTrackRep, 1)
337 };
338 
339 } /* End of namespace genfit */
342 #endif // genfit_AbsTrackRep_h
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.
Definition: AbsTrackRep.h:120
void getPosDir(const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
Get cartesian position and direction vector of a state.
Definition: AbsTrackRep.h:213
unsigned int debugLvl_
Definition: AbsTrackRep.h:333
virtual ~AbsTrackRep()
Definition: AbsTrackRep.h:80
Simple struct containing MaterialProperties and stepsize in the material.
Definition: AbsTrackRep.h:53
void setPropDir(int dir)
Set propagation direction. (-1, 0, 1) -> (backward, auto, forward).
Definition: AbsTrackRep.h:299
Abstract base class for a track representation.
Definition: AbsTrackRep.h:74
void switchPropDir()
Switch propagation direction. Has no effect if propDir_ is set to 0.
Definition: AbsTrackRep.h:310
StateOnPlane with additional covariance matrix.
Material properties needed e.g. for material effects calculation.
virtual void setDebugLvl(unsigned int lvl=1)
Definition: AbsTrackRep.h:318
MaterialProperties materialProperties_
Definition: AbsTrackRep.h:54
double stepSize_
Definition: AbsTrackRep.h:55
char getPropDir() const
Get propagation direction. (-1, 0, 1) -> (backward, auto, forward).
Definition: AbsTrackRep.h:253
char propDir_
propagation direction (-1, 0, 1) -> (backward, auto, forward)
Definition: AbsTrackRep.h:331
A state with arbitrary dimension defined in a DetPlane.
Definition: StateOnPlane.h:56
int getPDG() const
Get the pdg code.
Definition: AbsTrackRep.h:237
TVector3 getDir(const StateOnPlane &state) const
Get the direction vector of a state.
Definition: AbsTrackRep.h:207
int pdgCode_
Particle code.
Definition: AbsTrackRep.h:329
Contains the measurement and covariance in raw detector coordinates.
boost::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:64
Matrix inversion tools.
Definition: AbsBField.h:40