ATLAS Offline Software
Event
xAOD
xAODMissingET
Root
MissingETAssociationHelper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
xAODMissingET/MissingETAssociationHelper.h
"
6
7
#include "
xAODTracking/TrackParticle.h
"
8
#include "
xAODJet/JetAttributes.h
"
9
10
#include "
xAODBase/IParticleContainer.h
"
11
#include "
xAODBase/ObjectType.h
"
12
13
#include <iterator>
14
#include <cstdio>
15
#include <climits>
16
17
using namespace
xAOD
;
18
20
// Constructors and destructor //
22
23
MissingETAssociationHelper::MissingETAssociationHelper
()
24
: m_map(nullptr)
25
{ }
26
27
MissingETAssociationHelper::MissingETAssociationHelper
(
const
MissingETAssociationMap_v1
* map)
28
: m_map(map)
29
{ }
30
31
MissingETAssociationHelper::~MissingETAssociationHelper
()
32
{ }
33
34
void
MissingETAssociationHelper::setObjSelectionFlag
(
const
MissingETAssociation_v1
* assoc,
size_t
objIdx,
bool
status
)
35
{
36
if
(!assoc)
throw
std::runtime_error(
"MissingETAssociationHelper::setObjSelectionFlag received a null pointer"
);
37
size_t
index
= assoc->
index
();
38
if
(
index
>=
m_useObjectFlags
.size())
m_useObjectFlags
.resize(
index
+1, 0);
39
if
(
status
)
m_useObjectFlags
.at(
index
) |= (1<<objIdx);
40
else
m_useObjectFlags
.at(
index
) &= ~(1<<objIdx);
41
}
42
43
void
MissingETAssociationHelper::setObjSelectionFlag
(
const
MissingETAssociation_v1
* assoc,
const
IParticle
* pPart,
bool
status
)
44
{
45
if
(!assoc)
throw
std::runtime_error(
"MissingETAssociationHelper::setObjSelectionFlag received a null pointer"
);
46
this->
setObjSelectionFlag
(assoc,assoc->
findIndex
(pPart),
status
);
47
}
48
49
bool
MissingETAssociationHelper::objSelected
(
const
MissingETAssociation_v1
* assoc,
size_t
objIdx)
const
50
{
51
if
(!assoc)
throw
std::runtime_error(
"MissingETAssociationHelper::objSelected received a null pointer"
);
52
size_t
index
= assoc->
index
();
53
if
(
index
>=
m_useObjectFlags
.size())
return
false
;
// No flag for this association has been set to 1 yet
54
if
(objIdx >=
sizeof
(
MissingETBase::Types::bitmask_t
)*CHAR_BIT)
return
false
;
55
return
bool
(
m_useObjectFlags
.at(
index
) & (
static_cast<
MissingETBase::Types::bitmask_t
>
(1)<<objIdx));
56
}
57
58
bool
MissingETAssociationHelper::objSelected
(
const
MissingETAssociation_v1
* assoc,
const
IParticle
* pPart)
const
59
{
60
if
(!assoc)
throw
std::runtime_error(
"MissingETAssociationHelper::objSelected received a null pointer"
);
61
return
this->
objSelected
(assoc, assoc->
findIndex
(pPart));
62
}
63
64
MissingETBase::Types::bitmask_t
MissingETAssociationHelper::getObjSelectionFlags
(
const
MissingETAssociation_v1
* assoc)
const
65
{
66
if
(!assoc)
throw
std::runtime_error(
"MissingETAssociationHelper::getObjSelectionFlags received a null pointer"
);
67
if
(assoc->
index
() >=
m_useObjectFlags
.size())
return
0;
// No flag for this association has been set to 1 yet
68
return
m_useObjectFlags
.at(assoc->
index
());
69
}
70
71
xAOD::MissingETAssociation_v1
MET association descriptor contains object links and corresponding parameters.
Definition:
MissingETAssociation_v1.h:29
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:34
JetAttributes.h
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition:
ICaloAffectedTool.h:24
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:268
ObjectType.h
xAOD::MissingETAssociationHelper::m_useObjectFlags
std::vector< MissingETBase::Types::bitmask_t > m_useObjectFlags
Definition:
MissingETAssociationHelper.h:51
IParticleContainer.h
xAOD::MissingETAssociationHelper::~MissingETAssociationHelper
virtual ~MissingETAssociationHelper()
Base class destructor.
Definition:
MissingETAssociationHelper.cxx:31
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
xAOD::MissingETAssociationHelper::MissingETAssociationHelper
MissingETAssociationHelper()
Default constructor.
Definition:
MissingETAssociationHelper.cxx:23
xAOD::MissingETAssociationHelper::objSelected
bool objSelected(const MissingETAssociation_v1 *assoc, size_t objIdx) const
Test if object is selected for MET calculation.
Definition:
MissingETAssociationHelper.cxx:49
TrackParticle.h
merge.status
status
Definition:
merge.py:17
xAOD::MissingETAssociationHelper::getObjSelectionFlags
MissingETBase::Types::bitmask_t getObjSelectionFlags(const MissingETAssociation_v1 *assoc) const
Return object selection bitmask for the given association.
Definition:
MissingETAssociationHelper.cxx:64
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition:
TrigDecision_v1.cxx:60
MissingETAssociationHelper.h
Generated on Sun Dec 22 2024 21:14:30 for ATLAS Offline Software by
1.8.18