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

onlinemonitor/spadicV10monitor/TSpadicV10Event.h (r4864/r3199)

Go to the documentation of this file.
00001 #ifndef TSPADICV10EVENT_H
00002 #define TSPADICV10EVENT_H
00003 
00004 #include "TGo4EventElement.h"
00005 #include "TGo4CompositeEvent.h"
00006 #include <vector>
00007 
00008 /*
00009  * Put all definitions here and use them in processor,
00010  * since they are necessary for data structure of event
00011  */
00012 
00013 #include "sp605/Message.h"
00014 
00015 
00016 /*************************************/
00017       
00018 // number of maximum connected SPADICV10s
00019 #define MAX_SPADICV10_BOARDS          8
00020 
00021 // spadic id:                 0  1  2  3  4  5  6  7
00022 //                            |  |  |  |  |  |  |  |
00023 #define SET_SPADICV10_BOARDS {0, 1, 0, 0, 0, 0, 0, 1}
00024 // set 0 for spadic of id not existing, otherwise 1
00025 
00026 
00027 #define MAX_SPADICV10_SYNC    2
00028 #define MAX_SPADICV10_AUX     4
00029 
00030 
00031 #define MAX_SPADICV10_GROUPS  2
00032 
00033 #define MAX_SPADICV10CHANNELS  32
00034 
00035 
00036 
00037 
00038 
00039 // ========================== older defines =========================
00040 
00041 
00042 
00043 #define MAX_SPADICV10                 15
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 #define SPADICV10_TRACE_SIZE        SP605_SPADIC_MAX_SAMPLE+1 //64
00053 
00054 
00055 #include <stdint.h>
00056 
00057 /*
00058  * Extended message container. Keeps original SPADICV10 message, but adds full timestamp and
00059  * optionally corrected adc valules.
00060  * Note that extended messages inside the vector will be sorted after full timestamp
00061  * by the TSpadicV10Psp605::FinalizeEvent
00062  *
00063  */
00064 class TSpadicV10MessageExtended
00065 {
00066    public:
00067 
00068       TSpadicV10MessageExtended(const sp605::Message& msg, uint64_t fulltime=0) :
00069          fxMessage(msg),
00070          fuFulltime(fulltime),
00071          ffTriggerDeltaT(0)
00072       {
00073       }
00074 
00075       TSpadicV10MessageExtended() :
00076          fxMessage(),
00077          fuFulltime(0),
00078          ffTriggerDeltaT(0)
00079       {
00080       }
00081 
00082       virtual ~TSpadicV10MessageExtended(){}
00083 
00084       /* this is used for timesorting the messages in the filled vectors */
00085       bool operator<(const TSpadicV10MessageExtended &rhs) const
00086          { return (fuFulltime < rhs.fuFulltime); }
00087 
00088       void SetSpadicV10Message(const sp605::Message & source)
00089       {
00090          fxMessage=source;
00091       }
00092 
00093       sp605::Message& GetSpadicV10Message()
00094       {
00095          return fxMessage;
00096       }
00097 
00098 
00099       unsigned GetSpadicId() const { return fSpadicId; }
00100       void SetSpadicId(unsigned id) { fSpadicId = id; }
00101 
00102       uint8_t GetMessageType() const
00103       {
00104           return fxMessage.getMsgType();
00105       }
00106 
00107 
00108       void SetFullTime(uint64_t ts)
00109       {
00110          fuFulltime=ts;
00111       }
00112 
00113       uint64_t GetFullTime() const
00114       {
00115          return fuFulltime;
00116       }
00117 
00118       uint16_t GetSpadicNumber() const
00119       {
00120          return fxMessage.getSpadicNumber();
00121       }
00122 
00123 
00124       uint8_t GetGroupNumber() const
00125       {
00126          return fxMessage.getGroup();
00127       }
00128 
00129       uint8_t GetChNum() const
00130       {
00131          return fxMessage.getChNum();
00132       }
00133 
00134 
00135       unsigned GetFullChNum() const { return fxMessage.getFullChNum(); }
00136 
00137 
00138       void SetTriggerDeltaT(float dt)
00139       {
00140          ffTriggerDeltaT=dt;
00141       }
00142 
00143       float GetTriggerDeltaT() const
00144       {
00145         return ffTriggerDeltaT;
00146       }
00147 
00148 
00149      // void Print( unsigned kind = roc::msg_print_Human ) const;
00150 
00151    protected:
00152 
00153       /* original roc message*/
00154       sp605::Message fxMessage;
00155 
00156       unsigned fSpadicId;
00157 
00158       /* corrected adc value*/
00159       float ffCorrectedADC;
00160 
00161       /* full time stamp without correction*/
00162       uint64_t fuFulltime;
00163 
00164       /* corrected time difference to trigger time of master SPADICV10
00165        * float range should be sufficient here*/
00166       float ffTriggerDeltaT;
00167 
00168 //      UInt_t         uSpadicV10Epoch;
00169 //      UInt_t         uSpadicV10EpochCycle;
00170 
00171 //      ULong64_t      uLocalEpoch;
00172 //      UInt_t         uLocalEpochCycle;
00173 };
00174 
00175 class TSpadicV10Data : public TGo4EventElement {
00176    public:
00177       TSpadicV10Data();
00178       TSpadicV10Data(const char* name, Short_t id=0);
00179       virtual ~TSpadicV10Data();
00180 
00182       virtual void Clear(Option_t *t="");
00183 
00184       /* extended messages for each roc*/
00185       std::vector<TSpadicV10MessageExtended> fExtMessages;
00186 
00187 
00188       
00189       /* last time of SYNC signals. obsolete now? */
00190       ULong64_t fLastSyncTm[MAX_SPADICV10_SYNC];
00191 
00192       /* last time of trigger signal (defined by parameter)
00193        * can be sync or aux message, depending on TSpadicV10Parameter::triggerSignal setup*/
00194       ULong64_t fLastTriggerTm;
00195 
00196       ClassDef(TSpadicV10Data,1)
00197 };
00198 
00199 
00200 
00201 class TSpadicV10Event : public TGo4CompositeEvent {
00202    public:
00203       TSpadicV10Event();
00204       TSpadicV10Event(const char* name, Short_t id=0);
00205       virtual ~TSpadicV10Event();
00206 
00208       double GetEventTime() const { return fLastGlobalTriggerTm*1e-9; }
00209 
00210       /* Evaluate global corrected time stamp from trigger difference times
00211        * as stored for each extended message*/
00212       ULong64_t CalcGlobalTime(Double_t deltaTrigger);
00213 
00214       /* array for roc configuration*/
00215       static Bool_t  ConfigBoards[MAX_SPADICV10_BOARDS];
00216 
00217       /* last time of trigger signal from configured "master" SPADICV10
00218        * can be sync or aux message, depending on TSpadicV10Parameter::triggerSignal setup
00219        * This is also time reference for global timestamp
00220        * This may be kept over several events, so we dont need a Clear method!*/
00221       ULong64_t fLastGlobalTriggerTm;
00222 
00223       ULong64_t fMbsEventNumber;
00224 
00225       ClassDef(TSpadicV10Event,1)
00226 };
00227 #endif //TEVENT_H
00228 
00229 
00230 

Generated on Tue Dec 10 2013 04:52:23 for ROCsoft by  doxygen 1.7.1