ATLAS Offline Software
Classes | Public Member Functions | Private Attributes | List of all members
TrigEventSelectorByteStream Class Reference

online implementation of IEvtSelector for ByteStream More...

#include <TrigEventSelectorByteStream.h>

Inheritance diagram for TrigEventSelectorByteStream:
Collaboration diagram for TrigEventSelectorByteStream:

Classes

class  Context
 Event Selector context for TrigEventSelectorByteStream. More...
 

Public Member Functions

 TrigEventSelectorByteStream (const std::string &name, ISvcLocator *svcLoc)
 Standard constructor. More...
 
virtual ~TrigEventSelectorByteStream ()
 Standard destructor. More...
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual StatusCode createContext (IEvtSelector::Context *&c) const override
 
virtual StatusCode next (IEvtSelector::Context &c) const override
 
virtual StatusCode next (IEvtSelector::Context &c, int jump) const override
 
virtual StatusCode previous (IEvtSelector::Context &c) const override
 
virtual StatusCode previous (IEvtSelector::Context &c, int jump) const override
 
virtual StatusCode last (IEvtSelector::Context &refContext) const override
 
virtual StatusCode rewind (IEvtSelector::Context &c) const override
 
virtual StatusCode createAddress (const IEvtSelector::Context &c, IOpaqueAddress *&iop) const override
 
virtual StatusCode releaseContext (IEvtSelector::Context *&c) const override
 
virtual StatusCode resetCriteria (const std::string &cr, IEvtSelector::Context &c) const override
 

Private Attributes

ServiceHandle< IByteStreamInputSvcm_eventSource
 
ServiceHandle< StoreGateSvcm_evtStore
 

Detailed Description

online implementation of IEvtSelector for ByteStream

Definition at line 20 of file TrigEventSelectorByteStream.h.

Constructor & Destructor Documentation

◆ TrigEventSelectorByteStream()

TrigEventSelectorByteStream::TrigEventSelectorByteStream ( const std::string &  name,
ISvcLocator *  svcLoc 
)

Standard constructor.

Definition at line 22 of file TrigEventSelectorByteStream.cxx.

23 : base_class(name, svcLoc),
24  m_eventSource("ByteStreamInputSvc", name),
25  m_evtStore("StoreGateSvc", name) {
26  declareProperty("ByteStreamInputSvc", m_eventSource);
27 }

◆ ~TrigEventSelectorByteStream()

TrigEventSelectorByteStream::~TrigEventSelectorByteStream ( )
virtual

Standard destructor.

Definition at line 32 of file TrigEventSelectorByteStream.cxx.

32 {}

Member Function Documentation

◆ createAddress()

StatusCode TrigEventSelectorByteStream::createAddress ( const IEvtSelector::Context &  c,
IOpaqueAddress *&  iop 
) const
overridevirtual

Definition at line 136 of file TrigEventSelectorByteStream.cxx.

137 {
138  ATH_MSG_VERBOSE("start of " << __FUNCTION__);
139 
140  // Get the EventContext via event store because the interface doesn't allow passing it explicitly as an argument
141  // and we don't want to use ThreadLocalContext. Don't use ReadHandle here because it calls ThreadLocalContext if
142  // not given a context (which we want to retrieve).
143  const EventContext* eventContext = nullptr;
144  ATH_CHECK(m_evtStore->retrieve(eventContext));
145 
146  // Create and record ByteStreamAddress for xAOD::EventInfo
148  addr->setEventContext(*eventContext);
149  iop = static_cast<IOpaqueAddress*>(addr);
150  ATH_CHECK(m_evtStore->recordAddress("EventInfo",iop));
151  ATH_MSG_DEBUG("Recorded new ByteStreamAddress for xAOD::EventInfo with event context " << *eventContext);
152 
153  // Create and record ByteStreamAddress for xAOD::EventAuxInfo
154  ByteStreamAddress* auxaddr = new ByteStreamAddress(ClassID_traits<xAOD::EventAuxInfo>::ID(), "EventInfoAux.", "");
155  auxaddr->setEventContext(*eventContext);
156  ATH_CHECK(m_evtStore->recordAddress("EventInfoAux.", static_cast<IOpaqueAddress*>(auxaddr)));
157  ATH_MSG_DEBUG("Recorded new ByteStreamAddress for xAOD::EventAuxInfo with event context " << *eventContext);
158 
159  ATH_MSG_VERBOSE("end of " << __FUNCTION__);
160  return StatusCode::SUCCESS;
161 }

◆ createContext()

StatusCode TrigEventSelectorByteStream::createContext ( IEvtSelector::Context *&  c) const
overridevirtual

Definition at line 118 of file TrigEventSelectorByteStream.cxx.

119 {
121  return StatusCode::SUCCESS;
122 }

◆ finalize()

StatusCode TrigEventSelectorByteStream::finalize ( )
overridevirtual

Definition at line 51 of file TrigEventSelectorByteStream.cxx.

52 {
53  ATH_MSG_VERBOSE("start of " << __FUNCTION__);
54  if (m_eventSource.release().isFailure()) {
55  ATH_MSG_WARNING("Cannot release the event source service");
56  }
57  ATH_MSG_VERBOSE("end of " << __FUNCTION__);
58  return StatusCode::SUCCESS;
59 }

◆ initialize()

StatusCode TrigEventSelectorByteStream::initialize ( )
overridevirtual

Definition at line 37 of file TrigEventSelectorByteStream.cxx.

38 {
39  ATH_MSG_VERBOSE("start of " << __FUNCTION__);
40 
41  ATH_CHECK(m_eventSource.retrieve());
42  ATH_CHECK(m_evtStore.retrieve());
43 
44  ATH_MSG_VERBOSE("end of " << __FUNCTION__);
45  return StatusCode::SUCCESS;
46 }

