ATLAS Offline Software
Loading...
Searching...
No Matches
idx.h
Go to the documentation of this file.
1/*
2Copyright (C) 2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGT2BEAMSPOT_IDX_H
6#define TRIGT2BEAMSPOT_IDX_H
7
8#include <cstdint> //for int8_t
9namespace PESA{
10
11// Ordering of the monomials in Bx, By, tx, ty powers,
12// array indices correspond to power of those variables
13constexpr std::int8_t g_order[3][3][3][3] = {
14
15{
16 {{ 0, 1, 2 }, // Bx**0, By**0, tx**0, ty**0..ty**2
17 { 3, 4, -1 }, // Bx**0, By**0, tx**1, ty**0..ty**2
18 { 5, -1, -1 }}, // Bx**0, By**0, tx**2, ty**0..ty**2
19
20 {{ 6, 7, -1 }, // Bx**0, By**1, tx**0, ty**0..ty**2
21 { 8, -1, -1 }, // Bx**0, By**1, tx**1, ty**0..ty**2
22 { -1, -1, -1 }}, // Bx**0, By**1, tx**2, ty**0..ty**2
23
24 {{ 9, -1, -1 }, // Bx**0, By**2, tx**0, ty**0..ty**2
25 { -1, -1, -1 }, // Bx**0, By**2, tx**1, ty**0..ty**2
26 { -1, -1, -1 }}, // Bx**0, By**2, tx**2, ty**0..ty**2
27},
28
29{
30 {{ 10, 11, -1 }, // Bx**1, By**0, tx**0, ty**0..ty**2
31 { 12, -1, -1 }, // Bx**1, By**0, tx**1, ty**0..ty**2
32 { -1, -1, -1 }}, // Bx**1, By**0, tx**2, ty**0..ty**2
33
34 {{ 13, -1, -1 }, // Bx**1, By**1, tx**0, ty**0..ty**2
35 { -1, -1, -1 }, // Bx**1, By**1, tx**1, ty**0..ty**2
36 { -1, -1, -1 }}, // Bx**1, By**1, tx**2, ty**0..ty**2
37
38 {{ -1, -1, -1 }, // Bx**1, By**2, tx**0, ty**0..ty**2
39 { -1, -1, -1 }, // Bx**1, By**2, tx**1, ty**0..ty**2
40 { -1, -1, -1 }}, // Bx**1, By**2, tx**2, ty**0..ty**2
41},
42
43{
44 {{ 14, -1, -1 }, // Bx**2, By**0, tx**0, ty**0..ty**2
45 { -1, -1, -1 }, // Bx**2, By**0, tx**1, ty**0..ty**2
46 { -1, -1, -1 }}, // Bx**2, By**0, tx**2, ty**0..ty**2
47
48 {{ -1, -1, -1 }, // Bx**2, By**1, tx**0, ty**0..ty**2
49 { -1, -1, -1 }, // Bx**2, By**1, tx**1, ty**0..ty**2
50 { -1, -1, -1 }}, // Bx**2, By**1, tx**2, ty**0..ty**2
51
52 {{ -1, -1, -1 }, // Bx**2, By**2, tx**0, ty**0..ty**2
53 { -1, -1, -1 }, // Bx**2, By**2, tx**1, ty**0..ty**2
54 { -1, -1, -1 }}, // Bx**2, By**2, tx**2, ty**0..ty**2
55}
56};
57
58// number of possible combinations of all powers,
59// 15 is for squares, 1 for log
60constexpr unsigned g_size = 15 + 1;
61
62// Ordering of the monomials in omegax, omegay powers,
63// array indices correspond to power of those variables
64constexpr std::int8_t g_order2[3][3] = {
65 { 0, 1, 2 }, // Bx**0, By**0, tx**0, ty**0..ty**2
66 { 3, 4, -1 }, // Bx**0, By**0, tx**1, ty**0..ty**2
67 { 5, -1, -1 }, // Bx**0, By**0, tx**2, ty**0..ty**2
68};
69
70// number of possible combinations of omega powers
71constexpr unsigned g_size2 = 6;
72
73constexpr unsigned nbins =
74 // two extra bins to count number of tracks and beam_size*n_tracks
75 g_size*g_size2 // all polynomial coefficients
76 + 1 // Sum(z0)
77 + 1 // Sum(z0**2)
78 + 1 // Sum(1)
79 + 1 // Sum(beam_size)
80 ;
81
82
83
84template<unsigned Bx, unsigned By, unsigned tx, unsigned ty, unsigned ox, unsigned oy>
85consteval int idx()
86{
87 constexpr int i1 = g_order[Bx][By][tx][ty];
88 constexpr int i2 = g_order2[ox][oy];
89 static_assert(i1 >= 0 && i2 >= 0, "idx(): invalid power combination");
90 return i1 * g_size2 + i2;
91}
92
93
94} // namespace
95
96
97#endif
Local tools.
Definition idx.h:9
constexpr std::int8_t g_order2[3][3]
Definition idx.h:64
constexpr std::int8_t g_order[3][3][3][3]
Definition idx.h:13
constexpr unsigned g_size
Definition idx.h:60
constexpr unsigned nbins
Definition idx.h:73
consteval int idx()
Definition idx.h:85
constexpr unsigned g_size2
Definition idx.h:71