36 asg::AsgToolConfig config(
"CP::ElectronLRTOverlapRemovalTool/ElectronLRTOverlapRemovalTool");
47 return StatusCode::SUCCESS;
60 return StatusCode::FAILURE;
65 return StatusCode::FAILURE;
69 std::set<const xAOD::Electron *> ElectronsToRemove;
72 ATH_MSG_DEBUG(
"Size of overlapping electrons to remove: " << ElectronsToRemove.size());
86 auto transientContainer = std::make_unique<ConstDataVector<xAOD::ElectronContainer>>(
SG::VIEW_ELEMENTS);
87 transientContainer->reserve(promptCol->size() + lrtCol->size());
97 auto outputCol = std::make_unique<xAOD::ElectronContainer>();
98 auto outputAuxCol = std::make_unique<xAOD::ElectronAuxContainer>();
99 outputCol->setStore(outputAuxCol.get());
100 outputCol->reserve(promptCol->size() + lrtCol->size());
106 ATH_CHECK(h_write.
record(std::move(outputCol), std::move(outputAuxCol)));
111 return StatusCode::SUCCESS;
120 const std::set<const xAOD::Electron *> &ElectronsToRemove)
const
123 if (!electronCol.
empty())
130 for (
const auto *
const electron : electronCol)
137 std::unique_ptr<xAOD::Electron> newElectron = std::make_unique<xAOD::Electron>(*
electron);
140 originalElectronLink(*newElectron) = eLink;
143 isLRT(*newElectron) = isLRT(*
electron);
144 outputCol->
push_back(std::move(newElectron));
149 ATH_MSG_DEBUG(
"Size of merged output electron collection " << outputCol->
size());
158 const std::set<const xAOD::Electron *> &ElectronsToRemove)
const
161 if (!electronCol.
empty())
165 for (
const auto *
const electron : electronCol)
175 ATH_MSG_DEBUG(
"Size of transient merged electron collection " << outputCol->size());
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_FATAL(x,...)
SG::WriteHandleKey< ConstDataVector< xAOD::ElectronContainer > > m_outElectronViewLocation
Combined electron collection.
Gaudi::Property< float > m_ORThreshold
Remove overlapping electrons from output collection.
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_lrtIsLRTKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_lrtElectronLocation
Standard electron collection to be merged.
Gaudi::Property< bool > m_isDAOD
StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< int > m_ORstrategy
Delta R threshold for matching in overlap removal.
ToolHandle< CP::IElectronLRTOverlapRemovalTool > m_overlapRemovalTool
Combined electron view collection, set from m_outElectronLocation in initialize().
SG::WriteDecorHandleKey< xAOD::ElectronContainer > m_promptIsLRTKey
Gaudi::Property< bool > m_doRemoval
Create a view to avoid deep copy.
void mergeElectron(const xAOD::ElectronContainer &electronCol, xAOD::ElectronContainer *outputCol, const std::set< const xAOD::Electron * > &LRTElectronsToRemove) const
The lrt electron overlap removal tool.
SG::WriteHandleKey< xAOD::ElectronContainer > m_outElectronLocation
LRT electron collection to be merged.
StatusCode initialize() override
SG::ReadHandleKey< xAOD::ElectronContainer > m_promptElectronLocation
Switches method for retrieving electron ID.
Gaudi::Property< bool > m_createViewCollection
Protected data:
DataVector adapter that acts like it holds const pointers.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
ElementLink implementation for ROOT usage.
bool toIndexedElement(BaseConstReference container, index_type index)
Set link to point to given index (slower).
Helper class to provide type-safe access to aux data.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
Handle class for adding a decoration to an object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Select isolated Photons, Electrons and Muons.
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
bool setOriginalObjectLink(const IParticle &original, IParticle ©)
This function should be used by CP tools when they make a deep copy of an object in their correctedCo...
Electron_v1 Electron
Definition of the current "egamma version".