FairRoot/PandaRoot
PndFtsHoughTrackFinder.h
Go to the documentation of this file.
1 
37 #ifndef PndFtsHoughTrackFinder_H
38 #define PndFtsHoughTrackFinder_H
39 
41 
42 //#include "TClonesArray.h"
43 #include "Rtypes.h" // for Double_t, Int_t, etc
44 #include "FairLogger.h" // for FairLogger, MESSAGE_ORIGIN
45 
46 #include <cmath>
47 #include "TMath.h"
48 #include <math.h>
49 #include <algorithm>
50 #include <set>
51 #include <vector>
52 #include <map>
53 #include <fstream>
54 #include <iostream>
55 
56 #include "PndFtsHit.h"
57 #include "PndFtsHoughTrackerTask.h"
58 #include "PndFtsHoughSpace.h"
59 #include "PndFtsHoughTracklet.h"
60 #include "PndFtsHoughTrackCand.h"
61 #include "PndTrackCand.h"
62 #include "PndTrack.h"
63 
64 // For error throwing
65 #include "TString.h"
66 #include <stdexcept>
67 
68 
70 {
71 public:
73  virtual ~PndFtsHoughTrackFinder();
74 
75  // use this for parameter optimization
77 
78  virtual void FindTracks();
79 
80 
81  // Output
82  Int_t NTracks() const { return fHoughTrackCandsComplete.size(); };
83 
89  PndTrack GetPndTrack(int i){ return fHoughTrackCandsComplete[i].getPndTrack(); };
96  PndTrackCand GetPndTrackCand(int i) { return fHoughTrackCandsComplete[i].getPndTrackCand(); };
104 
105  // Output event statistics
108  Int_t getNParabolasFound() const { return fNParabolasFound; };
109  Int_t getNTracksFound() const { return fNTracksFound; };
110 
111 protected:
115 
117  void throwError(const TString s) const{ throw std::runtime_error(s.Data()); };
118 
119  // Int_t fFtsBranchId; // needed for saving and accessing hits
120  // TClonesArray *fFtsHitArray; ///< @brief Input array of all FTS hits.
121 
122 
123 
124 
125  // for Hough
127 
128  //-----------
129  std::vector<PndFtsHoughTrackCand> fHoughTrackCandsComplete;
130  std::vector<PndFtsHoughTrackCand> fHoughTrackCandsZxPlaneOnly;
131  // std::vector<PndTrackCand> fTrackCand; // resulting track candidates, also used for returning PndTracks
132 
133 
135 
138  const UInt_t fMinPeakHeightZxParabola;
140  const UInt_t fMinPeakHeightZxLineBehindDipole;
142  const UInt_t fMinPeakHeightZyLine;
144 
145 
146 
147  // event statistics
152 
153 
154  // takes the heighest peak (according to peak finder)
155  // of all peaks that share > maxSameHits
164  UInt_t maxAcceptableSharedHits,
165  std::vector<PndFtsHoughTracklet> &tracklets
166  );
167  // helper functions for tracking algorithm
168  std::vector<PndFtsHoughTracklet> FindLinesBehindDipoleZx();
169  std::vector<PndFtsHoughTracklet> FindLinesBeforeDipoleZx();
171  const std::vector<PndFtsHoughTracklet>& trackletsLineBeforeDipole,
172  const std::vector<PndFtsHoughTracklet>& trackletsLineBehindDipole
173  );
174  // kTRUE iif angles of parabola and of line behind dipole match at z coordinate where I switch from parabola to line (in zx plane)
176  const PndFtsHoughTrackCand &lineParabola,
177  const PndFtsHoughTracklet &lineBehindDipole
178  ) const;
180 
181 private:
183 };
184 
185 
186 
187 
188 // inline
190  const PndFtsHoughTrackCand& lineParabola,
191  const PndFtsHoughTracklet& lineBehindDipole
192 ) const {
193 
194  // the angles should be compared at the z coordinate where I switch from parabola to line behind dipole
195  Double_t zParabolaLine = lineBehindDipole.getZRefLabSys();
196  return fabs( lineParabola.getThetaZyRad(zParabolaLine) - lineBehindDipole.getThetaRadVal() ) < fThetaRadLineBehindDipoleMatchesToParabolaIfBelow;
197 }
198 
199 
200 
201 #endif /*PndFtsHoughTrackFinder_H*/
virtual ~PndFtsHoughTrackFinder()
Destructor.
virtual void FindTracks()
Performs the track finding.
const UInt_t fMinPeakHeightZxLineBehindDipole
Minimum required height for peaks in Hough spaces.
Int_t i
Definition: run_full.C:25
Double_t getThetaRadVal() const
Interface between PandaRoot (data input and output) and PndFtsHoughTrackFinder (implementation of PR ...
TLorentzVector s
Definition: Pnd2DStar.C:50
PndFtsHoughTrackFinderParams fParams
void throwError(const TString s) const
For error reporting.
Parameters for Hough space track finder. Created: 09.02.2015.
Bool_t LineBehindDipoleMatchesToLinePlusParabola(const PndFtsHoughTrackCand &lineParabola, const PndFtsHoughTracklet &lineBehindDipole) const
PndFtsHoughTrackerTask * fTrackerTask
Task which handles PandaRoot input/output and provides settings for FTS PR. Has to be set using the c...
Bool_t FilterTrackletsBasedOnSharedHits(UInt_t maxAcceptableSharedHits, std::vector< PndFtsHoughTracklet > &tracklets)
Filters a vector of tracklets based on the number of shared hits.
Double_t getZRefLabSys() const
Int_t getNLinesBehindDipoleFound() const
const UInt_t fMinPeakHeightZyLine
zy line
std::vector< PndFtsHoughTracklet > FindLinesBehindDipoleZx()
PndTrack GetPndTrack(int i)
Returns the number of found tracks.
Class for saving the result of one Hough transform for FTS PR.
PndTrackCand GetPndTrackCand(int i)
Returns the track cand. with index i.
const UInt_t fMinPeakHeightZxParabola
Minimum required height for peaks in Hough spaces.
std::vector< PndFtsHoughTrackCand > fHoughTrackCandsZxPlaneOnly
For internal storing of track cands. (zx plane track model only)
Double_t
Implementation of the Hough transform based FTS PR. Creates Hough spaces, finds peaks (=tracklets) an...
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
PndFtsHoughTrackCand GetHoughTrack(int i) const
Returns the track cand. with index i.
void OverwriteTrackFinderParams(PndFtsHoughTrackFinderParams newParams)
static const Double_t fThetaRadLineBehindDipoleMatchesToParabolaIfBelow
Minimum required height for peaks in Hough spaces.
const UInt_t fMinPeakHeightZxLineBeforeDipole
Minimum required height for peaks in Hough spaces.
Double_t getThetaZyRad(const Double_t) const
PndFtsHoughTrackFinder(PndFtsHoughTrackerTask *trackerTask)
Set pointer to tracker task (super important as it provides an I/O interface to PandaRoot) ...
Class for saving a FTS track cand. for Hough transform based FTS PR.
Int_t getNLinesBeforeDipoleFound() const
std::vector< PndFtsHoughTracklet > FindLinesBeforeDipoleZx()
void FindMatchingParabolaToLineBeforeDipoleZxAndAddLineBehindDipole(const std::vector< PndFtsHoughTracklet > &trackletsLineBeforeDipole, const std::vector< PndFtsHoughTracklet > &trackletsLineBehindDipole)
ClassDef(PndFtsHoughTrackFinder, 1)
std::vector< PndFtsHoughTrackCand > fHoughTrackCandsComplete
For internal storing of complete track cands.