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