/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
DybEventLoopMgr Class Reference

An Event Processor for Daya Bay. More...

#include <DybEventLoopMgr.h>

Inheritance diagram for DybEventLoopMgr:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DybEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc)
 Standard Constructor.
virtual ~DybEventLoopMgr ()
 Standard Destructor.
virtual StatusCode initialize ()
virtual StatusCode reinitialize ()
virtual StatusCode finalize ()
virtual StatusCode nextEvent (int maxevt)
virtual StatusCode executeEvent (void *par)

Protected Member Functions

StatusCode getEventRoot (IOpaqueAddress *&refpAddr)
 Create event address using event selector.

Protected Attributes

IDataManagerSvc * m_evtDataMgrSvc
IDataProviderSvc * m_evtDataSvc
IEvtSelector * m_evtSelector
IEvtSelector::Context * m_evtContext

Private Attributes

std::string m_evtSelName
 Property: EvtSelector: name of the event selector to use.
std::string m_evtStoreName
 Property: EventStore: name of the event store to use (def: "EventDataSvc")

Detailed Description

An Event Processor for Daya Bay.

This is a cleaned up version of Gaudi's EventLoopMgr. It removes:

In addition the Event Selector policy is changed to not force the setting to be same as ApplicationMgr's EvtSel.

bv@bnl.gov Sat Aug 6 12:33:06 2011

Definition at line 38 of file DybEventLoopMgr.h.


Constructor & Destructor Documentation

DybEventLoopMgr::DybEventLoopMgr ( const std::string &  nam,
ISvcLocator *  svcLoc 
)

Standard Constructor.

Definition at line 10 of file DybEventLoopMgr.cpp.

    : MinimalEventLoopMgr(nam, svcLoc)
    , m_evtDataMgrSvc(0)
    , m_evtDataSvc(0)
    , m_evtSelector(0)
    , m_evtContext(0)
{
    declareProperty("EvtSel", m_evtSelName="NONE",
                    "Name of Event Selector to use (def: NONE)");
    declareProperty("EventStore", m_evtStoreName="EventDataSvc",
                    "Name of the Event Store provider (def: EventDataSvc)");

}
DybEventLoopMgr::~DybEventLoopMgr ( ) [virtual]

Standard Destructor.

Definition at line 24 of file DybEventLoopMgr.cpp.

{
}

Member Function Documentation

StatusCode DybEventLoopMgr::initialize ( ) [virtual]

Reimplemented in DybDualEventLoopMgr.

Definition at line 28 of file DybEventLoopMgr.cpp.

                                          {
    // initilaize the base class
    MsgStream log(msgSvc(), name());

    StatusCode sc = MinimalEventLoopMgr::initialize();

    if (sc.isFailure()) {
        log << MSG::WARNING << "Error Initializing base class MinimalEventLoopMgr." << endreq;
        return sc;
    }

    log << MSG::DEBUG
        << "Getting event store service"
        << endreq;
   // Setup access to event data services
    sc = serviceLocator()->service(m_evtStoreName, m_evtDataMgrSvc, true);
    if (sc.isFailure()) {
        log << MSG::FATAL << "Error retrieving EventDataSvc interface IDataManagerSvc." << endreq;
        return sc;
    }
    sc = serviceLocator()->service(m_evtStoreName, m_evtDataSvc, true);
    if (sc.isFailure()) {
        log << MSG::FATAL << "Error retrieving EventDataSvc interface IDataProviderSvc." << endreq;
        return sc;
    }


    log << MSG::DEBUG
        << "Event selector name: \"" << m_evtSelName << "\""
        << endreq;

    if (!m_evtSelName.size() || "NONE" == m_evtSelName) {
        log << MSG::INFO << "No event selector to be used" << endreq;
        return StatusCode::SUCCESS;
    }
     
    sc = serviceLocator()->service(m_evtSelName, m_evtSelector, true);
    if (sc.isFailure()) {
        log << MSG::FATAL << "Failed to create event selector "
            << "\"" << m_evtSelName << "\"" << endreq;
        return sc;
    }

    sc = m_evtSelector->createContext(m_evtContext);
    if (sc.isFailure())   {
        log << MSG::FATAL << "Can not create the event selector Context." << endreq;
        return sc;
    }

    log << MSG::INFO << "initialized with EvtSel = " << m_evtSelName
        << ", Event Store = " << m_evtStoreName << endreq;

    return StatusCode::SUCCESS;
}
StatusCode DybEventLoopMgr::reinitialize ( ) [virtual]

Reimplemented in DybDualEventLoopMgr.

Definition at line 83 of file DybEventLoopMgr.cpp.

                                         {
    // reinitilaize the base class
    StatusCode sc = MinimalEventLoopMgr::reinitialize();
    if (sc.isFailure()) return sc;

    MsgStream log(msgSvc(), name());
    log << MSG::DEBUG << "I'm being reinitialized.  Why?" << endreq;

    return StatusCode::SUCCESS;
}
StatusCode DybEventLoopMgr::finalize ( ) [virtual]

Reimplemented in DybDualEventLoopMgr.

Definition at line 94 of file DybEventLoopMgr.cpp.

