ATLAS Offline Software
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
9 #include "AsgTools/ToolHandle.h"
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;}
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 
91  DataKeyHandler<xAOD::ElectronContainer> m_electronKey{this, "ElectronKey", "Electrons",
92  "StoreGate/TEvent key for electrons"};
93 
94  DataKeyHandler<xAOD::PhotonContainer> m_photonKey{this, "PhotonKey", "Photons",
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
WriteDecorHandleKeyArray.h
OverlapRemovalGenUseAlg::m_etaCut
Gaudi::Property< float > m_etaCut
Definition: OverlapRemovalGenUseAlg.h:125
OverlapRemovalGenUseAlg
Algorithm to implement basic OR procedure as a prerequisite for event cleaning.
Definition: OverlapRemovalGenUseAlg.h:28
OverlapRemovalGenUseAlg::DataKeyHandler::initialize
StatusCode initialize(bool allow_empty=false)
Definition: OverlapRemovalGenUseAlg.h:71
PropertyWrapper.h
OverlapRemovalGenUseAlg::m_jetKey
DataKeyHandler< xAOD::JetContainer > m_jetKey
Definition: OverlapRemovalGenUseAlg.h:88
OverlapRemovalGenUseAlg::m_muonLabel
Gaudi::Property< std::string > m_muonLabel
Definition: OverlapRemovalGenUseAlg.h:111
OverlapRemovalGenUseAlg::initialize
virtual StatusCode initialize()
Initialize the algorithm.
Definition: OverlapRemovalGenUseAlg.cxx:31
OverlapRemovalGenUseAlg::m_photonKey
DataKeyHandler< xAOD::PhotonContainer > m_photonKey
Definition: OverlapRemovalGenUseAlg.h:94
OverlapRemovalGenUseAlg::DataKeyHandler::declareOutput
void declareOutput(const std::string &variable)
Definition: OverlapRemovalGenUseAlg.h:81
OverlapRemovalGenUseAlg::m_orTool
ToolHandle< ORUtils::IOverlapRemovalTool > m_orTool
Handle to the tool.
Definition: OverlapRemovalGenUseAlg.h:60
OverlapRemovalGenUseAlg::m_ptCut
Gaudi::Property< float > m_ptCut
Definition: OverlapRemovalGenUseAlg.h:124
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
OverlapRemovalGenUseAlg::DataKeyHandler::m_writeDecorKeys
SG::WriteDecorHandleKeyArray< ContainerType > m_writeDecorKeys
Definition: OverlapRemovalGenUseAlg.h:85
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::ReadHandleKey< ContainerType >
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
OverlapRemovalGenUseAlg::m_tauLabel
Gaudi::Property< std::string > m_tauLabel
Definition: OverlapRemovalGenUseAlg.h:113
OverlapRemovalGenUseAlg::m_selectionLabel
Gaudi::Property< std::string > m_selectionLabel
Label configuration --> Internal usage no data dependency needed.
Definition: OverlapRemovalGenUseAlg.h:117
OverlapRemovalGenUseAlg::DataKeyHandler
Definition: OverlapRemovalGenUseAlg.h:62
OverlapRemovalGenUseAlg::m_electronKey
DataKeyHandler< xAOD::ElectronContainer > m_electronKey
Definition: OverlapRemovalGenUseAlg.h:91
ReadDecorHandleKeyArray.h
AnaAlgorithm.h
EL::AnaAlgorithm
the (new) base class for EventLoop algorithms
Definition: AnaAlgorithm.h:73
OverlapRemovalGenUseAlg::m_overlapLabel
Gaudi::Property< std::string > m_overlapLabel
Definition: OverlapRemovalGenUseAlg.h:120
OverlapRemovalGenUseAlg::m_photonLabel
Gaudi::Property< std::string > m_photonLabel
Definition: OverlapRemovalGenUseAlg.h:109
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
OverlapRemovalGenUseAlg::OverlapRemovalGenUseAlg
OverlapRemovalGenUseAlg(const std::string &name, ISvcLocator *svcLoc)
Standard algorithm constructor.
Definition: OverlapRemovalGenUseAlg.cxx:23
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
IParticleContainer.h
OverlapRemovalGenUseAlg::DataKeyHandler::m_readKey
SG::ReadHandleKey< ContainerType > m_readKey
Definition: OverlapRemovalGenUseAlg.h:83
OverlapRemovalGenUseAlg::m_defaultValue
Gaudi::Property< bool > m_defaultValue
Definition: OverlapRemovalGenUseAlg.h:123
python.selection.variable
variable
Definition: selection.py:33
OverlapRemovalGenUseAlg::printObjects
void printObjects(const xAOD::IParticleContainer &container, const std::string &type)
Print object info.
Definition: OverlapRemovalGenUseAlg.cxx:255
OverlapRemovalGenUseAlg::DataKeyHandler::m_readDecorKeys
SG::ReadDecorHandleKeyArray< ContainerType > m_readDecorKeys
Definition: OverlapRemovalGenUseAlg.h:84
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
OverlapRemovalGenUseAlg::selectObject
bool selectObject(const ObjType &obj)
Simple object selection.
Definition: OverlapRemovalGenUseAlg.cxx:189
OverlapRemovalGenUseAlg::setDefaultDecorations
void setDefaultDecorations(const ContainerType &container)
Definition: OverlapRemovalGenUseAlg.cxx:166
OverlapRemovalGenUseAlg::m_tauKey
DataKeyHandler< xAOD::TauJetContainer > m_tauKey
Definition: OverlapRemovalGenUseAlg.h:100
IOverlapRemovalTool.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
L1CaloPhase1Monitoring.propName
propName
Definition: L1CaloPhase1Monitoring.py:349
OverlapRemovalGenUseAlg::DataKeyHandler::DataKeyHandler
DataKeyHandler(EL::AnaAlgorithm *owner, const std::string &propName, const std::string &defaultValue, const std::string &descrip)
Definition: OverlapRemovalGenUseAlg.h:64
OverlapRemovalGenUseAlg::m_muonKey
DataKeyHandler< xAOD::MuonContainer > m_muonKey
Definition: OverlapRemovalGenUseAlg.h:97
OverlapRemovalGenUseAlg::applySelection
void applySelection(const ContainerType &container)
Simple object selection.
Definition: OverlapRemovalGenUseAlg.cxx:178
OverlapRemovalGenUseAlg::m_vtxKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vtxKey
Definition: OverlapRemovalGenUseAlg.h:103
OverlapRemovalGenUseAlg::DataKeyHandler::empty
bool empty() const
Definition: OverlapRemovalGenUseAlg.h:79
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
OverlapRemovalGenUseAlg::execute
virtual StatusCode execute()
Execute the algorithm.
Definition: OverlapRemovalGenUseAlg.cxx:72
OverlapRemovalGenUseAlg::DataKeyHandler::declareDependency
void declareDependency(const std::string &variable)
Definition: OverlapRemovalGenUseAlg.h:80
OverlapRemovalGenUseAlg::DataKeyHandler::key
std::string key() const
Definition: OverlapRemovalGenUseAlg.h:78
OverlapRemovalGenUseAlg::m_electronLabel
Gaudi::Property< std::string > m_electronLabel
Definition: OverlapRemovalGenUseAlg.h:107
ToolHandle.h
python.PyAthena.obj
obj
Definition: PyAthena.py:135
OverlapRemovalGenUseAlg::m_bJetLabel
Gaudi::Property< std::string > m_bJetLabel
Definition: OverlapRemovalGenUseAlg.h:106