ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
EventSelectionAlgorithms
Root
RunNumberSelectorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
#include "
EventSelectionAlgorithms/RunNumberSelectorAlg.h
"
8
9
namespace
CP
{
10
11
StatusCode
RunNumberSelectorAlg::initialize
() {
12
ANA_CHECK
(
m_eventInfoHandle
.initialize(
m_systematicsList
));
13
ANA_CHECK
(
m_preselection
.initialize(
m_systematicsList
,
m_eventInfoHandle
,
SG::AllowEmpty
));
14
ANA_CHECK
(
m_decoration
.initialize(
m_systematicsList
,
m_eventInfoHandle
));
15
ANA_CHECK
(
m_systematicsList
.initialize());
16
17
m_signEnum
=
SignEnum::stringToOperator
.at(
m_sign
);
18
19
return
StatusCode::SUCCESS;
20
}
21
22
StatusCode
RunNumberSelectorAlg::execute
(
const
EventContext& ctx) {
23
24
static
const
SG::Accessor<unsigned int>
acc_random(
"RandomRunNumber"
);
25
26
for
(
const
auto
&sys :
m_systematicsList
.systematicsVector()) {
27
// retrieve the EventInfo
28
const
xAOD::EventInfo
*evtInfo =
nullptr
;
29
ANA_CHECK
(
m_eventInfoHandle
.retrieve(evtInfo, sys, ctx));
30
31
// default-decorate EventInfo
32
m_decoration
.setBool(*evtInfo, 0, sys);
33
34
// check the preselection
35
if
(
m_preselection
&& !
m_preselection
.getBool(*evtInfo, sys))
36
continue
;
37
38
// retrieve the runNumber
39
unsigned
int
runNumber = 0;
40
if
(
m_useRandomRunNumber
) runNumber = acc_random(*evtInfo);
41
else
runNumber = evtInfo->
runNumber
();
42
43
// calculate decision
44
bool
decision =
SignEnum::checkValue
(
m_runNumberRef
.value(),
m_signEnum
, runNumber);
45
m_decoration
.setBool(*evtInfo, decision, sys);
46
}
47
return
StatusCode::SUCCESS;
48
}
49
}
// namespace CP
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
RunNumberSelectorAlg.h
CP::RunNumberSelectorAlg::initialize
virtual StatusCode initialize() override
Definition
RunNumberSelectorAlg.cxx:11
CP::RunNumberSelectorAlg::m_runNumberRef
Gaudi::Property< unsigned int > m_runNumberRef
the run number against which to compare
Definition
RunNumberSelectorAlg.h:38
CP::RunNumberSelectorAlg::m_preselection
CP::SysReadSelectionHandle m_preselection
the preselection
Definition
RunNumberSelectorAlg.h:58
CP::RunNumberSelectorAlg::m_sign
Gaudi::Property< std::string > m_sign
the comparison (GT, LT, etc)
Definition
RunNumberSelectorAlg.h:44
CP::RunNumberSelectorAlg::m_signEnum
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
Definition
RunNumberSelectorAlg.h:47
CP::RunNumberSelectorAlg::m_useRandomRunNumber
Gaudi::Property< bool > m_useRandomRunNumber
whether to use a random run number
Definition
RunNumberSelectorAlg.h:41
CP::RunNumberSelectorAlg::m_decoration
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
Definition
RunNumberSelectorAlg.h:63
CP::RunNumberSelectorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
the systematics
Definition
RunNumberSelectorAlg.h:50
CP::RunNumberSelectorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
Definition
RunNumberSelectorAlg.h:53
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition
Control/AthContainers/AthContainers/Accessor.h:68
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
SignEnum::checkValue
bool checkValue(T reference, ComparisonOperator sign, T test)
the comparison test given the specified sign and two test values
Definition
SignEnums.h:37
SignEnum::stringToOperator
static const std::map< std::string, ComparisonOperator > stringToOperator
the map between user inputs and comparison operators
Definition
SignEnums.h:27
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0