◆ last()

StatusCode TrigEventSelectorByteStream::last ( IEvtSelector::Context &  refContext) const
overridevirtual

Definition at line 185 of file TrigEventSelectorByteStream.cxx.

◆ next() [1/2]

StatusCode TrigEventSelectorByteStream::next ( IEvtSelector::Context &  c) const
overridevirtual

Definition at line 65 of file TrigEventSelectorByteStream.cxx.

66 {
67  ATH_MSG_VERBOSE("start of " << __FUNCTION__);
68 
69  // RawEvent is a typedef for FullEventFragment
70  const RawEvent* ptrRawEvent = nullptr;
71 
72  // Try to get the next event from the event source
73  try {
74  ptrRawEvent = m_eventSource->nextEvent();
75  }
76  catch (const hltonl::Exception::NoMoreEvents& e) {
77  ATH_MSG_INFO(e.what());
78  throw; // rethrow NoMoreEvents
79  }
81  ATH_MSG_DEBUG(e.what());
82  throw; // rethrow NoEventsTemporarily
83  }
85  ATH_MSG_ERROR(e.what());
86  throw; // rethrow EventSourceCorrupted
87  }
89  ATH_MSG_INFO(e.what());
90  throw; // rethrow MissingCTPFragment
91  }
92  catch (const hltonl::Exception::BadCTPFragment& e) {
93  ATH_MSG_INFO(e.what());
94  throw; // rethrow BadCTPFragment
95  }
96  catch (const std::exception& e) {
97  ATH_MSG_ERROR("Failed to get next event from the event source, std::exception caught: " << e.what());
98  return StatusCode::FAILURE;
99  }
100  catch (...) {
101  ATH_MSG_ERROR("Failed to get next event from the event source, unknown exception caught");
102  return StatusCode::FAILURE;
103  }
104 
105  // Check if something was returned
106  if (ptrRawEvent == nullptr) {
107  ATH_MSG_ERROR("Failed to get next event from the event source, nullptr returned");
108  return StatusCode::FAILURE;
109  }
110 
111  ATH_MSG_VERBOSE("end of " << __FUNCTION__);
112  return StatusCode::SUCCESS;
113 }

◆ next() [2/2]

StatusCode TrigEventSelectorByteStream::next ( IEvtSelector::Context &  c,
int  jump 
) const
overridevirtual

Definition at line 170 of file TrigEventSelectorByteStream.cxx.

◆ previous() [1/2]

StatusCode TrigEventSelectorByteStream::previous ( IEvtSelector::Context &  c) const
overridevirtual

Definition at line 175 of file TrigEventSelectorByteStream.cxx.

◆ previous() [2/2]

StatusCode TrigEventSelectorByteStream::previous ( IEvtSelector::Context &  c,
int  jump 
) const
overridevirtual

Definition at line 180 of file TrigEventSelectorByteStream.cxx.

◆ releaseContext()

StatusCode TrigEventSelectorByteStream::releaseContext ( IEvtSelector::Context *&  c) const
overridevirtual

Definition at line 127 of file TrigEventSelectorByteStream.cxx.

128 {
129  // this does nothing
130  return StatusCode::SUCCESS;
131 }

◆ resetCriteria()

StatusCode TrigEventSelectorByteStream::resetCriteria ( const std::string &  cr,
IEvtSelector::Context &  c 
) const
overridevirtual

Definition at line 195 of file TrigEventSelectorByteStream.cxx.

◆ rewind()

StatusCode TrigEventSelectorByteStream::rewind ( IEvtSelector::Context &  c) const
overridevirtual

Definition at line 190 of file TrigEventSelectorByteStream.cxx.

Member Data Documentation

◆ m_eventSource

ServiceHandle<IByteStreamInputSvc> TrigEventSelectorByteStream::m_eventSource
private

Definition at line 64 of file TrigEventSelectorByteStream.h.

◆ m_evtStore

ServiceHandle<StoreGateSvc> TrigEventSelectorByteStream::m_evtStore
private

Definition at line 66 of file TrigEventSelectorByteStream.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
hltonl::Exception::MissingCTPFragment
Thrown if the CTP ROBFragment cannot be retrieved for a new event.
Definition: HltExceptions.h:41
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
hltonl::Exception::EventSourceCorrupted
Thrown if event source throws an exception when new event is requested.
Definition: HltExceptions.h:33
TrigEventSelectorByteStream::m_eventSource
ServiceHandle< IByteStreamInputSvc > m_eventSource
Definition: TrigEventSelectorByteStream.h:64
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
hltonl::Exception::BadCTPFragment
Thrown if the CTP ROBFragment for a new event has non-zero status word or other errors.
Definition: HltExceptions.h:49
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
calibdata.exception
exception
Definition: calibdata.py:496
TrigEventSelectorByteStream::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
Definition: TrigEventSelectorByteStream.h:66
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
hltonl::Exception::NoEventsTemporarily
Thrown if the event source cannot provide new events temporarily, e.g. when trigger is on hold.
Definition: HltExceptions.h:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ByteStreamAddress::setEventContext
void setEventContext(const EventContext &eid)
Definition: ByteStreamAddress.h:59
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TrigEventSelectorByteStream::Context
Event Selector context for TrigEventSelectorByteStream.
Definition: TrigEventSelectorByteStream.h:26
python.compressB64.c
def c
Definition: compressB64.py:93
hltonl::Exception::NoMoreEvents
Thrown if all events are already read from the input and another one is requested.
Definition: HltExceptions.h:17
TRIGEVENTSELECTORBYTESTREAM_UNIMPL
#define TRIGEVENTSELECTORBYTESTREAM_UNIMPL
Definition: TrigEventSelectorByteStream.cxx:166