SCC/Scc.h

00001 // @(#)fROOT/SCC:$Name:  $:$Id: Scc.h,v 1.11 2007/09/24 07:32:41 Diego_Faso Exp $
00002 // Author: Diego Faso <mailto:faso@to.infn.it>, 2006/05/19
00003 
00004 #ifndef FROOT_Scc
00005 #define FROOT_Scc
00006 
00008 //                TFndSCCStd              //
00009 //                                        //
00010 // Constants for SCC (SlowControlManager) //
00011 //  management.                           //
00012 //                                        //
00014 
00015 #ifndef ROOT_Rtypes
00016 #include "Rtypes.h"
00017 #endif
00018 #include "TThread.h"
00019 #include "TString.h"
00020 #include "TMath.h"
00021 
00022 namespace Scc {
00023   
00024   enum SingleDetHdrPart_e {HdrDet_evlen = 0,
00025                            HdrDet_detname,
00026                            HdrDet_systime,
00027                            HdrDet_nchans,
00028                            HdrDet_dataoff,
00029                            HdrDet_msgoff,
00030                            HdrDet_miscoff,
00031                            HdrDet_hdrlen,
00032                            HdrDet_magic,
00033                            HdrDet_free 
00034   };
00035   enum GlobalHdrPart_e    {HdrTot_EvLen = 0,
00036                            HdrTot_SysTime,
00037                            HdrTot_TofiOff,
00038                            HdrTot_TofoOff,
00039                            HdrTot_LmdOff,
00040                            HdrTot_StbOff,
00041                            HdrTot_GasOff,
00042                            HdrTot_SilOff,
00043                            HdrTot_MagOff,
00044                            HdrTot_Magic
00045   };
00046   
00047   static const Int_t K_DEBUG_LEV = 0; // from 0 to 3
00048   
00049   static const Int_t K_N_SLOWS = 7;
00050   enum SlowDetectors_e {TOFI = 0, TOFO, LMD, STB, GAS, SIL, MAG};  // SlowDetectors_e = -1 is used for the "Global Header"
00051   static TString fSlowDetNames[K_N_SLOWS] =    {"TOFI", "TOFO", "LMD", "STB", "GAS", "SIL", "MAG"};
00052   // Number of channels (data-part only)
00053   static const Int_t K_SLOW_N_CHANS[K_N_SLOWS] = { 24, 144, 32, 192, 0, 108, 0};
00054   
00055   static const Int_t K_N_SECUR_SWITCHES = 5; // number of boolean information from Security system (misc info)
00056   
00057   // UDP local ports to receive SlowControls Raw-events
00058   static const Int_t K_N_SOCKS_IN = 8; // total number of socket used by the SCC to received data
00059   enum SlowSocksIn_e {SOCK_TOFI = 0, SOCK_TOFO, SOCK_LMD, SOCK_STB, SOCK_GAS, SOCK_SIL, SOCK_SIL_MSG, SOCK_MAG};  // 
00060   static const Int_t K_SLOW_UDP_PORT[K_N_SOCKS_IN] = { 3001, 3002, 3003, 3004, 3005, 3006, 3008, 3007 };
00061   // UDP socket length
00062   static const Int_t K_SLOW_SOCK_LEN = 4096;
00063   
00064   // (The assembled SlowControl-Raw-Event is sent to the DAQ machine)
00065   // (the IP address of the DAQ machine is already set in the "fnd.sh" script)  
00066   static const Int_t K_DAQ_SCC_EV_UDP_PORT = 3010;  // UDP port of the DAQ receiver machine (used to receive SCC events)
00067   
00068   static const Int_t K_SCC_HDR_SIZE = 40;  // bytes needed by the header of the complete SCC raw event (last byte is free)
00069   static const Int_t K_MSG_MAX_SIZE = 200; // maximum size of the message part (bytes)
00070   static const Int_t K_MISC_MAX_SIZE = 108; // maximum size of the message part (bytes) (124 bytes ==> 31 UInt_t)
00071   static const UInt_t K_MAGIC_NUMBER = 0xCAFE; // will be used for cross-checks on received data
00072   static const UInt_t K_TOT_SCC_MAX_SIZE = 3736; // maximum size of the complete buffer (bytes)
00073   
00074   void Print();
00075   
00076   inline static void print_binary(unsigned int a){
00077     Printf(" ---> printing binary code for (u_int_32)\"%d\"",a);
00078     TString built_data = "";
00079     for(int j=0;j<32;j++){
00080       int bit = (int)(31 -j);
00081       unsigned int tmp =  a & (unsigned int)(TMath::Power((double)2.,(double)bit));
00082       tmp = tmp >> bit;
00083       built_data+=tmp;
00084     }
00085     Printf("bynary number: %s",built_data.Data());
00086     Printf(" --- --- --- ");
00087   }
00088 }
00089 #endif //FROOT_Scc

Generated on Tue Oct 16 15:40:47 2007 by  doxygen 1.5.2