186 #ifndef StTriggerData_hh
187 #define StTriggerData_hh
189 #include "StObject.h"
191 #include "StMessMgr.h"
198 virtual void readData() {};
199 virtual void dump()
const = 0;
200 virtual void setDebug(
unsigned int);
201 virtual void blindRunInfo();
204 virtual int year()
const;
205 virtual unsigned int version()
const = 0;
206 virtual unsigned int numberOfPreXing()
const = 0;
207 virtual unsigned int numberOfPostXing()
const = 0;
208 virtual unsigned int errorFlag()
const;
211 virtual unsigned int eventNumber()
const;
212 virtual unsigned int token()
const = 0;
213 virtual unsigned int triggerWord()
const = 0;
214 virtual unsigned int actionWord()
const = 0;
215 virtual unsigned int zdcKillerBit()
const;
216 virtual unsigned short busyStatus()
const;
217 virtual unsigned short dsmInput()
const;
218 virtual unsigned short trgToken()
const;
219 virtual unsigned short dsmAddress()
const;
220 virtual unsigned short mAddBits()
const;
221 virtual unsigned short bcData(
int channel)
const;
223 virtual unsigned short getTrgDetMask()
const;
224 virtual unsigned int getTrgCrateMask()
const;
227 virtual int L2ResultsOffset(StL2AlgorithmId
id)
const;
228 bool isL2Triggered(StL2TriggerResultType
id)
const;
229 virtual unsigned long long l2sum()
const;
232 virtual unsigned int tcuCounter()
const;
233 virtual unsigned int rccCounter(
int crate)
const;
234 virtual unsigned long long bunchCounter()
const;
235 virtual unsigned int bunchCounterHigh()
const;
236 virtual unsigned int bunchCounterLow()
const;
237 virtual unsigned int bunchId48Bit()
const;
238 virtual unsigned int bunchId7Bit()
const;
239 virtual unsigned int revTick1()
const;
240 virtual unsigned int revTick2()
const;
241 virtual unsigned int revTick3()
const;
242 virtual unsigned int spinBit()
const;
243 virtual unsigned int spinBitYellowFilled()
const;
244 virtual unsigned int spinBitYellowUp()
const;
245 virtual unsigned int spinBitYellowDown()
const;
246 virtual unsigned int spinBitYellowUnpol()
const;
247 virtual unsigned int spinBitBlueFilled()
const;
248 virtual unsigned int spinBitBlueUp()
const;
249 virtual unsigned int spinBitBlueDown()
const;
250 virtual unsigned int spinBitBlueUnpol()
const;
253 virtual unsigned short tcuBits()
const = 0;
254 virtual unsigned short lastDSM(
int channel)
const;
255 virtual unsigned short vertexDSM(
int channel)
const;
256 virtual unsigned short ctbLayer1DSM(
int channel)
const;
257 virtual unsigned short ctbLayer2DSM(
int channel)
const;
258 virtual unsigned short bemcLayer1DSM(
int channel,
int prepost=0)
const;
259 virtual unsigned short eemcLayer1DSM(
int channel,
int prepost=0)
const;
260 virtual unsigned short emcLayer2DSM(
int channel)
const;
261 virtual unsigned short tpcMaskDSM(
int channel)
const;
262 virtual unsigned short fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost=0)
const;
263 virtual unsigned short fpdLayer1DSM(StBeamDirection eastwest,
int module,
int board,
int prepsot=0)
const;
264 virtual unsigned short fpdLayer2DSMRaw(
int channel)
const;
265 virtual unsigned short fpdLayer2DSM(StBeamDirection eastwest,
int module)
const;
268 virtual unsigned short ctbRaw(
int address,
int prepost=0)
const;
269 virtual unsigned short ctb(
int pmt,
int prepost=0)
const;
270 virtual unsigned short ctbTraySlat(
int tray,
int slat,
int prepost=0)
const;
271 virtual unsigned short ctbSum(
int prepost=0)
const;
274 virtual unsigned short mwc(
int sector,
int prepost=0)
const;
277 virtual bool zdcPresent(
int prepost=0)
const;
278 virtual unsigned short zdcAtChannel(
int channel,
int prepost=0)
const;
279 virtual unsigned short zdcAtAddress(
int address,
int prepost=0)
const;
280 virtual unsigned short zdcUnAttenuated(StBeamDirection eastwest,
int prepost=0)
const;
281 virtual unsigned short zdcAttenuated(StBeamDirection eastwest,
int prepost=0)
const;
282 virtual unsigned short zdcADC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
283 virtual unsigned short zdcTDC(StBeamDirection eastwest,
int prepost=0)
const;
284 virtual unsigned short zdcPmtTDC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
285 virtual unsigned short zdcHardwareSum(
int prepost=0)
const;
287 virtual unsigned short zdcEarliestTDC(StBeamDirection eastwest,
int prepost=0)
const;
288 virtual bool zdcSumADCaboveThreshold(StBeamDirection eastwest,
int prepost=0)
const;
289 virtual bool zdcFrontADCaboveThreshold(StBeamDirection eastwest,
int prepost=0)
const;
290 virtual bool zdcBackADCaboveThreshold(StBeamDirection eastwest,
int prepost=0)
const;
291 virtual unsigned short zdcTruncatedSum(StBeamDirection eastwest,
int prepost=0)
const;
293 virtual bool zdcSumADCaboveThresholdL2(StBeamDirection eastwest)
const;
294 virtual bool zdcFrontADCaboveThresholdL2(StBeamDirection eastwest)
const;
295 virtual bool zdcBackADCaboveThresholdL2(StBeamDirection eastwest)
const;
296 virtual unsigned short zdcTimeDifference()
const;
298 virtual bool zdcSumADCaboveThresholdL3(StBeamDirection eastwest)
const;
299 virtual bool zdcFrontADCaboveThresholdL3(StBeamDirection eastwest)
const;
300 virtual bool zdcBackADCaboveThresholdL3(StBeamDirection eastwest)
const;
301 virtual bool zdcTimeDifferenceInWindow()
const;
304 virtual bool zdcSMDPresent(
int prepost=0)
const;
305 virtual unsigned short zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost=0)
const;
306 virtual unsigned short zdcSMDHighestStrip(StBeamDirection eastwest,
int verthori,
int prepost=0)
const;
309 virtual unsigned char bemcHighTower(
int patch_id,
int prepost=0)
const;
310 virtual unsigned char bemcJetPatch (
int patch_id,
int prepost=0)
const;
311 virtual unsigned char eemcHighTower(
int patch_id,
int prepost=0)
const;
312 virtual unsigned char eemcJetPatch (
int patch_id,
int prepost=0)
const;
313 virtual unsigned char bemcHighestTowerADC(
int prepost=0)
const;
314 virtual unsigned char eemcHighestTowerADC(
int prepost=0)
const;
317 virtual unsigned short bbcADC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
318 virtual unsigned short bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
319 virtual unsigned short bbcTDC5bit(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
320 virtual unsigned short bbcADCSum(StBeamDirection eastwest,
int prepost=0)
const;
321 virtual unsigned short bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost=0)
const;
322 virtual unsigned short bbcEarliestTDC(StBeamDirection eastwest,
int prepost=0)
const;
323 virtual unsigned short bbcTimeDifference()
const;
324 virtual unsigned short bbcTacSum()
const;
325 virtual unsigned short bbcEarliestTDCLarge(StBeamDirection eastwest,
int prepost=0)
const;
326 virtual unsigned short bbcTimeDifferenceLarge()
const;
327 virtual unsigned short bbcBB101(
int ch,
int prepost=0)
const;
328 virtual unsigned short bbcBB102(
int ch,
int prepost=0)
const;
331 virtual unsigned short fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost=0)
const;
332 virtual unsigned short fpdSum(StBeamDirection eastwest,
int module)
const;
335 virtual unsigned short nQTdata(
int prepost=0)
const;
336 virtual unsigned int* QTdata(
int prepost=0)
const;
337 virtual unsigned short fmsADC(
int crt,
int adr,
int ch,
int prepost=0)
const;
338 virtual unsigned short fmsTDC(
int crt,
int adr,
int ch,
int prepost=0)
const;
341 virtual unsigned short epdEarliestTDC(StBeamDirection eastwest,
int prepost=0)
const;
342 virtual unsigned short epdTimeDifference()
const;
343 virtual bool epdHitLayer2(StBeamDirection eastwest)
const;
344 virtual unsigned short epdLayer1(
int ch,
int prepost=0)
const;
345 virtual unsigned short epdLayer1a(
int ch,
int prepost=0)
const;
346 virtual unsigned short epdLayer1b(
int ch,
int prepost=0)
const;
347 virtual unsigned short epdLayer0t(
int ch,
int prepost=0)
const;
348 virtual unsigned short epdLayer0a(
int ch,
int prepost=0)
const;
349 virtual unsigned char epdLayer0h(
int ch,
int prepost=0)
const;
350 virtual unsigned short epdADC(
int crt,
int adr,
int ch,
int prepost=0)
const;
351 virtual unsigned short epdTDC(
int crt,
int adr,
int ch,
int prepost=0)
const;
352 virtual unsigned short epdNHits(StBeamDirection eastwest,
int prepost=0)
const;
353 virtual unsigned short epdNHitsQT(
int crate,
int qt,
int mult12,
int prepost=0)
const;
354 virtual unsigned short epdLayer0aMult(
int ch,
int prepost=0)
const;
355 virtual unsigned short epdLayer0hMult(
int ch,
int mult12,
int prepost=0)
const;
356 virtual unsigned short epdLayer1bMult(StBeamDirection eastwest,
int ring,
int prepost=0)
const;
357 virtual unsigned short epdMultTotal(
int prepost=0)
const;
358 virtual unsigned short epdMultDiff(
int prepost=0)
const;
361 virtual unsigned short vpdADC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
362 virtual unsigned short vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
363 virtual unsigned short vpdADCHighThr(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
364 virtual unsigned short vpdTDCHighThr(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
365 virtual unsigned short vpdEarliestTDC(StBeamDirection eastwest,
int prepost=0)
const;
366 virtual unsigned short vpdEarliestTDCHighThr(StBeamDirection eastwest,
int prepost=0)
const;
367 virtual unsigned short vpdADCSum(StBeamDirection eastwest,
int prepost=0)
const;
368 virtual unsigned short vpdTimeDifference()
const;
369 virtual float vpdMeanTimeDifference(
int prepost=0)
const;
370 virtual unsigned short bbcVP101(
int ch,
int prepost = 0)
const;
373 virtual unsigned short mxqAtSlotAddress(
int address,
int prepost=0,
int slot=0)
const;
376 virtual unsigned short mtdQtAtCh(
int qtid,
int address,
int prepost)
const;
377 virtual unsigned short mtdAtAddress(
int address,
int prepost=0)
const;
378 virtual unsigned short mtdgemAtAddress(
int address,
int prepost=0)
const;
379 virtual unsigned short mtd3AtAddress(
int address,
int prepost=0)
const;
380 virtual unsigned short mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
381 virtual unsigned short mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost=0)
const;
382 virtual unsigned char mtdDsmAtCh(
int ch,
int prepost=0)
const;
383 virtual bool mtdDsmHit(
int pmt,
int prepost=0)
const;
384 virtual unsigned short mtdVpdTacDiff()
const;
385 virtual unsigned short mtd4AtAddress(
int address,
int prepost=0)
const;
388 virtual unsigned short tofAtAddress(
int address,
int prepost=0)
const;
389 virtual unsigned short tofTrayMultiplicity(
int tray,
int prepost=0)
const;
390 virtual unsigned short tofMultiplicity(
int prepost=0)
const;
391 virtual unsigned short dsmTF201Ch(
int ch)
const;
394 virtual unsigned short pp2ppADC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost=0)
const;
395 virtual unsigned short pp2ppTAC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost=0)
const;
396 virtual unsigned long pp2ppDSM(
int prepost=0)
const;
399 float zdcVertexZ()
const;
400 void setZdcVertexZ(
float);
403 virtual char* getTriggerStructure() = 0;
404 virtual int getRawSize()
const = 0;
405 virtual unsigned char* getDsm0_BEMCE(
int prepost=0)
const =0;
406 virtual unsigned char* getDsm0_BEMCW(
int prepost=0)
const =0;
407 virtual unsigned short* getDsm1_BEMC(
int prepost=0)
const =0;
408 virtual unsigned char* getDsm0_EEMC(
int prepost=0)
const =0;
409 virtual unsigned short* getDsm1_EEMC(
int prepost=0)
const =0;
410 virtual unsigned short* getDsm2_EMC()
const =0;
411 virtual unsigned short* getDsm3()
const =0;
412 virtual unsigned char* getDsm_FMS(
int prepost=0)
const;
413 virtual unsigned char* getDsm01_FMS(
int prepost=0)
const;
414 virtual unsigned char* getDsm02_FMS(
int prepost=0)
const;
415 virtual unsigned short* getDsm1_FMS(
int prepost=0)
const;
416 virtual unsigned short* getDsm2_FMS()
const;
417 virtual unsigned int l2ResultLength()
const = 0;
418 virtual const unsigned int* l2Result()
const = 0;
421 virtual void killFMS();
424 int prepostAddress(
int prepost)
const;
427 unsigned short decodeEmc12bit(
const int dsm,
const int channel,
const unsigned char *raw)
const;
430 void swapI(
unsigned int *);
431 void swapSCC(
unsigned int *);
432 void swapSS(
unsigned int *);
433 void swapIn(
unsigned int *,
unsigned int);
434 void swapSSn(
unsigned int *,
unsigned int);
435 void swapSCCn(
unsigned int *,
unsigned int);
438 enum {MaxQTData = 529};
439 void decodeQT(
unsigned int ndata,
unsigned int *
data,
unsigned short adc[16][32],
unsigned char tac[16][32]);
445 unsigned int mErrorFlag;
452 inline void StTriggerData::swapI(
unsigned int *var){
454 (*var & 0xff000000) >> 24 |
455 (*var & 0x00ff0000) >> 8 |
456 (*var & 0x0000ff00) << 8 |
457 (*var & 0x000000ff) << 24 ;
460 inline void StTriggerData::swapSCC(
unsigned int *var){
462 (*var & 0x0000ff00) >> 8 |
463 (*var & 0x000000ff) << 8 |
467 inline void StTriggerData::swapSS(
unsigned int *var){
469 (*var & 0xff000000) >> 8 |
470 (*var & 0x00ff0000) << 8 |
471 (*var & 0x0000ff00) >> 8 |
472 (*var & 0x000000ff) << 8;
475 inline void StTriggerData::swapIn(
unsigned int *var,
unsigned int n) {
for(
unsigned int i=0; i<n; i++) {swapI(var++);} }
476 inline void StTriggerData::swapSSn(
unsigned int *var,
unsigned int n) {
for(
unsigned int i=0; i<n/2; i++) {swapSS(var++);} }
477 inline void StTriggerData::swapSCCn(
unsigned int *var,
unsigned int n){
for(
unsigned int i=0; i<n; i++) {swapSCC(var++);} }