PSXtcInput/src/XtcEventId.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: XtcEventId.cpp 7083 2013-11-07 17:59:49Z davidsch@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class XtcEventId...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "PSXtcInput/XtcEventId.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 
00026 //-----------------------------------------------------------------------
00027 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00028 //-----------------------------------------------------------------------
00029 
00030 //              ----------------------------------------
00031 //              -- Public Function Member Definitions --
00032 //              ----------------------------------------
00033 
00034 namespace PSXtcInput {
00035 
00036 //----------------
00037 // Constructors --
00038 //----------------
00039 XtcEventId::XtcEventId (int run, const PSTime::Time& time, unsigned fiducials, unsigned ticks, unsigned vector, unsigned control)
00040   : PSEvt::EventId()
00041   , m_run(run)
00042   , m_time(time)
00043   , m_fiducials(fiducials)
00044   , m_ticks(ticks)
00045   , m_vector(vector)
00046   , m_control(control)
00047 {
00048 }
00049 
00050 //--------------
00051 // Destructor --
00052 //--------------
00053 XtcEventId::~XtcEventId ()
00054 {
00055 }
00056 
00057 /**
00058  *  @brief Return the time for event.
00059  */
00060 PSTime::Time 
00061 XtcEventId::time() const
00062 {
00063   return m_time;
00064 }
00065 
00066 /**
00067  *  @brief Return the run number for event.
00068  *  
00069  *  If run number is not known -1 will be returned.
00070  */
00071 int 
00072 XtcEventId::run() const
00073 {
00074   return m_run;
00075 }
00076 
00077 /**
00078  *  @brief Returns fiducials counter for the event.
00079  */
00080 unsigned
00081 XtcEventId::fiducials() const
00082 {
00083   return m_fiducials;
00084 }
00085 
00086 /**
00087  *  @brief Returns 119MHz counter within the fiducial.
00088  */
00089 unsigned
00090 XtcEventId::ticks() const
00091 {
00092   return m_ticks;
00093 }
00094 
00095 /**
00096  *  @brief Returns event counter since Configure.
00097  */
00098 unsigned
00099 XtcEventId::vector() const
00100 {
00101   return m_vector;
00102 }
00103 
00104 /**
00105  *  @brief Returns control - alternate representation of Xtc header.
00106  */
00107 unsigned
00108 XtcEventId::control() const
00109 {
00110   return m_control;
00111 }
00112 
00113 /// check if two event IDs refer to the same event
00114 bool 
00115 XtcEventId::operator==(const EventId& other) const
00116 {
00117   return m_time == other.time();
00118 }
00119 
00120 /// Compare two event IDs for ordering purpose
00121 bool 
00122 XtcEventId::operator<(const EventId& other) const
00123 {
00124   return m_time < other.time();
00125 }
00126 
00127 /// Dump object in human-readable format
00128 void 
00129 XtcEventId::print(std::ostream& os) const
00130 {
00131   os << "XtcEventId(run=" << m_run << ", time=" << m_time << ", fiducials=" << m_fiducials
00132      << ", ticks=" << m_ticks << ", vector=" << m_vector << ", control=" << m_control << ")";
00133 }
00134 
00135 } // namespace PSXtcInput

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7