ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Friends | List of all members
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true > Struct Template Reference

#include <EtaPhiMap.h>

Collaboration diagram for CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >:

Public Member Functions

constexpr void register_cell (const int cell, const float cell_eta, const float cell_phi, const float cell_deta, const float cell_dphi)
 
constexpr void 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)
 
CUDA_HOS_DEV void finish_initializing (void *buffer)
 ! More...
 
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. More...
 
constexpr bool has_cell_in_coords (const float test_eta, const float test_phi) const
 

Static Public Member Functions

constexpr static size_t finish_initializing_buffer_size ()
 

Public Attributes

float eta_min
 
float phi_min
 
float eta_max
 
float phi_max
 
float delta_eta
 
float delta_phi
 
int cells [eta_grid][phi_grid][s_max_overlap_cells]
 
float corner_eta [eta_grid][phi_grid][s_max_overlap_cells]
 
float corner_phi [eta_grid][phi_grid][s_max_overlap_cells]
 

Static Public Attributes

static constexpr int s_max_overlap_cells = 10
 

Private Member Functions

constexpr int eta_coordinate (const float eta) const
 
constexpr int eta_coordinate (const float eta, float &interval) const
 Version that returns the floating point remainder too via the second argument. More...
 
constexpr int phi_coordinate (const float phi) const
 
constexpr int phi_coordinate (const float phi, float &interval) const
 Version that returns the floating point remainder too via the second argument. More...
 
constexpr void add_cell_to_grid (const int cell, const float eta_corner, const float phi_corner, const int eta, const int phi)
 
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)
 
constexpr void register_cell_center (const int cell, const float cell_eta, const float cell_phi)
 
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)
 

Friends

struct EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >
 

Detailed Description

template<int eta_grid, int phi_grid, bool respect_deltas>
struct CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >

Definition at line 33 of file EtaPhiMap.h.

Member Function Documentation

◆ add_cell_to_grid()

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr void CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::add_cell_to_grid ( const int  cell,
const float  eta_corner,
const float  phi_corner,
const int  eta,
const int  phi 
)
inlineconstexprprivate

Definition at line 94 of file EtaPhiMap.h.

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  }

◆ eta_coordinate() [1/2]

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr int CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_coordinate ( const float  eta) const
inlineconstexprprivate

Definition at line 62 of file EtaPhiMap.h.

63  {
64  using namespace std;
65  return floorf((eta - eta_min) / delta_eta);
66  }

◆ eta_coordinate() [2/2]

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr int CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_coordinate ( const float  eta,
float &  interval 
) const
inlineconstexprprivate

Version that returns the floating point remainder too via the second argument.

Definition at line 69 of file EtaPhiMap.h.

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  }

◆ finish_initializing()

template<int eta_grid, int phi_grid, bool respect_deltas>
CUDA_HOS_DEV void CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::finish_initializing ( void *  buffer)
inline

!

buffer is casted to a sufficiently large array (minimum size given by finish_initializing_buffer_size).

Definition at line 276 of file EtaPhiMap.h.

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  }

◆ finish_initializing_buffer_size()

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr static size_t CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::finish_initializing_buffer_size ( )
inlinestaticconstexpr

Definition at line 270 of file EtaPhiMap.h.

271  {
272  return eta_grid * phi_grid * s_max_overlap_cells * sizeof(int);
273  }

◆ get_possible_cells_from_coords()

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr int CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::get_possible_cells_from_coords ( const float  test_eta,
const float  test_phi,
int *  cell_arr 
) const
inlineconstexpr

We assume cell_arr is large enough.

Definition at line 432 of file EtaPhiMap.h.

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  }

◆ has_cell_in_coords()

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr bool CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::has_cell_in_coords ( const float  test_eta,
const float  test_phi 
) const
inlineconstexpr

Definition at line 529 of file EtaPhiMap.h.

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  }

◆ initialize() [1/3]

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr void CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::initialize ( )
inlineconstexpr

Definition at line 256 of file EtaPhiMap.h.

257  {
258  initialize(0, 0, 0, 0, 0, 0);
259  }

◆ initialize() [2/3]

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr void CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::initialize ( const float  min_eta,
const float  min_phi,
const float  max_eta,
const float  max_phi,
const float  deta,
const float  dphi 
)
inlineconstexprprivate

Definition at line 217 of file EtaPhiMap.h.

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  }

◆ initialize() [3/3]

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr void CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::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 
)
inlineconstexpr

Definition at line 261 of file EtaPhiMap.h.

266  {
267  initialize(min_eta_neg, min_phi_neg, max_eta_pos, max_phi_pos, deta, dphi);
268  }

◆ phi_coordinate() [1/2]

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr int CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_coordinate ( const float  phi) const
inlineconstexprprivate

Definition at line 78 of file EtaPhiMap.h.

