4 #ifndef TRIGT1NSWSIMEXTRAS_H
5 #define TRIGT1NSWSIMEXTRAS_H
10 #include <unordered_map>
44 const std::vector<std::string>
WHEELS{
"A",
"C"};
54 ss << std::setfill(
'0') << std::setw(2) << (sec + 1);
61 constexpr
size_t nbitsPhi{5};
62 constexpr
size_t mask{(1 << nbitsPhi) - 1};
69 const std::string
LARGE{
"large"};
70 const std::string
SMALL{
"small"};
73 constexpr std::array<uint32_t, NLAYERS>
LAYERS{0, 1, 2, 3, 4, 5, 6, 7};
76 constexpr std::array<uint32_t, NSECTORS>
SECTORS{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
79 const std::string
PATTERN_TAG{
"pad_trigger_pattern_array :="};
90 if(wheel ==
'C')
prefix += (1<<16);
96 const auto layer = (multiplet-1)*4 + (gas_gap-1);
101 inline std::pair<int,int>
getNrowsNcols(
const int pfeb,
const bool isLarge) {
103 if(pfeb == 0)
return std::make_pair(17, 6);
104 if(pfeb == 1)
return std::make_pair(17, 6);
105 if(pfeb == 2)
return std::make_pair(16, 7);
106 if(pfeb == 3)
return std::make_pair(16, 7);
107 if(pfeb == 4)
return std::make_pair(16, 6);
108 if(pfeb == 5)
return std::make_pair(16, 6);
109 if(pfeb == 6)
return std::make_pair(16, 6);
110 if(pfeb == 7)
return std::make_pair(16, 6);
111 if(pfeb == 8)
return std::make_pair(14, 4);
112 if(pfeb == 9)
return std::make_pair(14, 4);
113 if(pfeb == 10)
return std::make_pair(15, 5);
114 if(pfeb == 11)
return std::make_pair(15, 5);
115 if(pfeb == 12)
return std::make_pair(14, 4);
116 if(pfeb == 13)
return std::make_pair(14, 4);
117 if(pfeb == 14)
return std::make_pair(14, 4);
118 if(pfeb == 15)
return std::make_pair(14, 4);
119 if(pfeb == 16)
return std::make_pair(15, 4);
120 if(pfeb == 17)
return std::make_pair(15, 4);
121 if(pfeb == 18)
return std::make_pair(14, 5);
122 if(pfeb == 19)
return std::make_pair(14, 5);
123 if(pfeb == 20)
return std::make_pair(13, 4);
124 if(pfeb == 21)
return std::make_pair(13, 4);
125 if(pfeb == 22)
return std::make_pair(14, 4);
126 if(pfeb == 23)
return std::make_pair(14, 4);
129 if(pfeb == 0)
return std::make_pair(17, 4);
130 if(pfeb == 1)
return std::make_pair(17, 4);
131 if(pfeb == 2)
return std::make_pair(18, 4);
132 if(pfeb == 3)
return std::make_pair(18, 4);
133 if(pfeb == 4)
return std::make_pair(17, 4);
134 if(pfeb == 5)
return std::make_pair(17, 4);
135 if(pfeb == 6)
return std::make_pair(17, 3);
136 if(pfeb == 7)
return std::make_pair(17, 3);
137 if(pfeb == 8)
return std::make_pair(16, 3);
138 if(pfeb == 9)
return std::make_pair(16, 3);
139 if(pfeb == 10)
return std::make_pair(15, 3);
140 if(pfeb == 11)
return std::make_pair(15, 3);
141 if(pfeb == 12)
return std::make_pair(15, 2);
142 if(pfeb == 13)
return std::make_pair(15, 2);
143 if(pfeb == 14)
return std::make_pair(15, 3);
144 if(pfeb == 15)
return std::make_pair(15, 3);
145 if(pfeb == 16)
return std::make_pair(13, 3);
146 if(pfeb == 17)
return std::make_pair(13, 3);
147 if(pfeb == 18)
return std::make_pair(14, 3);
148 if(pfeb == 19)
return std::make_pair(14, 3);
149 if(pfeb == 20)
return std::make_pair(12, 2);
150 if(pfeb == 21)
return std::make_pair(12, 2);
151 if(pfeb == 22)
return std::make_pair(13, 3);
152 if(pfeb == 23)
return std::make_pair(13, 3);
154 return std::make_pair(0,0);
158 const int arow = (athenaCh-1)%18;
159 const int acol =
int((athenaCh-1)/18);
160 return std::make_pair(arow, acol);
164 bool isLarge = (sector % 2 == 0);
168 const int ABrow = Nrows -1 -arow;
169 const int ABcol = ((
gasGap-1)%2 ==0) ? (Ncols-1)-acol : acol;
170 return ABrow*Ncols + ABcol;
177 constexpr std::array<uint32_t,8>
DUMMYPADS{104,105,110,111,112,113,114,115};
223 static const std::unordered_map<uint32_t,uint32_t> bandids = {
224 {94,84}, {93,84}, {92,84}, {91,84}, {90,82},
225 {89,80}, {88,80}, {87,77}, {86,76}, {85,76}, {84,74}, {83,74}, {82,72}, {81,72}, {80,70},
226 {79,70}, {78,70}, {77,67}, {76,66}, {75,66}, {74,66}, {73,62}, {72,62}, {71,62}, {70,62},
227 {69,62}, {68,62}, {67,62}, {66,62}, {65,54}, {64,54}, {63,54}, {62,54}, {61,51}, {60,51},
228 {59,51}, {58,51}, {57,51}, {56,46}, {55,45}, {54,44}, {53,44}, {52,43}, {51,41}, {50,41},
229 {49,41}, {48,41}, {47,41}, {46,36}, {45,35}, {44,35}, {43,33}, {42,32}, {41,32}, {40,32},
230 {39,32}, {38,32}, {37,32}, {36,32}, {35,24}, {34,24}, {33,24}, {32,22}, {31,22}, {30,22},
231 {29,22}, {28,22}, {27,22}, {26,22}, {25,22}, {24,14}, {23,14}, {22,12}, {21,12}, {20,12},
232 {19,12}, {18,12}, {17,12}, {16,12}, {15,12}, {14, 6}, {13, 6}, {12, 6}, {11, 6}, {10, 6},
233 { 9, 6}, { 8, 6}, { 7, 6}, { 6, 6}};
234 auto it = bandids.find(bandid);
235 if(
it == bandids.end())
return bandid;
236 else return it->second;
239 static const std::unordered_map<uint32_t,uint32_t> bandids = {
240 {94,85}, {93,85}, {92,85}, {91,80}, {90,80},
241 {89,80}, {88,80}, {87,80}, {86,76}, {85,74}, {84,74}, {83,74}, {82,74}, {81,69}, {80,69},
242 {79,69}, {78,69}, {77,69}, {76,64}, {75,64}, {74,64}, {73,64}, {72,64}, {71,64}, {70,64},
243 {69,64}, {68,57}, {67,57}, {66,57}, {65,57}, {64,53}, {63,53}, {62,53}, {61,53}, {60,53},
244 {59,53}, {58,47}, {57,46}, {56,46}, {55,44}, {54,44}, {53,43}, {52,43}, {51,43}, {50,43},
245 {49,43}, {48,37}, {47,37}, {46,37}, {45,37}, {44,33}, {43,33}, {42,33}, {41,33}, {40,33},
246 {39,33}, {38,33}, {37,33}, {36,25}, {35,25}, {34,25}, {33,22}, {32,22}, {31,22}, {30,22},
247 {29,22}, {28,22}, {27,22}, {26,22}, {25,14}, {24,14}, {23,12}, {22,12}, {21,12}, {20,12},
248 {19,12}, {18,12}, {17,12}, {16,12}, {15,12}, {14, 6}, {13, 6}, {12, 5}, {11, 5}, {10, 5},
249 { 9, 5}, { 8, 5}, { 7, 5}, { 6, 2}, { 5, 2}, { 4, 2}, { 3, 2}, { 2, 2}};
250 auto it = bandids.find(bandid);
251 if(
it == bandids.end())
return bandid;
252 else return it->second;
260 inline bool contains(
const std::string&
str,
const std::string& substr) {
261 return str.find(substr) != std::string::npos;
263 inline bool contains(
const std::vector<std::string>& cont,
const std::string&
val) {
270 return cont.contains(
val);
275 if (subject.empty() or
search.empty())
return subject;
278 while((
pos = subject.find(
search,
pos)) != std::string::npos) {
293 const auto word =
split.at(1);
295 return static_cast<uint32_t>(std::stoul(word_split.at(1)));