Belle II Software  release-05-01-25
HoughFinder.h
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : HoughFinder.h
5 // Section : TRG CDC
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A class to find tracks usning Hough algorithm
10 //-----------------------------------------------------------------------------
11 // $Log$
12 //-----------------------------------------------------------------------------
13 
14 #ifndef TRGCDCHoughFinder_FLAG_
15 #define TRGCDCHoughFinder_FLAG_
16 
17 #include <string>
18 #include "trg/cdc/HoughPlaneMulti2.h"
19 #include "trg/cdc/HoughTransformationCircle.h"
20 #include "trg/cdc/PeakFinder.h"
22 #include <map>
24 #ifdef TRGCDC_SHORT_NAMES
25 #define TCHFinder TRGCDCHoughFinder
26 #endif
27 
28 namespace Belle2 {
34  class TRGCDC;
35  class TRGCDCPeakFinder;
36  class TRGCDCTrack;
37  class TRGCDCLink;
38  class TRGCDCJSignal;
39  class TRGCDCJLUT;
40  class TRGCDCJSignalData;
41 
44 
45  public:
46 
48  TRGCDCHoughFinder(const std::string& name,
49  const TRGCDC&,
50  unsigned peakMin,
51  const std::string& mappingFilePlus,
52  const std::string& mappingFileMinus,
53  unsigned doit);
54 
56  virtual ~TRGCDCHoughFinder();
57 
58  public:
59 
61  std::string name(void) const;
62 
64  std::string version(void) const;
65 
67  void terminate();
68 
70  int FindAndFit(std::vector<TRGCDCTrack*>& trackList2D,
71  std::vector<TRGCDCTrack*>& trackList2DFitted);
72 
73  public:
74 
76  bool perfect(bool);
77 
78  private:
79 
81  int doFindingAndFittingTrasan(std::vector<TRGCDCTrack*>& trackList2D,
82  std::vector<TRGCDCTrack*>& trackList2DFitted);
83 
85  int doFindingAndFitting(std::vector<TRGCDCTrack*>& trackList2D,
86  std::vector<TRGCDCTrack*>& trackList2DFitted);
87 
89  std::vector<TRGCDCLink*> selectBestHits(
90  const std::vector<TRGCDCLink*>& links) const;
91 
93  void mappingByFile(const std::string& mappingFilePlus,
94  const std::string& mappingFileMinus);
95 
97  int doFindingTrasan(std::vector<unsigned> peaks[],
98  std::vector<TRGCDCTrack*>& trackList2D) const;
99 
101  int doFinding(std::vector<std::vector<unsigned>> peaks[],
102  std::vector<TRGCDCTrack*>& trackList2D);
103 
105  int doFittingTrasan(std::vector<unsigned> peaks[],
106  std::vector<TRGCDCTrack*>& trackList2DFitted) const;
107 
109  int doFitting(std::vector<TRGCDCTrack*>& trackList2D,
110  std::vector<TRGCDCTrack*>& trackList2DFitted);
111 
114  TRGCDCTrack* makeTrack(const unsigned serialID, const unsigned pm) const;
115 
117  static double calPhi(TRGCDCSegmentHit const* segmentHit,
118  double eventTime);
119 
121  static void calCosPhi(std::map<std::string, Belle2::TRGCDCJSignal>
122  & mSignalStorage,
123  std::map<std::string, Belle2::TRGCDCJLUT* >
124  & mLutStorage);
125 
127  static void calSinPhi(std::map<std::string, Belle2::TRGCDCJSignal>
128  & mSignalStorage,
129  std::map<std::string, Belle2::TRGCDCJLUT* >
130  & mLutStorage);
131 
133  static void rPhi(std::map<std::string, Belle2::TRGCDCJSignal>
134  & mSignalStorage,
135  std::map<std::string, Belle2::TRGCDCJLUT* >
136  & mLutStorage);
137  private:
138 
140  const std::string _name;
141 
143  const TRGCDC& _cdc;
144 
147 
150 
152  const unsigned _doit;
153 
156 
158  const unsigned _peakMin;
159 
161  std::map<std::string, double> m_mDouble;
162 
164  std::map<std::string, std::vector<double> > m_mVector;
165 
167  std::map<std::string, double> m_mConstants;
168 
170  std::map<std::string, double> m_mConstD;
171 
173  std::map<std::string, std::vector<double> > m_mConstV;
174 
176  std::map<std::string, bool> m_mBool;
177 
179  std::map<std::string, TRGCDCJSignal> m_mSignalStorage;
180 
182  std::map<std::string, TRGCDCJLUT*> m_mLutStorage;
183 
186  };
187 
188 //-----------------------------------------------------------------------------
189 
190  inline
191  std::string
193  {
194  return _name;
195  }
196 
197 
199 } // namespace Belle2
200 
201 #endif
Belle2::TRGCDCHoughFinder::m_mDouble
std::map< std::string, double > m_mDouble
Map to hold double values for Fitter2D.
Definition: HoughFinder.h:161
Belle2::TRGCDCHoughFinder::m_mConstV
std::map< std::string, std::vector< double > > m_mConstV
Map to ?
Definition: HoughFinder.h:173
Belle2::TRGCDCHoughFinder::doFindingTrasan
int doFindingTrasan(std::vector< unsigned > peaks[], std::vector< TRGCDCTrack * > &trackList2D) const
do track finding. (trasan version)
Definition: HoughFinder.cc:197
Belle2::TRGCDCHoughFinder::calCosPhi
static void calCosPhi(std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
Calculate Cos Sin ?
Definition: HoughFinder.cc:413
Belle2::TRGCDCHoughFinder::_peakMin
const unsigned _peakMin
Min. peak height for the peak finder.
Definition: HoughFinder.h:158
Belle2::TRGCDCHoughFinder::mappingByFile
void mappingByFile(const std::string &mappingFilePlus, const std::string &mappingFileMinus)
creates mappings by a file.
Definition: HoughFinder.cc:662
Belle2::TRGCDCHoughFinder::selectBestHits
std::vector< TRGCDCLink * > selectBestHits(const std::vector< TRGCDCLink * > &links) const
selects the best(fastest) hits in each super layer.
Definition: HoughFinder.cc:271
Belle2::TRGCDCHoughFinder::_commonData
TRGCDCJSignalData * _commonData
For VHDL code.
Definition: HoughFinder.h:185
Belle2::TRGCDCPeakFinder
A class to find peaks in Hough Plane.
Definition: PeakFinder.h:34
Belle2::TRGCDCHoughFinder::terminate
void terminate()
termination.
Definition: HoughFinder.cc:396
Belle2::TRGCDCHoughFinder::name
std::string name(void) const
returns name.
Definition: HoughFinder.h:192
Belle2::TRGCDCHoughFinder::m_mLutStorage
std::map< std::string, TRGCDCJLUT * > m_mLutStorage
Map to hold JLuts.
Definition: HoughFinder.h:182
Belle2::TRGCDCHoughFinder::m_mBool
std::map< std::string, bool > m_mBool
Map to hold input options.
Definition: HoughFinder.h:176
Belle2::TRGCDCHoughFinder::doFinding
int doFinding(std::vector< std::vector< unsigned >> peaks[], std::vector< TRGCDCTrack * > &trackList2D)
do track finding. (kaiyu version)
Definition: HoughFinder.cc:801
Belle2::TRGCDCHoughTransformationCircle
A class to represent circle Hough transformation.
Definition: HoughTransformationCircle.h:30
Belle2::TRGCDCHoughFinder::_cdc
const TRGCDC & _cdc
CDCTRG.
Definition: HoughFinder.h:143
Belle2::TRGCDCHoughFinder::m_mConstD
std::map< std::string, double > m_mConstD
Map to ?
Definition: HoughFinder.h:170
Belle2::TRGCDCHoughFinder::doFitting
int doFitting(std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
do track fitting. (kaiyu original)
Definition: HoughFinder.cc:858
Belle2::TRGCDCHoughPlaneMulti2
A class to represent a Hough parameter plane.
Definition: HoughPlaneMulti2.h:34
Belle2::TRGCDCJSignalData
A class to hold common data for JSignals.
Definition: JSignalData.h:34
Belle2::TRGCDCHoughFinder::_doit
const unsigned _doit
Doit version.
Definition: HoughFinder.h:152
Belle2::TRGCDCHoughFinder::TRGCDCHoughFinder
TRGCDCHoughFinder(const std::string &name, const TRGCDC &, unsigned peakMin, const std::string &mappingFilePlus, const std::string &mappingFileMinus, unsigned doit)
Contructor.
Definition: HoughFinder.cc:80
Belle2::TRGCDCHoughFinder::makeTrack
TRGCDCTrack * makeTrack(const unsigned serialID, const unsigned pm) const
Make a track from serial ID in Hough plane.
Definition: HoughFinder.cc:1110
Belle2::TRGCDCHoughFinder::_circleH
TRGCDCHoughTransformationCircle _circleH
Circle Hough transformtion.
Definition: HoughFinder.h:149
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGCDCHoughFinder::perfect
bool perfect(bool)
sets and returns switch to do perfect finding.
Belle2::TRGCDCHoughFinder::calPhi
static double calPhi(TRGCDCSegmentHit const *segmentHit, double eventTime)
Utility functions.
Definition: HoughFinder.cc:401
Belle2::TRGCDCSegmentHit
A class to represent a track segment hit in CDC.
Definition: SegmentHit.h:32
Belle2::TRGCDCHoughFinder::FindAndFit
int FindAndFit(std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
do track finding and fitting (wrapper that can choose between different versions).
Definition: HoughFinder.cc:756
Belle2::TRGCDCHoughFinder::m_mVector
std::map< std::string, std::vector< double > > m_mVector
Map to hold vector values for Fitter2D.
Definition: HoughFinder.h:164
Belle2::TRGCDCHoughFinder::doFittingTrasan
int doFittingTrasan(std::vector< unsigned > peaks[], std::vector< TRGCDCTrack * > &trackList2DFitted) const
do track fitting. (old trasan version)
Definition: HoughFinder.cc:308
Belle2::TRGCDCHoughFinder::_name
const std::string _name
Name.
Definition: HoughFinder.h:140
Belle2::TRGCDCHoughFinder::version
std::string version(void) const
returns version.
Definition: HoughFinder.cc:75
Belle2::TRGCDC
The instance of TRGCDC is a singleton.
Definition: TRGCDC.h:70
Belle2::TRGCDCHoughFinder::rPhi
static void rPhi(std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
Calculate r * phi ?
Definition: HoughFinder.cc:468
Belle2::TRGCDCTrack
A class to represent a reconstructed charged track in TRGCDC.
Definition: Track.h:39
Belle2::TRGCDCHoughFinder::_plane
TRGCDCHoughPlaneMulti2 * _plane[2]
Hough planes, for + and - charges.
Definition: HoughFinder.h:146
Belle2::TRGCDCHoughFinder::_peakFinder
TRGCDCPeakFinder _peakFinder
Peak finder.
Definition: HoughFinder.h:155
Belle2::TRGCDCHoughFinder::~TRGCDCHoughFinder
virtual ~TRGCDCHoughFinder()
Destructor.
Definition: HoughFinder.cc:185
Belle2::TRGCDCHoughFinder::calSinPhi
static void calSinPhi(std::map< std::string, Belle2::TRGCDCJSignal > &mSignalStorage, std::map< std::string, Belle2::TRGCDCJLUT * > &mLutStorage)
Calculate Cos Sin ?
Definition: HoughFinder.cc:441
Belle2::TRGCDCHoughFinder
A class to find tracks using Hough algorithm.
Definition: HoughFinder.h:43
Belle2::TRGCDCHoughFinder::m_mSignalStorage
std::map< std::string, TRGCDCJSignal > m_mSignalStorage
Map to hold JSignals.
Definition: HoughFinder.h:179
Belle2::TRGCDCHoughFinder::doFindingAndFitting
int doFindingAndFitting(std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
do track finding and fitting (Kaiyu version).
Definition: HoughFinder.cc:784
Belle2::TRGCDCHoughFinder::doFindingAndFittingTrasan
int doFindingAndFittingTrasan(std::vector< TRGCDCTrack * > &trackList2D, std::vector< TRGCDCTrack * > &trackList2DFitted)
do track finding and fitting (Trasan version).
Definition: HoughFinder.cc:767
Belle2::TRGCDCHoughFinder::m_mConstants
std::map< std::string, double > m_mConstants
Map to hold const values for Fitter2D.
Definition: HoughFinder.h:167