PandaRoot
PndFtsHoughTrackFinder.h
Go to the documentation of this file.
1 
34 #ifndef PndFtsHoughTrackFinder_H
35 #define PndFtsHoughTrackFinder_H
36 
38 
39 //#include "TClonesArray.h"
40 #include "Rtypes.h" // for Double_t, Int_t, etc
41 #include "FairLogger.h" // for FairLogger, MESSAGE_ORIGIN
42 
43 #include <cmath>
44 #include "TMath.h"
45 #include <math.h>
46 #include <algorithm>
47 #include <set>
48 #include <vector>
49 #include <map>
50 #include <fstream>
51 #include <iostream>
52 
53 #include "PndFtsHit.h"
54 #include "PndFtsHoughTrackerTask.h"
55 #include "PndFtsHoughSpace.h"
56 #include "PndFtsHoughTracklet.h"
57 #include "PndFtsHoughTrackCand.h"
58 #include "PndTrackCand.h"
59 #include "PndTrack.h"
60 
61 // For error throwing
62 #include "TString.h"
63 #include <stdexcept>
64 
66  public:
68  virtual ~PndFtsHoughTrackFinder();
69 
70  // use this for parameter optimization
72 
73  virtual void FindTracks();
74 
75  // Output
76  Int_t NTracks() const { return fHoughTrackCandsComplete.size(); };
77 
83  PndTrack GetPndTrack(int i) { return fHoughTrackCandsComplete[i].getPndTrack(); };
90  PndTrackCand GetPndTrackCand(int i) { return fHoughTrackCandsComplete[i].getPndTrackCand(); };
98 
99  // Output event statistics
102  Int_t getNParabolasFound() const { return fNParabolasFound; };
103  Int_t getNTracksFound() const { return fNTracksFound; };
104 
105  protected:
109 
111  void throwError(const TString s) const { throw std::runtime_error(s.Data()); };
112 
113  // Int_t fFtsBranchId; // needed for saving and accessing hits
114  // TClonesArray *fFtsHitArray; ///< @brief Input array of all FTS hits.
115 
116  // for Hough
118 
119  //-----------
120  std::vector<PndFtsHoughTrackCand> fHoughTrackCandsComplete;
121  std::vector<PndFtsHoughTrackCand> fHoughTrackCandsZxPlaneOnly;
122  // std::vector<PndTrackCand> fTrackCand; // resulting track candidates, also used for returning PndTracks
123 
125 
128  const UInt_t fMinPeakHeightZxParabola;
130  const UInt_t fMinPeakHeightZxLineBehindDipole;
132  const UInt_t fMinPeakHeightZyLine;
134 
135  // event statistics
140 
141  // takes the heighest peak (according to peak finder)
142  // of all peaks that share > maxSameHits
150  Bool_t FilterTrackletsBasedOnSharedHits(UInt_t maxAcceptableSharedHits, std::vector<PndFtsHoughTracklet> &tracklets);
151  // helper functions for tracking algorithm
152  std::vector<PndFtsHoughTracklet> FindLinesBehindDipoleZx();
153  std::vector<PndFtsHoughTracklet> FindLinesBeforeDipoleZx();
154  void FindMatchingParabolaToLineBeforeDipoleZxAndAddLineBehindDipole(const std::vector<PndFtsHoughTracklet> &trackletsLineBeforeDipole,
155  const std::vector<PndFtsHoughTracklet> &trackletsLineBehindDipole);
156  // kTRUE iif angles of parabola and of line behind dipole match at z coordinate where I switch from parabola to line (in zx plane)
157  inline Bool_t LineBehindDipoleMatchesToLinePlusParabola(const PndFtsHoughTrackCand &lineParabola, const PndFtsHoughTracklet &lineBehindDipole) const;
159 
160  private:
161  ClassDef(PndFtsHoughTrackFinder, 1);
162 };
163 
164 // inline
166 {
167 
168  // the angles should be compared at the z coordinate where I switch from parabola to line behind dipole
169  Double_t zParabolaLine = lineBehindDipole.getZRefLabSys();
170  return fabs(lineParabola.getThetaZyRad(zParabolaLine) - lineBehindDipole.getThetaRadVal()) < fThetaRadLineBehindDipoleMatchesToParabolaIfBelow;
171 }
172 
173 #endif /*PndFtsHoughTrackFinder_H*/
std::vector< PndFtsHoughTracklet > FindLinesBeforeDipoleZx()
const UInt_t fMinPeakHeightZxLineBehindDipole
Minimum required height for peaks in Hough spaces.
void FindZyLineMatchingToLineParabolaLineInZx()
Int_t getNLinesBehindDipoleFound() const
Interface between PandaRoot (data input and output) and PndFtsHoughTrackFinder (implementation of PR ...
Double_t getZRefLabSys() const
PndFtsHoughTrackFinderParams fParams
Double_t getThetaZyRad(const Double_t) const
void throwError(const TString s) const
For error reporting.
Parameters for Hough space track finder. Created: 09.02.2015.
PndFtsHoughTrackerTask * fTrackerTask
Task which handles PandaRoot input/output and provides settings for FTS PR. Has to be set using the c...
Bool_t LineBehindDipoleMatchesToLinePlusParabola(const PndFtsHoughTrackCand &lineParabola, const PndFtsHoughTracklet &lineBehindDipole) const
Bool_t FilterTrackletsBasedOnSharedHits(UInt_t maxAcceptableSharedHits, std::vector< PndFtsHoughTracklet > &tracklets)
Filters a vector of tracklets based on the number of shared hits.
const UInt_t fMinPeakHeightZyLine
zy line
unsigned int i
Definition: P4_F32vec4.h:21
virtual void FindTracks()
Performs the track finding.
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 getThetaRadVal() const
Int_t getNLinesBeforeDipoleFound() const
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:46
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.
PndFtsHoughTrackFinder(PndFtsHoughTrackerTask *trackerTask)
Set pointer to tracker task (super important as it provides an I/O interface to PandaRoot) ...
virtual ~PndFtsHoughTrackFinder()
Destructor.
std::vector< PndFtsHoughTracklet > FindLinesBehindDipoleZx()
Class for saving a FTS track cand. for Hough transform based FTS PR.
void FindMatchingParabolaToLineBeforeDipoleZxAndAddLineBehindDipole(const std::vector< PndFtsHoughTracklet > &trackletsLineBeforeDipole, const std::vector< PndFtsHoughTracklet > &trackletsLineBehindDipole)
PndFtsHoughTrackCand GetHoughTrack(int i) const
Returns the track cand. with index i.
std::vector< PndFtsHoughTrackCand > fHoughTrackCandsComplete
For internal storing of complete track cands.