00001 #ifndef PSXTCINPUT_XTCEVENTID_H 00002 #define PSXTCINPUT_XTCEVENTID_H 00003 00004 //-------------------------------------------------------------------------- 00005 // File and Version Information: 00006 // $Id: XtcEventId.h 7083 2013-11-07 17:59:49Z davidsch@SLAC.STANFORD.EDU $ 00007 // 00008 // Description: 00009 // Class XtcEventId. 00010 // 00011 //------------------------------------------------------------------------ 00012 00013 //----------------- 00014 // C/C++ Headers -- 00015 //----------------- 00016 00017 //---------------------- 00018 // Base Class Headers -- 00019 //---------------------- 00020 #include "PSEvt/EventId.h" 00021 00022 //------------------------------- 00023 // Collaborating Class Headers -- 00024 //------------------------------- 00025 #include "PSTime/Time.h" 00026 00027 //------------------------------------ 00028 // Collaborating Class Declarations -- 00029 //------------------------------------ 00030 00031 // --------------------- 00032 // -- Class Interface -- 00033 // --------------------- 00034 00035 namespace PSXtcInput { 00036 00037 /** 00038 * @ingroup PSXtcInput 00039 * 00040 * @brief Implementation of the EventId interface for XTC events. 00041 * 00042 * This software was developed for the LCLS project. If you use all or 00043 * part of it, please give an appropriate acknowledgment. 00044 * 00045 * @version $Id: XtcEventId.h 7083 2013-11-07 17:59:49Z davidsch@SLAC.STANFORD.EDU $ 00046 * 00047 * @author Andrei Salnikov 00048 */ 00049 00050 class XtcEventId : public PSEvt::EventId { 00051 public: 00052 00053 // Default constructor 00054 XtcEventId (int run, const PSTime::Time& time, unsigned fiducials, unsigned ticks, unsigned vector, unsigned control) ; 00055 00056 // Destructor 00057 ~XtcEventId () ; 00058 00059 /** 00060 * @brief Return the time for event. 00061 */ 00062 virtual PSTime::Time time() const; 00063 00064 /** 00065 * @brief Return the run number for event. 00066 * 00067 * If run number is not known -1 will be returned. 00068 */ 00069 virtual int run() const; 00070 00071 /** 00072 * @brief Returns fiducials counter for the event. 00073 * 00074 * Note that MCC sends fiducials as 17-bit number which overflows 00075 * frequently (fiducials clock runs at 360Hz) so this number is 00076 * not unique. In some cases (e.g. when reading from old HDF5 00077 * files) fiducials is not know, 0 will be returned in this case. 00078 */ 00079 virtual unsigned fiducials() const; 00080 00081 /** 00082 * @brief Returns 119MHz counter within the fiducial. 00083 * 00084 * Returns the value of 119MHz counter within the fiducial for the 00085 * event code which initiated the readout. In some cases (e.g. when 00086 * reading from old HDF5 files) ticks are not know, 0 will be 00087 * returned in this case. 00088 */ 00089 virtual unsigned ticks() const; 00090 00091 /** 00092 * @brief Returns event counter since Configure. 00093 * 00094 * Note that counter is saved as 15-bits integer and will overflow 00095 * frequently. In some cases (e.g. when reading from old HDF5 00096 * files) counter is not know, 0 will be returned in this case. 00097 */ 00098 virtual unsigned vector() const; 00099 00100 virtual unsigned control() const; 00101 00102 /// check if two event IDs refer to the same event 00103 virtual bool operator==(const EventId& other) const; 00104 00105 /// Compare two event IDs for ordering purpose 00106 virtual bool operator<(const EventId& other) const; 00107 00108 /// Dump object in human-readable format 00109 virtual void print(std::ostream& os) const; 00110 00111 protected: 00112 00113 private: 00114 00115 // Data members 00116 int m_run; 00117 PSTime::Time m_time; 00118 unsigned m_fiducials; 00119 unsigned m_ticks; 00120 unsigned m_vector; 00121 unsigned m_control; 00122 }; 00123 00124 } // namespace PSXtcInput 00125 00126 #endif // PSXTCINPUT_XTCEVENTID_H