//////////////////////////////////////////////////////////////////// /// \class RAT:TriggerClockJumpProc /// /// \brief Check for any trigger clock jumps /// /// \author Tanner Kaptanoglu /// /// \details This processor loops through the events and looks for /// trigger clock jumps in the 50 and 10 MHz clocks. If it /// find either, it pushes that information to a ratdb /// table, to be corrected by the ReconstructClocks processor. /// //////////////////////////////////////////////////////////////////// #ifndef __RAT__TriggerClockJumpProc__ #define __RAT__TriggerClockJumpProc__ #include #include #include #include //Fix for problems with cint and stdint.h on OSX // See https://root-forum.cern.ch/t/rootcint-on-os-x-10-9-and-stdint-h/16940/7 for more details #ifdef __APPLE__ #include <_types/_uint64_t.h> #else extern "C" { #include } #endif namespace RAT { class TriggerClockJumpProc : public Processor { public: TriggerClockJumpProc(); virtual ~TriggerClockJumpProc(){}; virtual void BeginOfRun(DS::Run& run); virtual Processor::Result DSEvent(DS::Run& run, DS::Entry& ds); void CorrectClock(DS::EV& ev); virtual void EndOfRun(DS::Run& run); protected: // Keep track of 50MHz clock jumps void Fix50MHzClock(std::vector clock_10, std::vector clock_50, int gtid); // Keep track of 10MHz clock jumps void Fix10MHzClock(std::vector clock_10, std::vector clock_50, int gtid); int gtidSync; // Keep track of the GTID we get a SYNC pulse int validGTID; // first valid GTID in the run int clockOnline; // whether the 10MHz clock is working UInt_t subRunID; // sub run ID ReconstructClocks fReconstructClocks; // Use to check 10MHz clock is working std::vector clock50; // Keep track of 50MHz clock ticks std::vector clock10; // Keep track of 10MHz clock ticks std::vector gtidClock10; // GTIDs of the 10MHz clock jumps std::vector gtidClock50; // GTIDs of the 50MHz clock jumps std::vector delta10; // Size of the 10MHz clock jump corrections std::vector delta50; // Size of the 50MHz clock jump corrections std::vector jump50; // Size of 50MHz jump std::vector jump10; // Size of 10MHz jump // Clock ticks that could not be corrected std::vector gtidBadClock10; // Bad 50MHz clock ticks std::vector gtidBadClock50; // Bad 10MHz clock ticks std::vector firstClock10; // first 10 MHz clock count for each sub run }; }//namespace RAT #endif