54 return StatusCode::SUCCESS;
60 std::unique_ptr<ConstDataVector<xAOD::MuonContainer>> outputViewCol;
61 std::unique_ptr<xAOD::MuonContainer> outputCol;
62 std::unique_ptr<xAOD::MuonAuxContainer> outputAuxCol;
64 outputViewCol = std::make_unique<ConstDataVector<xAOD::MuonContainer>>(
SG::VIEW_ELEMENTS);
66 outputCol = std::make_unique<xAOD::MuonContainer>();
67 outputAuxCol = std::make_unique<xAOD::MuonAuxContainer>();
68 outputCol->setStore(outputAuxCol.get());
76 return StatusCode::FAILURE;
80 return StatusCode::FAILURE;
84 std::vector<bool> writePromptMuon;
85 std::vector<bool> writeLRTMuon;
92 for (
const xAOD::Muon* mu : *promptCol) promptIsLRT(*mu) = 0;
93 for (
const xAOD::Muon* mu : *lrtCol) lrtIsLRT(*mu) = 1;
97 outputViewCol->reserve(promptCol->size() + lrtCol->size());
101 outputCol->reserve(promptCol->size() + lrtCol->size());
113 ATH_CHECK(h_write.
record(std::move(outputCol), std::move(outputAuxCol)));
116 return StatusCode::SUCCESS;
125 const std::vector<bool> & writeMuon,
130 if (writeMuon.at(
muon->index())){
134 return StatusCode::SUCCESS;
138 const std::vector<bool> & writeMuon,
144 if (writeMuon.at(
muon->index())){
145 auto newMuon = std::make_unique<xAOD::Muon>(*
muon);
148 originalMuonLink(*newMuon) = myLink;
150 static const SG::Accessor <char> isLRT(
"isLRT");
151 isLRT(*newMuon) = isLRT(*
muon);
152 outputCol->
push_back(std::move(newMuon));
155 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_FATAL(x,...)
DataVector adapter that acts like it holds const pointers.
ToolHandle< CP::IMuonLRTOverlapRemovalTool > m_overlapRemovalTool
MuonLRTMergingAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
SG::WriteHandleKey< xAOD::MuonContainer > m_outMuonLocation
Combined muon collection.
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_lrtIsLRTKey
StatusCode initialize() override
Gaudi::Property< bool > m_createViewCollection
flag to create a view collection rather than building deep-copies (true by default)
StatusCode mergeMuon(const xAOD::MuonContainer &muonCol, const std::vector< bool > &muonIsGood, ConstDataVector< xAOD::MuonContainer > *outputCol) const
Private methods:
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_promptIsLRTKey
SG::WriteHandleKey< ConstDataVector< xAOD::MuonContainer > > m_outMuonViewLocation
Combined muon view collection, set from m_outMuonLocation in initialize().
SG::ReadHandleKey< xAOD::MuonContainer > m_lrtMuonLocation
LRT muon collection to be merged.
SG::ReadHandleKey< xAOD::MuonContainer > m_promptMuonLocation
Private data:
StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< bool > m_useRun3WP
Gaudi::Property< int > m_ORstrategy
allows to pass an overlap removal strategy to the underlying removal tool, without manually configuri...
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.
AnaReentrantAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
ElementLink implementation for ROOT usage.
bool toIndexedElement(BaseConstReference container, index_type index)
Set link to point to given index (slower).
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
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
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...
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".