| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

ReadoutHeader.cc

Go to the documentation of this file.
00001 #include "Event/ReadoutHeader.h"
00002 
00003 #include "Event/ReadoutPmtCrate.h"
00004 
00005 #include "GaudiKernel/Bootstrap.h"
00006 #include "GaudiKernel/IService.h"
00007 #include "GaudiKernel/ISvcLocator.h"
00008 #include "DaqReadoutSvc/IDaqReadoutSvc.h"
00009 
00010 static IDaqReadoutSvc*  getDaqReadoutSvc() {
00011   ISvcLocator* svcLocator = Gaudi::svcLocator();
00012   IDaqReadoutSvc* daqReadoutSvc = 0;
00013   IService* svc = 0;
00014   StatusCode status = svcLocator->getService("DaqReadoutSvc",
00015                                              svc,
00016                                              true);
00017   if (status.isFailure() ) {
00018       return 0;
00019   }
00020   status = svc->queryInterface(IID_IDaqReadoutSvc,
00021                                (void**)&daqReadoutSvc);
00022   if (status.isFailure() ) {
00023       return 0;
00024   }
00025   return daqReadoutSvc;
00026 }
00027 
00028 const DayaBay::DaqCrate* DayaBay::ReadoutHeader::daqCrate() const {
00029     if (0 == m_daqCrate) {
00030         // Create DAQ crate if necessary.
00031         IDaqReadoutSvc* daqReadoutSvc = getDaqReadoutSvc();
00032         if (0 != daqReadoutSvc) {
00033             if (daqReadoutSvc->isGenerating()) {
00034                 const DayaBay::Detector& detector = m_readout->detector();
00035                 ReadoutPmtCrate* pmtCrate;
00036                 if (0 != (pmtCrate = dynamic_cast<ReadoutPmtCrate*>(m_readout))) {
00037                     const DayaBay::DaqCrate** crate = const_cast<const DayaBay::DaqCrate**>(&m_daqCrate);
00038                     *(crate) = pmtCrate->daqCrate(daqReadoutSvc->runNumber(detector),
00039                                                   daqReadoutSvc->nextEventNumber(detector),
00040                                                   daqReadoutSvc->ltbSlot(detector));
00041                 }
00042             }
00043         }
00044     }
00045     return m_daqCrate;
00046 
00047 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:24:49 2011 for ReadoutEvent by doxygen 1.4.7