CbmRoot
CbmL1RichENNRingFinderParallel.h
Go to the documentation of this file.
1 /*
2  *====================================================================
3  *
4  * CBM Level 1 Reconstruction
5  *
6  * Authors: I.Kisel, S.Gorbunov
7  *
8  * e-mail : ikisel@kip.uni-heidelberg.de
9  *
10  *====================================================================
11  *
12  * Standalone RICH ring finder based on the Elastic Neural Net
13  *
14  *====================================================================
15  */
16 
17 #ifndef _CBM_L1_RICH_ENN_RING_FINDER2_H_
18 #define _CBM_L1_RICH_ENN_RING_FINDER2_H_
19 
20 
21 #include "CbmL1Def.h"
22 #include "CbmRichRingFinder.h"
23 //#include "../vectors/PSEUDO_F32vec4.h" // for check
24 //#include "../vectors/PSEUDO_F32vec1.h" // for check
25 
26 #include "TStopwatch.h"
27 #include "TString.h"
28 
29 #include <vector>
30 
31 class ENNHit;
32 class ENNRing;
33 
34 
36 
37  typedef unsigned short THitIndex;
38  struct ENNHit {
39  ENNHit() : x(0), y(0), quality(0), localIndex(0) {};
40  virtual ~ENNHit() {};
41 
42  float x, y; // coordinates
43  int quality; // quality of the best ring with this hit
44  THitIndex localIndex; // index in local copy of Clone array
45 
46  static bool Compare(const ENNHit& h1, const ENNHit& h2) {
47  return (h1.x < h2.x);
48  };
49  };
50 
51 
52  struct ENNRingHit : public ENNHit {
53  ENNRingHit() : outIndex(0) {};
54 
55  THitIndex outIndex; // index in Clone Array
56  };
57 
58  struct ENNHitV {
59  ENNHitV() : x(0), y(0), quality(0), localIndex(0) {};
60  virtual ~ENNHitV() {};
61 
62  fvec x, y; // coordinates
63  fvec quality; // quality of the best ring with this hit
64  fvec localIndex; // index in local copy of Clone array
65  void CopyHit(ENNHit& a, int i) {
66  localIndex[i] = a.localIndex;
67  x[i] = a.x;
68  y[i] = a.y;
69  quality[i] = a.quality;
70  }
71  void CopyHit(ENNHitV& a, int j, int i) {
72  localIndex[i] = a.localIndex[j];
73  x[i] = a.x[j];
74  y[i] = a.y[j];
75  quality[i] = a.quality[j];
76  };
77  };
78 
79  struct ENNRingHitV : public ENNHitV {
80  ENNRingHitV() : outIndex(0) {};
81 
82  fvec outIndex; // index in local copy of Clone array
83 
84  void CopyHit(ENNRingHit& a, int i) {
85  outIndex[i] = a.outIndex;
86  ENNHitV::CopyHit(a, i);
87  }
88  void CopyHit(ENNRingHitV& a, int j, int i) {
89  outIndex[i] = a.outIndex[j];
90  ENNHitV::CopyHit(a, j, i);
91  };
92  };
93 
94  struct ENNSearchHitV : public ENNHitV {
96  : lx(0)
97  , ly(0)
98  , lr2(0)
99  , // local coordinates
100  S0(0)
101  , S1(0)
102  , S2(0)
103  , S3(0)
104  , S4(0)
105  , // coefficients for calculation of E
106  C(0)
107  , Cx(0)
108  , Cy(0)
109  , // coefficients for the parameter space
110  on_ring(0) {};
111 
112  // variables for local search:
113  fvec lx, ly, lr2; // local coordinates
114  fvec S0, S1, S2, S3, S4; // coefficients for calculation of E
115  fvec C, Cx, Cy; // coefficients for the parameter space
116  fvec on_ring; // is the hit close to the current ring
117  };
118 
119 
120  struct ENNRing {
122  : on(0)
123  , // is the ring selected?
124  x(0)
125  , y(0)
126  , r(0)
127  , // parameters
128  chi2(0)
129  , // chi^2
130  NHits(0)
131  , // number of ring hits
132  NOwn(0)
133  , // number of its own hits
134  skip(0)
135  , // skip the ring during selection
136  localIHits() {};
137 
138  bool on; // is the ring selected?
139  float x, y, r; // parameters
140  float chi2; // chi^2
141  // variables for the selection procedure:
142  THitIndex NHits; // number of ring hits
143  THitIndex NOwn; // number of its own hits
144  bool skip; // skip the ring during selection
145  std::vector<THitIndex> localIHits; // indexes of hits in local array
146 
147  static bool CompareENNHRings(const ENNRing& r1, const ENNRing& r2) {
148  if (r1.NHits != r2.NHits)
149  return (r1.NHits > r2.NHits);
150  else
151  return (r1.chi2 < r2.chi2);
152  };
153  };
154 
155  struct ENNRingV {
157  : x(0)
158  , y(0)
159  , r(0)
160  , // parameters
161  chi2(0)
162  , // chi^2
163  NHits(0)
164  , // number of ring hits
165  localIHits() {};
166 
167  fvec x, y, r; // parameters
168  fvec chi2; // chi^2
169 
170  fvec NHits; // number of ring hits
171  std::vector<fvec> localIHits; // indexes of hits in local array
172  };
173 
174 
175  void ENNRingFinder(const int NHits,
177  std::vector<ENNRing>& Rings,
178  float HitSize = 1.,
179  THitIndex MinRingHits = 5,
180  fvec RMin = 2.,
181  fvec RMax = 6.);
182 
183 public:
185  CbmL1RichENNRingFinderParallel(Int_t verbose = 0);
186 
189 
191  void Init();
192 
201  Int_t DoFind(TClonesArray* hitArray,
202  TClonesArray* projArray,
203  TClonesArray* ringArray);
204 
205 private:
206  Float_t fRecoTime;
207  Int_t fNEvents;
208 
209  enum { NTimers = 11 };
210  TStopwatch fTimers[NTimers]; // timers for different parts of algorithm
211  TString fTimersNames[NTimers]; // names which are correspond to the timers.
212  TStopwatch& GetTimer(TString t);
213 
214 public:
215 };
216 
217 #endif
CbmL1RichENNRingFinderParallel::ENNRingV::y
fvec y
Definition: CbmL1RichENNRingFinderParallel.h:167
CbmL1RichENNRingFinderParallel::THitIndex
unsigned short THitIndex
Definition: CbmL1RichENNRingFinderParallel.h:37
F32vec4
Definition: L1/vectors/P4_F32vec4.h:47
CbmL1RichENNRingFinderParallel::ENNRingV::x
fvec x
Definition: CbmL1RichENNRingFinderParallel.h:165
CbmL1RichENNRingFinderParallel::ENNSearchHitV::Cy
fvec Cy
Definition: CbmL1RichENNRingFinderParallel.h:115
CbmL1RichENNRingFinderParallel::fTimers
TStopwatch fTimers[NTimers]
Definition: CbmL1RichENNRingFinderParallel.h:210
CbmL1RichENNRingFinderParallel::ENNHitV::quality
fvec quality
Definition: CbmL1RichENNRingFinderParallel.h:63
CbmL1RichENNRingFinderParallel::Init
void Init()
Definition: CbmL1RichENNRingFinderParallel.cxx:70
CbmL1RichENNRingFinderParallel::fRecoTime
Float_t fRecoTime
Definition: CbmL1RichENNRingFinderParallel.h:206
CbmL1RichENNRingFinderParallel::ENNRingHit::outIndex
THitIndex outIndex
Definition: CbmL1RichENNRingFinderParallel.h:53
CbmL1RichENNRingFinderParallel::ENNSearchHitV::S4
fvec S4
Definition: CbmL1RichENNRingFinderParallel.h:114
CbmL1RichENNRingFinderParallel::fNEvents
Int_t fNEvents
Definition: CbmL1RichENNRingFinderParallel.h:207
CbmL1RichENNRingFinderParallel::ENNRingV::NHits
fvec NHits
Definition: CbmL1RichENNRingFinderParallel.h:170
CbmRichRingFinder.h
CbmL1RichENNRingFinderParallel::ENNRingV::chi2
fvec chi2
Definition: CbmL1RichENNRingFinderParallel.h:168
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmL1RichENNRingFinderParallel::GetTimer
TStopwatch & GetTimer(TString t)
Definition: CbmL1RichENNRingFinderParallel.cxx:975
CbmL1RichENNRingFinderParallel::ENNHitV::CopyHit
void CopyHit(ENNHit &a, int i)
Definition: CbmL1RichENNRingFinderParallel.h:65
CbmL1RichENNRingFinderParallel::ENNHit::~ENNHit
virtual ~ENNHit()
Definition: CbmL1RichENNRingFinderParallel.h:40
CbmL1RichENNRingFinderParallel::ENNHitV::~ENNHitV
virtual ~ENNHitV()
Definition: CbmL1RichENNRingFinderParallel.h:60
CbmL1RichENNRingFinderParallel::fTimersNames
TString fTimersNames[NTimers]
Definition: CbmL1RichENNRingFinderParallel.h:211
CbmL1RichENNRingFinderParallel::ENNRingV
Definition: CbmL1RichENNRingFinderParallel.h:155
CbmL1RichENNRingFinderParallel::ENNRing::x
float x
Definition: CbmL1RichENNRingFinderParallel.h:139
CbmL1RichENNRingFinderParallel::ENNSearchHitV::lr2
fvec lr2
Definition: CbmL1RichENNRingFinderParallel.h:113
CbmL1RichENNRingFinderParallel::ENNRingFinder
void ENNRingFinder(const int NHits, nsL1vector< ENNHitV >::TSimd &HitsV, std::vector< ENNRing > &Rings, float HitSize=1., THitIndex MinRingHits=5, fvec RMin=2., fvec RMax=6.)
Definition: CbmL1RichENNRingFinderParallel.cxx:233
CbmL1RichENNRingFinderParallel::ENNSearchHitV::S0
fvec S0
Definition: CbmL1RichENNRingFinderParallel.h:114
CbmL1RichENNRingFinderParallel::ENNSearchHitV::C
fvec C
Definition: CbmL1RichENNRingFinderParallel.h:115
CbmL1RichENNRingFinderParallel::~CbmL1RichENNRingFinderParallel
~CbmL1RichENNRingFinderParallel()
Definition: CbmL1RichENNRingFinderParallel.cxx:67
CbmL1Def.h
CbmL1RichENNRingFinderParallel::ENNSearchHitV::S2
fvec S2
Definition: CbmL1RichENNRingFinderParallel.h:114
CbmL1RichENNRingFinderParallel::ENNHit
Definition: CbmL1RichENNRingFinderParallel.h:38
CbmL1RichENNRingFinderParallel::ENNHit::ENNHit
ENNHit()
Definition: CbmL1RichENNRingFinderParallel.h:39
CbmL1RichENNRingFinderParallel::ENNRing::y
float y
Definition: CbmL1RichENNRingFinderParallel.h:139
CbmL1RichENNRingFinderParallel::ENNHit::quality
int quality
Definition: CbmL1RichENNRingFinderParallel.h:43
CbmL1RichENNRingFinderParallel::ENNHit::Compare
static bool Compare(const ENNHit &h1, const ENNHit &h2)
Definition: CbmL1RichENNRingFinderParallel.h:46
CbmL1RichENNRingFinderParallel::ENNRing::r
float r
Definition: CbmL1RichENNRingFinderParallel.h:139
CbmL1RichENNRingFinderParallel::ENNHitV
Definition: CbmL1RichENNRingFinderParallel.h:58
CbmL1RichENNRingFinderParallel::ENNRing::localIHits
std::vector< THitIndex > localIHits
Definition: CbmL1RichENNRingFinderParallel.h:145
CbmL1RichENNRingFinderParallel::ENNSearchHitV::lx
fvec lx
Definition: CbmL1RichENNRingFinderParallel.h:110
CbmL1RichENNRingFinderParallel::ENNRingHit
Definition: CbmL1RichENNRingFinderParallel.h:52
CbmL1RichENNRingFinderParallel::ENNSearchHitV::ENNSearchHitV
ENNSearchHitV()
hit to use for ringfinding
Definition: CbmL1RichENNRingFinderParallel.h:95
CbmL1RichENNRingFinderParallel::ENNRingHitV::CopyHit
void CopyHit(ENNRingHit &a, int i)
Definition: CbmL1RichENNRingFinderParallel.h:84
CbmL1RichENNRingFinderParallel::ENNRing::NOwn
THitIndex NOwn
Definition: CbmL1RichENNRingFinderParallel.h:143
CbmL1RichENNRingFinderParallel
Definition: CbmL1RichENNRingFinderParallel.h:35
CbmL1RichENNRingFinderParallel::ENNHitV::localIndex
fvec localIndex
Definition: CbmL1RichENNRingFinderParallel.h:64
CbmL1RichENNRingFinderParallel::ENNSearchHitV
Definition: CbmL1RichENNRingFinderParallel.h:94
CbmL1RichENNRingFinderParallel::ENNRing::CompareENNHRings
static bool CompareENNHRings(const ENNRing &r1, const ENNRing &r2)
Definition: CbmL1RichENNRingFinderParallel.h:147
CbmL1RichENNRingFinderParallel::ENNSearchHitV::S1
fvec S1
Definition: CbmL1RichENNRingFinderParallel.h:114
CbmL1RichENNRingFinderParallel::ENNHit::y
float y
Definition: CbmL1RichENNRingFinderParallel.h:42
CbmL1RichENNRingFinderParallel::ENNRingHit::ENNRingHit
ENNRingHit()
hit to use in ENNRings
Definition: CbmL1RichENNRingFinderParallel.h:53
CbmL1RichENNRingFinderParallel::ENNHitV::ENNHitV
ENNHitV()
Definition: CbmL1RichENNRingFinderParallel.h:59
CbmRichRingFinder
Definition: CbmRichRingFinder.h:32
CbmL1RichENNRingFinderParallel::ENNRingV::ENNRingV
ENNRingV()
Definition: CbmL1RichENNRingFinderParallel.h:156
CbmL1RichENNRingFinderParallel::ENNRingV::localIHits
std::vector< fvec > localIHits
Definition: CbmL1RichENNRingFinderParallel.h:171
CbmL1RichENNRingFinderParallel::ENNSearchHitV::ly
fvec ly
Definition: CbmL1RichENNRingFinderParallel.h:113
CbmL1RichENNRingFinderParallel::ENNRingHitV::ENNRingHitV
ENNRingHitV()
Definition: CbmL1RichENNRingFinderParallel.h:80
CbmL1RichENNRingFinderParallel::ENNRing::chi2
float chi2
Definition: CbmL1RichENNRingFinderParallel.h:140
CbmL1RichENNRingFinderParallel::ENNRing
Definition: CbmL1RichENNRingFinderParallel.h:120
CbmL1RichENNRingFinderParallel::ENNHit::x
float x
Definition: CbmL1RichENNRingFinderParallel.h:40
nsL1::vector::TSimd
std::vector< T > TSimd
Definition: L1/vectors/PSEUDO_F32vec1.h:148
CbmL1RichENNRingFinderParallel::ENNSearchHitV::on_ring
fvec on_ring
Definition: CbmL1RichENNRingFinderParallel.h:116
CbmL1RichENNRingFinderParallel::ENNSearchHitV::S3
fvec S3
Definition: CbmL1RichENNRingFinderParallel.h:114
CbmL1RichENNRingFinderParallel::ENNRing::ENNRing
ENNRing()
Definition: CbmL1RichENNRingFinderParallel.h:121
CbmL1RichENNRingFinderParallel::ENNHitV::CopyHit
void CopyHit(ENNHitV &a, int j, int i)
Definition: CbmL1RichENNRingFinderParallel.h:71
CbmL1RichENNRingFinderParallel::ENNSearchHitV::Cx
fvec Cx
Definition: CbmL1RichENNRingFinderParallel.h:115
CbmL1RichENNRingFinderParallel::ENNRing::skip
bool skip
Definition: CbmL1RichENNRingFinderParallel.h:144
CbmL1RichENNRingFinderParallel::ENNHit::localIndex
THitIndex localIndex
Definition: CbmL1RichENNRingFinderParallel.h:44
CbmL1RichENNRingFinderParallel::ENNRing::NHits
THitIndex NHits
Definition: CbmL1RichENNRingFinderParallel.h:142
CbmL1RichENNRingFinderParallel::DoFind
Int_t DoFind(TClonesArray *hitArray, TClonesArray *projArray, TClonesArray *ringArray)
Definition: CbmL1RichENNRingFinderParallel.cxx:72
CbmL1RichENNRingFinderParallel::ENNHitV::x
fvec x
Definition: CbmL1RichENNRingFinderParallel.h:60
CbmL1RichENNRingFinderParallel::NTimers
@ NTimers
Definition: CbmL1RichENNRingFinderParallel.h:209
CbmL1RichENNRingFinderParallel::ENNRingHitV::CopyHit
void CopyHit(ENNRingHitV &a, int j, int i)
Definition: CbmL1RichENNRingFinderParallel.h:88
CbmL1RichENNRingFinderParallel::ENNHitV::y
fvec y
Definition: CbmL1RichENNRingFinderParallel.h:62
CbmL1RichENNRingFinderParallel::CbmL1RichENNRingFinderParallel
CbmL1RichENNRingFinderParallel(Int_t verbose=0)
Definition: CbmL1RichENNRingFinderParallel.cxx:41
CbmL1RichENNRingFinderParallel::ENNRingHitV
Definition: CbmL1RichENNRingFinderParallel.h:79
CbmL1RichENNRingFinderParallel::ENNRingHitV::outIndex
fvec outIndex
Definition: CbmL1RichENNRingFinderParallel.h:80
CbmL1RichENNRingFinderParallel::ENNRingV::r
fvec r
Definition: CbmL1RichENNRingFinderParallel.h:167
CbmL1RichENNRingFinderParallel::ENNRing::on
bool on
Definition: CbmL1RichENNRingFinderParallel.h:136