/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 #include "Event/ReadoutHeader.h" 00002 00003 #include "Event/ReadoutPmtCrate.h" 00004 #include "Event/ReadoutRpcCrate.h" 00005 00006 #include "GaudiKernel/Bootstrap.h" 00007 #include "GaudiKernel/IService.h" 00008 #include "GaudiKernel/ISvcLocator.h" 00009 #include "DaqReadoutSvc/IDaqReadoutSvc.h" 00010 00011 static IDaqReadoutSvc* getDaqReadoutSvc() { 00012 ISvcLocator* svcLocator = Gaudi::svcLocator(); 00013 IDaqReadoutSvc* daqReadoutSvc = 0; 00014 IService* svc = 0; 00015 StatusCode status = svcLocator->getService("DaqReadoutSvc", 00016 svc, 00017 true); 00018 if (status.isFailure() ) { 00019 return 0; 00020 } 00021 status = svc->queryInterface(IID_IDaqReadoutSvc, 00022 (void**)&daqReadoutSvc); 00023 if (status.isFailure() ) { 00024 return 0; 00025 } 00026 return daqReadoutSvc; 00027 } 00028 00029 const DayaBay::DaqCrate* DayaBay::ReadoutHeader::daqCrate() const { 00030 if (0 == m_daqCrate) { 00031 // Create DAQ crate if necessary. 00032 IDaqReadoutSvc* daqReadoutSvc = getDaqReadoutSvc(); 00033 if (0 != daqReadoutSvc) { 00034 if (daqReadoutSvc->isGenerating()) { 00035 const DayaBay::Detector& detector = m_readout->detector(); 00036 ReadoutPmtCrate* pmtCrate; 00037 ReadoutRpcCrate* rpcCrate; 00038 if (0 != (pmtCrate = dynamic_cast<ReadoutPmtCrate*>(m_readout))) { 00039 const DayaBay::DaqCrate** crate = const_cast<const DayaBay::DaqCrate**>(&m_daqCrate); 00040 *(crate) = pmtCrate->daqCrate(daqReadoutSvc->runNumber(detector), 00041 daqReadoutSvc->nextEventNumber(detector), 00042 daqReadoutSvc->ltbSlot(detector)); 00043 } else if (0 != (rpcCrate = dynamic_cast<ReadoutRpcCrate*>(m_readout))) { 00044 const DayaBay::DaqCrate** crate = const_cast<const DayaBay::DaqCrate**>(&m_daqCrate); 00045 // FIXME: what is the DaqCrate's ltbSlot for? Need to treat the number in proper way, not hardcoded. 00046 int rtmSlot = 3; 00047 *(crate) = rpcCrate->daqCrate(daqReadoutSvc->runNumber(detector), 00048 daqReadoutSvc->nextEventNumber(detector), rtmSlot); 00049 } 00050 } 00051 } 00052 } 00053 return m_daqCrate; 00054 00055 }