StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TRG_Reader.cxx
1 /*
2  ***************************************************************************
3  * Author: Herb Ward
4  ***************************************************************************
5  * Description: TRG unpacking code
6  *
7  *
8  * change log
9  * 14-Jan-00 MJL added TRGD::PrintDataCompact()
10  * 04-Feb-00 hjw adaptations for "ushort ZDCDSM[8]" to "BYTE ZDC[16]" in
11  * trgStructures.h (BYTE = uchar)
12  *
13  ***************************************************************************
14 */
15 
16 #include "TRG_Reader.hh"
17 #include <assert.h>
18 #include "trgStructures2007.h"
19 #include "trgStructures2008.h"
20 #define PP printf(
21 
22 using namespace OLDEVP;
23 
25 #define PREPOST 11
26 #include "trgStructures.h"
27 typedef struct {
28  EvtDescData EvtDesc; /* L1 Event Descriptor Data */
29  TrgSumData TrgSum; /* summary data */
30  RawTrgDet RAW[PREPOST]; /* pre and post history determines actual dimension. */
32 MarilynMonroe *gs;
33 
34 #include "trgStructures2000.h"
35 typedef struct {
36  EvtDescData2000 EvtDesc; /* L1 Event Descriptor Data */
37  TrgSumData2000 TrgSum; /* summary data */
38  RawTrgDet2000 RAW[PREPOST]; /* For simplicity, I assume that you don't want pre and post history. */
40 MarilynMonroe2000 *gs2000; // CAUTION: this is used in duplicated.code, even
41  // though grep doesn't find it (see macro SWITCH).
43 // This section of code causes the functions in the file duplicated.code to appear twice
44 // in this code file. The second time is for trigger data in the year 2000 format.
45 // The first time is for year 2001 format.
46 #define SWITCH(x) x
47 #include "duplicated.code"
48 #undef SWITCH
49 #define SWITCH(x) x ## 2000
50 #include "duplicated.code"
53 
56  data+=sizeof(unsigned short)+sizeof(char); // Skip the first two data.
57 
58  if(*data==0x12) return 2000; // These years (2000, 2001, 2003, ...) correspond
59  if(*data==0x13) return 2001; // roughly to the file names for the various
60  if(*data==0x20) return 2003; // trgStructures.h versions (eg, trgStructures2003.h).
61  if(*data==0x21) return 2004; // trgStructures.h versions (eg, trgStructures2004.h).
62  if(*data==0x22) return 2005; // trgStructures.h versions (eg, trgStructures2005.h).
63  //This version 30 had problem and fixed 20070404 by version 31.
64  //Data before 20070404 have version 30, but will read correctly when casted to version 31
65  if(*data==0x30) return 2007; // trgStructures.h versions (eg, trgStructures2007.h).
66  //Fixed version of 2007 trigger structure
67  if(*data==0x31) return 2007; // trgStructures.h versions (eg, trgStructures2007.h).
68  //From run8 this will be TrgTowerTrnfer version#
69  if(*data==0x10 || *data==0x32) return 2008; // trgStructures.h versions (eg, trgStructures2008.h).
70 
71  (void) printf("TRG_Reader::YearOfData : value %d=0x%x not treated\n",*data,*data);
72  //assert(0); // Should not be here. My ne dolzhny byt6 zdec6.
73 
74  return 0;
75 }
76 
77 
78 TRG_Reader::TRG_Reader(EventReader *er, Bank_TRGP *pTRGP) :
79  mErr(0),pBankUnp(0),sizeUnp(0),pTRGD(0)
80 {
81  if (!pTRGD) pTRGD = new Bank_TRGD();
82 
83  pBankTRGP=pTRGP; //copy into class data member for use by other methods
84  ercpy=er; // squirrel away pointer eventreader for our friends
85 
86  if ( !pTRGP) return;
87 
88  if(!pBankTRGP->test_CRC()) {
89  (void) printf("TRG_Reader::TRG_Reader: CRC error: %s %d\n",__FILE__,__LINE__);
90  }
91 
92  if(pBankTRGP->swap()<0) {
93  // Use default swap.
94  mErr = 1;
95  (void) printf("TRG_Reader::TRG_Reader: swap error: %s %d\n",__FILE__,__LINE__);
96  }
97  pBankTRGP->header.CRC=0;
98  pBankTRGD=(Bank_TRGD*) ((char *)pBankTRGP + 4*pBankTRGP->theData.offset);
99  assert(pBankTRGD);
100 
101  if(!pBankTRGD->test_CRC()) {
102  mErr=2;
103  (void) printf("TRG_Reader::TRG_Reader: CRC error: %s %d\n",__FILE__,__LINE__);
104  }
105  char *ptr=(char*)pBankTRGD; ptr+=40; /* Skip the 10-word TRGD bank header. */
106 
107  switch(YearOfData(ptr)) {
108  case 0:
109  // An error occured with decoding the version / year number
110  (void) printf("TRG_Reader::TRG_Reader: YearOfData() returned a failure status\n");
111  mErr = 9999;
112  return;
113  break;
114 
115  case 2000:
116  gs2000=(MarilynMonroe2000*)ptr;
117  // SanityCheck2000(1);
118  if(pBankTRGD->HerbSwap2000() <0) {
119  mErr = 2000;
120  (void) printf("TRG_Reader::TRG_Reader: Swap error %s %d.\n",__FILE__,__LINE__);
121  }
122  break;
123 
124  case 2001:
125  gs=(MarilynMonroe*)ptr;
126  // SanityCheck(1);
127  if(pBankTRGD->HerbSwap() <0) {
128  mErr = 2001;
129  (void) printf("TRG_Reader::TRG_Reader: Swap error %s %d.\n",__FILE__,__LINE__);
130  }
131  break;
132 
133  case 2003:
134  S_mode = 0;
135  // SanityCheck2003(ptr,S_mode);
136  if(pBankTRGD->HerbSwap2003(ptr)<0) {
137  mErr = 2003;
138  (void) printf("TRG_Reader::TRG_Reader: Swap error %s %d.\n",__FILE__,__LINE__);
139  }
140  break;
141 
142  case 2004:
143  S_mode = 0;
144  // SanityCheck2004(ptr,S_mode);
145  if(pBankTRGD->HerbSwap2004(ptr)<0) {
146  mErr = 2004;
147  (void) printf("TRG_Reader::TRG_Reader: Swap error %s %d.\n",__FILE__,__LINE__);
148  }
149  break;
150 
151  case 2005:
152  S_mode = 0;
153  // SanityCheck2004(ptr,S_mode);
154  if(pBankTRGD->HerbSwap2005(ptr)<0) {
155  mErr = 2005;
156  (void) printf("TRG_Reader::TRG_Reader: Swap error %s %d.\n",__FILE__,__LINE__);
157  }
158  break;
159 
160  case 2007:
161  S_mode = 0;
162  // Since 2007 run, trigger data has variable length.
163  // Also byte swap accordingly
164  if(UnpackTrg2007(pBankTRGP) < 0){
165  mErr = 2007;
166  (void) printf("TRG_Reader::TRG_Reader: Swap error %s %d.\n",__FILE__,__LINE__);
167  }
168  pBankTRGD=(Bank_TRGD*) ((char *)pBankTRGP + 4*pBankTRGP->theData.offset);
169  break;
170 
171  case 2008:
172  S_mode = 0;
173  if(UnpackTrg2008(pBankTRGP) < 0){
174  mErr = 2008;
175  (void) printf("TRG_Reader::TRG_Reader: Swap error %s %d.\n",__FILE__,__LINE__);
176  }
177  pBankTRGD=(Bank_TRGD*) ((char *)pBankTRGP + 4*pBankTRGP->theData.offset);
178  break;
179 
180  default:
181  assert(0);
182  }
183  (void) printf("TRG_Reader::TRG_Reader: Trigger reader instantiated, distance to data = %d bytes.\n",
184  pBankTRGP->theData.offset);
185 }
186 
187 void TRG_Reader::dumpWordsToScreenInHexAndExit(int nwords) {
188  int i;
189  unsigned int *pp;
190  pp=(unsigned int*)pBankTRGD;
191  if(sizeof(unsigned int)!=4) { PP"Error 77b in %s.\n",__FILE__); assert(0); }
192  for(i=0;i<nwords;i++) {
193  PP"word number %3d: 0x%08x\n",i+1,pp[i]);
194  }
195  PP"Exiting from diagnostic function.\n");
196  assert(0); // Do not remove this exit. If you don't want to exit, don't call this function.
197 }
198 char *Bank_TRGD::PrintHelp(char *msg,int nn) {
199  static char rv[100];
200  sprintf(rv,"%s[%3d]",msg,nn);
201  return rv;
202 }
203 #define Funsigned_short "%32s 0x%04x %15d\n"
204 #define Fchar "%32s %c %15d\n"
205 #define Funsigned_int "%32s 0x%08x %15d\n"
206 #define Funsigned_char "%32s 0x%02x %15d\n"
207 #define Funsigned_long Funsigned_int
208 #define FF fprintf(ff,
209 /*--------------------- Commented Sep 7 2001. St_trg_Maker has functions for printing the data.
210 void Bank_TRGD::PrintAllTheData(FILE *ff) {
211  int i;
212  assert(ff);
213  FF Funsigned_short ,"EvtDesc.TCUdataBytes",GS->EvtDesc.TCUdataBytes,GS->EvtDesc.TCUdataBytes);
214  FF Fchar ,"EvtDesc.TCUEvtDesc",GS->EvtDesc.TCUEvtDesc,GS->EvtDesc.TCUEvtDesc);
215  FF Funsigned_char ,"EvtDesc.TrgDataFmtVer",GS->EvtDesc.TrgDataFmtVer,GS->EvtDesc.TrgDataFmtVer);
216  FF Funsigned_int ,"EvtDesc.bunchXing_hi",GS->EvtDesc.bunchXing_hi,GS->EvtDesc.bunchXing_hi);
217  FF Funsigned_int ,"EvtDesc.bunchXing_lo",GS->EvtDesc.bunchXing_lo,GS->EvtDesc.bunchXing_lo);
218  FF Funsigned_short ,"EvtDesc.TCU1.FIFO1.TrgToken",GS->EvtDesc.TCU1.FIFO1.TrgToken,GS->EvtDesc.TCU1.FIFO1.TrgToken);
219  FF Funsigned_short ,"EvtDesc.TCU1.FIFO1.TrgActionWd",GS->EvtDesc.TCU1.FIFO1.TrgActionWd,GS->EvtDesc.TCU1.FIFO1.TrgActionWd);
220  FF Funsigned_long ,"EvtDesc.TCU1.fifo1",GS->EvtDesc.TCU1.fifo1,GS->EvtDesc.TCU1.fifo1);
221  FF Funsigned_short ,"EvtDesc.TCU2.FIFO2.DSMInput",GS->EvtDesc.TCU2.FIFO2.DSMInput,GS->EvtDesc.TCU2.FIFO2.DSMInput);
222  FF Funsigned_short ,"EvtDesc.TCU2.FIFO2.DSMAddress",GS->EvtDesc.TCU2.FIFO2.DSMAddress,GS->EvtDesc.TCU2.FIFO2.DSMAddress);
223  FF Funsigned_long ,"EvtDesc.TCU2.fifo2",GS->EvtDesc.TCU2.fifo2,GS->EvtDesc.TCU2.fifo2);
224  FF Funsigned_char ,"EvtDesc.TCU3.FIFO3.DetectorBusy",GS->EvtDesc.TCU3.FIFO3.DetectorBusy,GS->EvtDesc.TCU3.FIFO3.DetectorBusy);
225  FF Funsigned_char ,"EvtDesc.TCU3.FIFO3.addBits",GS->EvtDesc.TCU3.FIFO3.addBits,GS->EvtDesc.TCU3.FIFO3.addBits);
226  FF Funsigned_char ,"EvtDesc.TCU3.FIFO3.TriggerWd",GS->EvtDesc.TCU3.FIFO3.TriggerWd,GS->EvtDesc.TCU3.FIFO3.TriggerWd);
227  FF Funsigned_long ,"EvtDesc.TCU3.fifo3",GS->EvtDesc.TCU3.fifo3,GS->EvtDesc.TCU3.fifo3);
228  FF Funsigned_short ,"EvtDesc.npre",GS->EvtDesc.npre,GS->EvtDesc.npre);
229  FF Funsigned_short ,"EvtDesc.npost",GS->EvtDesc.npost,GS->EvtDesc.npost);
230  FF Funsigned_short ,"TrgSum.TrgSumBytes",GS->TrgSum.TrgSumBytes,GS->TrgSum.TrgSumBytes);
231  char *TrgSumHeader=(char*)&(GS->TrgSum.TrgSumHeader);
232  for(i=0;i< 2;i++) FF Fchar ,PrintHelp("TrgSum.TrgSumHeader",i),
233  TrgSumHeader[i],
234  TrgSumHeader[i]);
235  for(i=0;i< 2;i++) FF Funsigned_int ,PrintHelp("TrgSum.L1Sum",i),GS->TrgSum.L1Sum[i],GS->TrgSum.L1Sum[i]);
236  for(i=0;i< 2;i++) FF Funsigned_int ,PrintHelp("TrgSum.L2Sum",i),GS->TrgSum.L2Sum[i],GS->TrgSum.L2Sum[i]);
237  FF Funsigned_short ,"TrgSum.L0SumBytes",GS->TrgSum.L0SumBytes,GS->TrgSum.L0SumBytes);
238  char *L0SumHeader=(char*)&(GS->TrgSum.L0SumHeader);
239  for(i=0;i< 2;i++) FF Fchar ,PrintHelp("TrgSum.L0SumHeader",i),
240  L0SumHeader[i],
241  L0SumHeader[i]);
242  for(i=0;i< 32;i++) FF Funsigned_short ,PrintHelp("TrgSum.DSM.CPA",i),GS->TrgSum.DSM.CPA[i],GS->TrgSum.DSM.CPA[i]);
243  for(i=0;i< 8;i++) FF Funsigned_short ,PrintHelp("TrgSum.DSM.quadDSM",i),GS->TrgSum.DSM.quadDSM[i],GS->TrgSum.DSM.quadDSM[i]);
244  for(i=0;i< 8;i++) FF Funsigned_short ,PrintHelp("TrgSum.DSM.lastDSM",i),GS->TrgSum.DSM.lastDSM[i],GS->TrgSum.DSM.lastDSM[i]);
245  for(i=0;i< 16;i++) FF Funsigned_char ,PrintHelp("TrgSum.DSM.ZDC",i),GS->TrgSum.DSM.ZDC[i],GS->TrgSum.DSM.ZDC[i]);
246  for(i=0;i< 16;i++) FF Funsigned_short ,PrintHelp("TrgSum.DSM.BCdata",i),GS->TrgSum.DSM.BCdata[i],GS->TrgSum.DSM.BCdata[i]);
247  FF Funsigned_short ,"TrgSum.L1SumBytes",GS->TrgSum.L1SumBytes,GS->TrgSum.L1SumBytes);
248  char *L1SumHeader=(char*)&(GS->TrgSum.L1SumHeader);
249  for(i=0;i< 2;i++) FF Fchar ,PrintHelp("TrgSum.L1SumHeader",i),
250  L1SumHeader[i],
251  L1SumHeader[i]);
252  for(i=0;i< 32;i++) FF Funsigned_int ,PrintHelp("TrgSum.L1Result",i),GS->TrgSum.L1Result[i],GS->TrgSum.L1Result[i]);
253  FF Funsigned_short ,"TrgSum.L2SumBytes",GS->TrgSum.L2SumBytes,GS->TrgSum.L2SumBytes);
254  char *L2SumHeader=(char*)&(GS->TrgSum.L2SumHeader);
255  for(i=0;i< 2;i++) FF Fchar ,PrintHelp("TrgSum.L2SumHeader",i),
256  L2SumHeader[i],
257  L2SumHeader[i]);
258  for(i=0;i< 32;i++) FF Funsigned_int ,PrintHelp("TrgSum.L2Result",i),GS->TrgSum.L2Result[i],GS->TrgSum.L2Result[i]);
259  FF Funsigned_short ,"RAW.RawDetBytes",GS->RAW[0].RawDetBytes,GS->RAW[0].RawDetBytes);
260  for(i=0;i< 2;i++) FF Fchar ,PrintHelp("RAW.RawDetHeader",i),GS->RAW[0].RawDetHeader[i],GS->RAW[0].RawDetHeader[i]);
261  FF Funsigned_short ,"RAW.CTBdataBytes",GS->RAW[0].CTBdataBytes,GS->RAW[0].CTBdataBytes);
262  for(i=0;i< 2;i++) FF Fchar ,PrintHelp("RAW.CTBdataHeader",i),GS->RAW[0].CTBdataHeader[i],GS->RAW[0].CTBdataHeader[i]);
263  for(i=0;i<256;i++) FF Funsigned_char ,PrintHelp("RAW.CTB",i),GS->RAW[0].CTB[i],GS->RAW[0].CTB[i]);
264  FF Funsigned_short ,"RAW.MWCdataBytes",GS->RAW[0].MWCdataBytes,GS->RAW[0].MWCdataBytes);
265  for(i=0;i< 2;i++) FF Fchar ,PrintHelp("RAW.MWCdataHeader",i),GS->RAW[0].MWCdataHeader[i],GS->RAW[0].MWCdataHeader[i]);
266  FF Funsigned_long ,"RAW.MWCfiller",GS->RAW[0].MWCfiller,GS->RAW[0].MWCfiller);
267  for(i=0;i<128;i++) FF Funsigned_char ,PrintHelp("RAW.MWC",i),GS->RAW[0].MWC[i],GS->RAW[0].MWC[i]);
268  FF Funsigned_short ,"RAW.EMCdataBytes",GS->RAW[0].EMCdataBytes,GS->RAW[0].EMCdataBytes);
269  for(i=0;i< 2;i++) FF Fchar ,PrintHelp("RAW.EMCdataHeader",i),GS->RAW[0].EMCdataHeader[i],GS->RAW[0].EMCdataHeader[i]);
270  FF Funsigned_long ,"RAW.EMCfiller",GS->RAW[0].EMCfiller,GS->RAW[0].EMCfiller);
271 }
272 #define Munsigned_short "%-32s 0x%04x %15d\n"
273 #define Mchar "%-32s %c %15d\n"
274 #define Munsigned_int "%-32s 0x%08x %15d\n"
275 #define Munsigned_char "%-32s 0x%02x %15d\n"
276 #define Munsigned_long Munsigned_int
277 #define M1unsigned_short "%-32s 0x%04x\n"
278 #define M1char "%-32s %c\n"
279 #define M1unsigned_int "%-32s 0x%08x\n"
280 #define M1unsigned_char "%-32s 0x%02x\n"
281 #define M1unsigned_long M1unsigned_int
282 #define PLINE fprintf(ff,"%s",line);
283 void Bank_TRGD::PrintDataCompact(FILE *ff) {
284  int i;
285  char *L0SumHeader,*TrgSumHeader;
286  TrgSumHeader=(char*)&(GS->TrgSum.TrgSumHeader);
287  L0SumHeader=(char*)&(GS->TrgSum.L0SumHeader);
288  char line[] = "-------------------------------------------------------------";
289  assert(ff);
290  FF Munsigned_short ,"EvtDesc.TCUdataBytes",GS->EvtDesc.TCUdataBytes,GS->EvtDesc.TCUdataBytes);
291  FF M1char ,"EvtDesc.TCUEvtDesc",GS->EvtDesc.TCUEvtDesc);
292  FF Munsigned_char ,"EvtDesc.TrgDataFmtVer",GS->EvtDesc.TrgDataFmtVer,GS->EvtDesc.TrgDataFmtVer);
293  FF M1unsigned_int ,"EvtDesc.bunchXing_hi",GS->EvtDesc.bunchXing_hi);
294  FF M1unsigned_int ,"EvtDesc.bunchXing_lo",GS->EvtDesc.bunchXing_lo);
295  FF Munsigned_short ,"EvtDesc.TCU1.FIFO1.TrgToken",GS->EvtDesc.TCU1.FIFO1.TrgToken,GS->EvtDesc.TCU1.FIFO1.TrgToken);
296  FF M1unsigned_short ,"EvtDesc.TCU1.FIFO1.TrgActionWd",GS->EvtDesc.TCU1.FIFO1.TrgActionWd);
297  FF M1unsigned_long ,"EvtDesc.TCU1.fifo1",GS->EvtDesc.TCU1.fifo1);
298  FF M1unsigned_short ,"EvtDesc.TCU2.FIFO2.DSMInput",GS->EvtDesc.TCU2.FIFO2.DSMInput);
299  FF M1unsigned_short ,"EvtDesc.TCU2.FIFO2.DSMAddress",GS->EvtDesc.TCU2.FIFO2.DSMAddress);
300  FF M1unsigned_long ,"EvtDesc.TCU2.fifo2",GS->EvtDesc.TCU2.fifo2);
301  FF M1unsigned_char ,"EvtDesc.TCU3.FIFO3.DetectorBusy",GS->EvtDesc.TCU3.FIFO3.DetectorBusy);
302  FF M1unsigned_char ,"EvtDesc.TCU3.FIFO3.addBits",GS->EvtDesc.TCU3.FIFO3.addBits);
303  FF M1unsigned_char ,"EvtDesc.TCU3.FIFO3.TriggerWd",GS->EvtDesc.TCU3.FIFO3.TriggerWd);
304  FF M1unsigned_long ,"EvtDesc.TCU3.fifo3",GS->EvtDesc.TCU3.fifo3);
305  FF Munsigned_short ,"EvtDesc.npre",GS->EvtDesc.npre,GS->EvtDesc.npre);
306  FF Munsigned_short ,"EvtDesc.npost",GS->EvtDesc.npost,GS->EvtDesc.npost);
307  FF Munsigned_short ,"TrgSum.TrgSumBytes",GS->TrgSum.TrgSumBytes,GS->TrgSum.TrgSumBytes);
308  FF "%-32s '%c%c'\n","TrgSum.TrgSumHeader", TrgSumHeader[0],TrgSumHeader[1]);
309  FF "%-32s 0x%08x 0x%08x\n", "TrgSum.L1Sum",GS->TrgSum.L1Sum[0],GS->TrgSum.L1Sum[1]);
310  FF "%-32s 0x%08x 0x%08x\n", "TrgSum.L2Sum",GS->TrgSum.L2Sum[0],GS->TrgSum.L2Sum[1]);
311  FF Munsigned_short ,"TrgSum.L0SumBytes",GS->TrgSum.L0SumBytes,GS->TrgSum.L0SumBytes);
312  FF "%-32s '%c%c'\n", "TrgSum.L0SumHeader",L0SumHeader[0],L0SumHeader[1]);
313 
314 
315  FF "\n%s ","TrgSum.DSM.CPA:");
316  for(i=0;i< 32;i++) {
317  if (i%8) FF "%4x ",GS->TrgSum.DSM.CPA[i]);
318  else FF "\n%2d| %4x ",i,GS->TrgSum.DSM.CPA[i]);
319  }
320  FF "\n\n");
321 
322  FF "\n%s ","TrgSum.DSM.quadDSM:");
323  for(i=0;i< 8;i++) {
324  if (i%8) FF "%4x ",GS->TrgSum.DSM.quadDSM[i]);
325  else FF "\n%2d| %4x ",i,GS->TrgSum.DSM.quadDSM[i]);
326  }
327  FF "\n\n");
328 
329  FF "\n%s ","TrgSum.DSM.lastDSM:");
330  for(i=0;i< 8;i++) {
331  if (i%8) FF "%4x ",GS->TrgSum.DSM.lastDSM[i]);
332  else FF "\n%2d| %4x ",i,GS->TrgSum.DSM.lastDSM[i]);
333  }
334  FF "\n\n");
335 
336 
337  FF "\n%s ","TrgSum.DSM.ZDC:");
338  for(i=0;i<16;i++) {
339  if (i%8) FF "%2x ",GS->TrgSum.DSM.ZDC[i]);
340  else FF "\n%2d| %2x ",i,GS->TrgSum.DSM.ZDC[i]);
341  }
342  FF "\n\n");
343 
344 
345  FF "\n%s ","TrgSum.DSM.BCdata:");
346  for(i=0;i< 16;i++) {
347  if (i%8) FF "%4x ",GS->TrgSum.DSM.BCdata[i]);
348  else FF "\n%2d| %4x ",i,GS->TrgSum.DSM.BCdata[i]);
349  }
350  FF "\n\n");
351 
352  PLINE
353  char *L1SumHeader=(char*)&(GS->TrgSum.L1SumHeader);
354  FF "\n%-20s0x%x (%d) bytes\tHeader: '%c%c'\n","TrgSum.L1Result:",GS->TrgSum.L1SumBytes,GS->TrgSum.L1SumBytes,
355  L1SumHeader[0],
356  L1SumHeader[1]);
357  PLINE
358  for(i=0;i< 32;i++) {
359  if (i%8) FF "%8x ",GS->TrgSum.L1Result[i]);
360  else FF "\n%2d| %8x ",i,GS->TrgSum.L1Result[i]);
361  }
362  FF "\n\n");
363 
364 
365  PLINE
366  char *L2SumHeader=(char*)&(GS->TrgSum.L2SumHeader);
367  FF "\n%-20s0x%x (%d) bytes\tHeader: '%c%c'\n","TrgSum.L2Result:",GS->TrgSum.L2SumBytes,GS->TrgSum.L2SumBytes,
368  L2SumHeader[0],
369  L2SumHeader[1]);
370  PLINE
371  for(i=0;i< 32;i++) {
372  if (i%8) FF "%8x ",GS->TrgSum.L2Result[i]);
373  else FF "\n%2d| %8x ",i,GS->TrgSum.L2Result[i]);
374  }
375  FF "\n\n");
376 
377  PLINE
378  FF "\n%-20s0x%x (%d) bytes\tHeader: '%c%c'\n","RAW Detector:",GS->RAW[0].RawDetBytes,GS->RAW[0].RawDetBytes,GS->RAW[0].RawDetHeader[0],GS->RAW[0].RawDetHeader[1]);
379  PLINE
380  FF "\n");
381 
382  PLINE
383  FF "\n%-20s0x%x (%d) bytes\tHeader: '%c%c'\n","RAW.CTB:",GS->RAW[0].CTBdataBytes,GS->RAW[0].CTBdataBytes,GS->RAW[0].CTBdataHeader[0],GS->RAW[0].CTBdataHeader[1]);
384  PLINE
385 
386  for(i=0;i< 256;i++) {
387  if (i%24) FF "%2x ",GS->RAW[0].CTB[i]);
388  else FF "\n%3d| %2x ",i,GS->RAW[0].CTB[i]);
389  }
390  FF "\n\n");
391 
392  PLINE
393  FF "\n%-20s0x%x (%d) bytes\tHeader: '%c%c'\n","RAW.MWCdataBytes:",GS->RAW[0].MWCdataBytes,GS->RAW[0].MWCdataBytes,GS->RAW[0].MWCdataHeader[0],GS->RAW[0].MWCdataHeader[1]);
394  PLINE
395 
396  for(i=0;i< 128;i++) {
397  if (i%24) FF "%2x ",GS->RAW[0].MWC[i]);
398  else FF "\n%3d| %2x ",i,GS->RAW[0].MWC[i]);
399  }
400  FF "\n\n");
401 
402  PLINE
403  FF "\n%-20s0x%x (%d) bytes\tHeader: '%c%c'\n","RAW.MWCdata:",GS->RAW[0].EMCdataBytes,GS->RAW[0].EMCdataBytes,GS->RAW[0].EMCdataHeader[0],GS->RAW[0].EMCdataHeader[1]);
404  PLINE
405 
406  FF "\n");
407 
408  FF M1unsigned_long ,"RAW.EMCfiller",GS->RAW[0].EMCfiller);
409  FF "\n\n\n\n");
410 }
411 ----------------------------------------------------------------------*/
412 
413 int Bank_TRGD::swapHerb4bytes(unsigned long *data,int number) {
414  return swapHerb4bytes((unsigned int*)data,number);
415 }
416 int Bank_TRGD::swapHerb4bytes(unsigned int *data,int number) {
417  int i;
418  char *hh,temp[4];
419  for(i=0;i<number;i++) {
420  hh=(char*)(&(data[i]));
421  temp[0]=hh[3]; temp[1]=hh[2]; temp[2]=hh[1]; temp[3]=hh[0];
422  data[i]=*((INT32*)temp);
423  }
424  return 3;
425 }
426 int Bank_TRGD::swapHerb2bytes(short unsigned int *data,int number) {
427  int i;
428  char *hh,temp[2];
429  for(i=0;i<number;i++) {
430  hh=(char*)(&(data[i]));
431  temp[0]=hh[1]; temp[1]=hh[0];
432  data[i]=*((INT16*)temp);
433  }
434  return 3;
435 }
436 
437 
438 
439 
440 
Bank_TRGD * pTRGD
Size of unpacked bank space.
Definition: TRG_Reader.hh:109
char * PrintHelp(char *, int)
for 2007 and later see TRG_Reader::UnpackTrg below
Definition: TRG_Reader.cxx:198
int YearOfData(char *)
This routine also exists in St_trg_Maker.
Definition: TRG_Reader.cxx:55