00001 #ifndef L2JETRESULTS2012_H
00002 #define L2JETRESULTS2012_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <fakeRtsLog.h>
00015
00016 #define L2JET_RESULTS_VERSION 4
00017
00018 struct L2jetOutInt0 {
00019 unsigned char version;
00020 unsigned char decision;
00021
00022
00023
00024
00025
00026
00027 unsigned char dumm;
00028 unsigned char kTick;
00029
00030 };
00031
00032 struct L2jetOutInt1 {
00033 unsigned short iTotEne;
00034 unsigned char checkSum;
00035 unsigned char free;
00036 };
00037 struct L2jetOutInt2 {
00038 unsigned short nBtowTw;
00039 unsigned short nEtowTw;
00040 };
00041
00042 struct L2jetOutJet {
00043 unsigned char jPhi;
00044 unsigned char jEta;
00045 unsigned short iEne;
00046 unsigned short rmsEta;
00047 unsigned short rmsPhi;
00048 };
00049
00050 struct L2jetResults2012{
00051 struct L2jetOutInt0 int0;
00052 struct L2jetOutInt1 int1;
00053 struct L2jetOutInt2 int2;
00054 struct L2jetOutJet jet1, jet2;
00055 };
00056
00057
00058
00059
00060
00061 #define GET_OB(x,n) ( (x & 1 << n)!=0 )
00062
00063 inline void
00064 L2jetResults2012_print(L2jetResults2012 *p) {
00065 if(p==0) {LOG(ERR,"print L2jetResults2012 - NULL pointer ????\n"); return;}
00066
00067 unsigned int x=p->int0.decision;
00068 LOG(DBG,"L2jetResults2012:\n Accept: rnd=%d oneJet=%d diJet=%d \n useBtowEast=%d useBtowWest=%d useEndcap=%d bemcIn=%d eemcIn=%d\n", GET_OB(x,5), GET_OB(x,6), GET_OB(x,7), GET_OB(x,0), GET_OB(x,1), GET_OB(x,2), GET_OB(x,3), GET_OB(x,4));
00069
00070 LOG(NOTE," Jet1: Et/GeV=%.2f phi/deg=%3d eta=%.2f RMS: phi/deg=%.1f eta=%.2f\n", p->jet1.iEne/100.,p->jet1.jPhi*2,p->jet1.jEta/50.-1., p->jet1.rmsPhi/10.,p->jet1.rmsEta/100.);
00071
00072 LOG(NOTE," Jet2: Et/GeV=%.2f phi/deg=%3d eta=%.2f RMS: phi/deg=%.1f eta=%.2f\n", p->jet2.iEne/100.,p->jet2.jPhi*2,p->jet2.jEta/50.-1., p->jet2.rmsPhi/10.,p->jet2.rmsEta/100.);
00073
00074 LOG(NOTE," totEne/GeV=%.2f nBtowTw=%d nEtwTw=%d, \n CPU kTicks=%d format=%d checkSum=%d\n", p->int1.iTotEne/100., p->int2.nBtowTw, p->int2.nEtowTw, p->int0.kTick,p->int0.version, p->int1.checkSum);
00075
00076
00077 };
00078
00079 #undef GET_OB
00080
00081
00082
00083 inline unsigned char
00084 L2jetResults2012_doCheckSum(L2jetResults2012 *p) {
00085 if(p==0) {LOG(ERR,"print L2jetResults2012 - NULL pointer ????\n"); return 0xff;}
00086 unsigned char* buf=(unsigned char*) p;
00087 int len=sizeof( L2jetResults2012);
00088 unsigned char sum=0;
00089 int i;
00090 for(i=0;i<len;i++) sum+=buf[i];
00091 return sum;
00092 }
00093 #endif
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122