PandaRoot
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 namespace genfit {
37 
41 struct MatStep {
43  double stepSize_;
44 
45  MatStep() { stepSize_ = 0; }
46 };
47 
48 class StateOnPlane;
50 class AbsMeasurement;
51 
62 class AbsTrackRep : public TObject {
63 
64  public:
65  AbsTrackRep();
66  AbsTrackRep(int pdgCode, char propDir = 0);
67 
68  virtual ~AbsTrackRep() { ; }
69 
71  virtual AbsTrackRep *clone() const = 0;
72 
82  virtual double extrapolateToPlane(StateOnPlane &state, const genfit::SharedPlanePtr &plane, bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
83 
93  virtual double
94  extrapolateToLine(StateOnPlane &state, const TVector3 &linePoint, const TVector3 &lineDirection, bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
95 
108  virtual double extrapolateToLine(StateOnPlane &state, const TVector3 &point1, const TVector3 &point2, TVector3 &poca, TVector3 &dirInPoca, TVector3 &poca_onwire,
109  bool stopAtBoundary = false, bool calcJacobianNoise = false) const
110  {
111  TVector3 wireDir(point2 - point1);
112  wireDir.Unit();
113  double retval = this->extrapolateToLine(state, point1, wireDir, stopAtBoundary, calcJacobianNoise);
114  poca = this->getPos(state);
115  dirInPoca = this->getMom(state);
116  dirInPoca.Unit();
117 
118  poca_onwire = point1 + wireDir * ((poca - point1) * wireDir);
119 
120  return retval;
121  }
122 
132  virtual double extrapolateToPoint(StateOnPlane &state, const TVector3 &point, bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
133 
143  virtual double extrapolateToPoint(StateOnPlane &state, const TVector3 &point,
144  const TMatrixDSym &G, // weight matrix (metric)
145  bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
146 
156  virtual double extrapolateToCylinder(StateOnPlane &state, double radius, const TVector3 &linePoint = TVector3(0., 0., 0.), const TVector3 &lineDirection = TVector3(0., 0., 1.),
157  bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
158 
168  virtual double
169  extrapolateToSphere(StateOnPlane &state, double radius, const TVector3 &point = TVector3(0., 0., 0.), bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
170 
180  virtual double extrapolateBy(StateOnPlane &state, double step, bool stopAtBoundary = false, bool calcJacobianNoise = false) const = 0;
181 
183  double extrapolateToMeasurement(StateOnPlane &state, const AbsMeasurement *measurement, bool stopAtBoundary = false, bool calcJacobianNoise = false) const;
184 
186  virtual unsigned int getDim() const = 0;
187 
189  virtual TVector3 getPos(const StateOnPlane &state) const = 0;
190 
192  virtual TVector3 getMom(const StateOnPlane &state) const = 0;
193 
195  TVector3 getDir(const StateOnPlane &state) const { return getMom(state).Unit(); }
196 
198  virtual void getPosMom(const StateOnPlane &state, TVector3 &pos, TVector3 &mom) const = 0;
199 
201  void getPosDir(const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
202  {
203  getPosMom(state, pos, dir);
204  dir.SetMag(1.);
205  }
206 
208  virtual TVectorD get6DState(const StateOnPlane &state) const;
209 
211  virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane &state) const = 0;
212 
214  virtual void getPosMomCov(const MeasuredStateOnPlane &state, TVector3 &pos, TVector3 &mom, TMatrixDSym &cov) const = 0;
215 
217  virtual void get6DStateCov(const MeasuredStateOnPlane &state, TVectorD &stateVec, TMatrixDSym &cov) const;
218 
220  virtual double getMomMag(const StateOnPlane &state) const = 0;
222  virtual double getMomVar(const MeasuredStateOnPlane &state) const = 0;
223 
225  int getPDG() const { return pdgCode_; }
226 
228  double getPDGCharge() const;
229 
234  virtual double getCharge(const StateOnPlane &state) const = 0;
236  virtual double getQop(const StateOnPlane &state) const = 0;
238  double getMass(const StateOnPlane &state) const;
239 
241  char getPropDir() const { return propDir_; }
242 
244  virtual void getForwardJacobianAndNoise(TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const = 0;
245 
247  virtual void getBackwardJacobianAndNoise(TMatrixD &jacobian, TMatrixDSym &noise, TVectorD &deltaState) const = 0;
248 
250  virtual std::vector<genfit::MatStep> getSteps() const = 0;
251 
253  virtual double getRadiationLenght() const = 0;
254 
256  // should keep this up to date with the time of flight.
257  virtual double getTime(const StateOnPlane &) const = 0;
258 
263  void calcJacobianNumerically(const genfit::StateOnPlane &origState, const genfit::SharedPlanePtr destPlane, TMatrixD &jacobian) const;
264 
266  bool switchPDGSign();
267 
269  virtual void setPosMom(StateOnPlane &state, const TVector3 &pos, const TVector3 &mom) const = 0;
271  virtual void setPosMom(StateOnPlane &state, const TVectorD &state6) const = 0;
273  virtual void setPosMomErr(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TVector3 &posErr, const TVector3 &momErr) const = 0;
275  virtual void setPosMomCov(MeasuredStateOnPlane &state, const TVector3 &pos, const TVector3 &mom, const TMatrixDSym &cov6x6) const = 0;
277  virtual void setPosMomCov(MeasuredStateOnPlane &state, const TVectorD &state6, const TMatrixDSym &cov6x6) const = 0;
278 
280  virtual void setChargeSign(StateOnPlane &state, double charge) const = 0;
282  virtual void setQop(StateOnPlane &state, double qop) const = 0;
284  virtual void setTime(StateOnPlane &state, double time) const = 0;
285 
287  void setPropDir(int dir)
288  {
289  if (dir > 0)
290  propDir_ = 1;
291  else if (dir < 0)
292  propDir_ = -1;
293  else
294  propDir_ = 0;
295  };
296 
298  void switchPropDir() { propDir_ = -1 * propDir_; }
299 
301  virtual bool isSameType(const AbsTrackRep *other) = 0;
302 
304  virtual bool isSame(const AbsTrackRep *other) = 0;
305 
306  virtual void setDebugLvl(unsigned int lvl = 1) { debugLvl_ = lvl; }
307 
308  virtual void Print(const Option_t * = "") const;
309 
310  protected:
312  AbsTrackRep(const AbsTrackRep &);
314  AbsTrackRep &operator=(const AbsTrackRep &);
315 
317  int pdgCode_;
319  char propDir_;
320 
321  unsigned int debugLvl_;
322 
323  public:
324  ClassDef(AbsTrackRep, 1)
325 };
326 
327 } /* End of namespace genfit */
330 #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:108
void getPosDir(const StateOnPlane &state, TVector3 &pos, TVector3 &dir) const
Get cartesian position and direction vector of a state.
Definition: AbsTrackRep.h:201
unsigned int debugLvl_
Definition: AbsTrackRep.h:321
virtual ~AbsTrackRep()
Definition: AbsTrackRep.h:68
Simple struct containing MaterialProperties and stepsize in the material.
Definition: AbsTrackRep.h:41
void setPropDir(int dir)
Set propagation direction. (-1, 0, 1) -> (backward, auto, forward).
Definition: AbsTrackRep.h:287
Abstract base class for a track representation.
Definition: AbsTrackRep.h:62
void switchPropDir()
Switch propagation direction. Has no effect if propDir_ is set to 0.
Definition: AbsTrackRep.h:298
StateOnPlane with additional covariance matrix.
Material properties needed e.g. for material effects calculation.
virtual void setDebugLvl(unsigned int lvl=1)
Definition: AbsTrackRep.h:306
MaterialProperties materialProperties_
Definition: AbsTrackRep.h:42
double stepSize_
Definition: AbsTrackRep.h:43
char getPropDir() const
Get propagation direction. (-1, 0, 1) -> (backward, auto, forward).
Definition: AbsTrackRep.h:241
char propDir_
propagation direction (-1, 0, 1) -> (backward, auto, forward)
Definition: AbsTrackRep.h:319
A state with arbitrary dimension defined in a DetPlane.
Definition: StateOnPlane.h:44
int getPDG() const
Get the pdg code.
Definition: AbsTrackRep.h:225
TVector3 getDir(const StateOnPlane &state) const
Get the direction vector of a state.
Definition: AbsTrackRep.h:195
int pdgCode_
Particle code.
Definition: AbsTrackRep.h:317
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:52
Matrix inversion tools.
Definition: AbsBField.h:28