{
    MsgStream log(msgSvc(), name());

    // Release evemt selector context
    if (m_evtSelector && m_evtContext) {
        m_evtSelector->releaseContext(m_evtContext).ignore();
        m_evtContext = 0;
    }

    // Release all interfaces...
    m_evtSelector     = releaseInterface(m_evtSelector);
    m_evtDataSvc      = releaseInterface(m_evtDataSvc);
    m_evtDataMgrSvc   = releaseInterface(m_evtDataMgrSvc);

    return MinimalEventLoopMgr::finalize();
}
StatusCode DybEventLoopMgr::nextEvent ( int  maxevt) [virtual]

Reimplemented in DybDualEventLoopMgr.

Definition at line 133 of file DybEventLoopMgr.cpp.

{
    StatusCode        sc = StatusCode::SUCCESS;
    MsgStream         log( msgSvc(), name() );

    // loop over events if the maxevt (received as input) if different from -1. 
    // if evtmax is -1 it means infinite loop
    for (int nevt = 0; (maxevt == -1 ? true : nevt < maxevt);  ++nevt) {

        log << MSG::DEBUG
            << "Executing event loop #" << nevt << endreq;

        // Check if there is a scheduled stop issued by some algorithm/sevice
        if (m_scheduledStop) {
            m_scheduledStop = false;
            log << MSG::ALWAYS
                << "Terminating event processing loop due to scheduled stop" << endreq;
            return StatusCode::SUCCESS;
        }

        sc = m_evtDataMgrSvc->clearStore();
        if (sc.isFailure()) {
            log << MSG::DEBUG << "Clear of Event data store failed" << endreq;
        }

        // Setup event in the event store
        if (m_evtContext) {
            IOpaqueAddress* addr = 0;
            // Only if there is a EventSelector
            sc = getEventRoot(addr);
            if (sc.isFailure())  {
                log << MSG::INFO << "No more events in event selection " << endreq;
                return StatusCode::SUCCESS;
            }

            // Set root clears the event data store first
            sc = m_evtDataMgrSvc->setRoot("/Event", addr);
            if (sc.isFailure())  {
                log << MSG::WARNING << "Error declaring event root address." << endreq;
                continue; // not failure?
            }
            DataObject* pObject = 0;
            sc = m_evtDataSvc->retrieveObject("/Event", pObject);
            if( sc.isFailure() ) {
                log << MSG::WARNING << "Unable to retrieve Event root object" << endreq;
                return StatusCode::FAILURE;
            }
        }
        else {
            sc = m_evtDataMgrSvc->setRoot ("/Event", new DataObject());
            if (sc.isFailure() )  {
                log << MSG::WARNING << "Error declaring event root DataObject" << endreq;
            } 
        }
        // Execute event for all required algorithms
        sc = executeEvent(NULL);
        if (sc.isFailure()){
            log << MSG::ERROR << "Terminating event processing loop due to errors" << endreq;
            return StatusCode::FAILURE;
        }
    }
    return StatusCode::SUCCESS;
}
StatusCode DybEventLoopMgr::executeEvent ( void *  par) [virtual]

Definition at line 113 of file DybEventLoopMgr.cpp.

{
    MsgStream log(msgSvc(), name());

    if (m_scheduledStop) {
        log << MSG::ALWAYS 
            << "Terminating event processing loop due to a stop scheduled by an incident listener"
            << endreq;
        return StatusCode::SUCCESS;
    }

    // Execute Algorithms
    StatusCode sc = MinimalEventLoopMgr::executeEvent(par);
    if (sc.isFailure()) {
        log << MSG::ERROR << "Terminating event processing loop due to errors" << endreq;
    }

    return sc;
}
StatusCode DybEventLoopMgr::getEventRoot ( IOpaqueAddress *&  refpAddr) [protected]

Create event address using event selector.

Definition at line 198 of file DybEventLoopMgr.cpp.

{
    refpAddr = 0;
    StatusCode sc = m_evtSelector->next(*m_evtContext);
    if (sc.isFailure())  {
        return sc;
    }

    // Create root address and assign address to data service
    sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
    if (sc.isFailure()) {
        sc = m_evtSelector->next(*m_evtContext);
        if (sc.isSuccess()) {
            sc = m_evtSelector->createAddress(*m_evtContext,refpAddr);
            if (sc.isFailure())  {
                MsgStream log( msgSvc(), name() );
                log << MSG::WARNING << "Error creating IOpaqueAddress." << endreq;
            }
        }
    }
    return sc;
}

Member Data Documentation

std::string DybEventLoopMgr::m_evtSelName [private]

Property: EvtSelector: name of the event selector to use.

Definition at line 54 of file DybEventLoopMgr.h.

std::string DybEventLoopMgr::m_evtStoreName [private]

Property: EventStore: name of the event store to use (def: "EventDataSvc")

Definition at line 56 of file DybEventLoopMgr.h.

IDataManagerSvc* DybEventLoopMgr::m_evtDataMgrSvc [protected]

Definition at line 62 of file DybEventLoopMgr.h.

IDataProviderSvc* DybEventLoopMgr::m_evtDataSvc [protected]

Definition at line 63 of file DybEventLoopMgr.h.

IEvtSelector* DybEventLoopMgr::m_evtSelector [protected]

Definition at line 64 of file DybEventLoopMgr.h.

IEvtSelector::Context* DybEventLoopMgr::m_evtContext [protected]

Definition at line 65 of file DybEventLoopMgr.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:09:08 for DybEventMgr by doxygen 1.7.4