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

Go to the documentation of this file.
00001 #include "GaudiKernel/MsgStream.h"
00002 #include "TrigEvent/TrigGTD.h"
00003 #include "RawDataCnv/RawDataAddress.h"
00004 #include "RawDataCnv/EventManagement/RAWEVENT.h"
00005 #include "RawDataCnv/RawDataInputSvc.h"
00006 #include "RawDataCnv/RawDataTrigGTDCnv.h"
00007 
00008 extern const CLID& CLID_TrigGTDCol;
00009 
00010 // Constructor
00011 RawDataTrigGTDCnv::RawDataTrigGTDCnv(ISvcLocator* svc) :
00012 RawDataBaseCnv(PACKEDRAWEVENT_StorageType, classID(), svc)
00013 {
00014   init();
00015 }
00016 
00017 // Return the identification number of this converter to the persistency service.
00018 const CLID& RawDataTrigGTDCnv::classID()
00019 {
00020   return CLID_TrigGTDCol;
00021 }
00022 
00023 StatusCode RawDataTrigGTDCnv::init()
00024 {
00025   StatusCode sc = RawDataBaseCnv::initialize();
00026   if (sc.isFailure()) {
00027     return sc;
00028   }
00029 
00030   MsgStream log(messageService(), "RawDataTrigGTDCnv");
00031 
00032   IService* isvc = 0;
00033   StatusCode status = serviceLocator()->service("PackedRawDataCnvSvc", isvc, true);
00034 
00035   m_RawDataAccess = dynamic_cast<PackedRawDataCnvSvc*> (isvc);
00036   if (m_RawDataAccess == 0) {
00037     log << MSG::ERROR << "RawDataTrigGTDCnv: Cant cast to RawDataCnvSvc" << endreq;
00038     return StatusCode::FAILURE;
00039   }
00040 
00041   if (m_RawDataAccess) log << MSG::INFO << "RawDataCnvSvc retrieved" << endreq;
00042 
00043   IService* svc;
00044   sc = serviceLocator()->getService("RawDataInputSvc", svc);
00045   if (sc.isFailure()) {
00046     log << MSG::WARNING << "Cant get RawDataInputSvc" << endreq;
00047     return sc;
00048   }
00049 
00050   m_inputSvc = dynamic_cast<RawDataInputSvc*> (svc);
00051   if (m_inputSvc == 0) {
00052     log << MSG::WARNING << "Cant cast to RawDataInputSvc" << endreq;
00053     return StatusCode::FAILURE;
00054   }
00055 
00056   return StatusCode::SUCCESS;
00057 }
00058 
00059 StatusCode RawDataTrigGTDCnv::updateObj(IOpaqueAddress* pAddr, DataObject* pObj) {
00060   MsgStream log(msgSvc(), "RawDataTrigGTDCnv");
00061   log << MSG::DEBUG << "RawDataTrigGTDCnv::updateObj" << endreq;
00062   return Converter::updateObj(pAddr, pObj);
00063 }
00064 
00065 // Create a converted object in the Transient Data Store.
00066 StatusCode RawDataTrigGTDCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
00067 {
00068   MsgStream log(msgSvc(), "RawDataTrigGTDCnv");
00069   RawDataAddress* pEFAddr;
00070 
00071   RAWEVENT* evt;
00072   TrigGTD*  trigGTD;
00073 
00074   TrigGTDCol* gtdCol = new TrigGTDCol;
00075   pObj = gtdCol;
00076 
00077   evt = m_inputSvc->currentEvent();
00078   if (evt == NULL) {
00079     log << MSG::ERROR << "RawDataTrigGTDCnv::createObj has no event!" << endreq;
00080     return StatusCode::FAILURE;
00081   }
00082 
00083   const BufferHolder& gtdBuf = evt->getGTDBuf();
00084   uint32_t nbuf = gtdBuf.nBuf();
00085 
00086   for (uint32_t i = 0; i < nbuf; i++) {
00087     uint32_t* buf = gtdBuf(i);
00088     uint32_t bufSize = gtdBuf.bufSize(i);
00089     uint32_t index = 0;
00090     while (bufSize - index > 1) {
00091       uint32_t blockSize = ( ((*(buf+index))>>14) & 0x3FF);
00092       uint32_t id = ((*(buf+index))>>24);
00093       if (blockSize == 0 || (index+blockSize) > bufSize) break;
00094       if ((id> 0xD1 && id < 0xD8 && id != 0xD5) || id == 0xDA || (id > 0xE1 && id < 0xED)) {
00095         trigGTD = new TrigGTD(buf+index);
00096         gtdCol->push_back(trigGTD);
00097       }
00098       index += blockSize;
00099     }
00100   }
00101 
00102   return StatusCode::SUCCESS;
00103 }
00104 
00105 StatusCode RawDataTrigGTDCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)
00106 {
00107   MsgStream log(messageService(), "RawDataTrigGTDCnv");
00108 
00109   return StatusCode::SUCCESS;
00110 }

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