ATLAS Offline Software
MuonSpectrometer
MuonCalib
MuonCalibStream
MuonCalibStreamCnvSvc
src
EventSelectorMuonCalibStream.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
//====================================================================
5
// EventSelectorMuonCalibStream.cxx
6
// Event loop for calibration stream
7
//====================================================================
8
//
9
// Include files.
10
#include "
MuonCalibStreamCnvSvc/EventSelectorMuonCalibStream.h
"
11
#include "
MuonCalibStreamCnvSvc/EventContextMuonCalibStream.h
"
12
#include "
MuonCalibStreamCnvSvc/MuonCalibStreamAddress.h
"
13
14
#include "GaudiKernel/ClassID.h"
15
#include "GaudiKernel/ISvcLocator.h"
16
#include "GaudiKernel/StatusCode.h"
17
18
#include "
xAODEventInfo/EventInfo.h
"
19
20
// Constructor.
21
EventSelectorMuonCalibStream::EventSelectorMuonCalibStream
(
const
std::string &
name
, ISvcLocator *svcloc) :
22
base_class(
name
, svcloc),
23
m_beginIter(nullptr),
24
m_endIter(nullptr)
25
{
26
ATH_MSG_DEBUG
(
"EventSelectorMuonCalibStream constructor"
);
27
}
28
29
// Destructor.
30
EventSelectorMuonCalibStream::~EventSelectorMuonCalibStream
() {
31
if
(
m_beginIter
)
delete
m_beginIter
;
32
if
(
m_endIter
)
delete
m_endIter
;
33
}
34
35
// EventSelectorMuonCalibStream::initialize().
36
StatusCode
EventSelectorMuonCalibStream::initialize
() {
37
ATH_MSG_INFO
(
"EventSelectorMuonCalibStream::initialize"
);
38
39
// Check MuonCalibStreamCnvSvc
40
ATH_CHECK
(
m_eventSource
.retrieve() );
41
42
ATH_CHECK
(
m_dataProvider
.retrieve() );
43
44
// Create the begin and end iterators for this selector.
45
m_beginIter
=
new
EventContextMuonCalibStream
(
this
);
46
// increment to get the new event in.
47
// ++(*m_beginIter); ???
48
m_endIter
=
new
EventContextMuonCalibStream
(0);
49
50
return
StatusCode::SUCCESS;
51
}
52
53
StatusCode
EventSelectorMuonCalibStream::createContext
(IEvtSelector::Context *&
it
)
const
{
54
it
=
new
EventContextMuonCalibStream
(
this
);
55
return
(StatusCode::SUCCESS);
56
}
57
58
// Implementation of IEvtSelector::next().
59
StatusCode
EventSelectorMuonCalibStream::next
(IEvtSelector::Context &
it
)
const
{
60
ATH_MSG_DEBUG
(
" EventSelectorMuonCalibStream::next m_NumEvents="
<<
m_NumEvents
);
61
for
(;;) {
62
const
LVL2_MUON_CALIBRATION::CalibEvent *pre =
m_eventSource
->nextEvent();
63
if
(!pre) {
64
// End of file
65
it
= *
m_endIter
;
66
return
StatusCode::FAILURE;
67
}
68
++
m_NumEvents
;
69
70
// Check if we are skipping events
71
if
(
m_NumEvents
>
m_SkipEvents
) {
72
break
;
73
}
else
{
74
ATH_MSG_DEBUG
(
" Skipping event "
<<
m_NumEvents
- 1);
75
}
76
}
77
78
return
StatusCode::SUCCESS;
79
}
80
81
// Implementation of IEvtSelector::next() with a "jump" parameter
82
// (to skip over a certain number of events?)
83
StatusCode
EventSelectorMuonCalibStream::next
(IEvtSelector::Context &ctxt,
int
jump)
const
{
84
ATH_MSG_DEBUG
(
" EventSelectorMuonCalibStream::next skipping events =="
<< jump);
85
if
(jump > 0) {
86
for
(
int
i
= 0;
i
< jump; ++
i
) {
87
StatusCode
status
=
next
(ctxt);
88
if
(!
status
.isSuccess()) {
return
status
; }
89
}
90
return
StatusCode::SUCCESS;
91
}
92
return
StatusCode::FAILURE;
93
}
94
95
//________________________________________________________________________________
96
StatusCode
EventSelectorMuonCalibStream::previous
(IEvtSelector::Context &
/*it*/
)
const
{
97
ATH_MSG_ERROR
(
"EventSelectorMuonCalibStream::previous() not implemented"
);
98
return
(StatusCode::FAILURE);
99
}
100
101
//________________________________________________________________________________
102
StatusCode
EventSelectorMuonCalibStream::previous
(IEvtSelector::Context &
it
,
int
/*jump*/
)
const
{
return
(
previous
(
it
)); }
103
104
//________________________________________________________________________________
105
StatusCode
EventSelectorMuonCalibStream::last
(IEvtSelector::Context &
it
)
const
{
106
if
(
it
.identifier() ==
m_endIter
->
identifier
()) {
107
ATH_MSG_DEBUG
(
"last(): Last event in InputStream."
);
108
return
(StatusCode::SUCCESS);
109
}
110
return
(StatusCode::FAILURE);
111
}
112
113
//________________________________________________________________________________
114
StatusCode
EventSelectorMuonCalibStream::resetCriteria
(
const
std::string &
/*criteria*/
, IEvtSelector::Context &
/*ctxt*/
)
const
{
115
return
(StatusCode::SUCCESS);
116
}
117
118
//________________________________________________________________________________
119
StatusCode
EventSelectorMuonCalibStream::rewind
(IEvtSelector::Context &
/*it*/
)
const
{
120
ATH_MSG_ERROR
(
"EventSelectorMuonCalibStream::rewind() not implemented"
);
121
return
(StatusCode::FAILURE);
122
}
123
124
//________________________________________________________________________________
125
StatusCode
EventSelectorMuonCalibStream::createAddress
(
const
IEvtSelector::Context &
/*it*/
, IOpaqueAddress *&iop)
const
{
126
ATH_MSG_DEBUG
(
"EventSelectorMuonCalibStream::createAddress"
);
127
const
LVL2_MUON_CALIBRATION::CalibEvent *pre =
m_eventSource
->currentEvent();
128
m_dataProvider
->setNextEvent(pre);
129
ATH_MSG_DEBUG
(
"Calib Event cached in Data Provider "
);
130
131
iop =
new
MuonCalibStreamAddress
(
ClassID_traits<xAOD::EventInfo>::ID
(),
"EventInfo"
,
""
);
// change to xAOD::EventInfo key
132
//iop = new MuonCalibStreamAddress(ClassID_traits<xAOD::EventInfo>::ID(), "MuonCalibStreamEventInfo", ""); // old key which need the conversion afterwards
133
ATH_MSG_DEBUG
(
"MuonCalibStreamAddress for MuonCalibStreamEventInfo created "
);
134
135
return
(StatusCode::SUCCESS);
136
}
137
138
//________________________________________________________________________________
139
StatusCode
EventSelectorMuonCalibStream::releaseContext
(IEvtSelector::Context *&
/*it*/
)
const
{
return
(StatusCode::SUCCESS); }
MuonCalibStreamAddress.h
EventSelectorMuonCalibStream::createContext
virtual StatusCode createContext(Context *&it) const
Definition:
EventSelectorMuonCalibStream.cxx:53
EventSelectorMuonCalibStream::next
virtual StatusCode next(Context &it) const
Definition:
EventSelectorMuonCalibStream.cxx:59
EventSelectorMuonCalibStream::m_NumEvents
std::atomic< long > m_NumEvents
Definition:
EventSelectorMuonCalibStream.h:59
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
EventSelectorMuonCalibStream::m_SkipEvents
Gaudi::Property< int > m_SkipEvents
Definition:
EventSelectorMuonCalibStream.h:52
EventSelectorMuonCalibStream::EventSelectorMuonCalibStream
EventSelectorMuonCalibStream(const std::string &name, ISvcLocator *svcloc)
Definition:
EventSelectorMuonCalibStream.cxx:21
skel.it
it
Definition:
skel.GENtoEVGEN.py:396
EventSelectorMuonCalibStream::releaseContext
virtual StatusCode releaseContext(Context *&it) const
Definition:
EventSelectorMuonCalibStream.cxx:139
EventSelectorMuonCalibStream::initialize
virtual StatusCode initialize()
Definition:
EventSelectorMuonCalibStream.cxx:36
EventSelectorMuonCalibStream::previous
virtual StatusCode previous(Context &it) const
Definition:
EventSelectorMuonCalibStream.cxx:96
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
EventSelectorMuonCalibStream::rewind
virtual StatusCode rewind(Context &it) const
Definition:
EventSelectorMuonCalibStream.cxx:119
lumiFormat.i
int i
Definition:
lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EventSelectorMuonCalibStream::~EventSelectorMuonCalibStream
~EventSelectorMuonCalibStream()
Definition:
EventSelectorMuonCalibStream.cxx:30
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition:
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
EventSelectorMuonCalibStream::last
virtual StatusCode last(Context &it) const
Definition:
EventSelectorMuonCalibStream.cxx:105
EventSelectorMuonCalibStream::m_beginIter
EventContextMuonCalibStream * m_beginIter
Definition:
EventSelectorMuonCalibStream.h:56
EventSelectorMuonCalibStream.h
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
EventContextMuonCalibStream::identifier
virtual void * identifier() const
Inequality operator.
Definition:
EventContextMuonCalibStream.cxx:25
EventSelectorMuonCalibStream::m_endIter
EventContextMuonCalibStream * m_endIter
Definition:
EventSelectorMuonCalibStream.h:57
EventInfo.h
EventSelectorMuonCalibStream::m_eventSource
ServiceHandle< MuonCalibStreamInputSvc > m_eventSource
Definition:
EventSelectorMuonCalibStream.h:53
EventSelectorMuonCalibStream::resetCriteria
virtual StatusCode resetCriteria(const std::string &criteria, Context &context) const
Definition:
EventSelectorMuonCalibStream.cxx:114
merge.status
status
Definition:
merge.py:17
EventSelectorMuonCalibStream::createAddress
virtual StatusCode createAddress(const Context &it, IOpaqueAddress *&iop) const
Definition:
EventSelectorMuonCalibStream.cxx:125
MuonCalibStreamAddress
Definition:
MuonCalibStreamAddress.h:14
EventContextMuonCalibStream
This class provides the Context for EventSelectorMuonCalibStream.
Definition:
EventContextMuonCalibStream.h:23
EventContextMuonCalibStream.h
This file contains the class definition for the EventContextMuonCalibStream class.
EventSelectorMuonCalibStream::m_dataProvider
ServiceHandle< IMuonCalibStreamDataProviderSvc > m_dataProvider
Definition:
EventSelectorMuonCalibStream.h:54
Generated on Sun Dec 22 2024 21:10:19 for ATLAS Offline Software by
1.8.18