00001 #include "GaudiKernel/MsgStream.h"
00002 #include "GaudiKernel/Bootstrap.h"
00003
00004 #include "GaudiKernel/Service.h"
00005 #include "GaudiKernel/DataSvc.h"
00006 #include <exception>
00007 #include "RawDataProviderSvc/RawDataProviderBase.h"
00008
00009 #include "GaudiKernel/ThreadGaudi.h"
00010
00011
00012 RawDataProviderBase::RawDataProviderBase() :
00013 m_svcLocator(0),
00014 m_msgSvc(0),
00015 m_name()
00016 {}
00017
00018
00019 RawDataProviderBase::RawDataProviderBase( const char* name ) :
00020 m_svcLocator(0),
00021 m_msgSvc(0),
00022 m_name(name)
00023 {}
00024
00025
00026 StatusCode RawDataProviderBase::initialize( ISvcLocator* pSvcLoc, IMessageSvc* pMsg ) {
00027 if(pSvcLoc!=0){
00028
00029
00030 std::string evtDataSvc_name("EventDataSvc");
00031 if(isGaudiThreaded(m_name)){
00032 evtDataSvc_name += getGaudiThreadIDfromName(m_name);
00033 std::cout << "---------------------------------- " << evtDataSvc_name << std::endl;
00034 }
00035
00036 IDataProviderSvc* evtSvc;
00037 StatusCode sc = pSvcLoc->service(evtDataSvc_name.c_str(),evtSvc,true);
00038 if (!sc.isSuccess()){
00039 std::cout << "RawDataProviderBase::initialize() ERROR Could not load EventDataSvc" << std::endl;
00040 return StatusCode::FAILURE;
00041 }
00042 m_svcLocator= pSvcLoc;
00043 }
00044 else {
00045 m_svcLocator= Gaudi::svcLocator();
00046 }
00047 try{
00048 if(pMsg!=0){
00049 MsgStream log(pMsg, m_name);
00050 log << MSG::INFO << "RawDataProviderBase::initialize() Test..." << endreq;
00051 m_msgSvc=pMsg;
00052 }
00053 else{
00054 StatusCode sc = m_svcLocator->service("MessageSvc", m_msgSvc ,true);
00055 if (!sc.isSuccess()) throw SvcDisable("MessageSvc");
00056 }
00057 }
00058 catch(...){
00059 std::cout << "RawDataProviderBase::initialize() ERROR Could not get MessageSvc" << std::endl;
00060 }
00061
00062 return StatusCode::SUCCESS;
00063 }