79 {
80
82 if(!this_eTowerContainer.isValid()){
84 return StatusCode::FAILURE;
85 }
86
87
88 std::map<int, std::vector<std::unique_ptr<eFEXegTOB>> > allEmTobObjects;
89 std::map<int, std::vector<std::unique_ptr<eFEXtauTOB>> > allTauHeuristicTobObjects;
90 std::map<int, std::vector<std::unique_ptr<eFEXtauTOB>> > allTauBDTTobObjects;
91
92
94 int tmp_eTowersIDs_subset_eFEX[10][18];
95 for (int i_efex{ 0 }; i_efex < 24; i_efex++) {
99
100 allEmTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXegTOB>> >::value_type(i_efex,
m_eFEXSimTool->getEmTOBs() ));
101 allTauHeuristicTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::value_type(i_efex,
m_eFEXSimTool->getTauHeuristicTOBs() ));
102 allTauBDTTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::value_type(i_efex,
m_eFEXSimTool->getTauBDTTOBs() ));
104 }
105 } else {
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128 int fexcounter = 0;
129
130
131 int emecEta = 24; int emecPhi = 1; int emecMod = 500000;
132 int initialEMEC =
calcTowerID(emecEta,emecPhi,emecMod);
133 int transEta = 14; int transPhi = 1; int transMod = 300000;
134 int initialTRANS =
calcTowerID(transEta,transPhi,transMod);
135 int embEta = 13; int embPhi = 1; int embMod = 100000;
136 int initialEMB =
calcTowerID(embEta,embPhi,embMod);
137 int eFEXa = 0;
138
139 for (int thisEFEX=eFEXa; thisEFEX<=21; thisEFEX+=3){
140
141 if(fexcounter > 0){ initialEMEC += 8; initialTRANS += 8; initialEMB += 8; }
142
143
144 std::map<int,eTower> tmp_eTowersColl_subset;
145
146
147 int tmp_eTowersIDs_subset [10][18];
148
149 int rows =
sizeof tmp_eTowersIDs_subset /
sizeof tmp_eTowersIDs_subset[0];
150 int cols =
sizeof tmp_eTowersIDs_subset[0] /
sizeof tmp_eTowersIDs_subset[0][0];
151
152
153 for(int thisCol=0; thisCol<10; thisCol++){
154 for(
int thisRow=0; thisRow<
rows; thisRow++){
155
156 int towerid = initialEMEC - (thisCol * 64) + thisRow;
157
158 if( (thisEFEX == 21) && (thisRow >= 7)){ towerid -= 64; };
159
160 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
161 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->findTower(towerid))));
162
163 }
164 }
165
166
167 for(
int thisRow = 0; thisRow <
rows; thisRow++){
168
169 int towerid = initialTRANS + thisRow;
170
171 if( (thisEFEX == 21) && (thisRow >= 7)){ towerid -= 64; };
172
173 tmp_eTowersIDs_subset[thisRow][10] = towerid;
174 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->findTower(towerid))));
175
176 }
177
178
179 for(
int thisCol = 11; thisCol <
cols; thisCol++){
180 for(
int thisRow=0; thisRow<
rows; thisRow++){
181
182 int towerid = initialEMB - ( (thisCol-11) * 64) + thisRow;
183
184 if( (thisEFEX == 21) && (thisRow >= 7)){ towerid -= 64; };
185
186 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
187 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->findTower(towerid))));
188
189 }
190 }
191
192
193 if(false){
195 for (int thisRow=rows-1; thisRow>=0; thisRow--){
196 for (
int thisCol=0; thisCol<
cols; thisCol++){
197 int tmptowerid = tmp_eTowersIDs_subset[thisRow][thisCol];
198 const float tmptowereta = this_eTowerContainer->findTower(tmptowerid)->eta();
199 const float tmptowerphi = this_eTowerContainer->findTower(tmptowerid)->phi();
200 if(thisCol != cols-1){
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowerphi <<
"][" << tmptowereta <<
"]) "); }
201 else {
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) |"); }
202 }
203 }
204 }
205
206
209 allEmTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXegTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getEmTOBs() ) ));
210 allTauHeuristicTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getTauHeuristicTOBs() ) ));
211 allTauBDTTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getTauBDTTOBs() ) ));
213
214 fexcounter++;
215 }
216
217
218
219 fexcounter = 0;
220 int embnegEta = 8; int embnegPhi = 1; int embnegMod = 100000;
221 int initialEMB_neg =
calcTowerID(embnegEta,embnegPhi,embnegMod);
222 int embposEta = 0; int embposPhi = 1; int embposMod = 200000;
223 int initialEMB_pos =
calcTowerID(embposEta,embposPhi,embposMod);
224 int eFEXb = 1;
225
226 for (int thisEFEX=eFEXb; thisEFEX<=22; thisEFEX+=3){
227
228 if(fexcounter > 0){ initialEMB_neg += 8; initialEMB_pos += 8; }
229
230
231 std::map<int,eTower> tmp_eTowersColl_subset;
232
233
234 int tmp_eTowersIDs_subset [10][18];
235
236 int rows =
sizeof tmp_eTowersIDs_subset /
sizeof tmp_eTowersIDs_subset[0];
237 int cols =
sizeof tmp_eTowersIDs_subset[0] /
sizeof tmp_eTowersIDs_subset[0][0];
238
239
240 for(
int thisCol = 0; thisCol <
cols; thisCol++){
241 for(
int thisRow=0; thisRow<
rows; thisRow++){
242 int towerid = -1;
243
244 int tmp_initEMB = initialEMB_neg;
245
246 if(thisCol < 9){
247 towerid = tmp_initEMB - ( (thisCol) * 64) + thisRow;
248 }
249 else{
250 tmp_initEMB = initialEMB_pos;
251 towerid = tmp_initEMB + ( (thisCol-9) * 64) + thisRow;
252 }
253
254 if( (thisEFEX == 22) && (thisRow >= 7)){ towerid -= 64; };
255
256 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
257
258 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->findTower(towerid))));
259 }
260 }
261
262
263 if(false){
265 for (int thisRow=rows-1; thisRow>=0; thisRow--){
266 for (
int thisCol=0; thisCol<
cols; thisCol++){
267 int tmptowerid = tmp_eTowersIDs_subset[thisRow][thisCol];
268 const float tmptowereta = this_eTowerContainer->findTower(tmptowerid)->eta();
269 const float tmptowerphi = this_eTowerContainer->findTower(tmptowerid)->phi();
270 if(thisCol != cols-1){
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) "); }
271 else {
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) |"); }
272 }
273 }
274 }
275
276
279 allEmTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXegTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getEmTOBs() ) ));
280 allTauHeuristicTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getTauHeuristicTOBs() ) ));
281 allTauBDTTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getTauBDTTOBs() ) ));
283
284 fexcounter++;
285 }
286
287
288
289 fexcounter = 0;
290
291 emecEta = 15; emecPhi = 1; emecMod = 600000;
292 initialEMEC =
calcTowerID(emecEta,emecPhi,emecMod);
293 transEta = 14; transPhi = 1; transMod = 400000;
294 initialTRANS =
calcTowerID(transEta,transPhi,transMod);
295 embEta = 7; embPhi = 1; embMod = 200000;
297 int eFEXc = 2;
298
299 for (int thisEFEX=eFEXc; thisEFEX<=23; thisEFEX+=3){
300
301 if(fexcounter > 0){ initialEMEC += 8; initialTRANS += 8; initialEMB += 8; }
302
303
304 std::map<int,eTower> tmp_eTowersColl_subset;
305
306
307 int tmp_eTowersIDs_subset [10][18];
308
309 int rows =
sizeof tmp_eTowersIDs_subset /
sizeof tmp_eTowersIDs_subset[0];
310 int cols =
sizeof tmp_eTowersIDs_subset[0] /
sizeof tmp_eTowersIDs_subset[0][0];
311
312
313 for(int thisCol = 0; thisCol < 7; thisCol++){
314 for(
int thisRow=0; thisRow<
rows; thisRow++){
315 int towerid = initialEMB + ( (thisCol) * 64) + thisRow;
316
317 if( (thisEFEX == 23) && (thisRow >= 7)){ towerid -= 64; };
318
319 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
320 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->findTower(towerid))));
321 }
322 }
323
324 for(
int thisRow = 0; thisRow <
rows; thisRow++){
325 int towerid = initialTRANS + thisRow;
326
327 if( (thisEFEX == 23) && (thisRow >= 7)){ towerid -= 64; };
328
329 tmp_eTowersIDs_subset[thisRow][7] = towerid;
330 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->findTower(towerid))));
331 }
332
333 for(
int thisCol=8; thisCol<
cols; thisCol++){
334 for(
int thisRow=0; thisRow<
rows; thisRow++){
335 int towerid = initialEMEC + ( (thisCol-8) * 64) + thisRow;
336
337 if( (thisEFEX == 23) && (thisRow >= 7)){ towerid -= 64; };
338
339 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
340 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->findTower(towerid))));
341 }
342 }
343
344
345 if(false){
347 for (int thisRow=rows-1; thisRow>=0; thisRow--){
348 for (
int thisCol=0; thisCol<
cols; thisCol++){
349 int tmptowerid = tmp_eTowersIDs_subset[thisRow][thisCol];
350 const float tmptowereta = this_eTowerContainer->findTower(tmptowerid)->eta();
351 const float tmptowerphi = this_eTowerContainer->findTower(tmptowerid)->phi();
352 if(thisCol != cols-1){
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) "); }
353 else {
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) |"); }
354 }
355 }
356 }
357
358
361 allEmTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXegTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getEmTOBs() ) ));
362 allTauHeuristicTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getTauHeuristicTOBs() ) ));
363 allTauBDTTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::value_type(thisEFEX, (
m_eFEXSimTool->getTauBDTTOBs() ) ));
365
366 fexcounter++;
367 }
368
369 }
370
371
372
373
374 auto eContainer = std::make_unique<xAOD::eFexEMRoIContainer> ();
375 auto eAuxContainer = std::make_unique<xAOD::eFexEMRoIAuxContainer> ();
376 eContainer->setStore(eAuxContainer.get());
377
378
379 auto xeContainer = std::make_unique<xAOD::eFexEMRoIContainer> ();
380 auto xeAuxContainer = std::make_unique<xAOD::eFexEMRoIAuxContainer> ();
381 xeContainer->setStore(xeAuxContainer.get());
382
383
384 for( auto const& [efex, tobObjects] : allEmTobObjects ){
385 for(auto &tobObject : tobObjects){
387 }
388 }
389
390
391
392
393 std::vector<std::unique_ptr<eFEXegTOB>> emTOBs;
394
395 auto iter = allEmTobObjects.begin();
396 while (iter != allEmTobObjects.end()) {
397 std::vector<std::unique_ptr<eFEXegTOB>> tobsSort = std::move(
iter->second);
398
399 std::sort (tobsSort.begin(), tobsSort.end(), std::bind(
TOBetSort<std::unique_ptr<eFEXegTOB>>, std::placeholders::_1, std::placeholders::_2,
false));
400
401 if (tobsSort.size() > 6) tobsSort.resize(6);
402
403 for (
unsigned int t = 0;
t < tobsSort.size(); ++
t) emTOBs.push_back(std::move(tobsSort[t]));
404
406 }
407
408
409 for(auto &tobObject : emTOBs){
410 int efex = tobObject->geteFEXID();
412 }
413
414
416
417
419 ATH_MSG_DEBUG(
" write: " << outputeFexEMxTOBHandle.key() <<
" = " <<
"..." );
420 ATH_CHECK(outputeFexEMxTOBHandle.record(std::move(xeContainer),std::move(xeAuxContainer)));
421
422 SG::WriteHandle<xAOD::eFexEMRoIContainer> outputeFexHandle(
m_eFexOutKey);
423 ATH_MSG_DEBUG(
" write: " << outputeFexHandle.key() <<
" = " <<
"..." );
424 ATH_CHECK(outputeFexHandle.record(std::move(eContainer),std::move(eAuxContainer)));
425
426 SG::ReadHandle<TrigConf::L1Menu> l1Menu (
m_l1MenuKey);
428
429 auto & thr_eTAU = l1Menu->thrExtraInfo().eTAU();
432
433
436 if (!omitAltTauContainer) {
438 }
441 if (!omitAltTauContainer) {
443 }
444 }
445
446
447
448
449
450
451 return StatusCode::SUCCESS;
452
453 }
#define ATH_CHECK
Evaluate an expression and check for errors.
ToolHandle< eFEXSim > m_eFEXSimTool
SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauAltOutKey
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
SG::WriteHandleKey< xAOD::eFexEMRoIContainer > m_eFexOutKey
ToolHandle< eFEXFillEDM > m_eFEXFillEDMTool
ToolHandle< eFEXFPGATowerIdProvider > m_eFEXFPGATowerIdProviderTool
StatusCode StoreTauTOBs(std::map< int, std::vector< std::unique_ptr< eFEXtauTOB > > > &allTauTobObjects, SG::WriteHandleKey< xAOD::eFexTauRoIContainer > &eFexTauxTOBOutKey, SG::WriteHandleKey< xAOD::eFexTauRoIContainer > &eFexTauOutKey)
static bool TOBetSort(const TOBObjectClass &i, const TOBObjectClass &j, bool isTau)
Internal data.
SG::WriteHandleKey< xAOD::eFexEMRoIContainer > m_eFexEMxTOBOutKey
SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauActivexTOBOutKey
SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauActiveOutKey
virtual int calcTowerID(int eta, int phi, int mod) const
SG::ReadHandleKey< LVL1::eTowerContainer > m_eTowerContainerSGKey
SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauAltxTOBOutKey
@ BDT
This object is generated by the BDT algorithm.
@ Heuristic
This object is generated by the heuristic algorithm.
void matchTOBs(T &TOBs, T &xTOBs)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.