ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
ORUtils::OverlapDecorationHelper Class Reference

Encapsulates the code needed to access and set overlap-related decorations. More...

#include <OverlapDecorationHelper.h>

Collaboration diagram for ORUtils::OverlapDecorationHelper:

Public Member Functions

 OverlapDecorationHelper (const std::string &inputLabel, const std::string &outputLabel, bool outputPassValue=false)
 Constructor. More...
 
bool isInputObject (const xAOD::IParticle &obj) const
 Check if object is flagged as input for OR. More...
 
bool isRejectedObject (const xAOD::IParticle &obj) const
 Check if an object has been rejected by decoration. More...
 
bool isSurvivingObject (const xAOD::IParticle &obj) const
 Check if object is surviving OR thus far. More...
 
char getObjectPriority (const xAOD::IParticle &obj) const
 Get the user priority score, which is currently the input decoration. More...
 
void setOverlapDecoration (const xAOD::IParticle &obj, bool result) const
 Set output decoration on object, pass or fail. More...
 
void setObjectPass (const xAOD::IParticle &obj) const
 Shorthand way to set an object as passing overlap removal. More...
 
void setObjectFail (const xAOD::IParticle &obj) const
 Shorthand way to set an object as failing overlap removal. More...
 
bool isDecorated (const xAOD::IParticleContainer &container) const
 Check if output decoration has been applied to a container. More...
 
void initializeDecorations (const xAOD::IParticleContainer &container) const
 Initialize decorations for a container to "pass". More...
 
void resetDecorations (const xAOD::IParticleContainer &container) const
 Helper method for setting all objects as passing. More...
 

Private Attributes

bool m_useInputLabel
 Toggle usage of input label. More...
 
ort::inputAccessor_t m_inputAccessor
 Input label accessor. More...
 
ort::outputDecorator_t m_outputDecorator
 Output decorator. More...
 
bool m_outputPassValue
 Output decoration logic. More...
 

Detailed Description

Encapsulates the code needed to access and set overlap-related decorations.

This utility class is used by the OverlapTools, but in principle could probably be used by a user as well.

Author
Steve Farrell Steve.nosp@m.n.Fa.nosp@m.rrell.nosp@m.@cer.nosp@m.n.ch

Definition at line 26 of file OverlapDecorationHelper.h.

Constructor & Destructor Documentation

◆ OverlapDecorationHelper()

ORUtils::OverlapDecorationHelper::OverlapDecorationHelper ( const std::string &  inputLabel,
const std::string &  outputLabel,
bool  outputPassValue = false 
)

Constructor.

Parameters
inputLabelInput decoration name
outputLabelOutput decoration name
outputPassValueSpecifies the boolean value to assign to passing, or non-overlapping objects. Default value is false for historical reasons.

Definition at line 14 of file OverlapDecorationHelper.cxx.

18  : m_useInputLabel(!inputLabel.empty()),
19  m_inputAccessor("OverlapDecorationHelper_Dummy"),
22  {
23  if(m_useInputLabel)
25  }

Member Function Documentation

◆ getObjectPriority()

char ORUtils::OverlapDecorationHelper::getObjectPriority ( const xAOD::IParticle obj) const

Get the user priority score, which is currently the input decoration.

Definition at line 59 of file OverlapDecorationHelper.cxx.

61  {
62  // We current reuse the input decoration as the priority score
63  return m_inputAccessor(obj);
64  }

◆ initializeDecorations()

void ORUtils::OverlapDecorationHelper::initializeDecorations ( const xAOD::IParticleContainer container) const

Initialize decorations for a container to "pass".

Note that the value written depends on the output pass-value.

Definition at line 98 of file OverlapDecorationHelper.cxx.

100  {
101  if(!isDecorated(container))
102  resetDecorations(container);
103  }

◆ isDecorated()

bool ORUtils::OverlapDecorationHelper::isDecorated ( const xAOD::IParticleContainer container) const

Check if output decoration has been applied to a container.

Returns false if the container is empty. Output logic independent.

Definition at line 88 of file OverlapDecorationHelper.cxx.

90  {
91  return container.size() > 0 &&
92  m_outputDecorator.isAvailable(*container[0]);
93  }

◆ isInputObject()

bool ORUtils::OverlapDecorationHelper::isInputObject ( const xAOD::IParticle obj) const

Check if object is flagged as input for OR.

Definition at line 30 of file OverlapDecorationHelper.cxx.

32  {
33  // Input label is turned off if empty string
34  if(!m_useInputLabel) return true;
35  return m_inputAccessor(obj);
36  }

◆ isRejectedObject()

bool ORUtils::OverlapDecorationHelper::isRejectedObject ( const xAOD::IParticle obj) const

Check if an object has been rejected by decoration.

Definition at line 41 of file OverlapDecorationHelper.cxx.

43  {
44  // isRejected = isInput && (output == fail)
46  }

◆ isSurvivingObject()

bool ORUtils::OverlapDecorationHelper::isSurvivingObject ( const xAOD::IParticle obj) const

Check if object is surviving OR thus far.

Definition at line 50 of file OverlapDecorationHelper.cxx.

52  {
53  // isSurviving = isInput && (output == pass)
55  }

◆ resetDecorations()

void ORUtils::OverlapDecorationHelper::resetDecorations ( const xAOD::IParticleContainer container) const

Helper method for setting all objects as passing.

Definition at line 108 of file OverlapDecorationHelper.cxx.

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  }

◆ setObjectFail()

void ORUtils::OverlapDecorationHelper::setObjectFail ( const xAOD::IParticle obj) const

Shorthand way to set an object as failing overlap removal.

Definition at line 80 of file OverlapDecorationHelper.cxx.

81  {
83  }

◆ setObjectPass()

void ORUtils::OverlapDecorationHelper::setObjectPass ( const xAOD::IParticle obj) const

Shorthand way to set an object as passing overlap removal.

Definition at line 75 of file OverlapDecorationHelper.cxx.

◆ setOverlapDecoration()

void ORUtils::OverlapDecorationHelper::setOverlapDecoration ( const xAOD::IParticle obj,
bool  result 
) const

Set output decoration on object, pass or fail.

Definition at line 69 of file OverlapDecorationHelper.cxx.

71  {
73  }

Member Data Documentation

◆ m_inputAccessor

ort::inputAccessor_t ORUtils::OverlapDecorationHelper::m_inputAccessor
private

Input label accessor.

Definition at line 81 of file OverlapDecorationHelper.h.

◆ m_outputDecorator

ort::outputDecorator_t ORUtils::OverlapDecorationHelper::m_outputDecorator
private

Output decorator.

Definition at line 83 of file OverlapDecorationHelper.h.

◆ m_outputPassValue

bool ORUtils::OverlapDecorationHelper::m_outputPassValue
private

Output decoration logic.

Definition at line 86 of file OverlapDecorationHelper.h.

◆ m_useInputLabel

bool ORUtils::OverlapDecorationHelper::m_useInputLabel
private

Toggle usage of input label.

Definition at line 78 of file OverlapDecorationHelper.h.


The documentation for this class was generated from the following files:
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::m_outputDecorator
ort::outputDecorator_t m_outputDecorator
Output decorator.
Definition: OverlapDecorationHelper.h:83
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
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
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
outputPassValue
const bool outputPassValue
Definition: OverlapRemovalTester.cxx:67
python.PyAthena.obj
obj
Definition: PyAthena.py:135
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.