PandaRoot
PndRiemannTrack.h
Go to the documentation of this file.
1 //-----------------------------------------------------------
2 // File and Version Information:
3 // $Id$
4 //
5 // Description:
6 // Track on Riemann Sphere
7 // Circle parameters can be calculated from plane parameters
8 // plane(c,nx,ny,nz);
9 //
10 //
11 // Environment:
12 // Software developed for the PANDA Detector at FAIR.
13 //
14 // Author List:
15 // Sebastian Neubert TUM (original author)
16 //
17 //
18 //-----------------------------------------------------------
19 
20 #ifndef PNDRIEMANNTRACK_HH
21 #define PNDRIEMANNTRACK_HH
22 
23 // Base Class Headers ----------------
24 #include "TObject.h"
25 
26 // Collaborating Class Headers -------
27 #include <vector>
28 #include "TVectorD.h"
29 #include "TVector3.h"
30 #include "TMatrixD.h"
31 #include "TMath.h"
32 
33 // Collaborating Class Declarations --
34 #include "PndRiemannHit.h"
35 #include "PndTrack.h"
36 #include "PndTrackCand.h"
37 
38 #include "PndSttHit.h"
39 #include "PndSttTube.h"
40 
41 #include <iostream>
42 #include <iomanip>
43 #include <algorithm>
44 
45 class PndRiemannTrack : public TObject {
46  public:
47  // Constructors/Destructors ---------
49  PndRiemannTrack(PndTrackCand *trackCand);
51 
52  // Accessors -----------------------
53  const TVectorD &n() const { return fn; }
54  double c() const { return fc; }
55  const TVectorD &av() const { return fav; }
56 
57  TVectorD orig() const;
58  double dX() { return TMath::Sqrt(fcovRXY[1][1]); }
59  double dY() { return TMath::Sqrt(fcovRXY[2][2]); }
60  double r() const;
61  double dR();
62  double dip();
63  double dipangle(); //< dipangle theta
64  double dDip();
65  double Pt(double B); //< transvers momentum Pt calculated by the magnetic field B [tesla]
66  double Pl(double B);
67  double P(double B);
68  double sign() const;
69  double getSZm() const { return fm; }
70  double getSZt() const { return ft; }
71  unsigned int getNumHits() { return fHits.size(); }
72  PndRiemannHit *getHit(unsigned int i)
73  {
74  PndRiemannHit *myHit = &(fHits[i]);
75  return myHit;
76  }
77  PndRiemannHit *getLastHit() { return getHit(getNumHits() - 1); }
78  std::vector<PndRiemannHit> getHits() const { return fHits; };
79  TVector3 getPforHit(int i, double B);
80  PndTrack getPndTrack(Double_t B);
81  FairTrackParP getTrackParPForHit(Int_t i, Double_t B);
82  Int_t getCharge(Double_t B);
83 
84  double calcZPosByS(double s);
85  TVector3 calcPosByS(double s);
86  void calcStartStopAlpha();
87  double calcAlpha(PndRiemannHit *myHit);
88 
89  void calcSForHits();
90 
91  int calcIntersection(PndRiemannTrack &track, TVector3 &p1, TVector3 &p2);
92 
93  void sortHits() { std::sort(fHits.begin(), fHits.end()); }
94 
95  double weight() const { return fweight; };
96  TMatrixD covPlane() const { return fcovPlane; };
97  TMatrixD jacRXY() const { return fjacRXY; };
98  TMatrixD covRXY() const { return fcovRXY; };
99  double m() const { return fm; }
100  double mError() const { return fmError; }
101  double t() const { return ft; }
102  double tError() const { return ftError; }
103 
104  // Modifiers -----------------------
105  void addHit(PndRiemannHit &hit);
106  void addPndTrackCand(PndTrackCand *trackCand);
107  void init(double x0, double y0, double R, double dip, double z0);
108 
109  // Operations ----------------------
110  void refit(bool withErrorCalc = true);
111  double dist(PndRiemannHit *hit);
112  double distError(PndRiemannHit *hit);
113  double distCircle(PndRiemannHit *hit);
114  double ChiSquareDistCircle();
115  void szFit(bool withErrorCalc = true);
116  double calcChi2Plane();
117  double calcSZChi2(PndRiemannHit *hit); // calculates the chi2 of the track plus the additional hit
118  double szDist(PndRiemannHit *hit);
119  double szError(PndRiemannHit *hit);
120  double szChi2() const { return fChi2; };
121 
122  void SetVerbose(int i) { fVerbose = i; }
123  void SetVertexCut(double cut) { fVertexCut = cut; }
124  TVector3 calcErrorPosByS(Double_t s, Double_t dS);
125 
126  void correctSttHits();
129  void PrintHits();
130 
131  virtual void Print(std::ostream &out = std::cout)
132  {
133 
134  out << std::setprecision(6) << "Riemann Track: Radius " << r() << " +/- " << dR() << " Origin: " << orig()[0] << " +/- " << dX() << " / " << orig()[1] << " +/- " << dY()
135  << std::endl;
136  out << "RiemannTrack: Normal: " << n()[0] << "/" << n()[1] << "/" << n()[2] << " c: " << c() << std::endl;
137  out << "Dip: " << dip() << " +/- " << dDip() << " StartAlpha: " << fStartAlpha << " StopAlpha: " << fStopAlpha << std::endl;
138  out << "Chi2Plane: " << calcChi2Plane() << std::endl;
139  PrintHits();
140  }
141 
142  friend std::ostream &operator<<(std::ostream &out, PndRiemannTrack &track)
143  {
144  track.Print(out);
145  return out;
146  }
147 
148  private:
149  // Private Data Members ------------
150  TVectorD fn;
151  TVectorD fav;
152  double fc;
153 
154  double fm;
155  double ft;
156  double fmError;
157  double ftError;
158  double fChi2;
159  TMatrixD fcovPlane;
160  TMatrixD fjacRXY;
161  TMatrixD fcovRXY;
162 
163  int fVerbose;
164 
165  bool fFitDone;
166  bool fSZFitDone;
167  bool fErrorCalcDone;
168  double fweight;
169  bool ftrefit;
170  double fVertexCut;
171 
172  std::vector<PndRiemannHit> fHits;
173  Double_t fStartAlpha;
174  Double_t fStopAlpha;
175 
176  std::map<TString, Int_t> fBranchNameMap;
179 
180  void calcJacRXY();
181 
182  TVector3 calcErrorLineNorm(PndRiemannTrack &track);
183  TVector3 calcErrorLineOffset(PndRiemannTrack &track);
184  TVectorD calcErrorXY1XY2(TVector3 &line, TVector3 &dLine, TVector3 &offset, TVector3 &dOffset);
185  Double_t calcErrorS(TVector2 &XY, TVector2 &dXY, PndRiemannTrack *track);
186 
187  Int_t GetBranchId(TString branchName);
188 
189  // Private Methods -----------------
190 
191  public:
192  ClassDef(PndRiemannTrack, 3)
193 };
194 
195 #endif
196 
197 //--------------------------------------------------------------
198 // $Log$
199 //--------------------------------------------------------------
PndRiemannHit * getLastHit()
unsigned int getNumHits()
double calcSZChi2(PndRiemannHit *hit)
double distError(PndRiemannHit *hit)
PndRiemannHit correctSttSkewedHit(PndSttHit *mySttHit, PndSttTube *myTube)
TMatrixD jacRXY() const
void init(double x0, double y0, double R, double dip, double z0)
double calcZPosByS(double s)
std::vector< PndRiemannHit > getHits() const
PndRiemannHit correctSttHit(PndSttHit *mySttHit)
double t() const
double dipangle()
static T Sqrt(const T &x)
Definition: PndCAMath.h:45
double distCircle(PndRiemannHit *hit)
double szChi2() const
double szDist(PndRiemannHit *hit)
friend std::ostream & operator<<(std::ostream &out, PndRiemannTrack &track)
double tError() const
double sign() const
const TVectorD & av() const
double P(double B)
double dist(PndRiemannHit *hit)
unsigned int i
Definition: P4_F32vec4.h:21
TMatrixD covPlane() const
TVector3 calcErrorPosByS(Double_t s, Double_t dS)
FairTrackParP getTrackParPForHit(Int_t i, Double_t B)
double c() const
Int_t getCharge(Double_t B)
const TVectorD & n() const
void addPndTrackCand(PndTrackCand *trackCand)
void SetVertexCut(double cut)
double getSZt() const
void refit(bool withErrorCalc=true)
double calcChi2Plane()
void SetVerbose(int i)
double Pt(double B)
void calcStartStopAlpha()
double ChiSquareDistCircle()
double mError() const
int calcIntersection(PndRiemannTrack &track, TVector3 &p1, TVector3 &p2)
TVectorD orig() const
virtual void Print(std::ostream &out=std::cout)
double m() const
double r() const
void szFit(bool withErrorCalc=true)
void addHit(PndRiemannHit &hit)
TVector3 getPforHit(int i, double B)
double getSZm() const
PndTrack getPndTrack(Double_t B)
void correctSttHits()
TMatrixD covRXY() const
double calcAlpha(PndRiemannHit *myHit)
double weight() const
TVector3 calcPosByS(double s)
PndRiemannHit * getHit(unsigned int i)
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
double szError(PndRiemannHit *hit)
double Pl(double B)