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

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

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