ATLAS Offline Software
Loading...
Searching...
No Matches
SelectEventNumber.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
9#include <fstream>
10
11namespace Trk {
12
13//___________________________________________________________________________
15{
16 ATH_MSG_DEBUG("in SelectEventNumber::initialize()");
17 std::ifstream input(m_eventListName.value().c_str());
18 int run,event;
19 if (input.is_open()) {
20 while (input>>run>>event) {
21 m_goodEventList.emplace_back(run,event);
22 ATH_MSG_DEBUG("adding run "<<run<<", event "<<event);
23 }
24 }
25 else {
26 ATH_MSG_WARNING("could not open "<<m_eventListName);
27 }
28
29 return StatusCode::SUCCESS;
30}
31
32//___________________________________________________________________________
34{
35 ATH_MSG_DEBUG("in SelectEventNumber::execute()");
36
37 const xAOD::EventInfo* eventInfo = nullptr;
38 StatusCode sc=evtStore()->retrieve(eventInfo);
39 if (sc.isFailure()) {
40 ATH_MSG_ERROR("Couldn't retrieve event info");
41 }
42
43 int run=eventInfo->runNumber();
44 int evt=eventInfo->eventNumber();
45
46 // check if this run/evt is in the good file
47 int currentevt=m_lastGoodEvt;
48 bool goodevt=false;
49 std::vector<std::pair<int,int> >::iterator it=
51 for (; it!=m_goodEventList.end(); ++it,currentevt++) {
52
53 if (evt==(*it).second &&
54 run==(*it).first) {
55 m_lastGoodEvt=currentevt;
56 goodevt=true;
57 break;
58 }
59 }
60
61 ATH_MSG_DEBUG("setting filter passed to "<<goodevt);
62
63 setFilterPassed(goodevt);
64
65 ATH_MSG_DEBUG("goodevt "<<goodevt);
66 return StatusCode::SUCCESS;
67}
68
69}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
StringProperty m_eventListName
virtual StatusCode execute()
execute method
std::vector< std::pair< int, int > > m_goodEventList
virtual StatusCode initialize()
initialize method
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
Ensure that the ATLAS eigen extensions are properly loaded.
Definition run.py:1
EventInfo_v1 EventInfo
Definition of the latest event info version.