StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTriggerData2022.h
1 /***************************************************************************
2  *
3  * $Id: StTriggerData2022.h,v 2.2 2022/06/25 15:50:16 ullrich Exp $
4  *
5  * Author: Akio Ogawa, October 13, 2017
6  ***************************************************************************
7  *
8  * Description: Concrete implementation of StTriggerData for 2022.
9  *
10  ***************************************************************************
11  *
12  * $Log: StTriggerData2022.h,v $
13  * Revision 2.2 2022/06/25 15:50:16 ullrich
14  * Improved QT board error reports/handling. Added EPD access functions. (Akio)
15  *
16  * Revision 2.1 2022/01/07 15:49:06 ullrich
17  * Initial Revision.
18  *
19  *
20  **************************************************************************/
21 #ifndef StTriggerData2022_hh
22 #define StTriggerData2022_hh
23 
24 #include "StTriggerData.h"
25 #include "StDaqLib/TRG/trgStructures2022.h"
26 
28 
29 public:
31  StTriggerData2022(const TriggerDataBlk2022* data, int run);
32  StTriggerData2022(const TriggerDataBlk2022* data, int run, int bs, int dbg=0);
34 
35  void readData() {readData(0,0);}
36  void readData(const TriggerDataBlk2022* data, int bs);
37  void dump() const; //dump data into text
38  void blindRunInfo();
39 
40  // Versison and data type information
41  unsigned int version() const;
42  unsigned int numberOfPreXing() const;
43  unsigned int numberOfPostXing() const;
44 
45  // Generic trigger informations
46  unsigned int eventNumber() const;
47  unsigned int token() const;
48  unsigned int triggerWord() const;
49  unsigned int actionWord() const;
50  unsigned int zdcKillerBit() const;
51  unsigned short busyStatus() const;
52  unsigned short dsmInput() const;
53  unsigned short trgToken() const;
54  unsigned short dsmAddress() const;
55  unsigned short mAddBits() const;
56  unsigned short bcData(int channel) const;
57 
58  unsigned short getTrgDetMask() const;
59  unsigned int getTrgCrateMask() const;
60 
61  // L2 offsets
62  int L2ResultsOffset(StL2AlgorithmId id) const;
63  bool isL2Triggered(StL2TriggerResultType id) const;
64  unsigned long long l2sum() const;
65 
66  // Bunch and spin bits
67  unsigned int tcuCounter() const;
68  unsigned int rccCounter(int crate) const;
69  unsigned long long bunchCounter() const;
70  unsigned int bunchCounterHigh() const;
71  unsigned int bunchCounterLow() const;
72  unsigned int bunchId48Bit() const;
73  unsigned int bunchId7Bit() const;
74  unsigned int revTick1() const;
75  unsigned int revTick2() const;
76  unsigned int revTick3() const;
77  unsigned int spinBit() const;
78  unsigned int spinBitYellowFilled() const;
79  unsigned int spinBitYellowUp() const;
80  unsigned int spinBitYellowDown() const;
81  unsigned int spinBitYellowUnpol() const;
82  unsigned int spinBitBlueFilled() const;
83  unsigned int spinBitBlueUp() const;
84  unsigned int spinBitBlueDown() const;
85  unsigned int spinBitBlueUnpol() const;
86 
87  // High Level Trigger info
88  unsigned short tcuBits() const;
89  unsigned short lastDSM(int address) const;
90  unsigned short vertexDSM(int channel) const;
91  unsigned short bemcLayer1DSM(int channel, int prepost=0) const;
92  unsigned short eemcLayer1DSM(int channel, int prepost=0) const;
93  unsigned short emcLayer2DSM(int channel) const;
94  unsigned short tpcMaskDSM(int channel) const;
95  //unsigned short fpdLayer1DSMRaw(StBeamDirection eastwest, int channel, int prepost=0) const;
96  // unsigned short fpdLayer1DSM(StBeamDirection eastwest, int module, int board, int prepost=0) const;
97  //unsigned short fpdLayer2DSMRaw(int channel) const;
98  // unsigned short fpdLayer2DSM(StBeamDirection eastwest, int module) const;
99 
100  // CTB
101  // unsigned short ctbRaw(int address, int prepost=0) const;
102  // unsigned short ctb(int pmt, int prepost=0) const;
103  // unsigned short ctbTraySlat(int tray, int slat, int prepost=0) const;
104  // unsigned short ctbSum(int prepost=0) const;
105 
106  // BBC
107  unsigned short bbcADC(StBeamDirection eastwest, int pmt, int prepost=0) const;
108  unsigned short bbcTDC(StBeamDirection eastwest, int pmt, int prepost=0) const;
109  unsigned short bbcTDC5bit(StBeamDirection eastwest, int pmt, int prepost=0) const;
110  unsigned short bbcADCSum(StBeamDirection eastwest, int prepost=0) const;
111  unsigned short bbcADCSumLargeTile(StBeamDirection eastwest, int prepost=0) const;
112  unsigned short bbcEarliestTDC(StBeamDirection eastwest, int prepost=0) const;
113  unsigned short bbcTimeDifference() const;
114  unsigned short bbcTacSum() const;
115  unsigned short bbcEarliestTDCLarge(StBeamDirection eastwest, int prepost=0) const;
116  unsigned short bbcTimeDifferenceLarge() const;
117  unsigned short bbcBB101(int ch, int prepost=0) const;
118  unsigned short bbcBB102(int ch, int prepost=0) const;
119 
120  // FPD
121  unsigned short fpd(StBeamDirection eastwest, int module, int pmt, int prepost=0) const;
122  unsigned short fpdSum(StBeamDirection eastwest, int module) const;
123 
124  // FMS
125  //unsigned short nQTdata(int prepost=0) const;
126  //unsigned int* QTdata(int prepost=0) const;
127  unsigned short fmsADC(int crt, int adr, int ch, int prepost=0) const;
128  unsigned short fmsTDC(int crt, int adr, int ch, int prepost=0) const;
129 
130  //EPD
131  unsigned short epdEarliestTDC(StBeamDirection eastwest, int prepost) const;
132  unsigned short epdTimeDifference() const;
133  bool epdHitLayer2(StBeamDirection eastwest) const;
134  unsigned short epdLayer1(int ch, int prepost=0) const;
135  unsigned short epdLayer1a(int ch, int prepost=0) const;
136  //unsigned short epdLayer1b(int ch, int prepost=0) const;
137  unsigned short epdLayer0t(int ch, int prepost=0) const;
138  //unsigned short epdLayer0a(int ch, int prepost=0) const;
139  // unsigned char epdLayer0h(int ch, int prepost=0) const;
140  unsigned short epdADC(int crt, int adr, int ch, int prepost=0) const;
141  unsigned short epdTDC(int crt, int adr, int ch, int prepost=0) const;
142  unsigned short epdNHits(StBeamDirection eastwest, int prepost=0) const;
143  unsigned short epdNHitsQT(int crate, int qt, int mult12, int prepost=0) const;
144  unsigned short epdLayer0aMult(int ch, int prepost=0) const;
145  unsigned short epdLayer0hMult(int ch, int mult12, int prepost=0) const;
146  unsigned short epdLayer1bMult(StBeamDirection eastwest, int ring, int prepost=0) const;
147  unsigned short epdMultTotal(int prepost=0) const;
148  unsigned short epdMultDiff(int prepost=0) const;
149 
150  //ZDC
151  bool zdcPresent(int prepost=0) const;
152  unsigned short zdcAtChannel(int channel, int prepost=0) const;
153  unsigned short zdcAtAddress(int address, int prepost=0) const;
154  unsigned short zdcUnAttenuated(StBeamDirection eastwest, int prepost=0) const;
155  unsigned short zdcAttenuated(StBeamDirection eastwest, int prepost=0) const;
156  unsigned short zdcADC(StBeamDirection eastwest, int pmt, int prepost=0) const;
157  unsigned short zdcTDC(StBeamDirection eastwest, int prepost=0) const;
158  unsigned short zdcPmtTDC(StBeamDirection eastwest, int pmt, int prepost=0) const;
159  unsigned short zdcHardwareSum(int prepost=0) const;
160  //ZDC DSM L1
161  unsigned short zdcEarliestTDC(StBeamDirection eastwest, int prepost=0) const;
162  bool zdcSumADCaboveThreshold(StBeamDirection eastwest, int prepost=0) const;
163  bool zdcFrontADCaboveThreshold(StBeamDirection eastwest, int prepost=0) const;
164  bool zdcBackADCaboveThreshold(StBeamDirection eastwest, int prepost=0) const;
165  unsigned short zdcTruncatedSum(StBeamDirection eastwest, int prepost=0) const;
166  //ZDC DSM L2
167  bool zdcSumADCaboveThresholdL2(StBeamDirection eastwest) const;
168  bool zdcFrontADCaboveThresholdL2(StBeamDirection eastwest) const;
169  bool zdcBackADCaboveThresholdL2(StBeamDirection eastwest) const;
170  unsigned short zdcTimeDifference() const;
171  //ZDC Last DSM
172  bool zdcSumADCaboveThresholdL3(StBeamDirection eastwest) const;
173  bool zdcFrontADCaboveThresholdL3(StBeamDirection eastwest) const;
174  bool zdcBackADCaboveThresholdL3(StBeamDirection eastwest) const;
175  bool zdcTimeDifferenceInWindow() const;
176 
177  //ZDCSMD
178  bool zdcSMDPresent(int prepost=0) const;
179  unsigned short zdcSMD(StBeamDirection eastwest, int verthori, int strip, int prepost=0) const;
180  unsigned short zdcSMDHighestStrip(StBeamDirection eastwest, int verthori, int prepost=0) const;
181 
182  // EMC
183  unsigned char bemcHighTower(int patch_id, int prepost=0) const;
184  unsigned char bemcJetPatch (int patch_id, int prepost=0) const;
185  unsigned char eemcHighTower(int patch_id, int prepost=0) const;
186  unsigned char eemcJetPatch (int patch_id, int prepost=0) const;
187  unsigned char bemcHighestTowerADC(int prepost=0) const;
188  unsigned char eemcHighestTowerADC(int prepost=0) const;
189 
190  // VPD
191  unsigned short vpdADC(StBeamDirection eastwest, int pmt, int prepost=0) const;
192  unsigned short vpdTDC(StBeamDirection eastwest, int pmt, int prepost=0) const;
193  unsigned short vpdADCHighThr(StBeamDirection eastwest, int pmt, int prepost=0) const;
194  unsigned short vpdTDCHighThr(StBeamDirection eastwest, int pmt, int prepost=0) const;
195  unsigned short vpdEarliestTDC(StBeamDirection eastwest, int prepost=0) const;
196  unsigned short vpdEarliestTDCHighThr(StBeamDirection eastwest, int prepost=0) const;
197  float vpdMeanTimeDifference(int prepost=0) const;
198  unsigned short vpdADCSum(StBeamDirection eastwest, int prepost=0) const;
199  unsigned short bbcVP101(int ch, int prepost = 0) const;
200 
201  //MXQ crate
202  unsigned short mxqAtSlotAddress(int address, int prepost=0, int slot=0) const;
203 
204  //MTD
205  unsigned short mtdQtAtCh(int qtid, int address, int prepost) const;
206  unsigned short mtdAtAddress(int address, int prepost=0) const;
207  unsigned short mtdgemAtAddress(int address, int prepost=0) const;
208  unsigned short mtd3AtAddress(int address, int prepost=0) const;
209  unsigned short mtdAdc(StBeamDirection eastwest, int pmt, int prepost=0) const;
210  unsigned short mtdTdc(StBeamDirection eastwest, int pmt, int prepost=0) const;
211  unsigned char mtdDsmAtCh(int ch, int prepost=0) const;
212  bool mtdDsmHit(int pmt, int prepost=0) const;
213  unsigned short mtdVpdTacDiff() const;
214  unsigned short mtd4AtAddress(int address, int prepost=0) const;
215 
216  //TOF
217  unsigned short tofAtAddress(int address, int prepost=0) const;
218  unsigned short tofTrayMultiplicity(int tray, int prepost=0) const;
219  unsigned short tofMultiplicity(int prepost=0) const;
220  unsigned short dsmTF201Ch(int ch) const;
221 
222  //PP2PP
223  unsigned short pp2ppADC(StBeamDirection eastwest, int vh, int udio, int ch, int prepost=0) const;
224  unsigned short pp2ppTAC(StBeamDirection eastwest, int vh, int udio, int ch, int prepost=0) const;
225  unsigned long pp2ppDSM(int prepost=0) const;
226 
227  // Experts only
228  char* getTriggerStructure();
229  TriggerDataBlk2022* getTriggerStructure2022();
230  int getRawSize() const;
231 
232  unsigned char* getDsm0_BEMCE(int prepost=0) const;
233  unsigned char* getDsm0_BEMCW(int prepost=0) const;
234  unsigned short* getDsm1_BEMC(int prepost=0) const;
235  unsigned char* getDsm0_EEMC(int prepost=0) const;
236  unsigned short* getDsm1_EEMC(int prepost=0) const;
237  unsigned short* getDsm2_EMC() const;
238 
239  unsigned short* getDsm3() const;
240  //unsigned char* getDsm_FMS(int prepost=0) const;
241  //unsigned char* getDsm01_FMS(int prepost=0) const;
242  //unsigned char* getDsm02_FMS(int prepost=0) const;
243  //unsigned short* getDsm1_FMS(int prepost=0) const;
244  //unsigned short* getDsm2_FMS() const;
245 
246  unsigned int l2ResultLength() const;
247  const unsigned int* l2Result() const;
248 
249  // StFmsHitMaker only!!!
250  //void killFMS();
251 
252 protected:
253  TriggerDataBlk2022 *mData;
254 
255  EvtDescData2022* EvtDesc;
256  L1_DSM_Data2022* L1_DSM;
257  TrgSumData2022* TrgSum;
258  BELayerBlock2022* mBC1[11];
259  QTBlock2022* mMXQ[11];
260  MIXBlock2022* mMIX[11];
261  BWestBlock2022* mBCW[11];
262  BEastBlock2022* mBCE[11];
263  QTBlock2022* mEQ3[11];
264  BBCBlock2022* mBBC[11];
265  QTBlock2022* mBBQ[11];
266  FMSBlock2022* mFMS[11];
267  QTBlock2022* mQT1[11];
268  QTBlock2022* mQT2[11];
269  QTBlock2022* mQT3[11];
270  QTBlock2022* mQT4[11];
271  QTBlock2022* mEQ1[11];
272  QTBlock2022* mEQ2[11];
273  QTBlock2022* mEQ4[11];
274  unsigned short mxq[11][16][32],eq3[11][16][32],bbq[11][16][32],
275  eq1[11][16][32],eq2[11][16][32],eq4[11][16][32];
276  unsigned char tmxq[11][16][32],teq3[11][16][32],tbbq[11][16][32],
277  teq1[11][16][32],teq2[11][16][32],teq4[11][16][32];
278 
279  void swapOfflen(TrgOfflen2022* offlen);
280  void swapDataBlk(TriggerDataBlk2022* TrgData);
281  void swapEvtDesc(EvtDescData2022* EvtDesc);
282  void swapL1_DSM(L1_DSM_Data2022* L1_DSM);
283  void swapTrgSum(TrgSumData2022* TrgSum);
284  void swapRawDetOfflen(TrgOfflen2022* offlen);
285  void swapRawDet(DataBlock2022* data, int name, int hlength, int bs);
286 
287  ClassDef(StTriggerData2022,2)
288 };
289 
290 inline void StTriggerData2022::swapOfflen(TrgOfflen2022* offlen)
291 {
292  swapI((unsigned int*)&offlen->offset);
293  swapI((unsigned int*)&offlen->length);
294 }
295 
296 inline void StTriggerData2022::swapDataBlk(TriggerDataBlk2022 *TrgData)
297 {
298  swapI((unsigned int*)&TrgData->FormatVersion);
299  swapI((unsigned int*)&TrgData->totalTriggerLength);
300  swapI((unsigned int*)&TrgData->eventNumber);
301  swapOfflen(&TrgData->EventDesc_ofl);
302  swapOfflen(&TrgData->L1_DSM_ofl);
303  swapOfflen(&TrgData->Summary_ofl);
304  swapIn((unsigned int*)TrgData->PrePostList,10);
305 }
306 
307 inline void StTriggerData2022::swapEvtDesc(EvtDescData2022* EvtDesc)
308 {
309  swapIn((unsigned int*)&EvtDesc->length,3);
310  swapSCC((unsigned int*)&EvtDesc->actionWdDetectorBitMask);
311  swapSSn((unsigned int*)&EvtDesc->TrgToken,12);
312 }
313 
314 inline void StTriggerData2022::swapL1_DSM(L1_DSM_Data2022* L1_DSM)
315 {
316  swapI((unsigned int*)&L1_DSM->length);
317  swapSSn((unsigned int*)L1_DSM->TOF,16+8*6); //removed FPD[8]
318 }
319 
320 inline void StTriggerData2022::swapTrgSum(TrgSumData2022* TrgSum)
321 {
322  swapIn((unsigned int*)&TrgSum->length,1+2+2+32+64+64);
323 }
324 
325 inline void StTriggerData2022::swapRawDetOfflen(TrgOfflen2022* offlen)
326 {
327  int i;
328  for (i=0; i<y22MAX_OFFLEN; i++) {
329  swapOfflen(&offlen[i]);
330  if (mDebug>0) printf("Offlen id=%2d offset=%d length=%d\n", i, offlen[i].offset, offlen[i].length);
331  }
332 }
333 
334 #endif