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

beamtime/gsi-aug12/prod/go4/MBSUNPACK/TMbsCrateEvent.cxx (r4864/r3597)

Go to the documentation of this file.
00001 #include "TMbsCrateEvent.h"
00002 
00003 #include <stdlib.h>
00004 #include "TGo4Version.h"
00005 #if __GO4BUILDVERSION__ > 40502
00006    #include "go4iostream.h"
00007 #else
00008    #include "Riostream.h"
00009 #endif
00010 
00011 
00012 void MQDC_t::Clear()
00013 {
00014    for (int n=0;n<MQDC_t::NumChan;n++) {
00015                  charge[n] = -1;
00016         }
00017 }
00018 
00019 int MQDC_t::FindGeo(int* pdata, int *len, int *crate)
00020 {
00021         int geo=0;
00022         if(((*pdata>>24) & 0x7) == 0x2)
00023         {
00024                 geo = (*pdata >> 27) & 0x1f;
00025                 *crate = (*pdata >> 16) & 0xff;
00026                 *len = (*pdata >> 8) & 0x3f;
00027         }
00028         return geo;
00029 }
00030 
00031 void MQDC_t::Unpack(int* pdata, unsigned len, int geo)
00032 {
00033         int data;
00034         int channel;
00035         
00036         if (len<2) {
00037                 printf("Error unpack V965 data - too few messages = %u\n", len);
00038         }
00039         for(UInt_t i = 0; i<len;i++)
00040         {
00041                 data = *pdata++;
00042                 //len--;
00043                 if(((data>>24) & 0x7) == 0)
00044                 {
00045                         if(geo != ((data>> 27) & 0x1f))
00046                         {
00047                                 //GO4_SKIP_EVENT_MESSAGE("Wrong geo address in data!\n");
00048                         }
00049                         else
00050                         {
00051                                 channel                                         = ((data >> 17) & 0xf);
00052                                 range[channel]          = ((data >> 16) & 0x1);
00053                                 under[channel]          = ((data >> 13) & 0x1);
00054                                 over[channel]                   = ((data >> 12) & 0x1);
00055                                 charge[channel]         = (data & 0xfff);
00056                                 if(range[channel]==0)
00057                                         charge[channel]=charge[channel]*8;
00058                         }
00059                 }
00060         }
00061         data = *pdata++;
00062         if(((data>>24) & 0x7) == 0x4)
00063         {
00064                 if(geo != ((data>> 27) & 0x1f))
00065                 {
00066                         //GO4_SKIP_EVENT_MESSAGE("Wrong geo address in trailer!\n");
00067                 }
00068         }
00069 }
00070 
00071 TMbsCrateEvent::TMbsCrateEvent(const char* name, Short_t id) :
00072    TGo4EventElement(name,name,id)
00073 {
00074    cout << "**** TTRDMadcEvent: Create instance " << name <<" with composite id "<<id<< endl;
00075 }
00076 
00077 TMbsCrateEvent::TMbsCrateEvent() :
00078    TGo4EventElement()
00079 {
00080 }
00081 
00082 TMbsCrateEvent::~TMbsCrateEvent()
00083 {
00084 }
00085 
00086 void  TMbsCrateEvent::Clear(Option_t *t)
00087 {
00088    // all members should be cleared.
00089 
00090    if(IsValid()) {
00091 
00092       for(int t=0; t<MAX_1182;++t)
00093          for (int ch=0;ch<NUM_1182_CH;ch++)
00094             fData1182[t][ch]=0;
00095 
00096       for (int n=0;n<MAX_1290;n++)
00097          fMtdc[n].Clear();
00098                         
00099       for(int n=0;n<MAX_965;n++)
00100          fMqdc[n].Clear();
00101 
00102       for (int n=0;n<MAX_FPGA_TDC;n++)
00103       {
00104          fFPGA[n].clear();
00105          fFPGAHEAD[n].clear();
00106       }
00107 
00108       for( Int_t iScalerInd=0; iScalerInd < SCALORMU_NB_SCAL; iScalerInd++)
00109          fScalOrMu.uScaler[iScalerInd] = 0;
00110       fScalOrMu.uReferenceClock = 0;
00111 
00112       fTriglogInputPattern = 0;
00113       fTriglogReferenceClock = 0;
00114 
00115       SetValid(kFALSE);
00116    }
00117 }

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