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

Go to the documentation of this file.
00001 //====================================================================
00002 //      RawDataMucDigiCnv.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/SmartDataPtr.h" 
00014 // for Mutil-thread by tianhl
00015 #include "GaudiKernel/ThreadGaudi.h"
00016 // for Mutil-thread by tianhl
00017 
00018 #include "EventModel/EventModel.h"
00019 #include "MucRawEvent/MucDigi.h"
00020 #include "RawDataCnv/EventManagement/RAWEVENT.h" 
00021 #include "RawDataCnv/EventManagement/RawEvent.h" 
00022 #include "RawDataCnv/RawDataInputSvc.h" 
00023 #include "RawDataCnv/RawDataMucDigiCnv.h"
00024 
00025 
00026 
00027 extern const CLID& CLID_MucDigiCol;
00028 
00029 // Constructor.
00030 RawDataMucDigiCnv::RawDataMucDigiCnv(ISvcLocator* svc) : 
00031 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc) 
00032 {
00033 }
00034 
00035 RawDataMucDigiCnv::~RawDataMucDigiCnv()
00036 {
00037    MucConverter::destroy();
00038 }
00039 
00040 // Return the identification number of this converter to the 
00041 // persistency service.
00042 const CLID& RawDataMucDigiCnv::classID()
00043 {
00044    return CLID_MucDigiCol;
00045 }
00046 
00047 StatusCode RawDataMucDigiCnv::initialize()
00048 {
00049    std::string PackedRawDataCnvSvc_Name("PackedRawDataCnvSvc");
00050    std::string RawDataInputSvc_Name("RawDataInputSvc");
00051    std::string RawDataMucDigiCnv_Name("RawDataMucDigiCnv");
00052 
00053    // for Mutil-thread by tianhl
00054    //ConversionSvc*  pCnvSvc = 0;
00055    //if (pCnvSvc = dynamic_cast<ConversionSvc*>(conversionSvc())){
00056    SmartIF<IService> pCnvSvc(conversionSvc());   
00057    if  (isGaudiThreaded(pCnvSvc->name())){
00058          PackedRawDataCnvSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00059          RawDataInputSvc_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00060          RawDataMucDigiCnv_Name += getGaudiThreadIDfromName(pCnvSvc->name());
00061       }
00062    //}
00063 
00064    MsgStream log(messageService(), RawDataMucDigiCnv_Name.c_str());
00065 
00066    StatusCode sc = RawDataBaseCnv::initialize();
00067    if ( sc.isFailure() ) {
00068       return sc;
00069    }
00070 
00071    // Check RawDataCnvSvc
00072    IService* isvc = 0;
00073    StatusCode status = serviceLocator()->service(PackedRawDataCnvSvc_Name.c_str(), isvc, true);
00074    m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc); 
00075    if(m_RawDataAccess  == 0 ) {
00076       log<<MSG::ERROR<< "  MucRawDataCnv: Cant cast to  RawDataCnvSvc " <<endreq; 
00077       return StatusCode::FAILURE ;
00078    }
00079 
00080    IService* svc ;
00081    sc = serviceLocator()->getService(RawDataInputSvc_Name.c_str(), svc);
00082    //if ( sc.isFailure() ) {
00083    //   log<<MSG::WARNING << " Cant get RawDataInputSvc " <<endreq;
00084    //   return sc ;
00085    //}
00086    m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
00087    if ( m_inputSvc == 0 ) {
00088       log<< MSG::WARNING << " Cant cast to  RawDataInputSvc " <<endreq;
00089       return StatusCode::FAILURE ;
00090    }
00091 
00092    m_cnv = MucConverter::instance();
00093 
00094    return StatusCode::SUCCESS; 
00095 }
00096 
00097 
00098 StatusCode RawDataMucDigiCnv::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(), "RawDataMucDigiCnv");
00103     //log << MSG::DEBUG << "RawDataMucDigiCnv::updateObj" << endreq;
00104     return Converter::updateObj(pAddr, pObj);
00105 }
00106 
00107 // Create a converted object in the Transient Data Store.
00108 StatusCode RawDataMucDigiCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
00109 {
00110   //MsgStream log(msgSvc(), "RawDataMucDigiCnv");
00111   // Purpose and Method:  This converter will create an empty MucDigiCol on
00112   //   the TDS.
00113   MucDigiCol *digiCol = new MucDigiCol;
00114   pObj = digiCol;
00115 
00116   RAWEVENT* evt = m_inputSvc->currentEvent(); 
00117   if (evt == NULL) {
00118     cout << "RawDataMucDigiCnv::createObj has event!" << endl; 
00119     return StatusCode::FAILURE;
00120   }
00121 
00122   const BufferHolder& mucBuf = evt->getMucBuf();
00123 
00124   return m_cnv->convert(mucBuf, digiCol); 
00125 }
00126 
00127 StatusCode RawDataMucDigiCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)  
00128 {
00129   // convert PixelRaw in the container into ByteStream
00130   //MsgStream log(messageService(), "RawDataMucDigiCnv");
00131 
00132   WriteRawEvent*& re = m_RawDataAccess->getRawEvent(); 
00133   if (re == 0) {
00134     //log << " get RawEvent failed !" << endreq;
00135     return StatusCode::FAILURE; 
00136   }
00137 
00138   SmartDataPtr<MucDigiCol> digiCol(dataProvider(), EventModel::Digi::MucDigiCol);
00139   if (digiCol == 0) {
00140     //log << "no MucDigiCol found" << endreq;
00141     return StatusCode::FAILURE;
00142   }
00143   /*
00144   else {
00145     log << MSG::INFO << endreq << "Detailed dump of 1st event: " << endreq << endreq;
00146     int ndigi = 0;
00147     MucDigiCol::const_iterator pMucDigi = digiCol->begin();
00148     for (pMucDigi; pMucDigi!= digiCol->end(); pMucDigi++) {
00149       log <<MSG::INFO << "Digi " << ndigi++ << " ";
00150       // output the digi proper:  " << digi " no longer works because
00151       // "digi" now returns an integer sort order
00152       (**pMucDigi).fillStream(log.stream());
00153       log << endreq;
00154     }
00155   }
00156   */
00157 
00158   return m_cnv->convert(digiCol, re);
00159 }

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