ATLAS Offline Software
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 
12 namespace 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
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
xAODReader::EventDuplicateFinderAlg::EventDuplicateFinderAlg
EventDuplicateFinderAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition: EventDuplicateFinderAlg.cxx:14
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
EventDuplicateFinderAlg.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAODReader::EventDuplicateFinderAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: EventDuplicateFinderAlg.cxx:24
AthAlgorithm
Definition: AthAlgorithm.h:47
xAODReader::EventDuplicateFinderAlg::m_key
std::string m_key
StoreGate key of the EI object to be tested.
Definition: EventDuplicateFinderAlg.h:46
xAODReader::EventDuplicateFinderAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: EventDuplicateFinderAlg.cxx:35
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
xAODReader
Definition: BTaggingReader.cxx:21
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