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

In This Package:

DybEvtSelector.cc

Go to the documentation of this file.
00001 #include "DybEvtSelector.h"
00002 
00003 //#include "TBaseEvent/RegistrationSequenceCnv.h"
00004 //using namespace DayaBay;
00005 
00006 #include "DybIO/IDybIODaqSvc.h"
00007 #include "RootIOSvc/IRootIOSvc.h"
00008 #include "RootIOSvc/RootInputStream.h"
00009 #include "Event/RegistrationSequence.h"
00010 
00011 #include "GaudiKernel/IDataManagerSvc.h"
00012 #include "GaudiKernel/MsgStream.h"
00013 
00014 #include <string>
00015 
00016 DybEvtSelector::DybEvtSelector(const std::string& name, ISvcLocator* svcloc)
00017     : Service(name,svcloc)
00018     , RootIOEvtSelector(name,svcloc)
00019     , m_reqSeqName("")
00020     , m_daqSvc(0)
00021     , m_controlStream(0)/*, m_regCnv(0)*/
00022 {
00023     m_reqSeqName = DayaBay::RegistrationSequenceLocation::Default;
00024     declareProperty("ReqSeq",m_reqSeqName,
00025                     "TES/TFile path where to find the RegistrationSequence");
00026 
00027 }
00028 
00029 DybEvtSelector::~DybEvtSelector()
00030 {
00031 }
00032 
00033 StatusCode DybEvtSelector::initialize()
00034 {
00035     StatusCode sc = RootIOEvtSelector::initialize();
00036     if (sc.isFailure()) {
00037       return sc;
00038     }
00039 
00040     IService* isvc=0;
00041     sc = serviceLocator()->service("DybIODaqSvc","DybIODaqSvc", isvc);
00042     if (sc.isFailure()) {
00043       m_daqSvc = 0;
00044     } else {
00045       sc = isvc->queryInterface(IDybIODaqSvc::interfaceID(), (void**)&m_daqSvc);
00046       if (sc.isFailure()) {
00047         m_daqSvc = 0;
00048       }
00049     }
00050     return StatusCode::SUCCESS;
00051 }
00052 
00053 StatusCode DybEvtSelector::finalize()
00054 {
00055     if (0 != m_daqSvc) {
00056         m_daqSvc->release();
00057     }
00058     return RootIOEvtSelector::finalize();
00059 }
00060 
00061 StatusCode DybEvtSelector::setEntry(RootIOEvtSelector::Context& rc, int entry) const
00062 {
00063     MsgStream log(msgSvc(), "DybEvtSelector");
00064 
00065     if (!m_controlStream) {
00066         IRootIOSvc::InputStreamMap& ism = m_rioSvc->inputStreams();
00067         m_controlStream = ism[m_reqSeqName];
00068         if (!m_controlStream) {
00069             log << MSG::WARNING << "failed to get control stream at " 
00070                 << m_reqSeqName << endreq;
00071             return StatusCode::FAILURE;
00072         }
00073     }
00074 
00075     log << MSG::DEBUG << "Loading control stream (RegistrationSequence) entry " << entry << endreq;
00076 
00077     // Set entry to the RegistrationSequence
00078     if (0 != m_daqSvc) {
00079         StatusCode sc = m_daqSvc->setEventEntry(entry);
00080         if (sc.isFailure()) {
00081             log << MSG::INFO
00082                 << "No more DAQ blocks are available"
00083                 << endreq;
00084         }
00085     }
00086 
00087     bool okay = m_controlStream->setEntry(entry,false); // false == do not read TObject
00088     if (!okay) {
00089         log << MSG::WARNING << "Failed to set entry " << 
00090             entry << " for control input stream " << m_reqSeqName << endreq;
00091         log << MSG::WARNING << "End of the input stream?" << endreq;
00092         return StatusCode::FAILURE;
00093     }
00094 
00095     //IRootIOSvc::InputStreamMap& ism = m_rioSvc->inputStreams();
00096 
00097     rc.m_entry = entry;
00098     return StatusCode::SUCCESS;
00099 }
00100 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:47:44 2011 for DybIO by doxygen 1.4.7