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

In This Package:

CheckTimeOrder.cc
Go to the documentation of this file.
00001 #include "CheckTimeOrder.h"
00002 #include "Context/Context.h"
00003 #include "Context/TimeStamp.h"
00004 #include "Event/HeaderObject.h"
00005 #include "Event/ReadoutHeader.h"
00006 
00007 using namespace DayaBay;
00008 using namespace std;
00009 
00010 
00011 CheckTimeOrder::CheckTimeOrder(const std::string& name, ISvcLocator* pSvcLocator)
00012     : GaudiAlgorithm(name,pSvcLocator)
00013     , m_lastTimeStamp(0)
00014 {
00015 }
00016 
00017 CheckTimeOrder::~CheckTimeOrder()
00018 {
00019 }
00020     
00021 StatusCode CheckTimeOrder::initialize()
00022 {
00023     return StatusCode::SUCCESS;
00024 }
00025 
00026 StatusCode CheckTimeOrder::execute()
00027 {
00028     ReadoutHeader* roh = get<ReadoutHeader>("/Event/Readout/ReadoutHeader");
00029     if ( !roh ) {
00030         error() << "Cannot find ReadoutHeader" << endreq;
00031         return StatusCode::FAILURE;
00032     } 
00033    
00034     TimeStamp ts = roh->context().GetTimeStamp();
00035     DetectorId::DetectorId_t detectorId = roh->context().GetDetId();
00036 
00037     if (detectorId == DetectorId::kRPC) {
00038         return StatusCode::SUCCESS; // skip RPC triggers
00039     } 
00040     
00041     // double dt = (ts - m_lastTimeStamp).GetSeconds();
00042     // 
00043     // if (dt>=0) {
00044     //     m_lastTimeStamp = ts;
00045     //     info() << "Timestamp order: #" << roh->execNumber() << ": dt:" << dt << " sec" << endreq;
00046     //     return StatusCode::SUCCESS;
00047     // }
00048     // else {
00049     //     error() << "Timestamp Disorder: #" << roh->execNumber() << ": dt:" << dt << " sec" << endreq;
00050     //     return StatusCode::FAILURE;
00051     // }
00052     
00053     long ts_sec = ts.GetSec();
00054     long ts_nsec = ts.GetNanoSec();
00055     long last_ts_sec = m_lastTimeStamp.GetSec();
00056     long last_ts_nsec = m_lastTimeStamp.GetNanoSec();
00057     
00058     
00059     bool inorder = false;
00060     if (ts_sec == last_ts_sec) {
00061         if (ts_nsec >= last_ts_nsec) inorder = true;
00062     }
00063     else if (ts_sec > last_ts_sec) inorder = true;
00064     
00065     if (inorder) {
00066         m_lastTimeStamp = ts;
00067         // info() << "Timestamp Inorder: #" << roh->execNumber() 
00068         //     << ": this: " << ts_sec << "+" << ts_nsec 
00069         //     << ": last: " << last_ts_sec << "+" << last_ts_nsec << endreq;
00070         return StatusCode::SUCCESS;
00071     }
00072     else {
00073         error() << "Timestamp Disorder: #" << roh->execNumber()
00074             << ": this: " << ts_sec << "+" << ts_nsec 
00075             << ": last: " << last_ts_sec << "+" << last_ts_nsec << endreq;
00076         return StatusCode::FAILURE;
00077     }
00078     return StatusCode::SUCCESS;
00079 }
00080 
00081 StatusCode CheckTimeOrder::finalize()
00082 {
00083     return StatusCode::SUCCESS;
00084 }
00085 
| 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