ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkAlignment
TrkAlignGenAlgs
src
SelectEventNumber.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrkAlignGenAlgs/SelectEventNumber.h
"
6
7
#include "
xAODEventInfo/EventInfo.h
"
8
9
#include <fstream>
10
11
namespace
Trk
{
12
13
//___________________________________________________________________________
14
StatusCode
SelectEventNumber::initialize
()
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
//___________________________________________________________________________
33
StatusCode
SelectEventNumber::execute
(
const
EventContext& ctx)
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=
50
m_goodEventList
.begin()+
m_lastGoodEvt
;
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, ctx);
64
65
ATH_MSG_DEBUG
(
"goodevt "
<<goodevt);
66
return
StatusCode::SUCCESS;
67
}
68
69
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
SelectEventNumber.h
AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Definition
AthCommonAlgorithm.h:99
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
iterator
Trk::SelectEventNumber::m_eventListName
StringProperty m_eventListName
Definition
SelectEventNumber.h:36
Trk::SelectEventNumber::m_goodEventList
std::vector< std::pair< int, int > > m_goodEventList
Definition
SelectEventNumber.h:38
Trk::SelectEventNumber::initialize
virtual StatusCode initialize()
initialize method
Definition
SelectEventNumber.cxx:14
Trk::SelectEventNumber::execute
virtual StatusCode execute(const EventContext &ctx)
execute method
Definition
SelectEventNumber.cxx:33
Trk::SelectEventNumber::m_lastGoodEvt
int m_lastGoodEvt
Definition
SelectEventNumber.h:40
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.
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
run
int run(int argc, char *argv[])
Definition
ttree2hdf5.cxx:28
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0