ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
xAOD
xAODTrigger
Root
TrigPassBits_v1.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
// System include(s):
7
#include <functional>
8
9
// xAOD include(s):
10
#include "
xAODCore/AuxStoreAccessorMacros.h
"
11
12
// Local include(s):
13
#include "
xAODTrigger/versions/TrigPassBits_v1.h
"
14
15
namespace
xAOD
{
16
17
TrigPassBits_v1::TrigPassBits_v1
()
18
:
SG
::AuxElement(),
m_container
( nullptr ) {
19
20
}
21
29
void
TrigPassBits_v1::markPassing
(
size_t
index
,
bool
passed
) {
30
31
// A sanity check:
32
if
(
index
>=
size
() ) {
33
throw
std::runtime_error(
"Index out of range"
);
34
}
35
36
// Access the serialised bits:
37
static
const
SG::AuxElement::Accessor< std::vector< uint32_t > >
38
accBits(
"passBits"
);
39
std::vector< uint32_t >& bits = accBits( *
this
);
40
41
// Calculate which bit to modify:
42
const
size_t
vec_element =
index
/ 32;
43
const
size_t
vec_index =
index
% 32;
44
45
// Another sanity check:
46
if
( vec_element >= bits.size() ) {
47
throw
std::runtime_error(
"The object is in an inconsistent state"
);
48
}
49
50
// Set the bit:
51
const
uint32_t
bit = ( 0x1 << vec_index );
52
uint32_t
mask = bits[ vec_element ];
53
if
(
passed
) {
54
mask |= bit;
55
}
else
{
56
mask &= ~bit;
57
}
58
bits[ vec_element ] = mask;
59
60
return
;
61
}
62
69
bool
TrigPassBits_v1::isPassing
(
size_t
index
)
const
{
70
71
// A sanity check:
72
if
(
index
>=
size
() ) {
73
throw
std::runtime_error(
"Index out of range"
);
74
}
75
76
// Access the serialised bits:
77
const
std::vector< uint32_t >& bits =
passBits
();
78
79
// Calculate the bit to extract:
80
const
size_t
vec_element =
index
/ 32;
81
const
size_t
vec_index =
index
% 32;
82
83
// Another sanity check:
84
if
( vec_element >= bits.size() ) {
85
throw
std::runtime_error(
"The object is in an inconsistent state"
);
86
}
87
88
// Extract the bit:
89
const
uint32_t
bit = ( 0x1 << vec_index );
90
const
uint32_t
mask = bits[ vec_element ];
91
return
( mask & bit );
92
}
93
100
uint32_t
TrigPassBits_v1::hash
(
const
std::string& key ) {
101
102
// The helper object:
103
static
const
std::hash< std::string > helper;
104
105
// The mask comes from how StoreGate creates hashes from keys. Could use
106
// some other value here as well though.
107
return
(
static_cast<
uint32_t
>
( helper( key ) ) & 0x3fffffff );
108
}
109
110
// Implementation of the raw accessor functions:
111
112
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
(
TrigPassBits_v1
,
uint32_t
,
113
size
, setSize )
114
AUXSTORE_OBJECT_SETTER_AND_GETTER
(
TrigPassBits_v1
, std::vector< uint32_t >,
115
passBits
, setPassBits )
116
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
(
TrigPassBits_v1
,
uint32_t
,
117
containerKey, setContainerKey )
118
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
(
TrigPassBits_v1
,
uint32_t
,
119
containerClid
, setContainerClid )
120
121
}
// namespace xAOD
AuxStoreAccessorMacros.h
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
Definition
AuxStoreAccessorMacros.h:36
AUXSTORE_OBJECT_SETTER_AND_GETTER
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of complex auxiliary properties.
Definition
AuxStoreAccessorMacros.h:88
passed
bool passed(DecisionID id, const DecisionIDContainer &)
checks if required decision ID is in the set of IDs in the container
Definition
TrigCompositeUtilsRoot.cxx:118
size
size_t size() const
Number of registered mappings.
TrigPassBits_v1.h
xAOD::TrigPassBits_v1
Type describing which elements in a container passed a trigger chain.
Definition
TrigPassBits_v1.h:38
xAOD::TrigPassBits_v1::size
uint32_t size() const
The size of the target container.
xAOD::TrigPassBits_v1::passBits
const std::vector< uint32_t > & passBits() const
The internal bitmap created with the hypo decisions.
xAOD::TrigPassBits_v1::hash
static uint32_t hash(const std::string &key)
Function calculating a "hash" out of a string.
Definition
TrigPassBits_v1.cxx:100
xAOD::TrigPassBits_v1::isPassing
bool isPassing(const OBJ *obj, const CONT *container) const
Check if an element of a container is passing/failing.
xAOD::TrigPassBits_v1::markPassing
void markPassing(const OBJ *obj, const CONT *container, bool passed=true)
Mark one of the elements of the target container as passing/failing.
xAOD::TrigPassBits_v1::m_container
const void * m_container
Transient pointer to the target container.
Definition
TrigPassBits_v1.h:107
xAOD::TrigPassBits_v1::TrigPassBits_v1
TrigPassBits_v1()
Default constructor.
Definition
TrigPassBits_v1.cxx:17
SG
Forward declaration.
Definition
CaloCellPacker_400_500.h:32
index
Definition
index.py:1
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
xAOD::AUXSTORE_PRIMITIVE_SETTER_AND_GETTER
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
xAOD::passBits
passBits
Definition
TrigPassBits_v1.cxx:115
xAOD::containerClid
setPassBits containerClid
Definition
TrigPassBits_v1.cxx:119
xAOD::uint32_t
setEventNumber uint32_t
Definition
EventInfo_v1.cxx:127
Generated on
for ATLAS Offline Software by
1.17.0