1#include "GaudiKernel/GenericAddress.h"
2#include "GaudiKernel/IOpaqueAddress.h"
3#include "GaudiKernel/IRegistry.h"
4#include "GaudiKernel/SmartDataPtr.h"
6#include "EventModel/EventModel.h"
7#include "RawDataCnv/ClassID_temp.h"
37 declareProperty(
"RawDataOutputSvc", m_ioSvcName );
38 declareProperty(
"Status", m_status = 0xFFFFFFFF );
43 StatusCode sc = ConversionSvc::initialize();
47 error() <<
"Unable to initialize ConversionSvc" << endmsg;
51 IDataProviderSvc* pIDP = 0;
53 sc = service(
"EventDataSvc", pIDP,
true );
54 if ( !sc.isSuccess() )
56 error() <<
"Unable to get EventDataSvc" << endmsg;
60 sc = setDataProvider( pIDP );
61 if ( !sc.isSuccess() )
63 error() <<
"Unable to set DataProvider" << endmsg;
69 if ( !sc.isSuccess() )
71 error() <<
"Unable to add converters to the service" << endmsg;
78 for ( LeafMap::iterator k = m_leaves.begin(); k != m_leaves.end(); k++ )
80 std::string path = ( *k ).first;
81 for ( LeafMap::iterator j = m_leaves.begin(); j != m_leaves.end(); j++ )
83 std::string pp = ( *j ).first.substr( 0, ( *j ).first.rfind(
"/" ) );
84 if ( path == pp && path != ( *j ).first ) { ( *k ).second->push_back( ( *j ).second ); }
88 sc = service( m_ioSvcName, m_ioSvc );
89 if ( sc != StatusCode::SUCCESS )
91 warning() <<
"Cant get RawDataOutputSvc " << endmsg;
95 return StatusCode::SUCCESS;
100 MsgStream log(
msgSvc(), name() );
144 return StatusCode::SUCCESS;
149 MsgStream log(
msgSvc(), name() );
151 log << MSG::DEBUG <<
" In connectOutput " << endmsg;
154 SmartDataPtr<Event::EventHeader> evt( dataProvider(), EventModel::EventHeader );
157 log << MSG::ERROR <<
"Did not retrieve event" << endmsg;
158 return StatusCode::FAILURE;
160 unsigned int eventNo = evt->eventNumber();
161 unsigned int runNo = evt->runNumber();
172 if ( m_status != 0xFFFFFFFF ) m_rawEvent->status( 1, &m_status );
173 else m_rawEvent->status( 0, NULL );
175 return StatusCode::SUCCESS;
179 MsgStream log(
msgSvc(), name() );
181 log << MSG::DEBUG <<
"In flushOutput" << endmsg;
185 log << MSG::ERROR <<
"RawDataCnvSvc not configure for output" << endmsg;
186 return StatusCode::FAILURE;
189 log << MSG::DEBUG <<
"commitOutput: Size of Event (words) =" << m_rawEvent->size_word()
192 if ( !m_ioSvc->putEvent( m_rawEvent ) )
194 log << MSG::ERROR <<
"commitOutput failed to send output" << endmsg;
195 return StatusCode::FAILURE;
222 return StatusCode::SUCCESS;
226 const ICnvFactory* fac ) {
260 return ConversionSvc::createConverter( typ, wanted, fac );
264 StatusCode status = ConversionSvc::finalize();
265 for ( LeafMap::iterator k = m_leaves.begin(); k != m_leaves.end(); k++ )
266 {
delete ( *k ).second; }
267 m_leaves.erase( m_leaves.begin(), m_leaves.end() );
274 Leaf* ll =
new Leaf( leaf );
275 std::pair<LeafMap::iterator, bool> p =
276 m_leaves.insert( LeafMap::value_type( leaf.
path, ll ) );
277 if ( p.second ) {
return StatusCode::SUCCESS; }
279 return StatusCode::FAILURE;
285 MsgStream log(
msgSvc(), name() );
286 StatusCode status = Status::INVALID_ADDRESS;
287 IRegistry* ent = pAddress->registry();
291 SmartIF<IDataManagerSvc> iaddrReg( dataProvider() );
293 status = StatusCode::SUCCESS;
294 std::string path = ent->identifier();
296 LeafMap::iterator itm = m_leaves.find( path );
297 if ( itm != m_leaves.end() )
303 for ( Leaf::iterator il = leaf->begin(); il != leaf->end(); il++ )
305 IOpaqueAddress* newAddr = 0;
306 unsigned long ipars[2] = { 0, 0 };
307 const std::string spars[2] = {
"",
"" };
309 StatusCode ir =
createAddress( repSvcType(), ( *il )->clid, spars, ipars, newAddr );
310 if ( ir.isSuccess() )
312 ir = iaddrReg->registerAddress( ( *il )->path, newAddr );
313 if ( !ir.isSuccess() )
323 else { status = IInterface::Status::NO_INTERFACE; }
329 const std::string*,
const unsigned long*,
330 IOpaqueAddress*& refpAddress ) {
331 MsgStream log(
msgSvc(), name() );
333 if ( storageType != repSvcType() )
335 log << MSG::ERROR <<
"bad storage type" << storageType << endmsg;
336 return StatusCode::FAILURE;
339 refpAddress =
new GenericAddress( storageType, clid,
"",
"", 0 );
341 return StatusCode::SUCCESS;
345 const std::string&, IOpaqueAddress*& refpAddress ) {
346 return createAddress( storageType, clid,
nullptr,
nullptr, refpAddress );
const long PACKEDRAWEVENT_StorageType
eformat::write::FullEventFragment WriteRawEvent
DECLARE_COMPONENT(RawDataCnvSvc)
StatusCode updateServiceState(IOpaqueAddress *pAddress)
RawDataCnvSvc(const std::string &name, ISvcLocator *svc)
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
Override inherited queryInterface due to enhanced interface.
StatusCode addConverters()
Add converters to the service.
IConverter * createConverter(long typ, const CLID &clid, const ICnvFactory *fac)
StatusCode connectOutput(const std::string &t)
StatusCode declareObject(const IRawDataCnvSvc::Leaf &leaf)
Associates a path on TDS with a particular converter.
StatusCode commitOutput(const std::string &t, bool b)
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
static const CLID & classID()
_EXTERN_ std::string Event
_EXTERN_ std::string MdcDigiCol
_EXTERN_ std::string MucDigiCol
_EXTERN_ std::string LumiDigiCol
_EXTERN_ std::string EmcDigiCol
_EXTERN_ std::string TofDigiCol
_EXTERN_ std::string Event
_EXTERN_ std::string HltRawCol
_EXTERN_ std::string EmcMcHitCol
_EXTERN_ std::string MucMcHitCol
_EXTERN_ std::string MdcMcHitCol
_EXTERN_ std::string TofMcHitCol
_EXTERN_ std::string McParticleCol
_EXTERN_ std::string Event
_EXTERN_ std::string Event
_EXTERN_ std::string TrigGTDCol
_EXTERN_ std::string ZddEvent