/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 Attributes
CheckTimeOrder Class Reference

Test if events are in time order. More...

#include <CheckTimeOrder.h>

Collaboration diagram for CheckTimeOrder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Private Attributes

TimeStamp m_lastTimeStamp

Detailed Description

Test if events are in time order.

Chao Zhang <chao@bnl.gov> 2013-08-09

Definition at line 17 of file CheckTimeOrder.h.


Constructor & Destructor Documentation

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

Definition at line 11 of file CheckTimeOrder.cc.

    : GaudiAlgorithm(name,pSvcLocator)
    , m_lastTimeStamp(0)
{
}
CheckTimeOrder::~CheckTimeOrder ( ) [virtual]

Definition at line 17 of file CheckTimeOrder.cc.

{
}

Member Function Documentation

StatusCode CheckTimeOrder::initialize ( ) [virtual]

Definition at line 21 of file CheckTimeOrder.cc.

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

Definition at line 26 of file CheckTimeOrder.cc.

{
    ReadoutHeader* roh = get<ReadoutHeader>("/Event/Readout/ReadoutHeader");
    if ( !roh ) {
        error() << "Cannot find ReadoutHeader" << endreq;
        return StatusCode::FAILURE;
    } 
   
    TimeStamp ts = roh->context().GetTimeStamp();
    DetectorId::DetectorId_t detectorId = roh->context().GetDetId();

    if (detectorId == DetectorId::kRPC) {
        return StatusCode::SUCCESS; // skip RPC triggers
    } 
    
    // double dt = (ts - m_lastTimeStamp).GetSeconds();
    // 
    // if (dt>=0) {
    //     m_lastTimeStamp = ts;
    //     info() << "Timestamp order: #" << roh->execNumber() << ": dt:" << dt << " sec" << endreq;
    //     return StatusCode::SUCCESS;
    // }
    // else {
    //     error() << "Timestamp Disorder: #" << roh->execNumber() << ": dt:" << dt << " sec" << endreq;
    //     return StatusCode::FAILURE;
    // }
    
    long ts_sec = ts.GetSec();
    long ts_nsec = ts.GetNanoSec();
    long last_ts_sec = m_lastTimeStamp.GetSec();
    long last_ts_nsec = m_lastTimeStamp.GetNanoSec();
    
    
    bool inorder = false;
    if (ts_sec == last_ts_sec) {
        if (ts_nsec >= last_ts_nsec) inorder = true;
    }
    else if (ts_sec > last_ts_sec) inorder = true;
    
    if (inorder) {
        m_lastTimeStamp = ts;
        // info() << "Timestamp Inorder: #" << roh->execNumber() 
        //     << ": this: " << ts_sec << "+" << ts_nsec 
        //     << ": last: " << last_ts_sec << "+" << last_ts_nsec << endreq;
        return StatusCode::SUCCESS;
    }
    else {
        error() << "Timestamp Disorder: #" << roh->execNumber()
            << ": this: " << ts_sec << "+" << ts_nsec 
            << ": last: " << last_ts_sec << "+" << last_ts_nsec << endreq;
        return StatusCode::FAILURE;
    }
    return StatusCode::SUCCESS;
}
StatusCode CheckTimeOrder::finalize ( ) [virtual]

Definition at line 81 of file CheckTimeOrder.cc.

{
    return StatusCode::SUCCESS;
}

Member Data Documentation

Definition at line 28 of file CheckTimeOrder.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:20:12 for RootIOTest by doxygen 1.7.4