10 const std::string &
name,
25 ATH_MSG_ERROR(
"No proton reconstruction tools set, check settings in AFP_GlobReco/AFP_GlobReco.py. Aborting.");
26 return StatusCode::FAILURE;
37 ATH_MSG_ERROR(
"No output proton containers provided, check settings in AFP_GlobReco/AFP_GlobReco.py. Aborting.");
38 return StatusCode::FAILURE;
50 std::vector<std::string> listOfWHKeys;
54 listOfWHKeys.push_back(whk.key());
56 unsigned int all_WHkeys=listOfWHKeys.size();
58 std::sort(listOfWHKeys.begin(), listOfWHKeys.end());
59 listOfWHKeys.erase(
std::unique(listOfWHKeys.begin(),listOfWHKeys.end()), listOfWHKeys.end());
60 if(listOfWHKeys.size() != all_WHkeys)
62 ATH_MSG_ERROR(
"It seems write handle keys do not have unique values, check settings in AFP_GlobReco/AFP_GlobReco.py. Aborting.");
63 return StatusCode::FAILURE;
66 std::vector<std::string> listOfOutputContainers;
69 ATH_MSG_DEBUG(
"have ouput container "<<recoTool->outputContainerName());
70 listOfOutputContainers.push_back(recoTool->outputContainerName());
73 std::sort(listOfOutputContainers.begin(), listOfOutputContainers.end());
74 listOfOutputContainers.erase(
std::unique(listOfOutputContainers.begin(),listOfOutputContainers.end()), listOfOutputContainers.end());
76 if(listOfWHKeys.size() != listOfOutputContainers.size())
78 ATH_MSG_ERROR(
"There is different number of unique write handle keys ("<<listOfWHKeys.size()<<
") and unique output containers ("<<listOfOutputContainers.size()<<
"). Aborting");
79 return StatusCode::FAILURE;
83 for(
const auto &trkOutCont : listOfOutputContainers)
85 if(
std::find(listOfWHKeys.begin(),listOfWHKeys.end(),trkOutCont) == listOfWHKeys.end())
87 ATH_MSG_ERROR(
"Cannot find proton reconstruction output container "<<trkOutCont<<
" in write handle keys. Aborting");
91 for(
const auto &whk : listOfWHKeys)
93 if(
std::find(listOfOutputContainers.begin(),listOfOutputContainers.end(),whk) == listOfOutputContainers.end())
95 ATH_MSG_ERROR(
"Cannot find write handle key "<<whk<<
" in proton reconstruction output containers. Aborting");
99 if(doAbort)
return StatusCode::FAILURE;
110 return StatusCode::SUCCESS;
121 auto afpProton=std::make_unique<xAOD::AFPProtonContainer>();
122 auto afpProtonAux=std::make_unique<xAOD::AFPProtonAuxContainer>();
123 afpProton->setStore(afpProtonAux.get());
127 if(recoTool->outputContainerName() != whk.key())
continue;
129 if( recoTool->doProtonReco(afpProton, ctx).isFailure() )
131 ATH_MSG_WARNING (
"Failed to reconstruct protons with algorithm = "<<recoTool->name());
135 ATH_MSG_DEBUG(
"write handle key "<<whk<<
", have "<<afpProton->size()<<
" reconstructed protons");
139 ATH_CHECK( protonContainer.
record(std::move(afpProton), std::move(afpProtonAux)) );
142 return StatusCode::SUCCESS;