BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataSelector.cxx
Go to the documentation of this file.
1//====================================================================
2// EventSelector.cpp
3//--------------------------------------------------------------------
4//
5// Package : RawDataSelector
6//
7// Description: The EventSelector component is able
8// to produce a list of event references given
9// a set of "selection criteria".
10//
11//
12//====================================================================
13
14// Include files
15#include "GaudiKernel/Bootstrap.h"
16#include "GaudiKernel/ISvcLocator.h"
17#include "GaudiKernel/MsgStream.h"
18#include "GaudiKernel/PropertyMgr.h"
19
20#include "RawDataCnv/EventManagement/RAWEVENT.h"
21#include "RawDataCnv/RawDataAddress.h"
22#include "RawDataContext.h"
23#include "RawDataSelector.h"
24
25#include "RawDataCnvSvc/IRawDataInputSvc.h"
26
28extern const CLID& CLID_Event;
29
30RawDataSelector::RawDataSelector( const std::string& name, ISvcLocator* svcloc )
31 : base_class( name, svcloc ), m_beginContext( 0 ), m_endContext( 0 ) {
32 declareProperty( "InputSvc", m_eventSourceName );
33}
34
36 // if (m_eventSource)
37 // delete m_eventSource;
38 if ( m_beginContext ) delete m_beginContext;
39 if ( m_endContext ) delete m_endContext;
40}
41
43
44 // Create a message stream.
45 MsgStream log( msgSvc(), name() );
46
47 // Initialize the Service base class.
48 StatusCode sc = Service::initialize();
49 if ( !sc.isSuccess() )
50 {
51 log << MSG::ERROR << "RawDataSelector::initialize: Unable to "
52 << "initialize Service base class." << endmsg;
53 return sc;
54 }
55
56 IService* svc;
57
58 // for Mutil-thread by tianhl
59 // if (isGaudiThreaded(name()))m_eventSourceName += getGaudiThreadIDfromName(name()); //
60 // FIXME: commented by mrli, 240612
61 log << MSG::INFO << name() << " get RawDataInputSvc by name: " << m_eventSourceName
62 << endmsg;
63 // for Mutil-thread by tianhl
64
65 // sc = serviceLocator()->getService( m_eventSourceName, svc );
66 // if ( sc != StatusCode::SUCCESS )
67 // {
68 // log << MSG::ERROR << " Cant get RawDataInputSvc " << endmsg;
69 // return sc;
70 // }
71
72 // m_eventSource = dynamic_cast<RawDataInputSvc *>(svc);
73 m_eventSource = service( m_eventSourceName );
74 if ( !m_eventSource )
75 {
76 log << MSG::ERROR << "Cannot get RawDataInputSvc " << endmsg;
77 return StatusCode::FAILURE;
78 }
79
80 m_beginContext = new RawDataContext( this );
81
82 // m_endContext = new RawDataContext(this, m_eventSource->end());
83
84 return sc;
85}
86
87StatusCode RawDataSelector::createContext( IEvtSelector::Context*& it ) const {
88 // m_eventSource->initialize();
89 it = m_beginContext;
90 return ( StatusCode::SUCCESS );
91}
92
93// Implementation of IEvtSelector::next().
94StatusCode RawDataSelector::next( IEvtSelector::Context& it ) const {
95 RAWEVENT* pre = m_eventSource->nextEvent();
96 //((RawDataContext &)it).next();
97 return StatusCode::SUCCESS;
98}
99
100//__________________________________________________________________________
101StatusCode RawDataSelector::next( IEvtSelector::Context& ctxt, int jump ) const {
102 if ( jump > 0 )
103 {
104 for ( int i = 0; i < jump; ++i )
105 {
106 StatusCode status = next( ctxt );
107 if ( !status.isSuccess() ) { return status; }
108 }
109 return StatusCode::SUCCESS;
110 }
111 return StatusCode::FAILURE;
112}
113
114StatusCode RawDataSelector::previous( IEvtSelector::Context& /*it*/ ) const {
115 MsgStream log( msgSvc(), name() );
116 log << MSG::ERROR << "RawDataSelector::previous() not implemented" << endmsg;
117 return ( StatusCode::FAILURE );
118}
119
120StatusCode RawDataSelector::previous( IEvtSelector::Context& it, int /*jump*/ ) const {
121 return ( previous( it ) );
122}
123
124StatusCode RawDataSelector::last( IEvtSelector::Context& it ) const {
125 return ( StatusCode::FAILURE );
126}
127
128StatusCode RawDataSelector::resetCriteria( const std::string& /*criteria*/,
129 IEvtSelector::Context& /*ctxt*/ ) const {
130 return ( StatusCode::SUCCESS );
131}
132
133StatusCode RawDataSelector::rewind( IEvtSelector::Context& /*it*/ ) const {
134 MsgStream log( msgSvc(), name() );
135 log << MSG::ERROR << "RawDataSelector::rewind() not implemented" << endmsg;
136 return ( StatusCode::FAILURE );
137}
138
139StatusCode RawDataSelector::createAddress( const IEvtSelector::Context& /*it*/,
140 IOpaqueAddress*& iop ) const {
141 iop = new RawDataAddress( CLID_Event, "EventHeader", "EventHeader" );
142
143 return ( StatusCode::SUCCESS );
144}
145
146StatusCode RawDataSelector::releaseContext( IEvtSelector::Context*& /*it*/ ) const {
147 return ( StatusCode::SUCCESS );
148}
149
150StatusCode RawDataSelector::queryInterface( const InterfaceID& riid, void** ppvInterface ) {
151 if ( riid == IEvtSelector::interfaceID() ) { *ppvInterface = (IEvtSelector*)this; }
152 else if ( riid == IProperty::interfaceID() ) { *ppvInterface = (IProperty*)this; }
153 else { return Service::queryInterface( riid, ppvInterface ); }
154 addRef();
155 return StatusCode::SUCCESS;
156}
DECLARE_COMPONENT(BesBdkRc)
const CLID & CLID_Event
IMessageSvc * msgSvc()
This class provides the Context for RawDataSelector.
virtual StatusCode previous(Context &it) const
virtual StatusCode createAddress(const Context &it, IOpaqueAddress *&iop) const
virtual StatusCode initialize()
RawDataSelector(const std::string &name, ISvcLocator *svcloc)
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
virtual StatusCode resetCriteria(const std::string &criteria, Context &context) const
virtual StatusCode last(Context &it) const
virtual StatusCode rewind(Context &it) const
virtual StatusCode next(Context &it) const
virtual StatusCode createContext(Context *&it) const
virtual StatusCode releaseContext(Context *&it) const