ATLAS Offline Software
Loading...
Searching...
No Matches
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.
13
14#include "GaudiKernel/ClassID.h"
15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/StatusCode.h"
17
19
20// Constructor.
21EventSelectorMuonCalibStream::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.
34
35// 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.
46 // increment to get the new event in.
47 // ++(*m_beginIter); ???
49
50 return StatusCode::SUCCESS;
51}
52
53StatusCode EventSelectorMuonCalibStream::createContext(IEvtSelector::Context *&it) const {
54 it = new EventContextMuonCalibStream(this);
55 return (StatusCode::SUCCESS);
56}
57
58// Implementation of IEvtSelector::next().
59StatusCode 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 }
69
70 // Check if we are skipping events
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?)
83StatusCode 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//________________________________________________________________________________
96StatusCode EventSelectorMuonCalibStream::previous(IEvtSelector::Context & /*it*/) const {
97 ATH_MSG_ERROR("EventSelectorMuonCalibStream::previous() not implemented");
98 return (StatusCode::FAILURE);
99}
100
101//________________________________________________________________________________
102StatusCode EventSelectorMuonCalibStream::previous(IEvtSelector::Context &it, int /*jump*/) const { return (previous(it)); }
103
104//________________________________________________________________________________
105StatusCode 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//________________________________________________________________________________
114StatusCode EventSelectorMuonCalibStream::resetCriteria(const std::string & /*criteria*/, IEvtSelector::Context & /*ctxt*/) const {
115 return (StatusCode::SUCCESS);
116}
117
118//________________________________________________________________________________
119StatusCode EventSelectorMuonCalibStream::rewind(IEvtSelector::Context & /*it*/) const {
120 ATH_MSG_ERROR("EventSelectorMuonCalibStream::rewind() not implemented");
121 return (StatusCode::FAILURE);
122}
123
124//________________________________________________________________________________
125StatusCode 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//________________________________________________________________________________
139StatusCode EventSelectorMuonCalibStream::releaseContext(IEvtSelector::Context *& /*it*/) const { return (StatusCode::SUCCESS); }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
This file contains the class definition for the EventContextMuonCalibStream class.
This class provides the Context for EventSelectorMuonCalibStream.
virtual StatusCode previous(Context &it) const
virtual StatusCode rewind(Context &it) const
ServiceHandle< IMuonCalibStreamDataProviderSvc > m_dataProvider
virtual StatusCode next(Context &it) const
EventContextMuonCalibStream * m_endIter
virtual StatusCode last(Context &it) const
virtual StatusCode resetCriteria(const std::string &criteria, Context &context) const
EventContextMuonCalibStream * m_beginIter
virtual StatusCode createAddress(const Context &it, IOpaqueAddress *&iop) const
virtual StatusCode releaseContext(Context *&it) const
virtual StatusCode createContext(Context *&it) const
ServiceHandle< MuonCalibStreamInputSvc > m_eventSource
EventSelectorMuonCalibStream(const std::string &name, ISvcLocator *svcloc)
::StatusCode StatusCode
StatusCode definition for legacy code.
status
Definition merge.py:16