ATLAS Offline Software
OverlapRemovalInit.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // System includes
6 #include <limits>
7 
8 // ROOT includes
9 #include "TError.h"
10 
11 // Local includes
20 
21 // Error checking macro
22 #define ORT_CHECK( ARG ) \
23  do { \
24  if(!static_cast<bool>(ARG)) { \
25  ::Error("OverlapRemovalInit", \
26  "Failed to execute: \"%s\"", \
27  #ARG ); \
28  return StatusCode::FAILURE; \
29  } \
30  } while( false )
31 
32 
33 namespace ORUtils
34 {
35 
36  //---------------------------------------------------------------------------
37  // ORFlags constructor
38  //---------------------------------------------------------------------------
39  ORFlags::ORFlags(const std::string& masterToolName,
40  const std::string& theInputLabel,
41  const std::string& theOutputLabel)
42  : masterName(masterToolName),
43  inputLabel(theInputLabel),
44  outputLabel(theOutputLabel)
45  {}
46 
47  //---------------------------------------------------------------------------
48  // Preconfigured recommended tools
49  //---------------------------------------------------------------------------
51  {
52  // Master tool
53  tbox.masterTool.setTypeAndName("ORUtils::OverlapRemovalTool/" +
54  flags.masterName);
55 
56  // El-el
57  if(flags.doElectrons && flags.doEleEleOR && tbox.eleEleORT.empty()) {
58  tbox.eleEleORT.setTypeAndName("ORUtils::EleEleOverlapTool/" +
59  flags.masterName + ".EleEleORT");
60  }
61 
62  // El-mu
63  if(flags.doElectrons && flags.doMuons && tbox.eleMuORT.empty()) {
64  tbox.eleMuORT.setTypeAndName("ORUtils::EleMuSharedTrkOverlapTool/" +
65  flags.masterName + ".EleMuORT");
66  }
67  // El-jet
68  if(flags.doElectrons && flags.doJets && tbox.eleJetORT.empty()) {
69  tbox.eleJetORT.setTypeAndName("ORUtils::EleJetOverlapTool/" +
70  flags.masterName + ".EleJetORT");
71  ORT_CHECK( tbox.eleJetORT.setProperty("BJetLabel", flags.bJetLabel) );
72  ORT_CHECK( tbox.eleJetORT.setProperty("MaxElePtForBJetAwareOR", flags.maxElePtForBJetAwareOR) );
73  ORT_CHECK( tbox.eleJetORT.setProperty("UseSlidingDR", flags.boostedLeptons) );
74  }
75  // Mu-jet
76  if(flags.doMuons && flags.doJets && tbox.muJetORT.empty()) {
77  tbox.muJetORT.setTypeAndName("ORUtils::MuJetOverlapTool/" +
78  flags.masterName + ".MuJetORT");
79  ORT_CHECK( tbox.muJetORT.setProperty("BJetLabel", flags.bJetLabel) );
80  ORT_CHECK( tbox.muJetORT.setProperty("UseSlidingDR", flags.boostedLeptons) );
81  }
82 
83  // Tau-ele overlap tool
84  if(flags.doTaus && flags.doElectrons && tbox.tauEleORT.empty()) {
85  tbox.tauEleORT.setTypeAndName("ORUtils::DeltaROverlapTool/" +
86  flags.masterName + ".TauEleORT");
87  ORT_CHECK( tbox.tauEleORT.setProperty("DR", 0.2) );
88  }
89  // Tau-mu overlap tool
90  if(flags.doTaus && flags.doMuons && tbox.tauMuORT.empty()) {
91  tbox.tauMuORT.setTypeAndName("ORUtils::DeltaROverlapTool/" +
92  flags.masterName + ".TauMuORT");
93  ORT_CHECK( tbox.tauMuORT.setProperty("DR", 0.2) );
94  }
95  // Tau-jet overlap tool
96  if(flags.doTaus && flags.doJets && tbox.tauJetORT.empty()) {
97  tbox.tauJetORT.setTypeAndName("ORUtils::DeltaROverlapTool/" +
98  flags.masterName + ".TauJetORT");
99  ORT_CHECK( tbox.tauJetORT.setProperty("DR", 0.2) );
100  }
101 
102  // Pho-ele overlap tool
103  if(flags.doPhotons && flags.doElectrons && tbox.phoEleORT.empty()) {
104  tbox.phoEleORT.setTypeAndName("ORUtils::DeltaROverlapTool/" +
105  flags.masterName + ".PhoEleORT");
106  }
107  // Pho-mu overlap tool
108  if(flags.doPhotons && flags.doMuons && tbox.phoMuORT.empty()) {
109  tbox.phoMuORT.setTypeAndName("ORUtils::DeltaROverlapTool/" +
110  flags.masterName + ".PhoMuORT");
111  }
112  // Pho-jet overlap tool
113  if(flags.doPhotons && flags.doJets && tbox.phoJetORT.empty()) {
114  tbox.phoJetORT.setTypeAndName("ORUtils::DeltaROverlapTool/" +
115  flags.masterName + ".PhoJetORT");
116  }
117 
118  // Ele-fatjet overlap tool
119  if(flags.doElectrons && flags.doFatJets && tbox.eleFatJetORT.empty()) {
120  tbox.eleFatJetORT.setTypeAndName("ORUtils::DeltaROverlapTool/" +
121  flags.masterName + ".EleFatJetORT");
122  ORT_CHECK( tbox.eleFatJetORT.setProperty("DR", 1.0) );
123  }
124 
125  // Jet-fatjet overlap tool
126  if(flags.doJets && flags.doFatJets && tbox.jetFatJetORT.empty()) {
127  tbox.jetFatJetORT.setTypeAndName("ORUtils::DeltaROverlapTool/" +
128  flags.masterName + ".JetFatJetORT");
129  ORT_CHECK( tbox.jetFatJetORT.setProperty("DR", 1.0) );
130  }
131 
132  // Overlap tool common properties
133  for(auto hptr : tbox.getOverlapTools()) {
134  ORT_CHECK( hptr->setProperty("LinkOverlapObjects", flags.linkOverlapObjects) );
135  }
136 
137  // Global common properties
138  ORT_CHECK( tbox.setGlobalProperty("InputLabel", flags.inputLabel) );
139  ORT_CHECK( tbox.setGlobalProperty("OutputLabel", flags.outputLabel) );
140  ORT_CHECK( tbox.setGlobalProperty("OutputPassValue", flags.outputPassValue) );
141 
142  return StatusCode::SUCCESS;
143  }
144 
145 }
146 
147 #undef ORT_CHECK
EleJetOverlapTool.h
MuJetOverlapTool.h
ORUtils::ToolBox::eleMuORT
OverlapHandle_t eleMuORT
Definition: ToolBox.h:70
inputLabel
const std::string inputLabel
Definition: OverlapRemovalTester.cxx:68
AthenaPoolTestRead.flags
flags
Definition: AthenaPoolTestRead.py:8
outputLabel
const std::string outputLabel
Definition: OverlapRemovalTester.cxx:69
EleMuSharedTrkOverlapTool.h
asg::AnaToolHandle::setTypeAndName
void setTypeAndName(const std::string &val_typeAndName)
set the value of type and name
ORUtils::recommendedTools
StatusCode recommendedTools(const ORFlags &flags, ToolBox &toolBox)
Pre-configured standard recommended OR tools.
Definition: OverlapRemovalInit.cxx:50
ORT_CHECK
#define ORT_CHECK(ARG)
Definition: OverlapRemovalInit.cxx:22
ORUtils::ToolBox::eleFatJetORT
OverlapHandle_t eleFatJetORT
Definition: ToolBox.h:79
asg::AnaToolHandle::setProperty
StatusCode setProperty(const std::string &property, const T2 &value)
set the given property of the tool.
ORUtils::ORFlags::ORFlags
ORFlags(const std::string &masterToolName="OverlapRemovalTool", const std::string &theInputLabel="selected", const std::string &theOutputLabel="overlaps")
Use constructor for convenience to initialize a few options.
Definition: OverlapRemovalInit.cxx:39
ORUtils
Definition: AltMuJetOverlapTool.h:20
ORUtils::ToolBox::setGlobalProperty
StatusCode setGlobalProperty(const std::string &property, const T &value)
Apply a global property to all tools.
Definition: ToolBox.h:104
ORUtils::ToolBox::muJetORT
OverlapHandle_t muJetORT
Definition: ToolBox.h:72
TauLooseMuOverlapTool.h
ORUtils::ToolBox::eleJetORT
OverlapHandle_t eleJetORT
Definition: ToolBox.h:71
TauLooseEleOverlapTool.h
ORUtils::ToolBox::getOverlapTools
std::vector< OverlapHandle_t * > getOverlapTools()
Get a list of all handles to loop over.
Definition: ToolBox.cxx:71
ORUtils::ToolBox::tauEleORT
OverlapHandle_t tauEleORT
Definition: ToolBox.h:73
ORUtils::ToolBox::jetFatJetORT
OverlapHandle_t jetFatJetORT
Definition: ToolBox.h:80
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ORUtils::ToolBox::tauMuORT
OverlapHandle_t tauMuORT
Definition: ToolBox.h:74
OverlapRemovalTool.h
ORUtils::ToolBox::tauJetORT
OverlapHandle_t tauJetORT
Definition: ToolBox.h:75
ORUtils::ToolBox::phoMuORT
OverlapHandle_t phoMuORT
Definition: ToolBox.h:77
ORUtils::ToolBox::phoEleORT
OverlapHandle_t phoEleORT
Definition: ToolBox.h:76
OverlapRemovalInit.h
Defines helper functions for initializing the OR tools in C++.
ORUtils::ToolBox::eleEleORT
OverlapHandle_t eleEleORT
Definition: ToolBox.h:69
DeltaROverlapTool.h
ORUtils::ToolBox::masterTool
MasterHandle_t masterTool
Master overlap removal tool handle.
Definition: ToolBox.h:64
ORUtils::ORFlags
A struct of global config options used to simplify the config helper interface.
Definition: OverlapRemovalInit.h:29
ORUtils::ToolBox::phoJetORT
OverlapHandle_t phoJetORT
Definition: ToolBox.h:78
ORUtils::ToolBox
A container and helper class for overlap removal tools.
Definition: ToolBox.h:39
asg::AnaToolHandle::empty
bool empty() const
whether this ToolHandle is completely empty, i.e.