ATLAS Offline Software
OverlapDecorationHelper.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 // Local includes
7 
8 namespace ORUtils
9 {
10 
11  //---------------------------------------------------------------------------
12  // Constructor
13  //---------------------------------------------------------------------------
15  OverlapDecorationHelper(const std::string& inputLabel,
16  const std::string& outputLabel,
17  bool outputPassValue)
18  : m_useInputLabel(!inputLabel.empty()),
19  m_inputAccessor("OverlapDecorationHelper_Dummy"),
20  m_outputDecorator(outputLabel),
21  m_outputPassValue(outputPassValue)
22  {
23  if(m_useInputLabel)
25  }
26 
27  //---------------------------------------------------------------------------
28  // Determine if object is currently OK for input to OR
29  //---------------------------------------------------------------------------
31  (const xAOD::IParticle& obj) const
32  {
33  // Input label is turned off if empty string
34  if(!m_useInputLabel) return true;
35  return m_inputAccessor(obj);
36  }
37 
38  //---------------------------------------------------------------------------
39  // Determine if object is currently rejected by OR
40  //---------------------------------------------------------------------------
42  (const xAOD::IParticle& obj) const
43  {
44  // isRejected = isInput && (output == fail)
46  }
47  //---------------------------------------------------------------------------
48  // Determine if object is NOT currently rejected by OR (is surviving)
49  //---------------------------------------------------------------------------
51  (const xAOD::IParticle& obj) const
52  {
53  // isSurviving = isInput && (output == pass)
55  }
56  //---------------------------------------------------------------------------
57  // Retrieve the user-defined object priority
58  //---------------------------------------------------------------------------
61  {
62  // We current reuse the input decoration as the priority score
63  return m_inputAccessor(obj);
64  }
65 
66  //---------------------------------------------------------------------------
67  // Set the overlap (output) decoration
68  //---------------------------------------------------------------------------
70  (const xAOD::IParticle& obj, bool result) const
71  {
73  }
74  //---------------------------------------------------------------------------
76  {
78  }
79  //---------------------------------------------------------------------------
81  {
83  }
84 
85  //---------------------------------------------------------------------------
86  // Check if output decoration has been applied to a container
87  //---------------------------------------------------------------------------
89  (const xAOD::IParticleContainer& container) const
90  {
91  return container.size() > 0 &&
92  m_outputDecorator.isAvailable(*container[0]);
93  }
94 
95  //---------------------------------------------------------------------------
96  // Initialize output decoration
97  //---------------------------------------------------------------------------
99  (const xAOD::IParticleContainer& container) const
100  {
101  if(!isDecorated(container))
102  resetDecorations(container);
103  }
104 
105  //---------------------------------------------------------------------------
106  // Reset output decoration
107  //---------------------------------------------------------------------------
109  (const xAOD::IParticleContainer& container) const
110  {
111  for(auto obj : container){
112  // This isn't terrible intuitive, but in order to support both output
113  // logic modes in a reasonable way, we initialize the output flag to the
114  // logical AND of isInput and outputPassValue. This results in non-input
115  // objects being initialized to 'false' regardless of output logic.
116  bool result = ( isInputObject(*obj) && m_outputPassValue );
118  }
119  //for(auto obj : container) setObjectPass(*obj);
120  }
121 
122 } // namespace ORUtils
ORUtils::OverlapDecorationHelper::setObjectPass
void setObjectPass(const xAOD::IParticle &obj) const
Shorthand way to set an object as passing overlap removal.
Definition: OverlapDecorationHelper.cxx:75
ORUtils::OverlapDecorationHelper::isSurvivingObject
bool isSurvivingObject(const xAOD::IParticle &obj) const
Check if object is surviving OR thus far.
Definition: OverlapDecorationHelper.cxx:51
get_generator_info.result
result
Definition: get_generator_info.py:21
ORUtils::OverlapDecorationHelper::m_useInputLabel
bool m_useInputLabel
Toggle usage of input label.
Definition: OverlapDecorationHelper.h:78
inputLabel
const std::string inputLabel
Definition: OverlapRemovalTester.cxx:68
outputLabel
const std::string outputLabel
Definition: OverlapRemovalTester.cxx:69
ORUtils::OverlapDecorationHelper::setObjectFail
void setObjectFail(const xAOD::IParticle &obj) const
Shorthand way to set an object as failing overlap removal.
Definition: OverlapDecorationHelper.cxx:80
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
ORUtils
Definition: AltMuJetOverlapTool.h:20
empty
bool empty(TH1 *h)
Definition: computils.cxx:295
ORUtils::OverlapDecorationHelper::getObjectPriority
char getObjectPriority(const xAOD::IParticle &obj) const
Get the user priority score, which is currently the input decoration.
Definition: OverlapDecorationHelper.cxx:60
ORUtils::OverlapDecorationHelper::m_outputDecorator
ort::outputDecorator_t m_outputDecorator
Output decorator.
Definition: OverlapDecorationHelper.h:83
ORUtils::OverlapDecorationHelper::OverlapDecorationHelper
OverlapDecorationHelper(const std::string &inputLabel, const std::string &outputLabel, bool outputPassValue=false)
Constructor.
Definition: OverlapDecorationHelper.cxx:15
ORUtils::OverlapDecorationHelper::resetDecorations
void resetDecorations(const xAOD::IParticleContainer &container) const
Helper method for setting all objects as passing.
Definition: OverlapDecorationHelper.cxx:109
ort::inputAccessor_t
SG::AuxElement::ConstAccessor< inputFlag_t > inputAccessor_t
Input object accessor.
Definition: OverlapRemovalDefs.h:25
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
ORUtils::OverlapDecorationHelper::isInputObject
bool isInputObject(const xAOD::IParticle &obj) const
Check if object is flagged as input for OR.
Definition: OverlapDecorationHelper.cxx:31
ORUtils::OverlapDecorationHelper::m_outputPassValue
bool m_outputPassValue
Output decoration logic.
Definition: OverlapDecorationHelper.h:86
ORUtils::OverlapDecorationHelper::isRejectedObject
bool isRejectedObject(const xAOD::IParticle &obj) const
Check if an object has been rejected by decoration.
Definition: OverlapDecorationHelper.cxx:42
SG::Decorator::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
ORUtils::OverlapDecorationHelper::m_inputAccessor
ort::inputAccessor_t m_inputAccessor
Input label accessor.
Definition: OverlapDecorationHelper.h:81
ORUtils::OverlapDecorationHelper::isDecorated
bool isDecorated(const xAOD::IParticleContainer &container) const
Check if output decoration has been applied to a container.
Definition: OverlapDecorationHelper.cxx:89
ORUtils::OverlapDecorationHelper::initializeDecorations
void initializeDecorations(const xAOD::IParticleContainer &container) const
Initialize decorations for a container to "pass".
Definition: OverlapDecorationHelper.cxx:99
outputPassValue
const bool outputPassValue
Definition: OverlapRemovalTester.cxx:67
python.PyAthena.obj
obj
Definition: PyAthena.py:132
ORUtils::OverlapDecorationHelper::setOverlapDecoration
void setOverlapDecoration(const xAOD::IParticle &obj, bool result) const
Set output decoration on object, pass or fail.
Definition: OverlapDecorationHelper.cxx:70
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
OverlapDecorationHelper.h