EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RKTrackRep.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RKTrackRep.h
1 /* Copyright 2008-2009, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert
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 
20 /*
21  */
22 
28 #ifndef RKTRACKREP_H
29 #define RKTRACKREP_H
30 
31 
32 #include "GFAbsTrackRep.h"
33 #include "GFDetPlane.h"
34 #include "GFTrackCand.h"
35 #include "GFPointPath.h"
36 #include "RKTools.h"
37 #include <TMatrixD.h>
38 
53 class RKTrackRep : public GFAbsTrackRep {
54 
55  public:
56 
57  // Constructors/Destructors ---------
58  RKTrackRep();
59  RKTrackRep(const TVector3& pos,
60  const TVector3& mom,
61  const TVector3& poserr,
62  const TVector3& momerr,
63  const int& PDGCode);
64 
65  RKTrackRep(const TVector3& pos,
66  const TVector3& mom,
67  const int& PDGCode);
68 
69  RKTrackRep(const GFTrackCand* aGFTrackCandPtr, int pdgcode = 0);
70 
71  virtual ~RKTrackRep();
72 
73 
74  virtual GFAbsTrackRep* clone() const {return new RKTrackRep(*this);}
75  virtual GFAbsTrackRep* prototype()const{return new RKTrackRep();}
76 
78 
143  double extrapolate(const GFDetPlane&,
144  TMatrixD& statePred,
145  TMatrixD& covPred);
146 
148  double extrapolate(const GFDetPlane&,
149  TMatrixD& statePred);
150 
152  void extrapolateToPoint(const TVector3& pos,
153  TVector3& poca,
154  TVector3& dirInPoca);
155 
157  void extrapolateToLine(const TVector3& point1,
158  const TVector3& point2,
159  TVector3& poca,
160  TVector3& dirInPoca,
161  TVector3& poca_onwire);
162 
164 
167  double stepalong(double h,
168  TVector3& point,
169  TVector3& dir);
170 
172 
175  TVector3 getPos(const GFDetPlane&);
177 
180  TVector3 getMom(const GFDetPlane&);
182 
185  void getPosMom(const GFDetPlane&,TVector3& pos,TVector3& mom);
186 
187  void getPosMomCov(const GFDetPlane& pl,
188  TVector3& pos, TVector3& mom,
189  TMatrixD& cov);
190 
192  double getCharge()const {return fCharge;}
193 
194  int getPDG() {return fPdg;};
195 
197  void setPropDir(int dir);
198 
201 
203  void setPDG(int);
204 
206 
210  void setData(const TMatrixD& st,
211  const GFDetPlane& pl,
212  const TMatrixD* cov=NULL,
213  const TMatrixD* aux=NULL);
214 
216 
218  void setPosMomCov(const TVector3& pos,
219  const TVector3& mom,
220  const TMatrixD& cov);
221 
222  void disableMaterialEffects(bool opt = true){fNoMaterial = opt;}
223 
224  const TMatrixD* getAuxInfo(const GFDetPlane& pl);
225 
226  bool hasAuxInfo() { return true; }
227 
228 
229 
230  private:
231 
232  void initArrays();
233 
234  void calcStateCov(const TVector3& pos,
235  const TVector3& mom,
236  const TVector3& poserr,
237  const TVector3& momerr);
238 
239  void calcState(const TVector3& pos,
240  const TVector3& mom);
241 
242  void getState7(M1x7& state7);
243  void getState7(M1x7& state7, const TMatrixD& state5, const GFDetPlane& pl, const double& spu);
244  TMatrixD getState5(const M1x7& state7, const GFDetPlane& pl, double& spu);
245 
246  void transformPM7(const TMatrixD& in5x5,
247  M7x7& out7x7,
248  const GFDetPlane& pl,
249  const TMatrixD& state5,
250  const double& spu,
251  TMatrixD* Jac = NULL);
252 
253  void transformPM6(const TMatrixD& in5x5,
254  M6x6& out6x6,
255  const GFDetPlane& pl,
256  const TMatrixD& state5,
257  const double& spu,
258  TMatrixD* Jac = NULL);
259 
260  void transformM7P(const M7x7& in7x7,
261  TMatrixD& out5x5,
262  const GFDetPlane& pl,
263  const M1x7& state7,
264  TMatrixD* Jac = NULL);
265 
266  void transformM6P(const M6x6& in6x6,
267  TMatrixD& out5x5,
268  const GFDetPlane& pl,
269  const M1x7& state7,
270  TMatrixD* Jac = NULL);
271 
273  return *this;
274  };
275 
277 
287  bool RKutta (const GFDetPlane& plane,
288  M8x7& P,
289  double& coveredDistance,
290  std::vector<GFPointPath>& points,
291  bool& checkJacProj,
292  bool calcCov = true,
293  bool onlyOneStep = false,
294  double maxStep = 1.E99);
295 
296  double estimateStep(std::vector<GFPointPath>& points,
297  const TVector3& pos,
298  const TVector3& dir,
299  const M1x4& SU,
300  const TVector3& MagField,
301  const GFDetPlane& plane,
302  const double& mom,
303  double& relMomLoss,
304  double& deltaAngle,
305  bool& momLossExceeded,
306  bool& atPlane,
307  double maxStep = 1.E99) const;
308 
309  TVector3 poca2Line(const TVector3& extr1,
310  const TVector3& extr2,
311  const TVector3& point) const;
312 
314 
322  double Extrap(const GFDetPlane& plane,
323  M1x7& state7,
324  M7x7* cov=NULL,
325  bool onlyOneStep = false,
326  double maxStep = 1.E99);
327 
328  //RKTrackRep(const RKTrackRep& rhs){};
329 
330  // data members
331 
332  int fDirection; // (-1,0,1) -> (backward prop,decide myself,forward)
333  bool fNoMaterial; // don't calculate material effects if true
334 
336  int fPdg;
338  double fMass;
340  double fCharge;
341 
343  double fCacheSpu;
344  double fSpu;
345  TMatrixD fAuxInfo;
346 
347  // vectors for getState, transform, Extrap etc. functions. Saves a lot of TVector3 constructions/destructions
348  TVector3 fO, fU, fV, fW;
349  TVector3 fPos, fDir;
350  TVector3 fpTilde;
352  TVector3 fH;
353 
354  // auxiliary variables and arrays
355  // needed in Extrap()
359  // needed in transform...
364 
365  public:
366  ClassDef(RKTrackRep, 7)
367 
368 };
369 
370 #endif
371