ATLAS Offline Software
Loading...
Searching...
No Matches
OverlapRemovalGenUseAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ASSOCIATIONUTILS_OVERLAPREMOVALGENUSEALG_H
6#define ASSOCIATIONUTILS_OVERLAPREMOVALGENUSEALG_H
7
8// Framework includes
14
16
17// EDM includes
19
20// Local includes
22
28{
29
30 public:
31
33 OverlapRemovalGenUseAlg(const std::string& name, ISvcLocator* svcLoc);
34
36 virtual StatusCode initialize();
37
39 virtual StatusCode execute();
40
41 private:
42
44 template<class ContainerType>
45 void applySelection(const ContainerType& container);
46
47 // Reset decorations to failing
48 template<class ContainerType>
49 void setDefaultDecorations(const ContainerType& container);
50
52 template<class ObjType>
53 bool selectObject(const ObjType& obj);
54
56 void printObjects(const xAOD::IParticleContainer& container,
57 const std::string& type);
58
60 ToolHandle<ORUtils::IOverlapRemovalTool> m_orTool{this, "OverlapRemovalTool", ""};
61
62 template <class ContainerType> class DataKeyHandler {
63 public:
65 const std::string& propName,
66 const std::string& defaultValue,
67 const std::string& descrip):
68 m_readKey{owner,propName, defaultValue, descrip},
69 m_readDecorKeys{owner, propName + "ReadDecors", {}, "External input data dependencies for "+propName},
70 m_writeDecorKeys{owner,propName + "WriteDecors", {}, "Dependencies written for "+propName}{}
71 StatusCode initialize(bool allow_empty = false){
72 if (!m_readKey.initialize(!allow_empty).isSuccess()) return StatusCode::FAILURE;
73 if (!m_readDecorKeys.initialize().isSuccess()) return StatusCode::FAILURE;
74 if (!m_writeDecorKeys.initialize().isSuccess()) return StatusCode::FAILURE;
75 return StatusCode::SUCCESS;
76 }
77 operator const SG::ReadHandleKey<ContainerType>& () const {return m_readKey;}
79 std::string key() const { return m_readKey.key();}
80 bool empty() const { return m_readKey.empty(); }
81 void declareDependency(const std::string& variable) { if (!empty() && !variable.empty()) m_readDecorKeys.emplace_back(m_readKey.key() + "." + variable );}
82 void declareOutput(const std::string& variable) { if (!empty() && !variable.empty()) m_writeDecorKeys.emplace_back(m_readKey.key() + "." + variable); }
83
84 template <class T>
85 void lockDecor (const std::string& decorKey, const EventContext& ctx) const {
87 if (SG::decorKeyFromKey (dhk.key()) == decorKey) {
89 if (h->size() > 0)
90 (void)h.getDecorationArray();
91 }
92 }
93 }
94 private:
98 };
99
100 DataKeyHandler<xAOD::JetContainer> m_jetKey{this, "JetKey", "AntiKt4EMPFlowJets",
101 "StoreGate/TEvent key for jets"};
102
104 "StoreGate/TEvent key for electrons"};
105
107 "StoreGate/TEvent key for photons"};
108
110 "StoreGate/TEvent key for muons"};
111
113 "StoreGate/TEvent key for taus"};
114
115 SG::ReadHandleKey<xAOD::VertexContainer> m_vtxKey{this, "VertexKey", "PrimaryVertices",
116 "StoreGate/TEvent key for the vertex container"};
117
118 Gaudi::Property<std::string> m_bJetLabel{this, "BJetLabel", "", "Input label for b-tagged jets"};
119 Gaudi::Property<std::string> m_electronLabel{this, "ElectronLabel", "DFCommonElectronsLHLoose",
120 "Input label for passing electrons"};
121 Gaudi::Property<std::string> m_photonLabel{this, "PhotonLabel", "DFCommonPhotonsIsEMLoose",
122 "Input label for passing photons"};
123 Gaudi::Property<std::string> m_muonLabel{this, "MuonLabel", "DFCommonMuonPassIDCuts",
124 "Input label for passing muons"};
125 Gaudi::Property<std::string> m_tauLabel{this, "TauLabel", "DFCommonTausLoose",
126 "Input label for passing taus" };
127
129 Gaudi::Property<std::string> m_selectionLabel{this, "SelectionLabel", "selected",
130 "Input label for the OverlapRemovalTool"};
131
132 Gaudi::Property<std::string> m_overlapLabel{this, "OverlapLabel", "overlaps",
133 "Output label for the OverlapRemovalTool"};
134
135 Gaudi::Property<bool> m_defaultValue{this, "DefaultValue", true, "Default value for objects failing OR"};
136 Gaudi::Property<float> m_ptCut{this, "PtCut", 20., "Minimum pt for consideration"};
137 Gaudi::Property<float> m_etaCut{this, "EtaCut", 4.5, "Maximum eta for consideration"};
138
139};
140
141#endif
Property holding a SG store/key/clid from which a ReadHandle is made.
static const Attributes_t empty
Header file for AthHistogramAlgorithm.
the (new) base class for EventLoop algorithms
const SG::ReadHandleKey< ContainerType > & hk() const
SG::ReadDecorHandleKeyArray< ContainerType > m_readDecorKeys
void declareDependency(const std::string &variable)
DataKeyHandler(EL::AnaAlgorithm *owner, const std::string &propName, const std::string &defaultValue, const std::string &descrip)
void lockDecor(const std::string &decorKey, const EventContext &ctx) const
SG::ReadHandleKey< ContainerType > m_readKey
StatusCode initialize(bool allow_empty=false)
void declareOutput(const std::string &variable)
SG::WriteDecorHandleKeyArray< ContainerType > m_writeDecorKeys
OverlapRemovalGenUseAlg(const std::string &name, ISvcLocator *svcLoc)
Standard algorithm constructor.
DataKeyHandler< xAOD::PhotonContainer > m_photonKey
Gaudi::Property< std::string > m_electronLabel
SG::ReadHandleKey< xAOD::VertexContainer > m_vtxKey
DataKeyHandler< xAOD::MuonContainer > m_muonKey
DataKeyHandler< xAOD::ElectronContainer > m_electronKey
void applySelection(const ContainerType &container)
Simple object selection.
DataKeyHandler< xAOD::TauJetContainer > m_tauKey
Gaudi::Property< float > m_etaCut
Gaudi::Property< std::string > m_muonLabel
Gaudi::Property< bool > m_defaultValue
void printObjects(const xAOD::IParticleContainer &container, const std::string &type)
Print object info.
Gaudi::Property< float > m_ptCut
Gaudi::Property< std::string > m_selectionLabel
Label configuration --> Internal usage no data dependency needed.
Gaudi::Property< std::string > m_photonLabel
Gaudi::Property< std::string > m_bJetLabel
Gaudi::Property< std::string > m_overlapLabel
void setDefaultDecorations(const ContainerType &container)
virtual StatusCode execute()
Execute the algorithm.
Gaudi::Property< std::string > m_tauLabel
virtual StatusCode initialize()
Initialize the algorithm.
DataKeyHandler< xAOD::JetContainer > m_jetKey
bool selectObject(const ObjType &obj)
Simple object selection.
ToolHandle< ORUtils::IOverlapRemovalTool > m_orTool
Handle to the tool.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Handle class for adding a decoration to an object.
DecorHandleKeyArray< ReadDecorHandle< T, S >, ReadDecorHandleKey< T >, Gaudi::DataHandle::Reader > ReadDecorHandleKeyArray
DecorHandleKeyArray< WriteDecorHandle< T, S >, WriteDecorHandleKey< T >, Gaudi::DataHandle::Writer > WriteDecorHandleKeyArray
std::string decorKeyFromKey(const std::string &key, const std::string &deflt)
Extract the decoration part of key.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.