// // File : MiRunTrailer.hh // // Purpose: Declaration of Mirror run trailer class. // // // $Id: MiRunTrailer.hh 12082 2011-02-21 17:11:29Z mathes $ // /** @file MiRunTrailer.hh * Declaration of the class TMirrorRunTrailer. * @author H.-J. Mathes, FzK */ #ifndef _MiRunTrailer_hh_ #define _MiRunTrailer_hh_ #include #include // std::time_t #include #include using std::time_t; // --- forward declaration(s) class TShmRunTrailer; /** Run trailer class. * * Each time when a RUN is stopped an object of this type is created * and its data fields are filled appropiately. This object contains * information about: * @li time of RUN start and RUN stop * @li the RUNs total number of events * @li the RUNs total number of triggers (T1) * @li the total duration of the RUN * * Note:
* This structure stores the times internally in GPS format ! */ class TMirrorRunTrailer : public TObject { friend class TShmRunTrailer; public: /** Default constructor of the class TMirrorRunTrailer. */ TMirrorRunTrailer(); #ifndef __CINT__ /** Constructor from class TShmRunTrailer in shared memory. */ TMirrorRunTrailer(TShmRunTrailer*); #endif /** Copy constructor of the class TMirrorRunTrailer. */ TMirrorRunTrailer(const TMirrorRunTrailer&); /** Destructor of the class TMirrorRunTrailer. */ virtual ~TMirrorRunTrailer(); /** Special operator=() which performs a deep copy. */ TMirrorRunTrailer& operator=(const TMirrorRunTrailer&); /** Clear the contents of a TMirrorRunTrailer object. */ virtual void Clear(Option_t * ="") { Init(); } /** Print the contents of the run trailer to cout. */ void Show(std::ostream& ostr=std::cout) const; // --- getters /** Get the total dead time of the DAQ (in sec). */ unsigned long long GetDaqDeadTime() const { return fRunTrailer->fDaqDeadTime; } #ifndef __CINT__ /** Get the final value of the dead time counter. */ unsigned long long GetDeadTimeCounter() const { return fRunTrailer->fDeadTimeCounter; } #endif // __CINT__ /** Get the number of events contained in the present RUN. */ UInt_t GetNumEvents() const { return fRunTrailer->fNEvents; } /** Get the number of skipped triggers of the present RUN (due to VETO * algorithms etc. present in the DAQ). */ UInt_t GetNumSkippedTriggers() const { return fRunTrailer->fNSkippedTriggers; } /** Get the number of triggers of the present RUN. */ UInt_t GetNumTriggers() const { return fRunTrailer->fNTriggers; } /** Get the final value of the RUN time counter. */ unsigned long long GetRunTimeCounter() const { return fRunTrailer->fRunTimeCounter; } /** Get the time (GPS scale) when the run was started. */ time_t GetStartTime() const { return fRunTrailer->fStartTime; } /** Get the time (GPS scale) when the run was stopped. */ time_t GetStopTime() const { return fRunTrailer->fStopTime; } /** Get the total time (in seconds) the RUN was active. */ UInt_t GetTotalTime() const { return fRunTrailer->fTotalTime; } #ifndef __CINT__ /** Get the final value of the VETO time counter. */ unsigned long long GetVetoTimeCounter() const { return fRunTrailer->fVetoTimeCounter; } #endif // __CINT__ // --- setters ... /** Set the DAQ dead time (* 100 nsec). */ void SetDaqDeadTime(unsigned long long dead_time) { fRunTrailer->fDaqDeadTime = dead_time; } #ifndef __CINT__ /** Set the final value of the dead time counter. */ void SetDeadTimeCounter(unsigned long long dead_time) { fRunTrailer->fDeadTimeCounter = dead_time; } #endif // __CINT__ /** Set the number of events contained in the present RUN. */ void SetNumEvents(UInt_t n_events) { fRunTrailer->fNEvents = n_events; } /** Set the number of skipped trigger (due to DAQ dead time). */ void SetNumSkippedTriggers(UInt_t n_skipped) { fRunTrailer->fNSkippedTriggers = n_skipped; } /** Set the number of triggers of the present RUN. */ void SetNumTriggers(UInt_t n_triggers) { fRunTrailer->fNTriggers = n_triggers; } /** Set the final value of the RUN time counter. */ void SetRunTimeCounter(unsigned long long run_time) { fRunTrailer->fRunTimeCounter = run_time; } /** Set the time when the run was started. * * The time must be passed as GPS seconds. */ void SetStartTime(time_t t) { fRunTrailer->fStartTime = t; } /** Set the time when the RUN was stopped. * * The time must be passed as GPS seconds. */ void SetStopTime(time_t t) { fRunTrailer->fStopTime = t; } /** Set the time when the RUN was stopped by using * the builtin time() system function and conversion routines to * the GPS time. */ void SetStopTime(); /** Set the total time the RUN was active. */ void SetTotalTime(UInt_t tt) { fRunTrailer->fTotalTime = tt; } /** Set the total time the RUN was active. * * This time is calculated internally assuming that the start and * the stop time are already set. */ void SetTotalTime() { fRunTrailer->fTotalTime = (UInt_t)fRunTrailer->fStopTime - (UInt_t)fRunTrailer->fStartTime; } #ifndef __CINT__ /** Set the final value of the VETO time counter. */ void SetVetoTimeCounter(unsigned long long veto_time) { fRunTrailer->fVetoTimeCounter = veto_time; } #endif // __CINT__ protected: /** Preset the data structure with default values. */ virtual void Init(); private: typedef struct _MiRunTrailerRec { time_t fStartTime; time_t fStopTime; UInt_t fTotalTime; UInt_t fNEvents; UInt_t fNTriggers; #ifndef __CINT__ unsigned long long fDeadTimeCounter; unsigned long long fVetoTimeCounter; #else UInt_t fDeadTimeCounter[2]; UInt_t fVetoTimeCounter[2]; #endif // __CINT__ unsigned long long fRunTimeCounter; unsigned long long fDaqDeadTime; // dead time of the DAQ [*100 ns] UInt_t fNSkippedTriggers; // due to DAQ dead time } MiRunTrailerRec, *MiRunTrailer; /** Constructor from pointer to internal struct MiRunTrailerRec. */ TMirrorRunTrailer(MiRunTrailer); enum Constructor_t { kCREATE, kRUNTRAILER, kSHM_RUNTRAILER }; enum Constructor_t fConstructorType; //! MiRunTrailer fRunTrailer; //! Version_t fStreamerVersion; //! version read from file ClassDef(TMirrorRunTrailer,MiEVENTVERSIONv4) }; #endif // _MiRunTrailer_hh_