ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
xAOD
xAODEventInfoCnv
src
EventDuplicateFinderAlg.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
// EDM include(s):
7
#include "
xAODEventInfo/EventInfo.h
"
8
9
// Local include(s):
10
#include "
EventDuplicateFinderAlg.h
"
11
12
namespace
xAODReader
{
13
14
EventDuplicateFinderAlg::EventDuplicateFinderAlg
(
const
std::string& name,
15
ISvcLocator* svcLoc )
16
:
AthAlgorithm
( name, svcLoc ),
17
m_seenEvents
() {
18
19
declareProperty
(
"EventInfoKey"
,
m_key
=
"EventInfo"
,
20
"StoreGate key of the xAOD::EventInfo object to be "
21
"used"
);
22
}
23
24
StatusCode
EventDuplicateFinderAlg::initialize
() {
25
26
ATH_MSG_DEBUG
(
"EventInfoKey = "
<<
m_key
);
27
28
// Reset the internal variable:
29
m_seenEvents
.clear();
30
31
// Return gracefully:
32
return
StatusCode::SUCCESS;
33
}
34
35
StatusCode
EventDuplicateFinderAlg::execute
(
const
EventContext&
/*ctx*/
) {
36
37
// Retrieve the EI object:
38
const
xAOD::EventInfo
* ei =
nullptr
;
39
ATH_CHECK
(
evtStore
()->retrieve( ei,
m_key
) );
40
41
// Check if we saw this event already or not:
42
if
( !
m_seenEvents
.insert(
43
std::make_pair( ei->
runNumber
(),
44
ei->
eventNumber
() ) ).second ) {
45
ATH_MSG_FATAL
(
"Seeing run #"
<< ei->
runNumber
() <<
", event #"
46
<< ei->
eventNumber
() <<
" for the second time"
);
47
return
StatusCode::FAILURE;
48
}
49
50
// No, we just saw it now for the first time:
51
ATH_MSG_VERBOSE
(
"Saw run #"
<< ei->
runNumber
() <<
", event #"
52
<< ei->
eventNumber
() <<
" for the first time"
);
53
54
// Return gracefully:
55
return
StatusCode::SUCCESS;
56
}
57
58
}
// namespace xAODReader
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
EventDuplicateFinderAlg.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
xAODReader::EventDuplicateFinderAlg::execute
virtual StatusCode execute(const EventContext &ctx)
Function executing the algorithm.
Definition
EventDuplicateFinderAlg.cxx:35
xAODReader::EventDuplicateFinderAlg::m_seenEvents
std::set< std::pair< unsigned int, unsigned int > > m_seenEvents
Variable keeping track of the events seen.
Definition
EventDuplicateFinderAlg.h:49
xAODReader::EventDuplicateFinderAlg::EventDuplicateFinderAlg
EventDuplicateFinderAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition
EventDuplicateFinderAlg.cxx:14
xAODReader::EventDuplicateFinderAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition
EventDuplicateFinderAlg.cxx:24
xAODReader::EventDuplicateFinderAlg::m_key
std::string m_key
StoreGate key of the EI object to be tested.
Definition
EventDuplicateFinderAlg.h:46
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
xAODReader
Definition
EventDuplicateFinderAlg.cxx:12
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0