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

Go to the documentation of this file.
00001 //====================================================================
00002 //      RawDataDigiCnv.cxx
00003 //====================================================================
00004 //
00005 // Description: A converter class to unpack Event Filter packed raw   
00006 //              event persistent data and place it in the Transient    
00007 //              Data Store of Athena.
00008 //
00009 //--------------------------------------------------------------------
00010 
00011 // Include files.
00012 #include "GaudiKernel/MsgStream.h"
00013 #include "GaudiKernel/StatusCode.h"
00014 #include "GaudiKernel/IRegistry.h"
00015 #include "GaudiKernel/Converter.h"
00016 // for Mutil-thread by tianhl
00017 #include "GaudiKernel/ThreadGaudi.h"
00018 // for Mutil-thread by tianhl
00019 
00020 #include "RawEvent/DigiEvent.h"
00021 #include "RawDataCnv/RawDataAddress.h"
00022 #include "RawDataCnv/RawDataInputSvc.h"
00023 #include "RawDataCnv/PackedRawDataCnvSvc.h"  
00024 #include "RawDataCnv/EventManagement/RawEvent.h"
00025 #include "RawDataCnv/RawDataDigiCnv.h"
00026 
00027 
00028 extern const CLID& CLID_DigiEvent;  
00029 
00030 // Constructor.
00031 RawDataDigiCnv::RawDataDigiCnv(ISvcLocator* svc) : 
00032 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00033 {
00034     //init();
00035 }
00036 
00037 // Return the identification number of this converter to the 
00038 // persistency service.
00039 const CLID& RawDataDigiCnv::classID()
00040 {
00041   return CLID_DigiEvent;
00042 }
00043 
00044 StatusCode RawDataDigiCnv::initialize() 
00045 {
00046     std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
00047     std::string RawDataInputSvc_Name("RawDataInputSvc");
00048     std::string RawDataDigiCnv_Name("RawDataDigiCnv");
00049     
00050     // for Mutil-thread by tianhl
00051     //ConversionSvc*  pCnvSvc = 0;
00052     SmartIF<IService> pCnvSvc(conversionSvc());
00053     //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
00054       if  (isGaudiThreaded(pCnvSvc->name())){
00055         PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00056         RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00057         RawDataDigiCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00058       }
00059     //}
00060     // for Mutil-thread by tianhl
00061     StatusCode sc = RawDataBaseCnv::initialize();
00062     if(StatusCode::SUCCESS!=sc)
00063     {
00064        return sc;
00065     }
00066 
00067     MsgStream log(messageService(), RawDataDigiCnv_Name.c_str());
00068 
00069     IService* svc = 0;
00070     sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), svc);
00071     if (sc != StatusCode::SUCCESS) {
00072         log << MSG::ERROR << "Can't get RawDataAccess interface" << endreq;
00073         return StatusCode::FAILURE;
00074     }
00075 
00076     m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (svc);
00077     if (m_RawDataAccess  == 0 ) {
00078       log << MSG::ERROR << "RawDataCnv: Cant cast to RawDataCnvSvc" << endreq;
00079       return StatusCode::FAILURE;
00080     }
00081 
00082     sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
00083     if(sc != StatusCode::SUCCESS ) {
00084         log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq;
00085         return sc ;
00086     }
00087  
00088     m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
00089     if(m_inputSvc == 0 ) {
00090         log << MSG::ERROR << "Cant cast to RawDataInputSvc" << endreq;
00091         return StatusCode::FAILURE ;
00092     }
00093 
00094     return StatusCode::SUCCESS;
00095 }
00096 
00097 
00098 StatusCode RawDataDigiCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
00099     // Purpose and Method:  This method does nothing other than announce it has
00100     //   been called.
00101 
00102     //MsgStream log(msgSvc(), "RawDataDigiCnv");
00103     //log << MSG::DEBUG << "RawDataDigiCnv::updateObj" << endreq;
00104     return Converter::updateObj(pAddr, pObj);
00105 }
00106 
00107 // Create a converted object in the Transient Data Store.
00108 StatusCode RawDataDigiCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
00109 {
00110    MsgStream log(msgSvc(), "RawDataDigiCnv");
00111    //RawDataAddress *pEFAddr;
00112    
00113    // Purpose and Method:  This converter will create an empty EventHeader on
00114    //   the TDS.
00115    DigiEvent *digi = new DigiEvent();
00116    // Set fromMc to false
00117    digi->initialize(false);
00118    pObj = digi;
00119    return StatusCode::SUCCESS;
00120 
00121 }
00122 
00123 StatusCode RawDataDigiCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)        
00124 {
00125     // convert Raws in the container into ByteStream
00126     StatusCode sc = StatusCode::SUCCESS ; 
00127     //MsgStream log(messageService(), "RawDataDigiCnv");
00128  
00129     //WriteRawEvent* re = static_cast<WriteRawEvent*>(m_RawDataAccess->getRawEvent()); 
00130  
00131  
00132     std::string nm = pObj->registry()->name(); 
00133  
00134     RawDataAddress* addr = new RawDataAddress(classID(), nm, ""); 
00135  
00136     pAddr = addr; 
00137  
00138     return StatusCode::SUCCESS; 
00139  
00140 }
00141 
00142 

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