ATLAS Offline Software
Loading...
Searching...
No Matches
OverlapRemovalGenUseAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 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
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;}
78 std::string key() const { return m_readKey.key();}
79 bool empty() const { return m_readKey.empty(); }
80 void declareDependency(const std::string& variable) { if (!empty() && !variable.empty()) m_readDecorKeys.emplace_back(m_readKey.key() + "." + variable );}
81 void declareOutput(const std::string& variable) { if (!empty() && !variable.empty()) m_writeDecorKeys.emplace_back(m_readKey.key() + "." + variable); }
82 private:
86 };
87
88 DataKeyHandler<xAOD::JetContainer> m_jetKey{this, "JetKey", "AntiKt4EMPFlowJets",
89 "StoreGate/TEvent key for jets"};
90
92 "StoreGate/TEvent key for electrons"};
93
95 "StoreGate/TEvent key for photons"};
96
98 "StoreGate/TEvent key for muons"};
99
101 "StoreGate/TEvent key for taus"};
102
103 SG::ReadHandleKey<xAOD::VertexContainer> m_vtxKey{this, "VertexKey", "PrimaryVertices",
104 "StoreGate/TEvent key for the vertex container"};
105
106 Gaudi::Property<std::string> m_bJetLabel{this, "BJetLabel", "", "Input label for b-tagged jets"};
107 Gaudi::Property<std::string> m_electronLabel{this, "ElectronLabel", "DFCommonElectronsLHLoose",
108 "Input label for passing electrons"};
109 Gaudi::Property<std::string> m_photonLabel{this, "PhotonLabel", "DFCommonPhotonsIsEMLoose",
110 "Input label for passing photons"};
111 Gaudi::Property<std::string> m_muonLabel{this, "MuonLabel", "DFCommonMuonPassIDCuts",
112 "Input label for passing muons"};
113 Gaudi::Property<std::string> m_tauLabel{this, "TauLabel", "DFCommonTausLoose",
114 "Input label for passing taus" };
115
117 Gaudi::Property<std::string> m_selectionLabel{this, "SelectionLabel", "selected",
118 "Input label for the OverlapRemovalTool"};
119
120 Gaudi::Property<std::string> m_overlapLabel{this, "OverlapLabel", "overlaps",
121 "Output label for the OverlapRemovalTool"};
122
123 Gaudi::Property<bool> m_defaultValue{this, "DefaultValue", true, "Default value for objects failing OR"};
124 Gaudi::Property<float> m_ptCut{this, "PtCut", 20., "Minimum pt for consideration"};
125 Gaudi::Property<float> m_etaCut{this, "EtaCut", 4.5, "Maximum eta for consideration"};
126
127};
128
129#endif
Property holding a SG store/key/clid from which a ReadHandle is made.
static const Attributes_t empty
the (new) base class for EventLoop algorithms
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)
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.
DecorHandleKeyArray< ReadDecorHandle< T, S >, ReadDecorHandleKey< T >, Gaudi::DataHandle::Reader > ReadDecorHandleKeyArray
DecorHandleKeyArray< WriteDecorHandle< T, S >, WriteDecorHandleKey< T >, Gaudi::DataHandle::Writer > WriteDecorHandleKeyArray
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.