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