Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbsTrackRep.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AbsTrackRep.h
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 "Material.h"
29 
30 #include <TVector3.h>
31 #include <TObject.h>
32 #include <TVectorD.h>
33 #include <TMatrixD.h>
34 #include <TMatrixDSym.h>
35 
36 
37 namespace genfit {
38 
42 struct MatStep {
44  double stepSize_;
45 
46  MatStep() {
47  stepSize_ = 0;
48  }
49 
50 };
51 
52 class StateOnPlane;
53 class MeasuredStateOnPlane;
54 class AbsMeasurement;
55 
66 class AbsTrackRep : public TObject {
67 
68  public:
69 
70  AbsTrackRep();
71  AbsTrackRep(int pdgCode, char propDir = 0);
72 
73  virtual ~AbsTrackRep() {;}
74 
76  virtual AbsTrackRep* clone() const = 0;
77 
87  virtual double extrapolateToPlane(
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 
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 = wireDir.Unit();
130  double retval = this->extrapolateToLine(state, point1, wireDir, stopAtBoundary, calcJacobianNoise);
131  poca = this->getPos(state);
132  dirInPoca = this->getMom(state);
133  dirInPoca = 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 extrapolateToCone(StateOnPlane& state,
195  double radius,
196  const TVector3& linePoint = TVector3(0.,0.,0.),
197  const TVector3& lineDirection = TVector3(0.,0.,1.),
198  bool stopAtBoundary = false,
199  bool calcJacobianNoise = false) const = 0;
200 
210  virtual double extrapolateToSphere(StateOnPlane& state,
211  double radius,
212  const TVector3& point = TVector3(0.,0.,0.),
213  bool stopAtBoundary = false,
214  bool calcJacobianNoise = false) const = 0;
215 
225  virtual double extrapolateBy(StateOnPlane& state,
226  double step,
227  bool stopAtBoundary = false,
228  bool calcJacobianNoise = false) const = 0;
229 
232  const AbsMeasurement* measurement,
233  bool stopAtBoundary = false,
234  bool calcJacobianNoise = false) const;
235 
237  virtual unsigned int getDim() const = 0;
238 
240  virtual TVector3 getPos(const StateOnPlane& state) const = 0;
241 
243  virtual TVector3 getMom(const StateOnPlane& state) const = 0;
244 
246  TVector3 getDir(const StateOnPlane& state) const {return getMom(state).Unit();}
247 
249  virtual void getPosMom(const StateOnPlane& state, TVector3& pos, TVector3& mom) const = 0;
250 
252  void getPosDir(const StateOnPlane& state, TVector3& pos, TVector3& dir) const {getPosMom(state, pos, dir); dir.SetMag(1.);}
253 
255  virtual TVectorD get6DState(const StateOnPlane& state) const;
256 
258  virtual TMatrixDSym get6DCov(const MeasuredStateOnPlane& state) const = 0;
259 
261  virtual void getPosMomCov(const MeasuredStateOnPlane& state, TVector3& pos, TVector3& mom, TMatrixDSym& cov) const = 0;
262 
264  virtual void get6DStateCov(const MeasuredStateOnPlane& state, TVectorD& stateVec, TMatrixDSym& cov) const;
265 
267  virtual double getMomMag(const StateOnPlane& state) const = 0;
269  virtual double getMomVar(const MeasuredStateOnPlane& state) const = 0;
270 
272  int getPDG() const {return pdgCode_;}
273 
275  double getPDGCharge() const;
276 
281  virtual double getCharge(const StateOnPlane& state) const = 0;
283  virtual double getQop(const StateOnPlane& state) const = 0;
285  double getMass(const StateOnPlane& state) const;
286 
288  char getPropDir() const {return propDir_;}
289 
291  virtual void getForwardJacobianAndNoise(TMatrixD& jacobian, TMatrixDSym& noise, TVectorD& deltaState) const = 0;
292 
294  virtual void getBackwardJacobianAndNoise(TMatrixD& jacobian, TMatrixDSym& noise, TVectorD& deltaState) const = 0;
295 
297  virtual std::vector<genfit::MatStep> getSteps() const = 0;
298 
300  virtual double getRadiationLenght() const = 0;
301 
303  // should keep this up to date with the time of flight.
304  virtual double getTime(const StateOnPlane&) const = 0;
305 
310  void calcJacobianNumerically(const genfit::StateOnPlane& origState,
311  const genfit::SharedPlanePtr destPlane,
312  TMatrixD& jacobian) const;
313 
315  bool switchPDGSign();
316 
318  virtual void setPosMom(StateOnPlane& state, const TVector3& pos, const TVector3& mom) const = 0;
320  virtual void setPosMom(StateOnPlane& state, const TVectorD& state6) const = 0;
322  virtual void setPosMomErr(MeasuredStateOnPlane& state, const TVector3& pos, const TVector3& mom, const TVector3& posErr, const TVector3& momErr) const = 0;
324  virtual void setPosMomCov(MeasuredStateOnPlane& state, const TVector3& pos, const TVector3& mom, const TMatrixDSym& cov6x6) const = 0;
326  virtual void setPosMomCov(MeasuredStateOnPlane& state, const TVectorD& state6, const TMatrixDSym& cov6x6) const = 0;
327 
329  virtual void setChargeSign(StateOnPlane& state, double charge) const = 0;
331  virtual void setQop(StateOnPlane& state, double qop) const = 0;
333  virtual void setTime(StateOnPlane& state, double time) const = 0;
334 
336  void setPropDir(int dir) {
337  if (dir>0) propDir_ = 1;
338  else if (dir<0) propDir_ = -1;
339  else propDir_ = 0;
340  };
341 
344 
346  virtual bool isSameType(const AbsTrackRep* other) = 0;
347 
349  virtual bool isSame(const AbsTrackRep* other) = 0;
350 
351  virtual void setDebugLvl(unsigned int lvl = 1) {debugLvl_ = lvl;}
352 
353  virtual void Print(const Option_t* = "") const;
354 
355  protected:
356 
358  AbsTrackRep(const AbsTrackRep&);
361 
362 
364  int pdgCode_;
366  char propDir_;
367 
368  unsigned int debugLvl_;
369 
370  public:
371  ClassDef(AbsTrackRep,1)
372 
373 };
374 
375 } /* End of namespace genfit */
378 #endif // genfit_AbsTrackRep_h