ATLAS Offline Software
MissingETAssociationHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include <stdexcept>
10 
11 using namespace xAOD;
12 
14 // Constructors and destructor //
16 
18  : m_map(nullptr)
19 { }
20 
22  : m_map(map)
23 { }
24 
26 { }
27 
29 {
30  if(!assoc) throw std::runtime_error("MissingETAssociationHelper::setObjSelectionFlag received a null pointer");
31  size_t index = assoc->index();
32  if(index >= m_useObjectFlags.size()) m_useObjectFlags.resize(index+1, 0);
33  if(status) m_useObjectFlags.at(index) |= (1<<objIdx);
34  else m_useObjectFlags.at(index) &= ~(1<<objIdx);
35 }
36 
38 {
39  if(!assoc) throw std::runtime_error("MissingETAssociationHelper::setObjSelectionFlag received a null pointer");
40  this->setObjSelectionFlag(assoc,assoc->findIndex(pPart),status);
41 }
42 
44 {
45  if(!assoc) throw std::runtime_error("MissingETAssociationHelper::objSelected received a null pointer");
46  size_t index = assoc->index();
47  if(index >= m_useObjectFlags.size()) return false; // No flag for this association has been set to 1 yet
48  if (objIdx >= sizeof(MissingETBase::Types::bitmask_t)*CHAR_BIT) return false;
49  return bool(m_useObjectFlags.at(index) & (static_cast<MissingETBase::Types::bitmask_t>(1)<<objIdx));
50 }
51 
53 {
54  if(!assoc) throw std::runtime_error("MissingETAssociationHelper::objSelected received a null pointer");
55  return this->objSelected(assoc, assoc->findIndex(pPart));
56 }
57 
59 {
60  if(!assoc) throw std::runtime_error("MissingETAssociationHelper::getObjSelectionFlags received a null pointer");
61  if(assoc->index() >= m_useObjectFlags.size()) return 0; // No flag for this association has been set to 1 yet
62  return m_useObjectFlags.at(assoc->index());
63 }
64 
65 
xAOD::MissingETAssociation_v1
MET association descriptor contains object links and corresponding parameters.
Definition: MissingETAssociation_v1.h:25
index
Definition: index.py:1
xAOD::MissingETAssociationHelper::setObjSelectionFlag
void setObjSelectionFlag(const MissingETAssociation_v1 *assoc, size_t objIdx, bool status)
Flag object as selected for MET calculation.
Definition: MissingETAssociationHelper.cxx:28
MissingETCompositionBase.h
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
MissingETAssociation_v1.h
MissingETBase::Types::bitmask_t
uint64_t bitmask_t
Type for status word bit mask.
Definition: MissingETBase.h:39
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
xAOD::MissingETAssociationMap_v1
Definition: MissingETAssociationMap_v1.h:29
xAOD::MissingETAssociation_v1::findIndex
size_t findIndex(const IParticle *pPart) const
Find index of given object in contributing object store.
Definition: MissingETAssociation_v1.cxx:266
xAOD::MissingETAssociationHelper::m_useObjectFlags
std::vector< MissingETBase::Types::bitmask_t > m_useObjectFlags
Definition: MissingETAssociationHelper.h:47
xAOD::MissingETAssociationHelper::~MissingETAssociationHelper
virtual ~MissingETAssociationHelper()
Base class destructor.
Definition: MissingETAssociationHelper.cxx:25
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
MissingETAssociationMap_v1.h
xAOD::MissingETAssociationHelper::MissingETAssociationHelper
MissingETAssociationHelper()
Default constructor.
Definition: MissingETAssociationHelper.cxx:17
xAOD::MissingETAssociationHelper::objSelected
bool objSelected(const MissingETAssociation_v1 *assoc, size_t objIdx) const
Test if object is selected for MET calculation.
Definition: MissingETAssociationHelper.cxx:43
merge.status
status
Definition: merge.py:16
xAOD::MissingETAssociationHelper::getObjSelectionFlags
MissingETBase::Types::bitmask_t getObjSelectionFlags(const MissingETAssociation_v1 *assoc) const
Return object selection bitmask for the given association.
Definition: MissingETAssociationHelper.cxx:58
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
MissingETAssociationHelper.h