79  {
80  using namespace std;
81  return floorf((phi - phi_min) / delta_phi);
82  }

◆ phi_coordinate() [2/2]

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr int CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_coordinate ( const float  phi,
float &  interval 
) const
inlineconstexprprivate

Version that returns the floating point remainder too via the second argument.

Definition at line 85 of file EtaPhiMap.h.

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  }

◆ register_cell()

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr void CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::register_cell ( const int  cell,
const float  cell_eta,
const float  cell_phi,
const float  cell_deta,
const float  cell_dphi 
)
inlineconstexpr

Definition at line 242 of file EtaPhiMap.h.

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  }

◆ register_cell_center()

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr void CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::register_cell_center ( const int  cell,
const float  cell_eta,
const float  cell_phi 
)
inlineconstexprprivate

Definition at line 198 of file EtaPhiMap.h.

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  }

◆ register_cell_with_deltas()

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr void CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::register_cell_with_deltas ( const int  cell,
const float  cell_eta,
const float  cell_phi,
const float  cell_deta,
const float  cell_dphi 
)
inlineconstexprprivate

Definition at line 114 of file EtaPhiMap.h.

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  }

Friends And Related Function Documentation

◆ EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >

template<int eta_grid, int phi_grid, bool respect_deltas>
friend struct EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, false >
friend

Definition at line 1 of file EtaPhiMap.h.

Member Data Documentation

◆ cells

template<int eta_grid, int phi_grid, bool respect_deltas>
int CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::cells[eta_grid][phi_grid][s_max_overlap_cells]

Definition at line 49 of file EtaPhiMap.h.

◆ corner_eta

template<int eta_grid, int phi_grid, bool respect_deltas>
float CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::corner_eta[eta_grid][phi_grid][s_max_overlap_cells]

Definition at line 50 of file EtaPhiMap.h.

◆ corner_phi

template<int eta_grid, int phi_grid, bool respect_deltas>
float CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::corner_phi[eta_grid][phi_grid][s_max_overlap_cells]

Definition at line 51 of file EtaPhiMap.h.

◆ delta_eta

template<int eta_grid, int phi_grid, bool respect_deltas>
float CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::delta_eta

Definition at line 47 of file EtaPhiMap.h.

◆ delta_phi

template<int eta_grid, int phi_grid, bool respect_deltas>
float CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::delta_phi

Definition at line 48 of file EtaPhiMap.h.

◆ eta_max

template<int eta_grid, int phi_grid, bool respect_deltas>
float CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_max

Definition at line 45 of file EtaPhiMap.h.

◆ eta_min

template<int eta_grid, int phi_grid, bool respect_deltas>
float CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_min

Definition at line 43 of file EtaPhiMap.h.

◆ phi_max

template<int eta_grid, int phi_grid, bool respect_deltas>
float CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_max

Definition at line 46 of file EtaPhiMap.h.

◆ phi_min

template<int eta_grid, int phi_grid, bool respect_deltas>
float CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_min

Definition at line 44 of file EtaPhiMap.h.

◆ s_max_overlap_cells

template<int eta_grid, int phi_grid, bool respect_deltas>
constexpr int CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::s_max_overlap_cells = 10
staticconstexpr

Definition at line 37 of file EtaPhiMap.h.


The documentation for this struct was generated from the following file:
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::corner_eta
float corner_eta[eta_grid][phi_grid][s_max_overlap_cells]
Definition: EtaPhiMap.h:50
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::cells
int cells[eta_grid][phi_grid][s_max_overlap_cells]
Definition: EtaPhiMap.h:49
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::s_max_overlap_cells
static constexpr int s_max_overlap_cells
Definition: EtaPhiMap.h:37
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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 >::corner_phi
float corner_phi[eta_grid][phi_grid][s_max_overlap_cells]
Definition: EtaPhiMap.h:51
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:144
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::delta_phi
float delta_phi
Definition: EtaPhiMap.h:48
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::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::eta_max
float eta_max
Definition: EtaPhiMap.h:45
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::phi_coordinate
constexpr int phi_coordinate(const float phi) const
Definition: EtaPhiMap.h:78
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
lumiFormat.i
int i
Definition: lumiFormat.py:92
ret
T ret(T t)
Definition: rootspy.cxx:260
checkxAOD.frac
frac
Definition: Tools/PyUtils/bin/checkxAOD.py:256
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, 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, 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 >::phi_min
float phi_min
Definition: EtaPhiMap.h:44
CaloRecGPU::EtaPhiMapEntry< eta_grid, phi_grid, respect_deltas, true >::initialize
constexpr void initialize()
Definition: EtaPhiMap.h:256
module_driven_slicing.min_eta
min_eta
Definition: module_driven_slicing.py:166
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
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
fitman.k
k
Definition: fitman.py:528