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