Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AtlasSeedFinder.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AtlasSeedFinder.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 // AtlasSeedFinder.hpp Acts project
12 
13 #pragma once
16 
17 #include <list>
18 #include <map>
19 #include <set>
20 #include <string>
21 #include <utility>
22 #include <vector>
23 
24 namespace Acts {
25 namespace Legacy {
26 template <typename SpacePoint>
28  struct Config {
29  // UNIT AS RETURNED BY m_fieldService->getField() default value in ATLAS
30  // was
31  // 5. Unit is kilo-Tesla
32  // double bFieldInZ = 5.;
33  double bFieldInZ = 0.00208;
34 
35  double SCT_rMin = 200.;
36 
37  double beamPosX = 0;
38  double beamPosY = 0;
39  double beamPosZ = 0;
40  double beamTiltX = 0;
41  double beamTiltY = 0;
42  };
44  // Public methods:
46 
47  public:
49  // Standard tool methods
51 
53  virtual ~AtlasSeedFinder() {
54  if (r_index != nullptr) {
55  delete[] r_index;
56  }
57  if (r_map != nullptr) {
58  delete[] r_map;
59  }
60  if (r_Sorted != nullptr) {
61  delete[] r_Sorted;
62  }
63 
64  // Delete seeds
65  //
66  for (i_seed = l_seeds.begin(); i_seed != l_seeds.end(); ++i_seed) {
67  delete *i_seed;
68  }
69  // Delete space points for reconstruction
70  //
71  i_spforseed = l_spforseed.begin();
72  for (; i_spforseed != l_spforseed.end(); ++i_spforseed) {
73  delete *i_spforseed;
74  }
75  if (m_seedOutput != nullptr) {
76  delete m_seedOutput;
77  }
78 
79  if (m_SP != nullptr) {
80  delete[] m_SP;
81  }
82  if (m_R != nullptr) {
83  delete[] m_R;
84  }
85  if (m_Tz != nullptr) {
86  delete[] m_Tz;
87  }
88  if (m_Er != nullptr) {
89  delete[] m_Er;
90  }
91  if (m_U != nullptr) {
92  delete[] m_U;
93  }
94  if (m_V != nullptr) {
95  delete[] m_V;
96  }
97  if (m_Zo != nullptr) {
98  delete[] m_Zo;
99  }
100  if (m_OneSeeds != nullptr) {
101  delete[] m_OneSeeds;
102  }
103  }
104 
106  // Methods to initialize tool for new event or region
108 
109  template <class RandIter>
110  void newEvent(int /*iteration*/, RandIter /*spBegin*/, RandIter /*spEnd*/);
111 
113  // Method to initialize seeds production
115  void find3Sp();
116 
118  // Iterator through seeds pseudo collection produced accordingly
119  // methods find
121 
122  const Seed<SpacePoint>* next();
123 
125  // Configuration
127 
129 
130  protected:
135  delete;
137 
138  // Protected data and methods
140 
141  bool m_endlist = false;
142  bool m_checketa = false;
143  bool m_isvertex = false;
144  int m_nprint = 0;
145  int m_nlist = 0;
146  int m_maxsize = 0;
147  int m_state = 0;
148  // event number since tool init
149  int m_iteration = 0;
150  float m_etamin = 0, m_etamax = 0;
151  float m_drmin = 0, m_drminv = 0;
152  float m_drmax = 0;
153  float m_dzdrmin0 = 0;
154  float m_dzdrmax0 = 0;
155  float m_dzdrmin = 0;
156  float m_dzdrmax = 0;
157  float m_zmin = 0;
158  float m_zmax = 0;
159  float m_zminU = 0;
160  float m_zmaxU = 0;
161  float m_zminB = 0;
162  float m_zmaxB = 0;
163  float m_ftrig = 0;
164  float m_ftrigW = 0;
165  // maximum radius of outermost detector element
166  float r_rmax = 0;
167  // size of one r-slice
168  float r_rstep = 0;
169 
170  float m_dzver = 0;
171  float m_dzdrver = 0;
172  float m_diver = 0;
173  float m_diverpps = 0;
174  float m_diversss = 0;
175  float m_divermax = 0;
176  float m_dazmax = 0;
177  float m_ptmin = 0;
178  float m_ipt = 0;
179  float m_ipt2 = 0;
180  float m_COF = 0;
181  float m_K = 0;
182  float m_ipt2K = 0;
183  float m_ipt2C = 0;
184  float m_COFK = 0;
185  float m_umax = 0;
186  // number of r-slices
187  int r_size = 0;
188  int r_first = 0;
189  int rf_size = 0;
190  int rfz_size = 0;
191  std::list<SPForSeed<SpacePoint>*>* r_Sorted = nullptr;
192  std::list<SPForSeed<SpacePoint>*> rfz_Sorted[583];
193  std::list<SPForSeed<SpacePoint>*> l_spforseed;
194  typename std::list<SPForSeed<SpacePoint>*>::iterator i_spforseed;
195  typename std::list<SPForSeed<SpacePoint>*>::iterator m_rMin;
196 
197  int m_nsaz = 0, m_nsazv = 0;
198  int m_fNmax = 0, m_fvNmax = 0;
199  int m_fNmin = 0, m_fvNmin = 0;
200  int m_zMin = 0;
201  // m_nr: number of bins used in r_Sorted; r_index: index of all used bins in
202  // r_Sorted; r_map is number of SP in each bin in r_Sorted
203  int m_nr = 0;
204  int* r_index = nullptr;
205  int* r_map = nullptr;
206  int m_nrfz = 0, rfz_index[583] = {}, rfz_map[583] = {};
207  int rfz_b[583] = {}, rfz_t[593] = {}, rfz_ib[583][9] = {},
208  rfz_it[583][9] = {};
209  float m_sF = 0;
210 
212  // Tables for 3 space points seeds search
214 
215  int m_maxsizeSP = 0;
217  float* m_Zo = nullptr;
218  float* m_Tz = nullptr;
219  float* m_R = nullptr;
220  float* m_U = nullptr;
221  float* m_V = nullptr;
222  float* m_Er = nullptr;
223 
225 
226  std::list<InternalSeed<SpacePoint>*> l_seeds;
227  typename std::list<InternalSeed<SpacePoint>*>::iterator i_seed;
228  typename std::list<InternalSeed<SpacePoint>*>::iterator i_seede;
229 
230  std::multimap<float, InternalSeed<SpacePoint>*> m_seeds;
231  typename std::multimap<float, InternalSeed<SpacePoint>*>::iterator m_seed;
232 
233  std::multimap<float, InternalSeed<SpacePoint>*> m_mapOneSeeds;
235  int m_maxOneSize = 0;
236  int m_nOneSeeds = 0;
237  int m_fillOneSeeds = 0;
238  std::vector<std::pair<float, SPForSeed<SpacePoint>*>> m_CmSp;
239 
241  // Beam geometry
243 
244  float m_xbeam = 0; // x-center of beam-axis
245  float m_ybeam = 0; // y-center of beam-axis
246  float m_zbeam = 0; // z-center of beam-axis
247 
249  // Protected methods
251 
252  void buildFrameWork();
253  void buildBeamFrameWork();
254 
256 
257  void newOneSeed(SPForSeed<SpacePoint>*& /*p1*/,
258  SPForSeed<SpacePoint>*& /*p2*/,
259  SPForSeed<SpacePoint>*& /*p3*/, float /*z*/, float /*q*/);
260 
262  SPForSeed<SpacePoint>*& /*SP0*/,
263  float /*Zob*/);
264 
265  void fillSeeds();
266  void fillLists();
267  void erase();
268  void production3Sp();
269  void production3Sp(
270  typename std::list<SPForSeed<SpacePoint>*>::iterator* /*rb*/,
271  typename std::list<SPForSeed<SpacePoint>*>::iterator* /*rbe*/,
272  typename std::list<SPForSeed<SpacePoint>*>::iterator* /*rt*/,
273  typename std::list<SPForSeed<SpacePoint>*>::iterator* /*rte*/, int /*NB*/,
274  int /*NT*/, int& /*nseed*/);
275 
276  void findNext();
277  bool isZCompatible(float& /*Zv*/);
278  void convertToBeamFrameWork(SpacePoint* const& /*sp*/, float* /*r*/);
279 };
280 
282 // Inline methods
284 
285 template <typename SpacePoint>
287  do {
288  if (i_seed == i_seede) {
289  findNext();
290  if (i_seed == i_seede) {
291  return nullptr;
292  }
293  }
294  ++i_seed;
295  } while (!(*m_seed++).second->set3(*m_seedOutput));
296  return (m_seedOutput);
297 }
298 
299 template <typename SpacePoint>
301  if (Zv < m_zminU || Zv > m_zmaxU) {
302  return false;
303  } else {
304  return true;
305  }
306 }
307 
309 // New space point for seeds
311 
312 template <typename SpacePoint>
314  SpacePoint* const& sp) {
315  SPForSeed<SpacePoint>* sps = nullptr;
316 
317  float r[3];
318  convertToBeamFrameWork(sp, r);
319 
320  if (m_checketa) {
321  // filter SP outside of eta-range
322  float z = (fabs(r[2]) + m_zmax);
323  float x = r[0] * m_dzdrmin;
324  float y = r[1] * m_dzdrmin;
325  if ((z * z) < (x * x + y * y)) {
326  return nullptr;
327  }
328  }
329 
330  if (i_spforseed != l_spforseed.end()) {
331  sps = (*i_spforseed++);
332  sps->set(sp, r);
333  } else {
334  l_spforseed.push_back((sps = new SPForSeed<SpacePoint>(sp, r)));
335  i_spforseed = l_spforseed.end();
336  }
337 
338  return sps;
339 }
340 
342 // Object-function for curvature seeds comparison
344 
346  public:
347  template <typename SpacePoint>
349  const std::pair<float, Acts::Legacy::SPForSeed<SpacePoint>*>& i1,
350  const std::pair<float, Acts::Legacy::SPForSeed<SpacePoint>*>& i2) {
351  return i1.first < i2.first;
352  }
353 };
354 } // namespace Legacy
355 } // namespace Acts