|
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include <unordered_map>
20 ISvcLocator *pSvcLocator)
21 :
EL::AnaReentrantAlgorithm(
name, pSvcLocator)
40 return StatusCode::SUCCESS;
50 std::unordered_map<std::size_t, const xAOD::IParticleContainer*> systhash_to_container;
53 size_t nominal_hash{SIZE_MAX};
62 if(
sys.name().empty()) {nominal_hash =
sys.hash();}
66 if (sys_container->
empty()) {
67 ATH_MSG_DEBUG(
"Container for systematic variation '" <<
sys.name() <<
"' was empty.");
68 systhash_to_container.insert({
sys.hash(),
nullptr});
77 systhash_to_container.insert({
sys.hash(), full_container});
78 if(full_container == sys_container) {
79 ATH_MSG_VERBOSE(
"The unfiltered container and the input container are the same.");
81 ATH_MSG_DEBUG(
"Read in container with " << sys_container->
size() <<
" elements.");
82 ATH_MSG_DEBUG(
"Traced back to unfiltered container with " << full_container->
size() <<
" elements.");
86 if(nominal_hash==SIZE_MAX) {
88 return StatusCode::FAILURE;
94 if(nom_cont==
nullptr) {
95 ATH_MSG_DEBUG(
"Unable to retrieve the nominal container, will have to assume there are no relevant objects");
96 return StatusCode::SUCCESS;
101 if(
sys.hash()==nominal_hash) {
continue;}
103 if(var_cont==
nullptr) {
104 ATH_MSG_ERROR(
"Cannot decorate syst '" <<
sys.name() <<
"' for obj " << nom_obj->index());
105 ATH_MSG_ERROR(
"Likely the systematics input container was empty after filtering.");
107 return StatusCode::FAILURE;
110 dec_nominalObject(*var_obj) =
iplink_t(*nom_cont, nom_obj->index());
113 ATH_MSG_VERBOSE(
"Nominal object with pt " << std::setprecision(3) << nom_obj->pt()/1
e3 <<
" GeV linked to");
114 ATH_MSG_VERBOSE(
" '" <<
sys.name() <<
"' varied object with pt " << std::setprecision(3) << var_obj->
pt()/1
e3 <<
" GeV.");
118 return StatusCode::SUCCESS;
StatusCode initialize() override
Initialisation method, for setting up tools and other persistent configs.
DataVector adapter that acts like it holds const pointers.
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
#define ATH_MSG_VERBOSE(x)
StatusCode execute(const EventContext &ctx) const override
Execute method, for actions to be taken in the event loop.
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
SystObjectLinkerAlg(const std::string &name, ISvcLocator *pSvcLocator)
The standard constructor.
::StatusCode initialize()
intialize this property
Helper class to provide type-safe access to aux data.
::StatusCode StatusCode
StatusCode definition for legacy code.
const T * front() const
Access the first element in the collection as an rvalue.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
size_t index() const
Return the index of this element within its container.
CP::SysListHandle m_systematicsList
We use default finalize() – this is for cleanup, and we don't do any.
virtual double pt() const =0
The transverse momentum ( ) of the particle.
CP::SysReadHandle< xAOD::IParticleContainer > m_inputHandle
Setup syst-aware input container handles.
CP::SysWriteDecorHandle< ElementLink< xAOD::IParticleContainer > > m_syst_link_decor
Setup sys-aware output decorations.
ElementLink< xAOD::IParticleContainer > iplink_t
ElementLink< xAOD::IParticleContainer > iplink_t
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.