StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EEstarTrig.cxx
1 #include "EEstarTrig.h"
2 
3 //#include <Stiostream.h>
4 
5 ClassImp(EEstarTrig)
6 
7 
8 //--------------------------------------------------
9 //
10 //--------------------------------------------------
12  clear();
13 }
14 
15 //--------------------------------------------------
16 //
17 //--------------------------------------------------
18 EEstarTrig :: ~EEstarTrig() { }
19 
20 
21 
22 //--------------------------------------------------
23 //
24 //--------------------------------------------------
25 void EEstarTrig :: clear() {
26 #define clearVec(x) memset( x, 0, sizeof(x))
27 
28  bX48hi=bX48lo=bX7bit=0;
29  daqbits=0;
30  clearVec( offline_id );
31  clearVec( EEMC );
32  clearVec( EEMC_l1 );
33  clearVec( BEMC );
34  clearVec( BEMC_l1 );
35  clearVec( lastDSM );
36  clearVec( VTX );
37  clearVec( EMC );
38  npre=npost=0;
39 
40 #undef clearVec
41 }
42 
43 
44 
45 //--------------------------------------------------
46 //
47 //--------------------------------------------------
48 int EEstarTrig :: get48bXing() const{
49  // printf("EEstarTrig:: print0() %d %d %d \n",bX48hi,bX48lo, bX7bit);
50  unsigned long long int hi=bX48hi;
51  unsigned long long int lo=bX48lo;
52  unsigned long long int bx48=hi<<32;
53  bx48+= lo;
54  int bx=bx48%120;
55  return bx;
56 }
57 
58 //
59 //--------------------------------------------------
60 void EEstarTrig :: print(int k, FILE *fd) const{
61  // printf("EEstarTrig:: print0() %d %d %d \n",bX48hi,bX48lo, bX7bit);
62  int bx=get48bXing();
63  int off=bx-bX7bit;
64  if(off<0) off+=120;
65  fprintf(fd,"EEstarTrig:: print() bX=%d bX7=%d off=%d\n",bx,bX7bit,off);
66  if(k<=0) return;
67 
68  int ii;
69  fprintf(fd," daqBits=0x%x npre=%d npost=%d\n",daqbits,npre,npost);
70 
71  fprintf(fd," trigID[] --> ");
72  for(ii=0;ii<32;ii++) {
73  if(offline_id[ii]==0) break;
74  fprintf(fd,"[%2d]=0x%02X [%u dec], ",ii,offline_id[ii],offline_id[ii]);
75  if(ii%4==3) printf("\n ");
76  }
77  fprintf(fd,"\n");
78 
79  fprintf(fd," bbcTimeDiff=%d spinBits=x%2.2x lastDSM[7]=x%4.4x\n",bbcTimeDiff(), spinBits(),lastDSM[7]);
80  // fprintf(fd," Yell fill=%d Up=%d Down=%d UnPol=%d \n",bitYellFill() ,bitYellUp(),bitYellDown(), bitYellUnpol());
81  // fprintf(fd," Blue fill=%d Up=%d Down=%d UnPol=%d \n",bitBlueFill() ,bitBlueUp(),bitBlueDown(), bitBlueUnpol());
82  if(k<=1) return;
83 
84 
85  for(ii=0;ii<144;ii++) {
86  if(ii%16==8) printf(" , ");
87  if(ii%16==0) printf("\n EEMC board-%d= ",ii/16+1);
88  fprintf(fd,"x%2.2x ", EEMC[ii]);
89  }
90  fprintf(fd,"\n");
91 
92  int j;
93 
94  fprintf(fd," DSM VTX[j] = ");
95  for (j=0; j<8; j++) printf("[%d]=x%4.4x ",j, VTX[j]);
96  fprintf(fd,"\n");
97  fprintf(fd," emcDSM[j]= ");
98  for (j=0; j<8; j++) printf("[%d]=x%4.4x ",j, EMC[j]);
99  fprintf(fd,"\n");
100  fprintf(fd," lastDSM[j]= ");
101  for (j=0; j<8; j++) printf("[%d]=x%4.4x ",j, lastDSM[j]);
102  fprintf(fd,"\n");
103 
104 }
105 
106 
107 //--------------------------------------------------
108 //--------------------------------------------------
109 int EEstarTrig ::isTrigID(int trigId) { // works only for 2003 data
110  int i;
111  for(i=0;i<32;i++) {
112  if(trigId==offline_id[i]) return 1;
113  if(offline_id[i]<=0) break; // no more triggers in the list
114  }
115  return 0;
116 }
117 
118