FairRoot/PandaRoot
PndFtsHoughTrackCand.h
Go to the documentation of this file.
1 
23 #ifndef PNDFTSHOUGHTRACKCAND_H
24 #define PNDFTSHOUGHTRACKCAND_H
25 
27 
28 // Root Class Headers ----------------
29 #include "PndTrackCand.h"
30 #include "PndFtsHoughTracklet.h"
31 #include "Rtypes.h" // for Double_t, Int_t, etc
32 #include "FairLogger.h" // for FairLogger, MESSAGE_ORIGIN
33 
34 // For error reporting
35 #include "TString.h"
36 #include <stdexcept>
37 
38 #include <cmath>
39 
40 class PndFtsHit;
41 class PndTrack;
42 class FairTrackParP;
43 class TVector3;
44 class TClonesArray;
45 
46 
47 class PndFtsHoughTrackCand : public TObject {
48 public:
49 
50  // Constructors/Destructors ---------
53 
54  // operators
55  // PndFtsHoughTrackCand are the same if they contain the same hits, that means if the PndTrackCand are the same, therefore no need to implement that operator here
56 
57  // Accessors -----------------------
58  void Print();
59  // isComplete() is kTRUE iif data from all Hough transforms have been entered
61 
62  PndTrackCand getPndTrackCand(); // convert *this to a PndTrackCand, cannot be const
63  PndTrack getPndTrack(); // convert *this to a PndTrack, cannot be const // calculates first and last parameter, but uses an empty PndTrackCand which has to be set lateron using SetTrackCandRef
64 
65 
66  FairTrackParP getTrackParPForHit(const UInt_t i); // get the track parameters (needed for conversion to PndTrack) for hit with index i, cannot be const
67 
68  inline Int_t getCharge() const; // gets charge of track candidate // TODO only charge sign is implemented
69  TVector3 getP(const Double_t zLabSys) const; // gets the momentum calculated at some z coordinate in laboratory system
70  TVector3 getPos(const Double_t zLabSys) const; // gets the position calculated at some z coordinate in laboratory system
71  Double_t getXLabSys(const Double_t zLabSys) const;
72 
73  Double_t getThetaZxRad(const Double_t zLabSys) const; // gets the angle to the z axis in the zx plane calculated at some z coordinate (in laboratory system)
74  // gets the angle to the z axis in the zy plane calculated at some z coordinate (in laboratory system)
75  Double_t getThetaZyRad(const Double_t ) const { return fZyLine.getThetaRadVal(); }; // zLabSys //[R.K.03/2017] unused variable(s)
76 
77  Double_t getZLineParabola() { return fZCoordLineParabola; }; // gets z coordinate in laboratory system where I switch from line before dipole to parabola within dipole (in zx plane)
78  Double_t getZParabolaLine() { return fZCoordParabolaLine; }; // gets z coordinate in laboratory system where I switch from parabola within dipole to line behind dipole (in zx plane)
79 
80 
81 
82  // Modifiers -----------------------
83  // add results from Hough transforms
84  void SetZxLineBeforeDipole(const PndFtsHoughTracklet zxLineParabola);
85  void SetZxParabola(const PndFtsHoughTracklet zxParabola);
86  void SetZxLineBehindDipole(const PndFtsHoughTracklet zxParabolaLine);
87  void SetZyLine(const PndFtsHoughTracklet zyLine);
88 
89 
90 private:
91  // for PandaRoot input/output
93 
95  void throwError(const TString s) const { throw std::runtime_error(s.Data()); };
96  void throwIfZOutOfRange(const Double_t &zLabSys) const {
97  if ( zLabSys <= 100 ) throwError("zLabSys is too small, track model is not valid in that region.");
98  if ( zLabSys >= 1000 ) throwError("zLabSys is too big, track model is not valid in that region.");
99  };
100 
101  void addUniqueTrackletHits(const PndFtsHoughTracklet inTracklet);
102 
104 
105  inline Double_t getPYLab() const;
106  inline std::pair<Double_t, Double_t> getPZPXLabLine(const Double_t &zLabSys, const PndFtsHoughTracklet * const lineTracklet) const;
107  inline std::pair<Double_t, Double_t> getPZPXLabParabola(const Double_t &zLabSys) const;
108 
109  inline Double_t getXOrYLabForLine(const Double_t &zLabSys, const PndFtsHoughTracklet * const lineTracklet) const;
110  Double_t getXLabForParabola(const Double_t &zLabSys) const; // TODO: Check this!
111 
112 
113 
114  // Private Data Members ------------
115  Int_t fVerbose;
116 
117  // zx plane
118  // straight line Hough transform in zx plane (stations before dipole field)
120  // theta in zx plane
121  // vs
122  // x intercept
123 
124  // parabola Hough transform in zx plane (stations inside dipole field)
126  // theta in zx plane
127  // vs
128  // charge divided by momentum projected into zx plane
129 
130  // straight line Hough transform in zx plane (stations after dipole field)
132  // theta in zx plane
133  // vs
134  // x intercept
135 
136  // zy plane
137  // straight line Hough transform in zy plane (all stations)
139  // theta in zy plane
140  // vs
141  // y intercept
142 
143  // internal track candidate for storing of hits belonging to this track candidate
145 
146 
147  // at which z value the transition in the bending zx plane is done from a line (before dipole field) to a parabola (within dipole field)
149  // at which z value the transition in the bending zx plane is done from a parabola (within dipole field) to a line (before dipole field)
151 
152 public:
154 
155 };
156 
157 
158 
159 
160 
161 
162 //inline functions
164  if (0 < getQdivPzx()){
165  return 1;
166  }
167  else{
168  return -1;
169  }
170 }
171 
172 
173 
174 Double_t PndFtsHoughTrackCand::getXOrYLabForLine(const Double_t &zLabSys, const PndFtsHoughTracklet * const lineTracklet) const {
175  // calculate x or y in lab sys for a given z position in lab sys for which the line assumption holds
176  // theta in radian in zx plane given at z = zRefLabSys
177  const Double_t thetaRad = lineTracklet->getThetaRadVal();
178  const Double_t intercept = lineTracklet->getSecondVal();
179  const Double_t zRefLabSys = lineTracklet->getZRefLabSys();
180  const Double_t zshifted = zLabSys-zRefLabSys;
181 
182  Double_t xOrYLabSys = tan(thetaRad)*zshifted+intercept;
183 
184  return xOrYLabSys;
185 }
186 
187 
188 std::pair<Double_t, Double_t> PndFtsHoughTrackCand::getPZPXLabParabola(const Double_t &zLabSys) const {
189 
190  const Double_t currentThetaRad = getThetaZxRad(zLabSys);
191 
192  const Double_t qDivPzx = getQdivPzx(); // Q/pzx
193  const Double_t pZx = getCharge() / qDivPzx;
194 
195  const Double_t pZLabSys = pZx*cos(currentThetaRad);
196  const Double_t pXLabSys = pZx*sin(currentThetaRad);
197  std::pair<Double_t, Double_t> pZPXLabSys(pZLabSys, pXLabSys);
198 
199  return pZPXLabSys;
200 }
201 
202 
203 std::pair<Double_t, Double_t> PndFtsHoughTrackCand::getPZPXLabLine(const Double_t &, const PndFtsHoughTracklet * const lineTracklet) const { // zLabSys //[R.K.03/2017] unused variable(s)
204  // theta in radian in zx plane given at z = zRefLabSys
205  const Double_t thetaRad = lineTracklet->getThetaRadVal();
206  const Double_t qDivPzx = fZxParabola.getSecondVal(); // Q/pzx
207  const Double_t pZx = getCharge() / qDivPzx;
208 
209  const Double_t pZLabSys = pZx*cos(thetaRad);
210  const Double_t pXLabSys = pZx*sin(thetaRad);
211  std::pair<Double_t, Double_t> pZPXLabSys(pZLabSys, pXLabSys);
212 
213  return pZPXLabSys;
214  }
215 
216 
218  // theta in radian in zy plane given at z where first zx line meets the parabola
219  const Double_t zRefLabSys = fZxParabola.getZRefLabSys();
220  const Double_t thetaZyRad = fZyLine.getThetaRadVal();
221  std::pair<Double_t, Double_t> pZPXLabSys = getPZPXLabLine(zRefLabSys, &fZxLineBeforeDipole);
222  const Double_t pZLabSys = pZPXLabSys.first;
223  Double_t pYLabSys = tan(thetaZyRad)*pZLabSys;
224  return pYLabSys;
225  }
226 
227 
228 #endif
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
void SetZxParabola(const PndFtsHoughTracklet zxParabola)
Int_t i
Definition: run_full.C:25
FairTrackParP getTrackParPForHit(const UInt_t i)
Double_t getThetaRadVal() const
void SetZyLine(const PndFtsHoughTracklet zyLine)
ClassDef(PndFtsHoughTrackCand, 1)
Interface between PandaRoot (data input and output) and PndFtsHoughTrackFinder (implementation of PR ...
PndFtsHoughTracklet fZxLineBehindDipole
Double_t getXLabForParabola(const Double_t &zLabSys) const
std::pair< Double_t, Double_t > getPZPXLabLine(const Double_t &zLabSys, const PndFtsHoughTracklet *const lineTracklet) const
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
TLorentzVector s
Definition: Pnd2DStar.C:50
Bool_t isComplete() const
std::pair< Double_t, Double_t > getPZPXLabParabola(const Double_t &zLabSys) const
void SetZxLineBeforeDipole(const PndFtsHoughTracklet zxLineParabola)
void addUniqueTrackletHits(const PndFtsHoughTracklet inTracklet)
PndFtsHoughTrackerTask * fTrackerTask
Double_t getZRefLabSys() const
TVector3 getPos(const Double_t zLabSys) const
void throwError(const TString s) const
For error reporting.
PndFtsHoughTracklet fZxParabola
Class for saving the result of one Hough transform for FTS PR.
Double_t getXOrYLabForLine(const Double_t &zLabSys, const PndFtsHoughTracklet *const lineTracklet) const
PndFtsHoughTrackCand(PndFtsHoughTrackerTask *trackerTask=0)
Set pointer to tracker task (super important as it provides an I/O interface to PandaRoot) ...
Double_t
Double_t getSecondVal() const
TVector3 getP(const Double_t zLabSys) const
void throwIfZOutOfRange(const Double_t &zLabSys) const
void SetZxLineBehindDipole(const PndFtsHoughTracklet zxParabolaLine)
Double_t getThetaZyRad(const Double_t) const
PndFtsHoughTracklet fZxLineBeforeDipole
Double_t getQdivPzx() const
Class for saving a FTS track cand. for Hough transform based FTS PR.
Double_t getPYLab() const
Double_t getXLabSys(const Double_t zLabSys) const
PndFtsHoughTracklet fZyLine
Double_t getThetaZxRad(const Double_t zLabSys) const