StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trgReader12.cxx
1 #include <stdio.h>
2 #include <string.h>
3 #include <arpa/inet.h>
4 
5 #include <rtsLog.h>
6 
7 // one needs to diffuse the crummy trigger stuff first
8 #define TRG_VERSION 0x12
9 
10 #include <daqFormats.h>
11 #include <rtsSystems.h>
12 
13 
14 #include "daq_trg.h"
15 
16 // this maps from the raw data to the following representation
17 // sector1,slat1,ch1 ... ch5, sector1,slat2,ch1.... ch5, sector2,slat1,ch1...
18 
19 static unsigned char ctbMap[240] = {
20 7, 6, 5, 4, 3, 23, 22, 21, 20, 19,
21 2, 1, 0, 15, 14, 18, 17, 16, 31, 30,
22 13, 12, 11, 10, 9, 29, 28, 27, 26, 25,
23 39, 38, 37, 36, 35, 55, 54, 53, 52, 51,
24 34, 33, 32, 47, 46, 50, 49, 48, 63, 62,
25 45, 44, 43, 42, 41, 61, 60, 59, 58, 57,
26 71, 70, 69, 68, 67, 87, 86, 85, 84, 83,
27 66, 65, 64, 79, 78, 82, 81, 80, 95, 94,
28 77, 76, 75, 74, 73, 93, 92, 91, 90, 89,
29 103, 102, 101, 100, 99, 119, 118, 117, 116, 115,
30 98, 97, 96, 111, 110, 114, 113, 112, 127, 126,
31 109, 108, 107, 106, 105, 125, 124, 123, 122, 121,
32 135, 134, 133, 132, 131, 151, 150, 149, 148, 147,
33 130, 129, 128, 143, 142, 146, 145, 144, 159, 158,
34 141, 140, 139, 138, 137, 157, 156, 155, 154, 153,
35 167, 166, 165, 164, 163, 183, 182, 181, 180, 179,
36 162, 161, 160, 175, 174, 178, 177, 176, 191, 190,
37 173, 172, 171, 170, 169, 189, 188, 187, 186, 185,
38 199, 198, 197, 196, 195, 215, 214, 213, 212, 211,
39 194, 193, 192, 207, 206, 210, 209, 208, 223, 222,
40 205, 204, 203, 202, 201, 221, 220, 219, 218, 217,
41 231, 230, 229, 228, 227, 247, 246, 245, 244, 243,
42 226, 225, 224, 239, 238, 242, 241, 240, 255, 254,
43 237, 236, 235, 234, 233, 253, 252, 251, 250, 249,
44 } ;
45 
46 
47 static unsigned char mwcMap[96] = {
48 71, 70, 69, 68, 67, 66, 65, 64, 79, 78, 77, 76,
49 95, 94, 93, 92, 87, 86, 85, 84, 83, 82, 81, 80,
50 99, 98, 97, 96, 111, 110, 109, 108, 103, 102, 101, 100,
51 119, 118, 117, 116, 115, 114, 113, 112, 127, 126, 125, 124,
52 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12,
53 31, 30, 29, 28, 23, 22, 21, 20, 19, 18, 17, 16,
54 35, 34, 33, 32, 47, 46, 45, 44, 39, 38, 37, 36,
55 55, 54, 53, 52, 51, 50, 49, 48, 63, 62, 61, 60,
56 } ;
57 
58 
59 
60 
61 // read the Trigger RAW data
62 int trgReader12(char *arg, trg_t *trg)
63 {
64  int i ;
65 
66  struct TRGD *trgd = (struct TRGD *)arg ;
67 
68  LOG(DBG,"TrgDataFmtVer 0x%X, %c %c %c %c", trgd->desc.TrgDataFmtVer,
69  trgd->sum.TrgSumHeader[0],
70  trgd->sum.TrgSumHeader[1],
71  trgd->raw[0].CTBdataHeader[0],
72  trgd->raw[0].CTBdataHeader[1]) ;
73  LOG(DBG,"TrgSumBytes %d, %c %c %c %c", trgd->sum.TrgSumBytes,
74  trgd->sum.L0RegHeader[0],
75  trgd->sum.L0RegHeader[1],
76  trgd->raw[0].RawDetHeader[0],
77  trgd->raw[0].RawDetHeader[1]) ;
78 
79  for(i=0;i<240;i++) {
80  trg->CTB[i] = trgd->raw[0].CTB[ctbMap[i]] ;
81  }
82 
83  for(i=0;i<96;i++) {
84  trg->MWC[i] = trgd->raw[0].MWC[mwcMap[i]] ;
85  }
86 
87  for(i=0;i<16;i++) {
88  trg->ZDC[i] = trgd->sum.DSM.ZDC[i] ;
89  }
90 
91 
92  trg->trg_sum = NULL ;
93 
94  return 0 ;
95 }
96 
Definition: daq_trg.h:9