#ifndef __ANTARESDAQ__EVENTPREAMBLE__ #define __ANTARESDAQ__EVENTPREAMBLE__ #include #include #include #include #include "antares-dataformat/FramePreamble.hh" #include "antares-dataformat/DataTypes.hh" /** * Interface for event classes. * It holds the information from the 'preamble' of an event object. */ class EventPreamble : public TObject { protected: //unsigned int length_; //!< size of object in bytes; not to be written by ROOT //unsigned short dataType; //!< type of object; not to be written by ROOT public: /** Unique code representing the shore station for this frame */ unsigned short frameTarget; /** Frame 'time stamp' in units of 50ns (MSW) */ unsigned int frameTime1; /** Frame 'time stamp' in units of 50ns (LSW) */ unsigned int frameTime2; /** Number of frames since start of the run */ unsigned int frameIndex; /** Run-number as given by the RunControl */ unsigned int runNumber; public: /** * Default constructor. */ EventPreamble() { //length_ = 0; //dataType = UNDEFINED_EVENT_TYPE; frameTarget = 0; frameTime1 = 0; frameTime2 = 0; frameIndex = 0; runNumber = 0; } /** * Virtual destructor. */ virtual ~EventPreamble() {}; /** * Print ASCII. * * \param out output stream * \param object event preamble * \return output stream */ friend std::ostream& operator<<(std::ostream& out, const EventPreamble& object) { using namespace std; out << "frameTarget " << object.frameTarget << endl; out << "frameTime1 " << object.frameTime1 << endl; out << "frameTime2 " << object.frameTime2 << endl; out << "frameIndex " << object.frameIndex << endl; out << "runNumber " << object.runNumber << endl; return out; } ClassDef(EventPreamble, 2); }; /** * equal operator for event preamble * * \param first event preamble * \param second event preamble * \return true if first equals second; else false */ inline bool operator==(const EventPreamble& first, const EventPreamble& second) { return (first.frameIndex == second.frameIndex && first.runNumber == second.runNumber); } /** * not-equal operator for event preamble * * \param first event preamble * \param second event preamble * \return true if first not equals second; else false */ inline bool operator!=(const EventPreamble& first, const EventPreamble& second) { return (first.frameIndex != second.frameIndex || first.runNumber != second.runNumber); } #endif