EIC 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 
56  // Methods to initialize tool for new event or region
58 
59  template <class RandIter>
60  void newEvent(int, RandIter, RandIter);
61 
63  // Method to initialize seeds production
65  void find3Sp();
66 
68  // Iterator through seeds pseudo collection produced accordingly
69  // methods find
71 
72  const Seed<SpacePoint>* next();
73 
75  // Configuration
77 
79 
80  protected:
85  delete;
87 
88  // Protected data and methods
90 
91  bool m_endlist;
92  bool m_checketa;
93  bool m_isvertex;
94  int m_nprint;
95  int m_nlist;
96  int m_maxsize;
97  int m_state;
98  // event number since tool init
102  float m_drmax;
103  float m_dzdrmin0;
104  float m_dzdrmax0;
105  float m_dzdrmin;
106  float m_dzdrmax;
107  float m_zmin;
108  float m_zmax;
109  float m_zminU;
110  float m_zmaxU;
111  float m_zminB;
112  float m_zmaxB;
113  float m_ftrig;
114  float m_ftrigW;
115  // maximum radius of outermost detector element
116  float r_rmax;
117  // size of one r-slice
118  float r_rstep;
119 
120  float m_dzver;
121  float m_dzdrver;
122  float m_diver;
123  float m_diverpps;
124  float m_diversss;
125  float m_divermax;
126  float m_dazmax;
127  float m_ptmin;
128  float m_ipt;
129  float m_ipt2;
130  float m_COF;
131  float m_K;
132  float m_ipt2K;
133  float m_ipt2C;
134  float m_COFK;
135  float m_umax;
136  // number of r-slices
137  int r_size;
138  int r_first;
139  int rf_size;
140  int rfz_size;
141  std::list<SPForSeed<SpacePoint>*>* r_Sorted;
142  std::list<SPForSeed<SpacePoint>*> rfz_Sorted[583];
143  std::list<SPForSeed<SpacePoint>*> l_spforseed;
144  typename std::list<SPForSeed<SpacePoint>*>::iterator i_spforseed;
145  typename std::list<SPForSeed<SpacePoint>*>::iterator m_rMin;
146 
150  int m_zMin;
151  // m_nr: number of bins used in r_Sorted; r_index: index of all used bins in
152  // r_Sorted; r_map is number of SP in each bin in r_Sorted
153  int m_nr;
154  int* r_index;
155  int* r_map;
156  int m_nrfz, rfz_index[583], rfz_map[583];
157  int rfz_b[583], rfz_t[593], rfz_ib[583][9], rfz_it[583][9];
158  float m_sF;
159 
161  // Tables for 3 space points seeds search
163 
166  float* m_Zo;
167  float* m_Tz;
168  float* m_R;
169  float* m_U;
170  float* m_V;
171  float* m_Er;
172 
174 
175  std::list<InternalSeed<SpacePoint>*> l_seeds;
176  typename std::list<InternalSeed<SpacePoint>*>::iterator i_seed;
177  typename std::list<InternalSeed<SpacePoint>*>::iterator i_seede;
178 
179  std::multimap<float, InternalSeed<SpacePoint>*> m_seeds;
180  typename std::multimap<float, InternalSeed<SpacePoint>*>::iterator m_seed;
181 
182  std::multimap<float, InternalSeed<SpacePoint>*> m_mapOneSeeds;
187  std::vector<std::pair<float, SPForSeed<SpacePoint>*>> m_CmSp;
188 
190  // Beam geometry
192 
193  float m_xbeam; // x-center of beam-axis
194  float m_ybeam; // y-center of beam-axis
195  float m_zbeam; // z-center of beam-axis
196 
198  // Protected methods
200 
201  void buildFrameWork();
202  void buildBeamFrameWork();
203 
205 
207  SPForSeed<SpacePoint>*&, float, float);
208 
210  SPForSeed<SpacePoint>*&, float);
211 
212  void fillSeeds();
213  void fillLists();
214  void erase();
215  void production3Sp();
216  void production3Sp(typename std::list<SPForSeed<SpacePoint>*>::iterator*,
217  typename std::list<SPForSeed<SpacePoint>*>::iterator*,
218  typename std::list<SPForSeed<SpacePoint>*>::iterator*,
219  typename std::list<SPForSeed<SpacePoint>*>::iterator*, int,
220  int, int&);
221 
222  void findNext();
223  bool isZCompatible(float&);
224  void convertToBeamFrameWork(SpacePoint* const&, float*);
225 };
226 
228 // Inline methods
230 
231 template <typename SpacePoint>
233  do {
234  if (i_seed == i_seede) {
235  findNext();
236  if (i_seed == i_seede) {
237  return 0;
238  }
239  }
240  ++i_seed;
241  } while (!(*m_seed++).second->set3(*m_seedOutput));
242  return (m_seedOutput);
243 }
244 
245 template <typename SpacePoint>
247  if (Zv < m_zminU || Zv > m_zmaxU) {
248  return false;
249  } else {
250  return true;
251  }
252 }
253 
255 // New space point for seeds
257 
258 template <typename SpacePoint>
260  SpacePoint* const& sp) {
262 
263  float r[3];
264  convertToBeamFrameWork(sp, r);
265 
266  if (m_checketa) {
267  // filter SP outside of eta-range
268  float z = (fabs(r[2]) + m_zmax);
269  float x = r[0] * m_dzdrmin;
270  float y = r[1] * m_dzdrmin;
271  if ((z * z) < (x * x + y * y)) {
272  return 0;
273  }
274  }
275 
276  if (i_spforseed != l_spforseed.end()) {
277  sps = (*i_spforseed++);
278  sps->set(sp, r);
279  } else {
280  l_spforseed.push_back((sps = new SPForSeed<SpacePoint>(sp, r)));
281  i_spforseed = l_spforseed.end();
282  }
283 
284  return sps;
285 }
286 
288 // Object-function for curvature seeds comparison
290 
292  public:
293  template <typename SpacePoint>
295  const std::pair<float, Acts::Legacy::SPForSeed<SpacePoint>*>& i1,
296  const std::pair<float, Acts::Legacy::SPForSeed<SpacePoint>*>& i2) {
297  return i1.first < i2.first;
298  }
299 };
300 } // namespace Legacy
301 } // namespace Acts