ATLAS Offline Software
Loading...
Searching...
No Matches
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):
8
9// Local include(s):
11
12namespace xAODReader {
13
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
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
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::set< std::pair< unsigned int, unsigned int > > m_seenEvents
Variable keeping track of the events seen.
EventDuplicateFinderAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
virtual StatusCode initialize()
Function initialising the algorithm.
virtual StatusCode execute()
Function executing the algorithm.
std::string m_key
StoreGate key of the EI object to be tested.
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
EventInfo_v1 EventInfo
Definition of the latest event info version.