ATLAS Offline Software
EtaPhiMap.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 //
4 // Dear emacs, this is -*- c++ -*-
5 //
6 
7 #ifndef CALORECGPU_ETAPHIMAP_H
8 #define CALORECGPU_ETAPHIMAP_H
9 
10 #include "BaseDefinitions.h"
11 #include "Helpers.h"
12 
13 #include <utility>
14 
15 namespace CaloRecGPU
16 {
29  template <int eta_grid, int phi_grid, bool respect_deltas, bool continuous>
31 
32  template <int eta_grid, int phi_grid, bool respect_deltas>
33  struct EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, true>
34  {
35  friend struct EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, false>;
36 
37  static constexpr int s_max_overlap_cells = 10;
38  //We could/should try to refine things
39  //so we get only 8 overlapping cells at most,
40  //for more efficient memory transfers
41  //(32 bytes more natural than 40...).
42 
43  float eta_min;
44  float phi_min;
45  float eta_max;
46  float phi_max;
47  float delta_eta;
48  float delta_phi;
49  int cells [eta_grid][phi_grid][s_max_overlap_cells];
50  float corner_eta [eta_grid][phi_grid][s_max_overlap_cells];
51  float corner_phi [eta_grid][phi_grid][s_max_overlap_cells];
52  //Corners in fractions of delta_eta/phi
53  //(Or center (eta, phi) of original cells,
54  //if respect_deltas == false)
55 
56  //If corner_{eta, phi}[h][f][n] > 0,
57  //then the cell ends at this fraction.
58  //If it < 0, it starts at this fraction.
59 
60  private:
61 
62  constexpr int eta_coordinate(const float eta) const
63  {
64  using namespace std;
65  return floorf((eta - eta_min) / delta_eta);
66  }
67 
69  constexpr int eta_coordinate(const float eta, float & interval) const
70  {
71  using namespace std;
72  const float frac = (eta - eta_min) / delta_eta;
73  const float rounded = floorf(frac);
74  interval = frac - rounded;
75  return rounded;
76  }
77 
78  constexpr int phi_coordinate(const float phi) const
79  {
80  using namespace std;
81  return floorf((phi - phi_min) / delta_phi);
82  }
83 
85  constexpr int phi_coordinate(const float phi, float & interval) const
86  {
87  using namespace std;
88  const float frac = (phi - phi_min) / delta_phi;
89  const float rounded = floorf(frac);
90  interval = frac - rounded;
91  return rounded;
92  }
93 
94  constexpr void add_cell_to_grid(const int cell, const float eta_corner, const float phi_corner, const int eta, const int phi)
95  {
96  for (int i = 0; i < s_max_overlap_cells; ++i)
97  {
98  if (cells[eta][phi][i] < 0)
99  {
100  cells [eta][phi][i] = cell;
101  corner_eta [eta][phi][i] = eta_corner;
102  corner_phi [eta][phi][i] = phi_corner;
103  return;
104  }
105  }
106  // /*
107  printf("Unable to store %d: %d %d %d %d (%d %d %d %d)\n", cell,
108  cells[eta][phi][0], cells[eta][phi][1],
109  cells[eta][phi][2], cells[eta][phi][3],
110  eta, eta_grid, phi, phi_grid );
111  // */
112  }
113 
114  constexpr void register_cell_with_deltas(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
115  {
116  int eta_coord_start = 0, eta_coord_end = 0, phi_coord_start = 0, phi_coord_end = 0;
117  int phi_coord_extra_neg = 0, phi_coord_extra_pos = 0;
118  float eta_fraction_start = 0.f, eta_fraction_end = 0.f, phi_fraction_start = 0.f, phi_fraction_end = 0.f;
119  float phi_fraction_extra_neg = 0.f, phi_fraction_extra_pos = 0.f;
120 
121  eta_coord_start = eta_coordinate(cell_eta - cell_deta / 2, eta_fraction_start);
122  eta_coord_end = eta_coordinate(cell_eta + cell_deta / 2, eta_fraction_end);
123  phi_coord_start = phi_coordinate(cell_phi - cell_dphi / 2, phi_fraction_start);
124  phi_coord_end = phi_coordinate(cell_phi + cell_dphi / 2, phi_fraction_end);
125 
126  phi_coord_extra_neg = phi_coordinate(cell_phi + cell_dphi / 2 - 2 * Helpers::Constants::pi<float>, phi_fraction_extra_neg);
127  phi_coord_extra_pos = phi_coordinate(cell_phi - cell_dphi / 2 + 2 * Helpers::Constants::pi<float>, phi_fraction_extra_pos);
128 
129  if ((eta_coord_end == eta_coord_start && (eta_fraction_start > 0 || eta_fraction_end < 1)) ||
130  (phi_coord_end == phi_coord_start && (phi_fraction_start > 0 || phi_fraction_end < 1)) )
131  {
132  // /*
133  printf("Something strange going on with cell %d: %f %f %f %f %f %f (%d %d %f %f | %d %d %f %f)\n",
134  cell, cell_eta, cell_deta, delta_eta, cell_phi, cell_dphi, delta_phi,
135  eta_coord_start, eta_coord_end, eta_fraction_start, eta_fraction_end,
136  phi_coord_start, phi_coord_end, phi_fraction_start, phi_fraction_end);
137  // */
138  return;
139  }
140 
141  if (eta_coord_start < 0 || eta_coord_end < 0 || phi_coord_start < 0 || phi_coord_end < 0 ||
142  eta_fraction_start < 0 || eta_fraction_end < 0 || phi_fraction_start < 0 || phi_fraction_end < 0)
143  {
144  // /*
145  printf("Underflowing cell %d: %f %f %f %f %f %f (%d %d %f %f | %d %d %f %f) [%f %f]\n",
146  cell, cell_eta, cell_deta, cell_eta - cell_deta / 2, cell_phi, cell_dphi, cell_phi - cell_dphi / 2,
147  eta_coord_start, eta_coord_end, eta_fraction_start, eta_fraction_end,
148  phi_coord_start, phi_coord_end, phi_fraction_start, phi_fraction_end,
149  eta_min, phi_min);
150  // */
151  return;
152  }
153 
154  if (eta_coord_start >= eta_grid || eta_coord_end >= eta_grid || phi_coord_start >= phi_grid || phi_coord_end >= phi_grid ||
155  eta_fraction_start > 1 || eta_fraction_end > 1 || phi_fraction_start > 1 || phi_fraction_end > 1)
156  {
157  // /*
158  printf("Overflowing cell %d: %f %f %f %f %f %f (%d %d %f %f | %d %d %f %f) [%f %f]\n",
159  cell, cell_eta, cell_deta, cell_eta + cell_deta / 2, cell_phi, cell_dphi, cell_phi + cell_dphi / 2,
160  eta_coord_start, eta_coord_end, eta_fraction_start, eta_fraction_end,
161  phi_coord_start, phi_coord_end, phi_fraction_start, phi_fraction_end,
162  eta_min, phi_min);
163  // */
164  return;
165  }
166 
167  for (int eta_c = eta_coord_start; eta_c <= eta_coord_end; ++eta_c)
168  {
169  const float eta_corner = ( eta_c == eta_coord_start ?
170  -eta_fraction_start : ( eta_c == eta_coord_end ?
171  eta_fraction_end : 0.f )
172  );
173  for (int phi_c = 0; phi_c <= phi_coord_extra_neg; ++phi_c)
174  {
175  const float phi_corner = ( phi_c == phi_coord_extra_neg ?
176  phi_fraction_extra_neg : 0.f );
177 
178  add_cell_to_grid(cell, eta_corner, phi_corner, eta_c, phi_c);
179 
180  }
181  for (int phi_c = phi_coord_start; phi_c <= phi_coord_end; ++phi_c)
182  {
183  const float phi_corner = ( phi_c == phi_coord_start ?
184  -phi_fraction_start : ( phi_c == phi_coord_end ?
185  phi_fraction_end : 0.f )
186  );
187  add_cell_to_grid(cell, eta_corner, phi_corner, eta_c, phi_c);
188  }
189  for (int phi_c = phi_coord_extra_pos; phi_c < phi_grid; ++phi_c)
190  {
191  const float phi_corner = ( phi_c == phi_coord_extra_pos ?
192  -phi_fraction_extra_pos : 0.f );
193  add_cell_to_grid(cell, eta_corner, phi_corner, eta_c, phi_c);
194  }
195  }
196  }
197 
198  constexpr void register_cell_center(const int cell, const float cell_eta, const float cell_phi)
199  {
200  const int eta_coord = eta_coordinate(cell_eta);
201  const int phi_coord = phi_coordinate(cell_phi);
202 
203  if (eta_coord < 0 || eta_coord >= eta_grid || phi_coord < 0 || phi_coord >= phi_grid)
204  {
205  // /*
206  printf("Out of bounds cell: %d | %f %d %f %f %d | %f %d %f %f %d\n", cell,
207  cell_eta, eta_coord, eta_min, eta_max, eta_grid,
208  cell_phi, phi_coord, phi_min, phi_max, phi_grid );
209  // */
210  return;
211  }
212 
213  add_cell_to_grid(cell, cell_eta, cell_phi, eta_coord, phi_coord);
214  }
215 
216 
217  constexpr void initialize(const float min_eta, const float min_phi,
218  const float max_eta, const float max_phi,
219  const float deta, const float dphi)
220  {
221  for (int i = 0; i < eta_grid; ++i)
222  {
223  for (int j = 0; j < phi_grid; ++j)
224  {
225  for (int k = 0; k < s_max_overlap_cells; ++k)
226  {
227  cells[i][j][k] = -1;
228  }
229  }
230  }
231  eta_min = min_eta;
232  phi_min = min_phi;
233  eta_max = max_eta;
234  phi_max = max_phi;
235  delta_eta = deta;
236  delta_phi = dphi;
237  }
238 
239  public:
240 
241 
242  constexpr void register_cell(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
243  {
244  if (respect_deltas)
245  //If we could be sure of C++17 compatibility,
246  //this would be a constexpr if...
247  {
248  register_cell_with_deltas(cell, cell_eta, cell_phi, cell_deta, cell_dphi);
249  }
250  else
251  {
252  register_cell_center(cell, cell_eta, cell_phi);
253  }
254  }
255 
256  constexpr void initialize()
257  {
258  initialize(0, 0, 0, 0, 0, 0);
259  }
260 
261  constexpr void initialize(const float min_eta_neg, const float min_phi_neg,
262  const float /*max_eta_neg*/, const float /*max_phi_neg*/,
263  const float /*min_eta_pos*/, const float /*min_phi_pos*/,
264  const float max_eta_pos, const float max_phi_pos,
265  const float deta, const float dphi)
266  {
267  initialize(min_eta_neg, min_phi_neg, max_eta_pos, max_phi_pos, deta, dphi);
268  }
269 
270  constexpr static size_t finish_initializing_buffer_size()
271  {
272  return eta_grid * phi_grid * s_max_overlap_cells * sizeof(int);
273  }
274 
277  {
278  if (!respect_deltas)
279  //If we could be sure of C++17 compatibility,
280  //this would be a constexpr if...
281  {
282  //This is O( N * M * (N + M) ) for a N * M grid,
283  //but gives us reasonable results.
284  //And, since this is just an initialization step,
285  //not too serious. Still, we could optimize it further...
286  //(Or do it on the GPU. Really.
287  //Because it ends up being quite cellular automaton-y.)
288  //
289  //Of course the proper way to do this would be to build
290  //a Voronoi diagram based on the cell positions
291  //and then discretize it in the grid (overlapping where needed),
292  //but the complexity versus performance gains trade-off
293  //in this case favours keeping this simpler version.
294 
295  int (*casted)[eta_grid][phi_grid][s_max_overlap_cells] = (int (*)[eta_grid][phi_grid][s_max_overlap_cells]) buffer;
296 
297  int (&cell_arr_dest)[eta_grid][phi_grid][s_max_overlap_cells] = *casted;
298 
299  using namespace std;
300 
301  memcpy(&(cell_arr_dest[0][0][0]), &(cells[0][0][0]), finish_initializing_buffer_size());
302 
303  bool keep_going = true;
304 
305  bool second_phase = false;
306  //The first phase grows out the clusters,
307  //I mean, the elements of the grid that are
308  //closest to a cell and stops when they intersect.
309  //The second phase grows out those who do intersect
310  //to empty elements, to handle the cases where an element
311  //is all surrounded by intersections...
312 
313 
314  auto propagate_cell = [&](const int eta_c, const int phi_c, const int input_cell,
315  const float input_eta, const float input_phi, const bool only_empty )
316  {
317  if (only_empty && cells[eta_c][phi_c][0] >= 0)
318  {
319  return;
320  }
321  int to_add_index = 0;
322  for (; to_add_index < s_max_overlap_cells; ++to_add_index)
323  {
324  if (cell_arr_dest[eta_c][phi_c][to_add_index] == input_cell)
325  {
326  return;
327  }
328  else if (cell_arr_dest[eta_c][phi_c][to_add_index] < 0)
329  {
330  break;
331  }
332  }
333  if (to_add_index == s_max_overlap_cells)
334  {
335  // /*
336  printf("Unable to store %d: %d %d %d %d (%d %d %d %d)\n", input_cell,
337  cell_arr_dest[eta_c][phi_c][0], cell_arr_dest[eta_c][phi_c][1],
338  cell_arr_dest[eta_c][phi_c][2], cell_arr_dest[eta_c][phi_c][3],
339  eta_c, eta_grid, phi_c, phi_grid );
340  // */
341  return;
342  }
343 
344  cell_arr_dest [eta_c][phi_c][to_add_index] = input_cell;
345  corner_eta [eta_c][phi_c][to_add_index] = input_eta;
346  corner_phi [eta_c][phi_c][to_add_index] = input_phi;
347 
348  keep_going = true;
349  };
350 
351  auto process_cell = [&](const int eta_c, const int phi_c, const int cell_index, const bool only_empty)
352  {
353  const int this_cell = cells [eta_c][phi_c][cell_index];
354  const float this_eta = corner_eta [eta_c][phi_c][cell_index];
355  const float this_phi = corner_phi [eta_c][phi_c][cell_index];
356 
357  for (int delta_eta = -1; delta_eta <= 1; ++delta_eta)
358  {
359  const int target_eta_c = eta_c + delta_eta;
360  if (target_eta_c < 0 || target_eta_c >= eta_grid)
361  {
362  continue;
363  }
364  for (int delta_phi = -1; delta_phi <= 1; ++delta_phi)
365  {
366  int target_phi_c = phi_c + delta_phi;
367  if (target_phi_c < 0)
368  {
369  target_phi_c = phi_coordinate(phi_min + delta_phi * target_phi_c + 2 * Helpers::Constants::pi<float>);
370  if (target_phi_c < 0 || target_phi_c >= phi_grid)
371  {
372  continue;
373  }
374  }
375  else if (target_phi_c >= phi_grid)
376  {
377  target_phi_c = phi_coordinate(phi_min + delta_phi * target_phi_c - 2 * Helpers::Constants::pi<float>);
378  if (target_phi_c < 0 || target_phi_c >= phi_grid)
379  {
380  continue;
381  }
382  }
383  propagate_cell(target_eta_c, target_phi_c, this_cell, this_eta, this_phi, only_empty);
384  }
385  }
386  };
387 
388  while (keep_going)
389  {
390  keep_going = false;
391  for (int eta_c = 0; eta_c < eta_grid; ++eta_c)
392  {
393  for (int phi_c = 0; phi_c < phi_grid; ++phi_c)
394  {
395  const auto & this_square_cells = cells[eta_c][phi_c];
396  if (!second_phase)
397  {
398  if (this_square_cells[0] >= 0 && this_square_cells[1] < 0)
399  {
400  process_cell(eta_c, phi_c, 0, false);
401  }
402  }
403  else
404  {
405  for (int cell_index = 0; cell_index < s_max_overlap_cells; ++cell_index)
406  {
407  if (this_square_cells[cell_index] < 0)
408  {
409  break;
410  }
411  process_cell(eta_c, phi_c, cell_index, true);
412  }
413  }
414  }
415  }
416  memcpy(&(cells[0][0][0]), &(cell_arr_dest[0][0][0]), finish_initializing_buffer_size());
417  if (!keep_going && !second_phase)
418  {
419  second_phase = true;
420  keep_going = true;
421  }
422  }
423  }
424  else
425  {
426  //Do nothing: when respecting deltas,
427  //cells get properly initialized outright...
428  }
429  }
430 
432  constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int * cell_arr) const
433  {
434  int num_cells = 0;
435 
436  float frac_eta = 0.f, frac_phi = 0.f;
437 
438  const int eta_coord = eta_coordinate(test_eta, frac_eta);
439  const int phi_coord = phi_coordinate(test_phi, frac_phi);
440 
441  if ( test_eta < eta_min || test_eta > eta_max ||
442  test_phi < phi_min || test_phi > phi_max ||
443  eta_coord < 0 || eta_coord >= eta_grid ||
444  phi_coord < 0 || phi_coord >= phi_grid )
445  {
446  /*
447  printf("OOB: %f %d %f %f %d | %f %d %f %f %d\n",
448  test_eta, eta_coord, eta_min, eta_max, eta_grid,
449  test_phi, phi_coord, phi_min, phi_max, phi_grid);
450  // */
451  return 0;
452  }
453 
454  if (respect_deltas)
455  //If we could be sure of C++17 compatibility,
456  //this would be a constexpr if...
457  {
458  auto check_coord = [](const float test, const float target)
459  {
460  using namespace std;
461  if (target > 0 && fabsf(test) <= fabsf(target))
462  {
463  return true;
464  }
465  else if (target < 0 && fabsf(test) >= fabsf(target))
466  {
467  return true;
468  }
469  else if (target == 0)
470  {
471  return true;
472  }
473  else
474  {
475  return false;
476  }
477  };
478 
479  for (int i = 0; i < s_max_overlap_cells; ++i)
480  {
481  if (cells[eta_coord][phi_coord][i] < 0)
482  {
483  break;
484  }
485  if ( check_coord(frac_eta, corner_eta[eta_coord][phi_coord][i]) &&
486  check_coord(frac_phi, corner_phi[eta_coord][phi_coord][i]) )
487  {
488  cell_arr[num_cells] = cells[eta_coord][phi_coord][i];
489  ++num_cells;
490  }
491  }
492  }
493  else
494  {
495  float distance = 1e38f;
496  int ret = -1;
497 
498  for (int i = 0; i < s_max_overlap_cells; ++i)
499  {
500  const int this_cell = cells[eta_coord][phi_coord][i];
501  if (this_cell < 0)
502  {
503  break;
504  }
505  const float delta_eta = corner_eta[eta_coord][phi_coord][i] - test_eta;
506  const float delta_phi = Helpers::angular_difference(corner_phi[eta_coord][phi_coord][i], test_phi);
507  //If respect_deltas == false,
508  //corner_coords are actually
509  //the center (eta, phi) of the cell.
510  const float this_dist = delta_eta * delta_eta + delta_phi * delta_phi;
511 
512  if (this_dist < distance || (this_dist == distance && this_cell > ret))
513  {
514  distance = this_dist;
515  ret = this_cell;
516  }
517  }
518 
519  if (ret > 0)
520  {
521  cell_arr[0] = ret;
522  num_cells = 1;
523  }
524  }
525 
526  return num_cells;
527  }
528 
529  constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const
530  {
531  float frac_eta = 0.f, frac_phi = 0.f;
532 
533  const int eta_coord = eta_coordinate(test_eta, frac_eta);
534  const int phi_coord = phi_coordinate(test_phi, frac_phi);
535 
536  if ( test_eta < eta_min || test_eta > eta_max ||
537  test_phi < phi_min || test_phi > phi_max ||
538  eta_coord < 0 || eta_coord >= eta_grid ||
539  phi_coord < 0 || phi_coord >= phi_grid )
540  {
541  return false;
542  }
543 
544  if (respect_deltas)
545  //If we could be sure of C++17 compatibility,
546  //this would be a constexpr if...
547  {
548  auto check_coord = [](const float test, const float target)
549  {
550  using namespace std;
551  if (fabsf(test) >= fabs(target) && target < 0)
552  {
553  return true;
554  }
555  else if (fabs(test) <= fabs(target) && target > 0)
556  {
557  return true;
558  }
559  else if (target == 0)
560  {
561  return true;
562  }
563  else
564  {
565  return false;
566  }
567  };
568 
569  for (int i = 0; i < s_max_overlap_cells; ++i)
570  {
571  if (cells[eta_coord][phi_coord][i] < 0)
572  {
573  break;
574  }
575  if ( check_coord(frac_eta, corner_eta[eta_coord][phi_coord][i]) &&
576  check_coord(frac_phi, corner_phi[eta_coord][phi_coord][i]) )
577  {
578  return true;
579  }
580  }
581  return false;
582  }
583  else
584  {
585  return true;
586  //Except for being out-of-bounds,
587  //if respect_deltas == false
588  //we can always find a closest cell
589  //for each coordinate.
590  }
591  }
592 
593  };
594 
595  template <int eta_grid, int phi_grid, bool respect_deltas>
596  struct EtaPhiMapEntry<eta_grid, phi_grid, respect_deltas, false>
597  {
599 
601 
602  constexpr void register_cell(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
603  {
604  if (cell_eta >= 0)
605  {
606  pos.register_cell(cell, cell_eta, cell_phi, cell_deta, cell_dphi);
607  }
608  else
609  {
610  neg.register_cell(cell, cell_eta, cell_phi, cell_deta, cell_dphi);
611  }
612  }
613 
614  constexpr void initialize(const float min_eta_neg, const float min_phi_neg,
615  const float max_eta_neg, const float max_phi_neg,
616  const float min_eta_pos, const float min_phi_pos,
617  const float max_eta_pos, const float max_phi_pos,
618  const float deta, const float dphi)
619  {
620  pos.initialize(min_eta_pos, min_phi_pos, max_eta_pos, max_phi_pos, deta, dphi);
621  neg.initialize(min_eta_neg, min_phi_neg, max_eta_neg, max_phi_neg, deta, dphi);
622  }
623 
624  constexpr void initialize()
625  {
626  pos.initialize();
627  neg.initialize();
628  }
629 
630  constexpr static size_t finish_initializing_buffer_size()
631  {
633  }
634 
637  {
638  pos.finish_initializing(buffer);
640  }
641 
643  constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int * cell_arr) const
644  {
645  int ret = -1;
646  if (test_eta >= 0)
647  {
648  ret = pos.get_possible_cells_from_coords(test_eta, test_phi, cell_arr);
649  }
650  else
651  {
652  ret = neg.get_possible_cells_from_coords(test_eta, test_phi, cell_arr);
653  }
654  return ret;
655  }
656 
657  constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const
658  {
659  if (test_eta >= 0)
660  {
661  return pos.has_cell_in_coords(test_eta, test_phi);
662  }
663  else
664  {
665  return neg.has_cell_in_coords(test_eta, test_phi);
666  }
667  }
668 
669  };
670 
672  {
673  static constexpr int s_max_overlap_cells = EtaPhiMapEntry<1, 1, true, true>::s_max_overlap_cells;
674 
675  //Samplings have custom, hard-coded sizes to save space.
676  //Could've gone with one-size-fits all maxima,
677  //but it'd likely be unnecessarily wasteful.
706 
707  static_assert(NumSamplings == 28, "Written under the assumption there are 28 samplings.");
708 
710  template <class Func, class ... Args>
711  constexpr void apply_to_all_samplings(Func && F, Args && ... args)
712  {
713  F(sampling_0, std::forward<Args>(args)...);
714  F(sampling_1, std::forward<Args>(args)...);
715  F(sampling_2, std::forward<Args>(args)...);
716  F(sampling_3, std::forward<Args>(args)...);
717  F(sampling_4, std::forward<Args>(args)...);
718  F(sampling_5, std::forward<Args>(args)...);
719  F(sampling_6, std::forward<Args>(args)...);
720  F(sampling_7, std::forward<Args>(args)...);
721  F(sampling_8, std::forward<Args>(args)...);
722  F(sampling_9, std::forward<Args>(args)...);
723  F(sampling_10, std::forward<Args>(args)...);
724  F(sampling_11, std::forward<Args>(args)...);
725  F(sampling_12, std::forward<Args>(args)...);
726  F(sampling_13, std::forward<Args>(args)...);
727  F(sampling_14, std::forward<Args>(args)...);
728  F(sampling_15, std::forward<Args>(args)...);
729  F(sampling_16, std::forward<Args>(args)...);
730  F(sampling_17, std::forward<Args>(args)...);
731  F(sampling_18, std::forward<Args>(args)...);
732  F(sampling_19, std::forward<Args>(args)...);
733  F(sampling_20, std::forward<Args>(args)...);
734  F(sampling_21, std::forward<Args>(args)...);
735  F(sampling_22, std::forward<Args>(args)...);
736  F(sampling_23, std::forward<Args>(args)...);
737  F(sampling_24, std::forward<Args>(args)...);
738  F(sampling_25, std::forward<Args>(args)...);
739  F(sampling_26, std::forward<Args>(args)...);
740  F(sampling_27, std::forward<Args>(args)...);
741  }
742 
744  template <class Func, class ... Args>
745  constexpr void apply_to_all_samplings(Func && F, Args && ... args) const
746  {
747  F(sampling_0, std::forward<Args>(args)...);
748  F(sampling_1, std::forward<Args>(args)...);
749  F(sampling_2, std::forward<Args>(args)...);
750  F(sampling_3, std::forward<Args>(args)...);
751  F(sampling_4, std::forward<Args>(args)...);
752  F(sampling_5, std::forward<Args>(args)...);
753  F(sampling_6, std::forward<Args>(args)...);
754  F(sampling_7, std::forward<Args>(args)...);
755  F(sampling_8, std::forward<Args>(args)...);
756  F(sampling_9, std::forward<Args>(args)...);
757  F(sampling_10, std::forward<Args>(args)...);
758  F(sampling_11, std::forward<Args>(args)...);
759  F(sampling_12, std::forward<Args>(args)...);
760  F(sampling_13, std::forward<Args>(args)...);
761  F(sampling_14, std::forward<Args>(args)...);
762  F(sampling_15, std::forward<Args>(args)...);
763  F(sampling_16, std::forward<Args>(args)...);
764  F(sampling_17, std::forward<Args>(args)...);
765  F(sampling_18, std::forward<Args>(args)...);
766  F(sampling_19, std::forward<Args>(args)...);
767  F(sampling_20, std::forward<Args>(args)...);
768  F(sampling_21, std::forward<Args>(args)...);
769  F(sampling_22, std::forward<Args>(args)...);
770  F(sampling_23, std::forward<Args>(args)...);
771  F(sampling_24, std::forward<Args>(args)...);
772  F(sampling_25, std::forward<Args>(args)...);
773  F(sampling_26, std::forward<Args>(args)...);
774  F(sampling_27, std::forward<Args>(args)...);
775  }
776 
778  template <class Func, class ... Args>
779  constexpr void apply_to_sampling(const int sampling, Func && F, Args && ... args)
780  {
781  switch (sampling)
782  {
783  case 0:
784  F(sampling_0, std::forward<Args>(args)...);
785  break;
786  case 1:
787  F(sampling_1, std::forward<Args>(args)...);
788  break;
789  case 2:
790  F(sampling_2, std::forward<Args>(args)...);
791  break;
792  case 3:
793  F(sampling_3, std::forward<Args>(args)...);
794  break;
795  case 4:
796  F(sampling_4, std::forward<Args>(args)...);
797  break;
798  case 5:
799  F(sampling_5, std::forward<Args>(args)...);
800  break;
801  case 6:
802  F(sampling_6, std::forward<Args>(args)...);
803  break;
804  case 7:
805  F(sampling_7, std::forward<Args>(args)...);
806  break;
807  case 8:
808  F(sampling_8, std::forward<Args>(args)...);
809  break;
810  case 9:
811  F(sampling_9, std::forward<Args>(args)...);
812  break;
813  case 10:
814  F(sampling_10, std::forward<Args>(args)...);
815  break;
816  case 11:
817  F(sampling_11, std::forward<Args>(args)...);
818  break;
819  case 12:
820  F(sampling_12, std::forward<Args>(args)...);
821  break;
822  case 13:
823  F(sampling_13, std::forward<Args>(args)...);
824  break;
825  case 14:
826  F(sampling_14, std::forward<Args>(args)...);
827  break;
828  case 15:
829  F(sampling_15, std::forward<Args>(args)...);
830  break;
831  case 16:
832  F(sampling_16, std::forward<Args>(args)...);
833  break;
834  case 17:
835  F(sampling_17, std::forward<Args>(args)...);
836  break;
837  case 18:
838  F(sampling_18, std::forward<Args>(args)...);
839  break;
840  case 19:
841  F(sampling_19, std::forward<Args>(args)...);
842  break;
843  case 20:
844  F(sampling_20, std::forward<Args>(args)...);
845  break;
846  case 21:
847  F(sampling_21, std::forward<Args>(args)...);
848  break;
849  case 22:
850  F(sampling_22, std::forward<Args>(args)...);
851  break;
852  case 23:
853  F(sampling_23, std::forward<Args>(args)...);
854  break;
855  case 24:
856  F(sampling_24, std::forward<Args>(args)...);
857  break;
858  case 25:
859  F(sampling_25, std::forward<Args>(args)...);
860  break;
861  case 26:
862  F(sampling_26, std::forward<Args>(args)...);
863  break;
864  case 27:
865  F(sampling_27, std::forward<Args>(args)...);
866  break;
867  default:
868  break;
869  }
870  }
871 
873  template <class Func, class ... Args>
874  constexpr void apply_to_sampling(const int sampling, Func && F, Args && ... args) const
875  {
876  switch (sampling)
877  {
878  case 0:
879  F(sampling_0, std::forward<Args>(args)...);
880  break;
881  case 1:
882  F(sampling_1, std::forward<Args>(args)...);
883  break;
884  case 2:
885  F(sampling_2, std::forward<Args>(args)...);
886  break;
887  case 3:
888  F(sampling_3, std::forward<Args>(args)...);
889  break;
890  case 4:
891  F(sampling_4, std::forward<Args>(args)...);
892  break;
893  case 5:
894  F(sampling_5, std::forward<Args>(args)...);
895  break;
896  case 6:
897  F(sampling_6, std::forward<Args>(args)...);
898  break;
899  case 7:
900  F(sampling_7, std::forward<Args>(args)...);
901  break;
902  case 8:
903  F(sampling_8, std::forward<Args>(args)...);
904  break;
905  case 9:
906  F(sampling_9, std::forward<Args>(args)...);
907  break;
908  case 10:
909  F(sampling_10, std::forward<Args>(args)...);
910  break;
911  case 11:
912  F(sampling_11, std::forward<Args>(args)...);
913  break;
914  case 12:
915  F(sampling_12, std::forward<Args>(args)...);
916  break;
917  case 13:
918  F(sampling_13, std::forward<Args>(args)...);
919  break;
920  case 14:
921  F(sampling_14, std::forward<Args>(args)...);
922  break;
923  case 15:
924  F(sampling_15, std::forward<Args>(args)...);
925  break;
926  case 16:
927  F(sampling_16, std::forward<Args>(args)...);
928  break;
929  case 17:
930  F(sampling_17, std::forward<Args>(args)...);
931  break;
932  case 18:
933  F(sampling_18, std::forward<Args>(args)...);
934  break;
935  case 19:
936  F(sampling_19, std::forward<Args>(args)...);
937  break;
938  case 20:
939  F(sampling_20, std::forward<Args>(args)...);
940  break;
941  case 21:
942  F(sampling_21, std::forward<Args>(args)...);
943  break;
944  case 22:
945  F(sampling_22, std::forward<Args>(args)...);
946  break;
947  case 23:
948  F(sampling_23, std::forward<Args>(args)...);
949  break;
950  case 24:
951  F(sampling_24, std::forward<Args>(args)...);
952  break;
953  case 25:
954  F(sampling_25, std::forward<Args>(args)...);
955  break;
956  case 26:
957  F(sampling_26, std::forward<Args>(args)...);
958  break;
959  case 27:
960  F(sampling_27, std::forward<Args>(args)...);
961  break;
962  default:
963  break;
964  }
965  }
966 
967  private:
968 
969  //CUDA and lambdas is still a bit tricky,
970  //hence we'll use explicitly written functors
971  //to implement several things.
972 
974  {
975  template <class Entry>
976  constexpr void operator() (Entry & entry) const
977  {
978  entry.initialize();
979  }
980  };
981 
983  {
984  template <class Entry>
985  constexpr void operator() (Entry & entry,
986  const float min_eta_neg, const float min_phi_neg,
987  const float max_eta_neg, const float max_phi_neg,
988  const float min_eta_pos, const float min_phi_pos,
989  const float max_eta_pos, const float max_phi_pos,
990  const float delta_eta, const float delta_phi ) const
991  {
992  entry.initialize(min_eta_neg, min_phi_neg, max_eta_neg, max_phi_neg,
993  min_eta_pos, min_phi_pos, max_eta_pos, max_phi_pos,
994  delta_eta, delta_phi );
995  }
996  };
997 
999  {
1000  template <class Entry>
1001  constexpr void operator() (Entry & entry, const int cell,
1002  const float cell_eta, const float cell_phi,
1003  const float cell_deta, const float cell_dphi ) const
1004  {
1005  entry.register_cell(cell, cell_eta, cell_phi, cell_deta, cell_dphi);
1006  }
1007  };
1008 
1010  {
1011  template <class Entry>
1012  constexpr void operator() (Entry & entry, size_t & ret) const
1013  {
1014  using namespace std;
1015  ret = max(ret, entry.finish_initializing_buffer_size());
1016  }
1017  };
1018 
1020  {
1021  template <class Entry>
1022  constexpr void operator() (Entry & entry, void * buffer) const
1023  {
1024  entry.finish_initializing(buffer);
1025  }
1026  };
1027  //Aliohjelma-olio?
1028  //(To not go with the obvious funktio-olio...)
1029 
1031  {
1032  template <class Entry>
1033  constexpr void operator() (Entry & entry, int & ret, const float test_eta, const float test_phi, int * cell_arr) const
1034  {
1035  ret = entry.get_possible_cells_from_coords(test_eta, test_phi, cell_arr);
1036  }
1037  };
1038 
1040  {
1041  template <class Entry>
1042  constexpr void operator() (Entry & entry, bool & ret, const float test_eta, const float test_phi) const
1043  {
1044  ret = entry.has_cell_in_coords(test_eta, test_phi);
1045  }
1046  };
1047 
1049  {
1050  template <class Entry>
1051  constexpr void operator() (Entry & entry, int & ret, const float test_eta, const float test_phi, int * cell_arr) const
1052  {
1053  ret += entry.get_possible_cells_from_coords(test_eta, test_phi, cell_arr + ret);
1054  }
1055  };
1056 
1058  {
1059  template <class Entry>
1060  constexpr void operator() (Entry & entry, bool & ret, const float test_eta, const float test_phi) const
1061  {
1062  ret = ( ret || entry.has_cell_in_coords(test_eta, test_phi) );
1063  //Short circuit evaluation?
1064  }
1065  };
1066 
1067  public:
1068 
1070  constexpr void initialize()
1071  {
1072  apply_to_all_samplings(initialize_all_functor{});
1073  }
1074 
1076  constexpr void initialize(const int sampling,
1077  const float min_eta_neg, const float min_phi_neg,
1078  const float max_eta_neg, const float max_phi_neg,
1079  const float min_eta_pos, const float min_phi_pos,
1080  const float max_eta_pos, const float max_phi_pos,
1081  const float delta_eta, const float delta_phi)
1082  {
1083  apply_to_sampling(sampling, initialize_sampling_functor{},
1084  min_eta_neg, min_phi_neg,
1085  max_eta_neg, max_phi_neg,
1086  min_eta_pos, min_phi_pos,
1087  max_eta_pos, max_phi_pos,
1088  delta_eta, delta_phi );
1089  }
1090 
1091  constexpr void register_cell(const int cell, const int sampling, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
1092  {
1093  apply_to_sampling(sampling, register_cell_functor{}, cell, cell_eta, cell_phi, cell_deta, cell_dphi);
1094  }
1095 
1096 
1097  constexpr size_t finish_initializing_buffer_size() const
1098  {
1099  size_t ret = 0;
1100 
1101  apply_to_all_samplings(buffer_size_functor{}, ret);
1102 
1103  return ret;
1104  }
1105 
1108  {
1109  apply_to_all_samplings(finish_functor{}, buffer);
1110  }
1111 
1113  constexpr int get_possible_cells_from_coords(const int sampling, const float test_eta, const float test_phi, int * cell_arr) const
1114  {
1115  int ret = 0;
1116 
1117  apply_to_sampling(sampling, get_cell_from_sampling_functor{}, ret, test_eta, test_phi, cell_arr);
1118 
1119  return ret;
1120  }
1121 
1122  constexpr bool has_cell_in_coords(const int sampling, const float test_eta, const float test_phi) const
1123  {
1124  bool ret = false;
1125 
1126  apply_to_sampling(sampling, check_cell_in_sampling_functor{}, ret, test_eta, test_phi);
1127 
1128  return ret;
1129  }
1130 
1132  constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int * cell_arr) const
1133  {
1134  int ret = 0;
1135 
1136  apply_to_all_samplings(get_cell_from_all_functor{}, ret, test_eta, test_phi, cell_arr);
1137 
1138  return ret;
1139  }
1140 
1141  constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const
1142  {
1143  bool ret = false;
1144 
1145  apply_to_all_samplings(check_cell_in_all_functor{}, ret, test_eta, test_phi);
1146 
1147  return ret;
1148  }
1149 
1150  };
1151 
1152 }
1153 
1154 #endif //CALORECGPU_ETAPHIMAP_H
CaloRecGPU::EtaPhiToCellMap::get_possible_cells_from_coords
constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int *cell_arr) const
We assume cell_arr is large enough.
Definition: EtaPhiMap.h:1132
RunTileCalibRec.cells
cells
Definition: RunTileCalibRec.py:271
CaloRecGPU::EtaPhiToCellMap::sampling_24
EtaPhiMapEntry< 1, 1, false, true > sampling_24
Definition: EtaPhiMap.h:702
CaloRecGPU::EtaPhiToCellMap::sampling_26
EtaPhiMapEntry< 1, 1, false, true > sampling_26
Definition: EtaPhiMap.h:704
CaloRecGPU::EtaPhiToCellMap::sampling_13
EtaPhiMapEntry< 12, 66, true, false > sampling_13
Definition: EtaPhiMap.h:691
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
max
#define max(a, b)
Definition: cfImp.cxx:41
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::initialize
constexpr void initialize(const float min_eta_neg, const float min_phi_neg, const float, const float, const float, const float, const float max_eta_pos, const float max_phi_pos, const float deta, const float dphi)
Definition: EtaPhiMap.h:261
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
CaloRecGPU::EtaPhiToCellMap::sampling_20
EtaPhiMapEntry< 4, 66, true, false > sampling_20
Definition: EtaPhiMap.h:698
CaloRecGPU::EtaPhiMapEntry
Holds an (eta, phi) to cell map for a given sampling.
Definition: EtaPhiMap.h:30
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloRecGPU::EtaPhiToCellMap::has_cell_in_coords
constexpr bool has_cell_in_coords(const int sampling, const float test_eta, const float test_phi) const
Definition: EtaPhiMap.h:1122
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
CaloRecGPU::EtaPhiToCellMap::sampling_14
EtaPhiMapEntry< 5, 66, true, false > sampling_14
Definition: EtaPhiMap.h:692
initialize
void initialize()
Definition: run_EoverP.cxx:894
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >::initialize
constexpr void initialize(const float min_eta_neg, const float min_phi_neg, const float max_eta_neg, const float max_phi_neg, const float min_eta_pos, const float min_phi_pos, const float max_eta_pos, const float max_phi_pos, const float deta, const float dphi)
Definition: EtaPhiMap.h:614
CaloRecGPU::EtaPhiToCellMap::sampling_10
EtaPhiMapEntry< 16, 66, false, false > sampling_10
Definition: EtaPhiMap.h:688
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::add_cell_to_grid
constexpr void add_cell_to_grid(const int cell, const float eta_corner, const float phi_corner, const int eta, const int phi)
Definition: EtaPhiMap.h:94
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >
Definition: EtaPhiMap.h:34
CaloRecGPU::EtaPhiToCellMap::sampling_23
EtaPhiMapEntry< 32, 128, false, false > sampling_23
Definition: EtaPhiMap.h:701
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:144
CaloRecGPU::EtaPhiToCellMap::sampling_12
EtaPhiMapEntry< 12, 66, true, false > sampling_12
Definition: EtaPhiMap.h:690
Args
Definition: test_lwtnn_fastgraph.cxx:12
CaloRecGPU::NumSamplings
constexpr int NumSamplings
Definition: BaseDefinitions.h:44
CaloRecGPU::EtaPhiToCellMap::sampling_27
EtaPhiMapEntry< 1, 1, false, true > sampling_27
Definition: EtaPhiMap.h:705
CaloRecGPU::EtaPhiToCellMap::sampling_2
EtaPhiMapEntry< 121, 260, false, true > sampling_2
Definition: EtaPhiMap.h:680
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::get_possible_cells_from_coords
constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int *cell_arr) const
We assume cell_arr is large enough.
Definition: EtaPhiMap.h:432
CaloRecGPU::EtaPhiToCellMap::buffer_size_functor
Definition: EtaPhiMap.h:1010
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::delta_phi
float delta_phi
Definition: EtaPhiMap.h:48
CaloRecGPU::EtaPhiToCellMap::sampling_8
EtaPhiMapEntry< 20, 66, false, false > sampling_8
Definition: EtaPhiMap.h:686
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::register_cell_center
constexpr void register_cell_center(const int cell, const float cell_eta, const float cell_phi)
Definition: EtaPhiMap.h:198
CaloRecGPU::EtaPhiToCellMap::sampling_18
EtaPhiMapEntry< 6, 66, true, false > sampling_18
Definition: EtaPhiMap.h:696
CaloRecGPU::EtaPhiToCellMap::check_cell_in_all_functor
Definition: EtaPhiMap.h:1058
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_max
float eta_max
Definition: EtaPhiMap.h:45
CaloRecGPU::EtaPhiToCellMap::get_cell_from_sampling_functor
Definition: EtaPhiMap.h:1031
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_coordinate
constexpr int phi_coordinate(const float phi) const
Definition: EtaPhiMap.h:78
CaloRecGPU::EtaPhiToCellMap
Definition: EtaPhiMap.h:672
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >::finish_initializing_buffer_size
constexpr static size_t finish_initializing_buffer_size()
Definition: EtaPhiMap.h:630
CaloRecGPU::EtaPhiToCellMap::sampling_16
EtaPhiMapEntry< 2, 66, true, false > sampling_16
Definition: EtaPhiMap.h:694
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_coordinate
constexpr int eta_coordinate(const float eta) const
Definition: EtaPhiMap.h:62
CUDA_HOS_DEV
#define CUDA_HOS_DEV
Definition: Calorimeter/CaloRecGPU/CaloRecGPU/Helpers.h:100
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::initialize
constexpr void initialize(const float min_eta, const float min_phi, const float max_eta, const float max_phi, const float deta, const float dphi)
Definition: EtaPhiMap.h:217
lumiFormat.i
int i
Definition: lumiFormat.py:92
ret
T ret(T t)
Definition: rootspy.cxx:260
CaloRecGPU::EtaPhiToCellMap::sampling_21
EtaPhiMapEntry< 142, 228, false, false > sampling_21
Definition: EtaPhiMap.h:699
checkxAOD.frac
frac
Definition: Tools/PyUtils/bin/checkxAOD.py:256
CaloRecGPU::EtaPhiToCellMap::sampling_22
EtaPhiMapEntry< 96, 162, false, false > sampling_22
Definition: EtaPhiMap.h:700
CaloRecGPU::EtaPhiToCellMap::has_cell_in_coords
constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const
Definition: EtaPhiMap.h:1141
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_min
float eta_min
Definition: EtaPhiMap.h:43
getLatestRuns.interval
interval
Definition: getLatestRuns.py:24
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >::finish_initializing
CUDA_HOS_DEV void finish_initializing(void *buffer)
!
Definition: EtaPhiMap.h:636
CaloRecGPU::EtaPhiToCellMap::initialize_sampling_functor
Definition: EtaPhiMap.h:983
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::register_cell
constexpr void register_cell(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
Definition: EtaPhiMap.h:242
CaloRecGPU::EtaPhiToCellMap::initialize
constexpr void initialize(const int sampling, const float min_eta_neg, const float min_phi_neg, const float max_eta_neg, const float max_phi_neg, const float min_eta_pos, const float min_phi_pos, const float max_eta_pos, const float max_phi_pos, const float delta_eta, const float delta_phi)
Initialize a specific sampling with known eta and phi ranges.
Definition: EtaPhiMap.h:1076
CaloRecGPU::EtaPhiToCellMap::sampling_0
EtaPhiMapEntry< 125, 65, false, true > sampling_0
Definition: EtaPhiMap.h:678
CaloRecGPU::EtaPhiToCellMap::sampling_9
EtaPhiMapEntry< 18, 66, false, false > sampling_9
Definition: EtaPhiMap.h:687
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::finish_initializing_buffer_size
constexpr static size_t finish_initializing_buffer_size()
Definition: EtaPhiMap.h:270
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >::has_cell_in_coords
constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const
Definition: EtaPhiMap.h:657
CaloRecGPU::EtaPhiToCellMap::sampling_3
EtaPhiMapEntry< 56, 260, false, true > sampling_3
Definition: EtaPhiMap.h:681
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::register_cell_with_deltas
constexpr void register_cell_with_deltas(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
Definition: EtaPhiMap.h:114
module_driven_slicing.max_eta
max_eta
Definition: module_driven_slicing.py:166
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_coordinate
constexpr int eta_coordinate(const float eta, float &interval) const
Version that returns the floating point remainder too via the second argument.
Definition: EtaPhiMap.h:69
CaloRecGPU::EtaPhiToCellMap::apply_to_all_samplings
constexpr void apply_to_all_samplings(Func &&F, Args &&... args)
F must be prepared to receive as first argument a EtaPhiMapEntry<N, M>, as well as any arguments.
Definition: EtaPhiMap.h:711
CaloRecGPU::EtaPhiToCellMap::sampling_5
EtaPhiMapEntry< 362, 68, false, false > sampling_5
Definition: EtaPhiMap.h:683
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_min
float phi_min
Definition: EtaPhiMap.h:44
CaloRecGPU::EtaPhiToCellMap::sampling_25
EtaPhiMapEntry< 1, 1, false, true > sampling_25
Definition: EtaPhiMap.h:703
CaloRecGPU::EtaPhiToCellMap::finish_initializing
CUDA_HOS_DEV void finish_initializing(void *buffer)
!
Definition: EtaPhiMap.h:1107
CaloRecGPU::EtaPhiToCellMap::register_cell_functor
Definition: EtaPhiMap.h:999
CaloRecGPU::EtaPhiToCellMap::apply_to_sampling
constexpr void apply_to_sampling(const int sampling, Func &&F, Args &&... args) const
F must be prepared to receive as first argument a EtaPhiMapEntry<N, M>, as well as any arguments.
Definition: EtaPhiMap.h:874
CaloRecGPU::EtaPhiToCellMap::sampling_1
EtaPhiMapEntry< 955, 260, false, true > sampling_1
Definition: EtaPhiMap.h:679
CaloRecGPU::EtaPhiToCellMap::apply_to_sampling
constexpr void apply_to_sampling(const int sampling, Func &&F, Args &&... args)
F must be prepared to receive as first argument a EtaPhiMapEntry<N, M>, as well as any arguments.
Definition: EtaPhiMap.h:779
CaloRecGPU::EtaPhiToCellMap::finish_initializing_buffer_size
constexpr size_t finish_initializing_buffer_size() const
Definition: EtaPhiMap.h:1097
CaloRecGPU::EtaPhiToCellMap::finish_functor
Definition: EtaPhiMap.h:1020
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CaloRecGPU::EtaPhiToCellMap::sampling_11
EtaPhiMapEntry< 18, 66, false, false > sampling_11
Definition: EtaPhiMap.h:689
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_coordinate
constexpr int phi_coordinate(const float phi, float &interval) const
Version that returns the floating point remainder too via the second argument.
Definition: EtaPhiMap.h:85
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >::pos
EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true > pos
Definition: EtaPhiMap.h:598
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::has_cell_in_coords
constexpr bool has_cell_in_coords(const float test_eta, const float test_phi) const
Definition: EtaPhiMap.h:529
CaloRecGPU::EtaPhiToCellMap::register_cell
constexpr void register_cell(const int cell, const int sampling, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
Definition: EtaPhiMap.h:1091
CaloRecGPU::EtaPhiToCellMap::check_cell_in_sampling_functor
Definition: EtaPhiMap.h:1040
CaloRecGPU::EtaPhiToCellMap::sampling_19
EtaPhiMapEntry< 6, 66, true, false > sampling_19
Definition: EtaPhiMap.h:697
CaloRecGPU::EtaPhiToCellMap::sampling_7
EtaPhiMapEntry< 36, 260, false, false > sampling_7
Definition: EtaPhiMap.h:685
eFEXNTuple.delta_phi
def delta_phi(phi1, phi2)
Definition: eFEXNTuple.py:15
CaloRecGPU::EtaPhiToCellMap::initialize
constexpr void initialize()
Initialize all cells of all samplings.
Definition: EtaPhiMap.h:1070
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >::initialize
constexpr void initialize()
Definition: EtaPhiMap.h:624
F
#define F(x, y, z)
Definition: MD5.cxx:112
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::initialize
constexpr void initialize()
Definition: EtaPhiMap.h:256
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >::register_cell
constexpr void register_cell(const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
Definition: EtaPhiMap.h:602
CaloRecGPU::EtaPhiToCellMap::apply_to_all_samplings
constexpr void apply_to_all_samplings(Func &&F, Args &&... args) const
F must be prepared to receive as first argument a EtaPhiMapEntry<N, M>, as well as any arguments.
Definition: EtaPhiMap.h:745
module_driven_slicing.min_eta
min_eta
Definition: module_driven_slicing.py:166
CaloRecGPU::EtaPhiToCellMap::sampling_4
EtaPhiMapEntry< 14, 68, false, false > sampling_4
Definition: EtaPhiMap.h:682
COOLRates.target
target
Definition: COOLRates.py:1106
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_max
float phi_max
Definition: EtaPhiMap.h:46
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >::get_possible_cells_from_coords
constexpr int get_possible_cells_from_coords(const float test_eta, const float test_phi, int *cell_arr) const
We assume cell_arr is large enough.
Definition: EtaPhiMap.h:643
CaloRecGPU
Definition: BaseDefinitions.h:11
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::finish_initializing
CUDA_HOS_DEV void finish_initializing(void *buffer)
!
Definition: EtaPhiMap.h:276
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::delta_eta
float delta_eta
Definition: EtaPhiMap.h:47
CaloRecGPU::EtaPhiToCellMap::initialize_all_functor
Definition: EtaPhiMap.h:974
CaloRecGPU::EtaPhiToCellMap::sampling_6
EtaPhiMapEntry< 74, 260, false, false > sampling_6
Definition: EtaPhiMap.h:684
Helpers.h
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
CaloRecGPU::EtaPhiToCellMap::get_possible_cells_from_coords
constexpr int get_possible_cells_from_coords(const int sampling, const float test_eta, const float test_phi, int *cell_arr) const
We assume cell_arr is large enough.
Definition: EtaPhiMap.h:1113
BaseDefinitions.h
fitman.k
k
Definition: fitman.py:528
CaloRecGPU::EtaPhiToCellMap::sampling_15
EtaPhiMapEntry< 2, 66, true, false > sampling_15
Definition: EtaPhiMap.h:693
CaloRecGPU::EtaPhiToCellMap::get_cell_from_all_functor
Definition: EtaPhiMap.h:1049
CaloRecGPU::EtaPhiToCellMap::sampling_17
EtaPhiMapEntry< 8, 66, true, false > sampling_17
Definition: EtaPhiMap.h:695