00001 // @(#)fROOT/SCC:$Name: $:$Id: TFndSlowCntSilRecode.h,v 1.5 2007/09/05 10:34:58 Diego_Faso Exp $ 00002 // Author: Diego Faso <mailto:faso@to.infn.it>, 2006/12/14 00003 00004 #ifndef FROOT_TFndSlowCntSilRecode 00005 #define FROOT_TFndSlowCntSilRecode 00006 00008 // // 00009 // Class for the FINUDA Slow Control SIL Raw re-encoding // 00010 // // 00012 00013 #include <Riostream.h> 00014 #include "TString.h" 00015 #include "TThread.h" 00016 #include "TDatime.h" 00017 #include "TMath.h" 00018 #include "TApplication.h" 00019 00020 #include "Scc.h" 00021 00022 //using namespace FROOT; 00023 using namespace Scc; 00024 00025 class TFndSlowCntSilRecode: public TObject{ 00026 00027 public: 00028 struct vsc_Data_compact 00029 { 00030 double timeStamp; 00031 float biasV[18]; 00032 float biasI[18]; 00033 int crateErrorCondition; 00034 int crateKill; 00035 int crateStartupFailed; 00036 int crateStatus; 00037 int packetCounter; 00038 }; 00039 00040 struct vsc_Data 00041 { 00042 UInt_t TimeStamp_hours; 00043 UInt_t TimeStamp_minutes; 00044 UInt_t TimeStamp_seconds; 00045 UInt_t TimeStamp_day; 00046 UInt_t TimeStamp_month; 00047 UInt_t TimeStamp_year; 00048 TString SCC_msg; 00049 Float_t biasV[18]; 00050 Float_t biasI[18]; 00051 Int_t biasStatus[18]; 00052 // 00053 Float_t Phi_V[18][3]; 00054 Float_t Phi_I[18][3]; 00055 Int_t Phi_Status[18][3]; 00056 // 00057 Float_t ZA_V[18][3]; 00058 Float_t ZA_I[18][3]; 00059 Int_t ZA_Status[18][3]; 00060 // 00061 Float_t ZB_V[18][3]; 00062 Float_t ZB_I[18][3]; 00063 Int_t ZB_Status[18][3]; 00064 Float_t Temperature; 00065 // int crateKill; 00066 // int crateStartupFailed; 00067 // int crateStatus; 00068 // int packetCounter; 00069 }; 00070 00071 private: 00072 00073 Int_t fDebugLevel; 00074 00075 TString fReceivedString; 00076 00077 UInt_t fSilRawLen; // count the number of bytes (4 for every UInt_t) 00078 UInt_t fSilRawBuf[K_SLOW_SOCK_LEN]; 00079 00080 vsc_Data_compact fDataCompact; 00081 vsc_Data fData; 00082 TString fMessagePart; // used while updating sil message 00083 00084 00085 UInt_t fCurChar; // used while encoding sil message 00086 UInt_t fCurMsgInt_ID; // used while encoding sil message 00087 TString fMsgBuf; // used while encoding sil message 00088 00089 00090 00091 public: 00092 TFndSlowCntSilRecode(); 00093 ~TFndSlowCntSilRecode(); 00094 00095 private: 00096 void ConvertSingleU32(); 00097 00098 void BuildHeaderPart(Bool_t emptydata); 00099 void UpdateHeaderPart(); 00100 void BuildDataPart(); 00101 void BuildMessagesPart(); 00102 void BuildMiscPart(); 00103 00104 public: 00105 void Reset(); 00106 00107 void SetDebugLevel(Int_t deb_lev) { fDebugLevel = deb_lev; } 00108 Int_t GetDebugLevel() { return fDebugLevel; } 00109 00110 UInt_t *GetRawBuf() { return fSilRawBuf; } 00111 void SetReceivedString(UInt_t *raw); 00112 void SetReceivedMessage(UInt_t *raw); 00113 00114 void FillExampleString(); 00115 // 00116 void ReadSilStringCompact(); 00117 void PrintDataCompact(); 00118 // 00119 void ReadSilString(); 00120 void PrintData(); 00121 // 00122 void ReBuildSilSlowRaw(Bool_t empty=kFALSE); // the empty option is used to build an empty data 00123 void UpdateMessagePart(); // called every 6 seconds (whenever the message string only is received) 00124 00125 void PrintSilSlowRaw(Bool_t hdr,Bool_t data,Bool_t msg); 00126 00127 ClassDef(TFndSlowCntSilRecode,0) 00128 }; 00129 00130 #endif //SlowCntSilRecode