/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 | Private Member Functions | Private Attributes
DybAbortEventAlg Class Reference

Abort an execution cycle. More...

#include <DybAbortEventAlg.h>

List of all members.

Public Member Functions

 DybAbortEventAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~DybAbortEventAlg ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()

Private Member Functions

StatusCode abort_event (const std::string &reason)

Private Attributes

std::vector< std::string > m_requiredHeaders
 Property: RequiredHeaders: a list of TES locations that are required to exist.
std::string m_requireReadout
 Property: RequireReadout: if set, require a ReadoutHeader and that it has a ReadoutObject.
int m_siteMask
 Property: Sites: a bit mask of what sites to accept.
int m_detectorMask
 Property: Detectors: a bit mask of what detectors to accept.
bool m_goth
 Property: Force: set true to immediately abort any and all executions.
IIncidentSvc * m_incidentSvc

Detailed Description

Abort an execution cycle.

Sometimes you want to "shield" some algorithms from running during a given execution cycle. For example, if you only want to run calibration on water pools you can abort any execution cycles that instead have AD or RPC readouts.

The default configuration is permissive.

bv@bnl.gov Thu Apr 5 12:36:20 2012

Definition at line 30 of file DybAbortEventAlg.h.


Constructor & Destructor Documentation

DybAbortEventAlg::DybAbortEventAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 12 of file DybAbortEventAlg.cc.

    : GaudiAlgorithm(name,pSvcLocator)
{
    declareProperty("Sites", m_siteMask=0xffffffff, 
                    "Bitmask of which sites to accept");

    declareProperty("Detectors", m_detectorMask=0xffffffff, 
                    "Bitmask of which detectors to accept");

    declareProperty("RequiredHeaders", m_requiredHeaders,
                    "List of TES locations of required header");
    
    declareProperty("RequireReadout", m_requireReadout,
                    "Require a ReadoutHeader to exist");

    declareProperty("Force", m_goth = false,
                    "Set true to abort all events");

}
DybAbortEventAlg::~DybAbortEventAlg ( ) [virtual]

Definition at line 32 of file DybAbortEventAlg.cc.

{
}

Member Function Documentation

StatusCode DybAbortEventAlg::initialize ( ) [virtual]

Definition at line 47 of file DybAbortEventAlg.cc.

{
    StatusCode sc = this->GaudiAlgorithm::initialize();
    if (sc.isFailure()) {
        error() << "GaudiAlgorithm failed to initialize" << endreq;
        return sc;
    }

    m_incidentSvc = svc<IIncidentSvc>("IncidentSvc",true);

    // Maybe add required readout path to list of required headers
    if (m_requireReadout.size()) {
        string ropath = ReadoutHeader::defaultLocation();
        if ("/Event/" == m_requireReadout.substr(0,7)) {
            ropath = m_requireReadout;
        }
        else {
            m_requireReadout = ropath;
        }
        if (! isin(ropath,m_requiredHeaders)) {
            m_requiredHeaders.push_back(ropath);
            debug () << "Adding path " << ropath << " to list of required headers" << endreq;
        }
    }
    

    // spew my configuration:

    if (m_goth) {
        info() << "Will always abort" << endreq;
        return StatusCode::SUCCESS;
    }

    if (m_requiredHeaders.size()) {
        info() << "Will abort if any of these are missing:\n";
        for (size_t ind=0; ind<m_requiredHeaders.size(); ++ind) {
            info() << "\t" << m_requiredHeaders[ind] << "\n";
        }
        info() << endreq;

        info() << "Required site mask: 0X" << hex << m_siteMask 
               << ", detector mask: 0X" << hex << m_detectorMask
               << endreq;
    }
    else {
        info() << "Nothing special required, I'll go to sleep" << endl;
    }

    return StatusCode::SUCCESS;
}
StatusCode DybAbortEventAlg::execute ( ) [virtual]

Definition at line 107 of file DybAbortEventAlg.cc.

{
    if (m_goth) {
        return abort_event("force option set");
    }

    if (0 == m_requiredHeaders.size()) { 
        return StatusCode::SUCCESS;
    }

    for (size_t ind=0; ind<m_requiredHeaders.size(); ++ind) {
        string loc = m_requiredHeaders[ind];

        if (! exist<DataObject>(loc)) {
            return abort_event("no object at: " + loc);
        }

        HeaderObject* ho = get<HeaderObject>(loc);
        if (!ho) {
            return abort_event("header not found: " + loc);
        }

        if (!ind) {             // first time through, check for matching site/det
            const Context& ctx = ho->context();
            Site::Site_t site = ctx.GetSite();

            if (! (site&m_siteMask)) {
                return abort_event("failed to match site mask");
            }

            DetectorId::DetectorId_t det = ctx.GetDetId();
            int detmask = 0;
            if (det == DetectorId::kAll) {
                detmask = 0xffffffff;
            }
            else {
                detmask = 1 << det;
            }
            if (! (detmask&m_detectorMask)) {
                return abort_event("failed to match detector mask");
            }
        }

        // maybe check for existing readout header with a readout/daqCrate payload
        if (m_requireReadout.size() && loc == m_requireReadout) {
            ReadoutHeader* roh = dynamic_cast<ReadoutHeader*>(ho);
            if (!roh) {
                return abort_event("no readout header");
            }
            if ((!roh->readout()) && (!roh->daqCrate())) {
                return abort_event("readout header with no payload");
            }
        }
    }

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

Definition at line 165 of file DybAbortEventAlg.cc.

{

    return this->GaudiAlgorithm::finalize();
}
StatusCode DybAbortEventAlg::abort_event ( const std::string &  reason) [private]

Definition at line 98 of file DybAbortEventAlg.cc.

{
    debug() << "Aborting current execution cycle due to " << reason << endreq;
    m_incidentSvc->fireIncident(Incident(name(),IncidentType::AbortEvent));
    return StatusCode::SUCCESS;
}

Member Data Documentation

std::vector<std::string> DybAbortEventAlg::m_requiredHeaders [private]

Property: RequiredHeaders: a list of TES locations that are required to exist.

Definition at line 46 of file DybAbortEventAlg.h.

std::string DybAbortEventAlg::m_requireReadout [private]

Property: RequireReadout: if set, require a ReadoutHeader and that it has a ReadoutObject.

If the property starts with "/Event/" use the value as the TES location for the ReadoutHeader. The ReadoutHeader's location will be added to the list of required headers.

Definition at line 53 of file DybAbortEventAlg.h.

Property: Sites: a bit mask of what sites to accept.

Each bit is interpreted as a SiteId. Default: all bits set. At least one header must be required for this selection to take effect. The first one will be tested.

Definition at line 59 of file DybAbortEventAlg.h.

Property: Detectors: a bit mask of what detectors to accept.

Each bit is interpreted as a DetectorId. Default: all bits set. At least one header must be required for this selection to take effect. The first one will be tested.

Definition at line 65 of file DybAbortEventAlg.h.

bool DybAbortEventAlg::m_goth [private]

Property: Force: set true to immediately abort any and all executions.

Default is false.

Definition at line 69 of file DybAbortEventAlg.h.

IIncidentSvc* DybAbortEventAlg::m_incidentSvc [private]

Definition at line 76 of file DybAbortEventAlg.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:44 for DybAlg by doxygen 1.7.4