• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

newmonitor/nx/SubEvent.h (r3879/r3822)

Go to the documentation of this file.
00001 #ifndef NX_SUBEVENT_H
00002 #define NX_SUBEVENT_H
00003 
00004 #include "base/SubEvent.h"
00005 
00006 #include "roc/Message.h"
00007 
00008 #include <vector>
00009 
00010 namespace nx {
00011 
00012 
00013    /*
00014     * Extended message container. Keeps original ROC message, but adds full timestamp and
00015     * optionally corrected adc valules.
00016     * Note that extended messages inside the vector will be sorted after full timestamp
00017     * by the TRocProc::FinalizeEvent
00018     *
00019     */
00020 
00021    class MessageExtended {
00022       protected:
00023          /* original roc message*/
00024          roc::Message fMessage;
00025 
00026          /* full time stamp without correction*/
00027          double fGlobalTime;
00028 
00029          /* corrected adc value*/
00030          float fCorrectedADC;
00031 
00032       public:
00033 
00034          MessageExtended() :
00035             fMessage(),
00036             fGlobalTime(0.),
00037             fCorrectedADC(0)
00038          {
00039          }
00040 
00041          MessageExtended(const roc::Message& msg, double globaltm) :
00042             fMessage(msg),
00043             fGlobalTime(globaltm),
00044             fCorrectedADC(0)
00045          {
00046          }
00047 
00048          MessageExtended(const MessageExtended& src) :
00049             fMessage(src.fMessage),
00050             fGlobalTime(src.fGlobalTime),
00051             fCorrectedADC(src.fCorrectedADC)
00052          {
00053          }
00054 
00055          MessageExtended& operator=(const MessageExtended& src)
00056          {
00057             fMessage = src.fMessage;
00058             fGlobalTime = src.fGlobalTime;
00059             fCorrectedADC = src.fCorrectedADC;
00060             return *this;
00061          }
00062 
00063          ~MessageExtended() {}
00064 
00065          /* this is used for timesorting the messages in the filled vectors */
00066          bool operator<(const MessageExtended &rhs) const
00067             { return (fGlobalTime < rhs.fGlobalTime); }
00068 
00069          const roc::Message& msg() const { return fMessage; }
00070 
00071          void SetCorrectedADC(float val) { fCorrectedADC = val; }
00072          float GetCorrectedNxADC() const { return fCorrectedADC; }
00073 
00074          double GetGlobalTime() const { return fGlobalTime; }
00075    };
00076 
00077 
00078    class SubEvent : public base::SubEvent {
00079       public:
00080          std::vector<nx::MessageExtended> fExtMessages;   
00081 
00082          SubEvent() : base::SubEvent(), fExtMessages()  {}
00083          ~SubEvent() {}
00084 
00085          virtual void Reset()
00086          {
00087             fExtMessages.clear();
00088          }
00089    };
00090 
00091 }
00092 
00093 
00094 
00095 #endif

Generated on Thu Dec 13 2012 04:52:22 for ROCsoft by  doxygen 1.7.1