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

Go to the documentation of this file.
00001 //====================================================================
00002 //      RawDataMcCnv.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/IRegistry.h"
00014 // for Mutil-thread by tianhl
00015 #include "GaudiKernel/ThreadGaudi.h"
00016 // for Mutil-thread by tianhl
00017  
00018 #include "McTruth/McEvent.h"
00019 #include "RawDataCnv/RawDataAddress.h" 
00020 #include "RawDataCnv/RawDataInputSvc.h" 
00021 #include "RawDataCnv/RawDataMcCnv.h"
00022 
00023 
00024 extern const CLID& CLID_McEvent;
00025 
00026 // Constructor.
00027 RawDataMcCnv::RawDataMcCnv(ISvcLocator* svc) : 
00028 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00029 {
00030   //init();
00031 }
00032 
00033 // Return the identification number of this converter to the 
00034 // persistency service.
00035 const CLID& RawDataMcCnv::classID()
00036 {
00037   return CLID_McEvent;
00038 }
00039 
00040 StatusCode RawDataMcCnv::initialize()
00041 {
00042     std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
00043     std::string RawDataInputSvc_Name("RawDataInputSvc");
00044     std::string RawDataMcCnv_Name("RawDataMcCnv");
00045     
00046     // for Mutil-thread by tianhl
00047     //ConversionSvc*  pCnvSvc = 0;
00048     //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
00049     SmartIF<IService> pCnvSvc(conversionSvc());  
00050     if  (isGaudiThreaded(pCnvSvc->name())){
00051         PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00052         RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00053         RawDataMcCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00054       }
00055     //}
00056     
00057 
00058   MsgStream log(messageService(), RawDataMcCnv_Name.c_str());
00059 
00060   StatusCode sc = RawDataBaseCnv::initialize();
00061   if (StatusCode::SUCCESS != sc) {
00062     log << MSG::ERROR << "RawDataBaseCnv: Cant initialize PackedRawDataCnvSvc" << endreq;
00063     return sc;
00064   }
00065 
00066   // Check RawDataCnvSvc
00067   IService* isvc = 0;
00068   sc = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
00069   if (sc != StatusCode::SUCCESS) {
00070     log << MSG::ERROR << "Cant get PackedRawDataCnvSvc" << endreq;
00071   }
00072 
00073   m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 
00074   if (m_RawDataAccess  == 0 ) {
00075     log << MSG::ERROR << "RawDataMdcCnv: Cant cast to RawDataCnvSvc " << endreq; 
00076     return StatusCode::FAILURE;
00077   }
00078 
00079   sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), isvc);
00080   if (sc != StatusCode::SUCCESS ) {
00081     log << MSG::WARNING << "Cant get RawDataInputSvc " << endreq;
00082     return sc ;
00083   }
00084 
00085   m_inputSvc = dynamic_cast<RawDataInputSvc*> (isvc);
00086   if (m_inputSvc == 0 ) {
00087     log << MSG::ERROR << "Cant cast to RawDataInputSvc " << endreq;
00088     return StatusCode::FAILURE ;
00089   }
00090 
00091   return StatusCode::SUCCESS; 
00092 }
00093 
00094 
00095 StatusCode RawDataMcCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
00096   // Purpose and Method:  This method does nothing other than announce it has
00097   //   been called.
00098 
00099   //MsgStream log(msgSvc(), "RawDataMcCnv");
00100   //log << MSG::DEBUG << "RawDataMcCnv::updateObj" << endreq;
00101   return Converter::updateObj(pAddr, pObj);
00102 }
00103 
00104 // Create a converted object in the Transient Data Store.
00105 StatusCode RawDataMcCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
00106 {
00107   //MsgStream log(msgSvc(), "RawDataMcCnv");
00108 
00109   McEvent *mcEvent = new McEvent;
00110   pObj = mcEvent;
00111    
00112   return StatusCode::SUCCESS; 
00113 
00114 }
00115 
00116 StatusCode RawDataMcCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)  
00117 {
00118    // convert PixelRaw in the container into ByteStream
00119   //MsgStream log(messageService(), "RawDataMcCnv");
00120   
00121   std::string nm = pObj->registry()->name();
00122   
00123   RawDataAddress* addr = new RawDataAddress(classID(), nm, "");
00124 
00125   pAddr = addr;
00126   
00127   return StatusCode::SUCCESS; 
00128 }
00129 
00130 

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