ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
9namespace CP {
10
21
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));
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
#define ANA_CHECK(EXP)
check whether the given expression was successful
virtual StatusCode initialize() override
Gaudi::Property< unsigned int > m_runNumberRef
the run number against which to compare
virtual StatusCode execute() override
CP::SysReadSelectionHandle m_preselection
the preselection
Gaudi::Property< std::string > m_sign
the comparison (GT, LT, etc)
SignEnum::ComparisonOperator m_signEnum
the operator version of the comparison (>, <, etc)
Gaudi::Property< bool > m_useRandomRunNumber
whether to use a random run number
CP::SysWriteSelectionHandle m_decoration
the output selection decoration
CP::SysListHandle m_systematicsList
the systematics
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
the event info handle
Helper class to provide type-safe access to aux data.
uint32_t runNumber() const
The current event's run number.
Select isolated Photons, Electrons and Muons.
bool checkValue(T reference, ComparisonOperator sign, T test)
the comparison test given the specified sign and two test values
Definition SignEnums.h:37
static const std::map< std::string, ComparisonOperator > stringToOperator
the map between user inputs and comparison operators
Definition SignEnums.h:27
EventInfo_v1 EventInfo
Definition of the latest event info version.