40 declareInterface<IeFEXSysSim>(
this);
73 return StatusCode::SUCCESS;
78 return ((64*eta) + phi +
mod);
84 if(!this_eTowerContainer.
isValid()){
86 return StatusCode::FAILURE;
90 std::map<int, std::vector<std::unique_ptr<eFEXegTOB>> > allEmTobObjects;
91 std::map<int, std::vector<std::unique_ptr<eFEXtauTOB>> > allTauHeuristicTobObjects;
92 std::map<int, std::vector<std::unique_ptr<eFEXtauTOB>> > allTauBDTTobObjects;
96 int tmp_eTowersIDs_subset_eFEX[10][18];
97 for (
int i_efex{ 0 }; i_efex < 24; i_efex++) {
102 allEmTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXegTOB>> >::
value_type(i_efex,
m_eFEXSimTool->getEmTOBs() ));
103 allTauHeuristicTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::
value_type(i_efex,
m_eFEXSimTool->getTauHeuristicTOBs() ));
104 allTauBDTTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::
value_type(i_efex,
m_eFEXSimTool->getTauBDTTOBs() ));
133 int emecEta = 24;
int emecPhi = 1;
int emecMod = 500000;
134 int initialEMEC =
calcTowerID(emecEta,emecPhi,emecMod);
135 int transEta = 14;
int transPhi = 1;
int transMod = 300000;
136 int initialTRANS =
calcTowerID(transEta,transPhi,transMod);
137 int embEta = 13;
int embPhi = 1;
int embMod = 100000;
138 int initialEMB =
calcTowerID(embEta,embPhi,embMod);
141 for (
int thisEFEX=eFEXa; thisEFEX<=21; thisEFEX+=3){
143 if(fexcounter > 0){ initialEMEC += 8; initialTRANS += 8; initialEMB += 8; }
146 std::map<int,eTower> tmp_eTowersColl_subset;
149 int tmp_eTowersIDs_subset [10][18];
151 int rows =
sizeof tmp_eTowersIDs_subset /
sizeof tmp_eTowersIDs_subset[0];
152 int cols =
sizeof tmp_eTowersIDs_subset[0] /
sizeof tmp_eTowersIDs_subset[0][0];
155 for(
int thisCol=0; thisCol<10; thisCol++){
156 for(
int thisRow=0; thisRow<
rows; thisRow++){
158 int towerid = initialEMEC - (thisCol * 64) + thisRow;
160 if( (thisEFEX == 21) && (thisRow >= 7)){ towerid -= 64; };
162 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
163 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->
findTower(towerid))));
169 for(
int thisRow = 0; thisRow <
rows; thisRow++){
171 int towerid = initialTRANS + thisRow;
173 if( (thisEFEX == 21) && (thisRow >= 7)){ towerid -= 64; };
175 tmp_eTowersIDs_subset[thisRow][10] = towerid;
176 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->
findTower(towerid))));
181 for(
int thisCol = 11; thisCol <
cols; thisCol++){
182 for(
int thisRow=0; thisRow<
rows; thisRow++){
184 int towerid = initialEMB - ( (thisCol-11) * 64) + thisRow;
186 if( (thisEFEX == 21) && (thisRow >= 7)){ towerid -= 64; };
188 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
189 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->
findTower(towerid))));
197 for (
int thisRow=
rows-1; thisRow>=0; thisRow--){
198 for (
int thisCol=0; thisCol<
cols; thisCol++){
199 int tmptowerid = tmp_eTowersIDs_subset[thisRow][thisCol];
200 const float tmptowereta = this_eTowerContainer->
findTower(tmptowerid)->
eta();
201 const float tmptowerphi = this_eTowerContainer->
findTower(tmptowerid)->
phi();
202 if(thisCol !=
cols-1){
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowerphi <<
"][" << tmptowereta <<
"]) "); }
203 else {
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) |"); }
211 allEmTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXegTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getEmTOBs() ) ));
212 allTauHeuristicTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getTauHeuristicTOBs() ) ));
213 allTauBDTTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getTauBDTTOBs() ) ));
222 int embnegEta = 8;
int embnegPhi = 1;
int embnegMod = 100000;
223 int initialEMB_neg =
calcTowerID(embnegEta,embnegPhi,embnegMod);
224 int embposEta = 0;
int embposPhi = 1;
int embposMod = 200000;
225 int initialEMB_pos =
calcTowerID(embposEta,embposPhi,embposMod);
228 for (
int thisEFEX=eFEXb; thisEFEX<=22; thisEFEX+=3){
230 if(fexcounter > 0){ initialEMB_neg += 8; initialEMB_pos += 8; }
233 std::map<int,eTower> tmp_eTowersColl_subset;
236 int tmp_eTowersIDs_subset [10][18];
238 int rows =
sizeof tmp_eTowersIDs_subset /
sizeof tmp_eTowersIDs_subset[0];
239 int cols =
sizeof tmp_eTowersIDs_subset[0] /
sizeof tmp_eTowersIDs_subset[0][0];
242 for(
int thisCol = 0; thisCol <
cols; thisCol++){
243 for(
int thisRow=0; thisRow<
rows; thisRow++){
246 int tmp_initEMB = initialEMB_neg;
249 towerid = tmp_initEMB - ( (thisCol) * 64) + thisRow;
252 tmp_initEMB = initialEMB_pos;
253 towerid = tmp_initEMB + ( (thisCol-9) * 64) + thisRow;
256 if( (thisEFEX == 22) && (thisRow >= 7)){ towerid -= 64; };
258 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
260 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->
findTower(towerid))));
267 for (
int thisRow=
rows-1; thisRow>=0; thisRow--){
268 for (
int thisCol=0; thisCol<
cols; thisCol++){
269 int tmptowerid = tmp_eTowersIDs_subset[thisRow][thisCol];
270 const float tmptowereta = this_eTowerContainer->
findTower(tmptowerid)->
eta();
271 const float tmptowerphi = this_eTowerContainer->
findTower(tmptowerid)->
phi();
272 if(thisCol !=
cols-1){
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) "); }
273 else {
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) |"); }
281 allEmTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXegTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getEmTOBs() ) ));
282 allTauHeuristicTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getTauHeuristicTOBs() ) ));
283 allTauBDTTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getTauBDTTOBs() ) ));
293 emecEta = 15; emecPhi = 1; emecMod = 600000;
294 initialEMEC =
calcTowerID(emecEta,emecPhi,emecMod);
295 transEta = 14; transPhi = 1; transMod = 400000;
296 initialTRANS =
calcTowerID(transEta,transPhi,transMod);
297 embEta = 7; embPhi = 1; embMod = 200000;
301 for (
int thisEFEX=eFEXc; thisEFEX<=23; thisEFEX+=3){
303 if(fexcounter > 0){ initialEMEC += 8; initialTRANS += 8; initialEMB += 8; }
306 std::map<int,eTower> tmp_eTowersColl_subset;
309 int tmp_eTowersIDs_subset [10][18];
311 int rows =
sizeof tmp_eTowersIDs_subset /
sizeof tmp_eTowersIDs_subset[0];
312 int cols =
sizeof tmp_eTowersIDs_subset[0] /
sizeof tmp_eTowersIDs_subset[0][0];
315 for(
int thisCol = 0; thisCol < 7; thisCol++){
316 for(
int thisRow=0; thisRow<
rows; thisRow++){
317 int towerid = initialEMB + ( (thisCol) * 64) + thisRow;
319 if( (thisEFEX == 23) && (thisRow >= 7)){ towerid -= 64; };
321 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
322 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->
findTower(towerid))));
326 for(
int thisRow = 0; thisRow <
rows; thisRow++){
327 int towerid = initialTRANS + thisRow;
329 if( (thisEFEX == 23) && (thisRow >= 7)){ towerid -= 64; };
331 tmp_eTowersIDs_subset[thisRow][7] = towerid;
332 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->
findTower(towerid))));
335 for(
int thisCol=8; thisCol<
cols; thisCol++){
336 for(
int thisRow=0; thisRow<
rows; thisRow++){
337 int towerid = initialEMEC + ( (thisCol-8) * 64) + thisRow;
339 if( (thisEFEX == 23) && (thisRow >= 7)){ towerid -= 64; };
341 tmp_eTowersIDs_subset[thisRow][thisCol] = towerid;
342 tmp_eTowersColl_subset.insert( std::map<int, eTower>::value_type(towerid, *(this_eTowerContainer->
findTower(towerid))));
349 for (
int thisRow=
rows-1; thisRow>=0; thisRow--){
350 for (
int thisCol=0; thisCol<
cols; thisCol++){
351 int tmptowerid = tmp_eTowersIDs_subset[thisRow][thisCol];
352 const float tmptowereta = this_eTowerContainer->
findTower(tmptowerid)->
eta();
353 const float tmptowerphi = this_eTowerContainer->
findTower(tmptowerid)->
phi();
354 if(thisCol !=
cols-1){
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) "); }
355 else {
ATH_MSG_DEBUG(
"| " << tmptowerid <<
"([" << tmptowereta <<
"][" << tmptowerphi <<
"]) |"); }
363 allEmTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXegTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getEmTOBs() ) ));
364 allTauHeuristicTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getTauHeuristicTOBs() ) ));
365 allTauBDTTobObjects.insert( std::map<
int, std::vector<std::unique_ptr<eFEXtauTOB>> >::
value_type(thisEFEX, (
m_eFEXSimTool->getTauBDTTOBs() ) ));
376 auto eContainer = std::make_unique<xAOD::eFexEMRoIContainer> ();
377 auto eAuxContainer = std::make_unique<xAOD::eFexEMRoIAuxContainer> ();
378 eContainer->setStore(eAuxContainer.get());
381 auto xeContainer = std::make_unique<xAOD::eFexEMRoIContainer> ();
382 auto xeAuxContainer = std::make_unique<xAOD::eFexEMRoIAuxContainer> ();
383 xeContainer->setStore(xeAuxContainer.get());
386 for(
auto const& [efex, tobObjects] : allEmTobObjects ){
387 for(
auto &tobObject : tobObjects){
395 std::vector<std::unique_ptr<eFEXegTOB>> emTOBs;
397 auto iter = allEmTobObjects.begin();
398 while (iter != allEmTobObjects.end()) {
399 std::vector<std::unique_ptr<eFEXegTOB>> tobsSort = std::move(iter->second);
401 std::sort (tobsSort.begin(), tobsSort.end(), std::bind(
TOBetSort<std::unique_ptr<eFEXegTOB>>, std::placeholders::_1, std::placeholders::_2,
false));
403 if (tobsSort.size() > 6) tobsSort.resize(6);
405 for (
unsigned int t = 0;
t < tobsSort.size(); ++
t) emTOBs.push_back(std::move(tobsSort[
t]));
411 for(
auto &tobObject : emTOBs){
412 int efex = tobObject->geteFEXID();
421 ATH_MSG_DEBUG(
" write: " << outputeFexEMxTOBHandle.
key() <<
" = " <<
"..." );
422 ATH_CHECK(outputeFexEMxTOBHandle.
record(std::move(xeContainer),std::move(xeAuxContainer)));
426 ATH_CHECK(outputeFexHandle.
record(std::move(eContainer),std::move(eAuxContainer)));
438 if (!omitAltTauContainer) {
443 if (!omitAltTauContainer) {
453 return StatusCode::SUCCESS;
461 std::unique_ptr< xAOD::eFexTauRoIContainer > tauContainer;
462 std::unique_ptr< xAOD::eFexTauRoIAuxContainer > tauAuxContainer;
463 std::unique_ptr< xAOD::eFexTauRoIContainer > xtauContainer;
464 std::unique_ptr< xAOD::eFexTauRoIAuxContainer > xtauAuxContainer;
466 tauContainer = std::make_unique<xAOD::eFexTauRoIContainer> ();
467 tauAuxContainer = std::make_unique<xAOD::eFexTauRoIAuxContainer> ();
468 tauContainer->setStore(tauAuxContainer.get());
470 xtauContainer = std::make_unique<xAOD::eFexTauRoIContainer> ();
471 xtauAuxContainer = std::make_unique<xAOD::eFexTauRoIAuxContainer> ();
472 xtauContainer->setStore(xtauAuxContainer.get());
475 for(
auto const& [efex, tobObjects] : allTauTobObjects ){
476 for(
auto &tobObject: tobObjects ){
484 std::vector<std::unique_ptr<eFEXtauTOB>> tauTOBs;
486 auto iterTau = allTauTobObjects.begin();
487 while (iterTau != allTauTobObjects.end()) {
488 std::vector<std::unique_ptr<eFEXtauTOB>> tobsSort = std::move(iterTau->second);
490 std::sort (tobsSort.begin(), tobsSort.end(), std::bind(
TOBetSort<std::unique_ptr<eFEXtauTOB>>, std::placeholders::_1, std::placeholders::_2,
true));
492 if (tobsSort.size() > 6) tobsSort.resize(6);
494 for (
unsigned int t = 0;
t < tobsSort.size(); ++
t) tauTOBs.push_back(std::move(tobsSort[
t]));
500 for(
auto &tobObject : tauTOBs){
501 int efex = tobObject->geteFEXID();
510 ATH_MSG_DEBUG(
" write: " << outputeFexTauxTOBHandle.
key() <<
" = " <<
"..." );
511 ATH_CHECK(outputeFexTauxTOBHandle.
record(std::move(xtauContainer), std::move(xtauAuxContainer)));
515 ATH_CHECK(outputeFexTauHandle.
record(std::move(tauContainer), std::move(tauAuxContainer)));
517 return StatusCode::SUCCESS;