/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/RawDataCnv/RawDataCnv-00-04-35/src/RawDataLumiDigiCnv.cxx

Go to the documentation of this file.
00001 // Include files.
00002 #include "GaudiKernel/MsgStream.h"
00003 #include "GaudiKernel/IDataProviderSvc.h"
00004 // for Mutil-thread by tianhl
00005 #include "GaudiKernel/ThreadGaudi.h"
00006 // for Mutil-thread by tianhl
00007 
00008 #include "EventModel/EventModel.h"
00009 #include "LumiDigi/LumiDigi.h"
00010 #include "RawDataCnv/RawDataInputSvc.h" 
00011 #include "RawDataCnv/RawDataLumiDigiCnv.h"
00012 
00013 
00014 // REMOVE THIS LINE AFTER "PACKEDRAWEVENT_StorageType" IS ADDED TO
00015 // THE FILE "GaudiKernel/ClassID.h"
00016 extern const CLID& CLID_LumiDigiCol;
00017 
00018 // Constructor.
00019 RawDataLumiDigiCnv::RawDataLumiDigiCnv(ISvcLocator* svc) : 
00020 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00021 {
00022 }
00023 
00024 RawDataLumiDigiCnv::~RawDataLumiDigiCnv()
00025 {
00026 }
00027 
00028 // Return the identification number of this converter to the 
00029 // persistency service.
00030 const CLID& RawDataLumiDigiCnv::classID()
00031 {
00032    return CLID_LumiDigiCol;
00033 }
00034 
00035 StatusCode RawDataLumiDigiCnv::initialize()
00036 {
00037 
00038     std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
00039     std::string RawDataInputSvc_Name("RawDataInputSvc");
00040     std::string RawDataLumiDigiCnv_Name("RawDataLumiDigiCnv");
00041     
00042     // for Mutil-thread by tianhl
00043     //ConversionSvc*  pCnvSvc = 0;
00044     //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
00045     SmartIF<IService> pCnvSvc(conversionSvc());  
00046     if  (isGaudiThreaded(pCnvSvc->name())){
00047         PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00048         RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00049         RawDataLumiDigiCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00050       }
00051     //}
00052     
00053     StatusCode sc = RawDataBaseCnv::initialize();
00054     if(StatusCode::SUCCESS!=sc)
00055     {
00056        return sc;
00057     }
00058 
00059     MsgStream log(messageService(), RawDataLumiDigiCnv_Name.c_str());
00060 
00061     // Check RawDataCnvSvc
00062    IService* isvc = 0;
00063    StatusCode status = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
00064 
00065    m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 
00066     if(m_RawDataAccess  == 0 ) {
00067       log<<MSG::ERROR<< "  RawDataLumiCnv: Cant cast to  RawDataCnvSvc " <<endreq; 
00068       return StatusCode::FAILURE ;
00069    }
00070 
00071    if(m_RawDataAccess)
00072         log << MSG::INFO << "RawDataCnvSvc retrieved "<< endreq;
00073 
00074    IService* svc ;
00075    sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
00076    if(sc != StatusCode::SUCCESS ) {
00077        log<<MSG::WARNING << " Cant get RawDataInputSvc " <<endreq;
00078        return sc ;
00079    }
00080  
00081    m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
00082    if(m_inputSvc == 0 ) {
00083        log<<MSG::WARNING<< " Cant cast to  RawDataInputSvc " <<endreq;
00084        return StatusCode::FAILURE ;
00085    }
00086  
00087    return StatusCode::SUCCESS; 
00088 }
00089 
00090 
00091 StatusCode RawDataLumiDigiCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
00092     // Purpose and Method:  This method does nothing other than announce it has
00093     //   been called.
00094 
00095     //MsgStream log(msgSvc(), "RawDataLumiDigiCnv");
00096     //log << MSG::DEBUG << "RawDataLumiDigiCnv::updateObj" << endreq;
00097     return Converter::updateObj(pAddr, pObj);
00098 }
00099 
00100 // Create a converted object in the Transient Data Store.
00101 StatusCode RawDataLumiDigiCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
00102 {
00103    DataObject* pLumi;
00104    dataProvider()->findObject("/Event/Digi/LumiDigiCol", pLumi);
00105 
00106    if ( pLumi == NULL ) {
00107       LumiDigiCol* lumiDigiCol = new LumiDigiCol;
00108       dataProvider()->registerObject("/Event/Digi/LumiDigiCol", lumiDigiCol);
00109       pObj = lumiDigiCol;
00110    }
00111    else {
00112       pObj = pLumi;
00113    }
00114 
00115    return StatusCode::SUCCESS;
00116 }
00117 
00118 StatusCode RawDataLumiDigiCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)  
00119 {
00120   return StatusCode::SUCCESS;
00121 }

Generated on Tue Nov 29 22:58:32 2016 for BOSS_7.0.2 by  doxygen 1.4.7