119 #include "StTriggerData.h"
121 static const char rcsid[] =
"$Id: StTriggerData.cxx,v 2.35 2020/05/15 15:40:20 ullrich Exp $";
130 StTriggerData::~StTriggerData() { }
132 void StTriggerData::setDebug(
unsigned int val) { mDebug=val; }
134 int StTriggerData::prepostAddress(
int prepost)
const
136 if (prepost == 0)
return 0;
137 int npre = numberOfPreXing();
138 if (prepost < 0 && -prepost <= npre)
return 1+npre+prepost;
139 int npost = numberOfPostXing();
140 if (prepost > 0 && prepost <= npost)
return npre+prepost;
141 gMessMgr->Warning() <<
"Wrong prepost " << prepost <<
" (pre=" << numberOfPreXing() <<
", post=" << numberOfPostXing() <<
")" << endm;
145 unsigned short StTriggerData::decodeEmc12bit(
const int dsm,
const int channel,
const unsigned char *raw)
const
147 static const int dsmmap[16]={7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8};
148 const unsigned char *crate_p=raw+dsm*16;
152 int k=(channel-1)/2*3+1;
153 return (crate_p[dsmmap[k+1]]<<4) + (crate_p[dsmmap[k]]>>4);
158 return ((crate_p[dsmmap[k+1]]&0xF) << 8) + crate_p[dsmmap[k]];
162 void StTriggerData::decodeQT(
unsigned int ndata,
unsigned int*
data,
unsigned short adc[16][32],
unsigned char tdc[16][32])
164 if (ndata==0)
return;
165 if (ndata>MaxQTData) { printf(
"QT data length %d is too long (max is %d)\n",ndata,MaxQTData);
return;}
166 if (data[ndata-1] != 0xac10) { printf(
"Wrong QT data last word %x (should be 0xAC10)\n",data[ndata-1]);
return;}
168 int oldch, oldcrt=-1;
170 unsigned int addr,ch,nline;
171 for (
unsigned int i=0; i<ndata-1; i++){
172 unsigned int d = data[i];
174 crate = (d & 0xff000000) >> 24;
175 addr = ((d & 0x00ff0000) >> 16) - 0x10;
176 nline = (d & 0x000000ff);
178 if (addr > 15 || (oldcrt!=-1 && crate!=oldcrt)){
179 static Int_t err = 0;
182 printf(
"i=%3d d=%08x crt=%3d adr=%08x nline=%3d oldcrt=%3d QTBd header bad crt or addr\n",
183 i,d,crate,addr+0x10,nline,oldcrt);
189 if(nline>0) header=0;
190 if(oldcrt==-1) oldcrt=crate;
193 ch = (d & 0xf8000000) >> 27;
194 unsigned short a = (
unsigned short) (d & 0x00000fff);
195 unsigned short t = (
unsigned char) ((d & 0x001f0000) >> 16);
198 if((
int)ch<=oldch) flag+=2;
199 if(ch==31 && a==4095 && t==31) flag+=4;
200 if(d==0xffffffff) flag+=8;
202 printf(
"i=%3d d=%08x crt=%3d adr=0x%02x ch=%3d oldch=%3d adc=%4d tdc=%4d",
203 i,d,crate,addr+0x10,ch,oldch,a,t);
204 if((flag & 0x1)>0) printf(
" ADC=0!");
205 if((flag & 0x2)>0) printf(
" OrderWrong!");
206 if((flag & 0x4)>0) printf(
" ffff!");
207 if((flag & 0x8)>0) printf(
" FFFF!");
216 if (nline==0) header=1;
226 void StTriggerData::blindRunInfo(){}
227 int StTriggerData::year()
const {
return mYear;}
228 unsigned int StTriggerData::errorFlag()
const {
return mErrorFlag;}
229 unsigned int StTriggerData::eventNumber()
const {
return 0;}
230 float StTriggerData::zdcVertexZ()
const {
return mZdcVertexZ;}
231 void StTriggerData::setZdcVertexZ(
float val) {mZdcVertexZ = val;}
232 unsigned short StTriggerData::dsmInput()
const {
return 0;}
233 unsigned short StTriggerData::trgToken()
const {
return 0;}
234 unsigned short StTriggerData::dsmAddress()
const {
return 0;}
235 unsigned short StTriggerData::mAddBits()
const {
return 0;}
236 unsigned short StTriggerData::bcData(
int address)
const {
return 0;}
237 unsigned short StTriggerData::getTrgDetMask()
const {
return 0;}
238 unsigned int StTriggerData::getTrgCrateMask()
const {
return 0;}
239 unsigned int StTriggerData::zdcKillerBit()
const {
return 0;}
240 unsigned short StTriggerData::busyStatus()
const {
return 0;}
241 unsigned int StTriggerData::tcuCounter()
const {
return 0;}
242 unsigned int StTriggerData::rccCounter(
int crate)
const {
return 0;}
243 unsigned long long StTriggerData::bunchCounter()
const {
return 0;}
244 unsigned int StTriggerData::bunchCounterHigh()
const {
return 0;}
245 unsigned int StTriggerData::bunchCounterLow()
const {
return 0;}
246 unsigned int StTriggerData::bunchId48Bit()
const {
return 0;}
247 unsigned int StTriggerData::bunchId7Bit()
const {
return 0;}
248 unsigned int StTriggerData::revTick1()
const {
return 0;}
249 unsigned int StTriggerData::revTick2()
const {
return 0;}
250 unsigned int StTriggerData::revTick3()
const {
return 0;}
251 unsigned int StTriggerData::spinBit()
const {
return 0;}
252 unsigned int StTriggerData::spinBitYellowFilled()
const {
return 0;}
253 unsigned int StTriggerData::spinBitYellowUp()
const {
return 0;}
254 unsigned int StTriggerData::spinBitYellowDown()
const {
return 0;}
255 unsigned int StTriggerData::spinBitYellowUnpol()
const {
return 0;}
256 unsigned int StTriggerData::spinBitBlueFilled()
const {
return 0;}
257 unsigned int StTriggerData::spinBitBlueUp()
const {
return 0;}
258 unsigned int StTriggerData::spinBitBlueDown()
const {
return 0;}
259 unsigned int StTriggerData::spinBitBlueUnpol()
const {
return 0;}
260 unsigned short StTriggerData::lastDSM(
int channel)
const {
return 0;};
261 unsigned short StTriggerData::vertexDSM(
int channel)
const {
return 0;}
262 unsigned short StTriggerData::ctbLayer1DSM(
int channel)
const {
return 0;}
263 unsigned short StTriggerData::ctbLayer2DSM(
int channel)
const {
return 0;}
264 unsigned short StTriggerData::bemcLayer1DSM(
int channel,
int prepost)
const {
return 0;}
265 unsigned short StTriggerData::eemcLayer1DSM(
int channel,
int prepost)
const {
return 0;}
266 unsigned short StTriggerData::emcLayer2DSM(
int channel)
const {
return 0;}
267 unsigned short StTriggerData::tpcMaskDSM(
int channel)
const {
return 0;}
268 unsigned short StTriggerData::fpdLayer1DSMRaw(StBeamDirection eastwest,
int channel,
int prepost)
const {
return 0;}
269 unsigned short StTriggerData::fpdLayer1DSM(StBeamDirection eastwest,
int module,
int board,
int prepost)
const {
return 0;}
270 unsigned short StTriggerData::fpdLayer2DSMRaw(
int channel)
const {
return 0;}
271 unsigned short StTriggerData::fpdLayer2DSM(StBeamDirection eastwest,
int module)
const {
return 0;}
272 unsigned short StTriggerData::ctbRaw(
int address,
int prepost)
const {
return 0;}
273 unsigned short StTriggerData::ctb(
int pmt,
int prepost)
const {
return 0;}
274 unsigned short StTriggerData::ctbTraySlat(
int tray,
int slat,
int prepost)
const {
return 0;}
275 unsigned short StTriggerData::ctbSum(
int prepost)
const {
return 0;}
276 unsigned short StTriggerData::mwc(
int sector,
int prepost)
const {
return 0;}
277 bool StTriggerData::zdcPresent(
int prepost)
const {
return 1;}
278 unsigned short StTriggerData::zdcAtChannel(
int channel,
int prepost)
const {
return 0;}
279 unsigned short StTriggerData::zdcAtAddress(
int address,
int prepost)
const {
return 0;}
280 unsigned short StTriggerData::zdcUnAttenuated(StBeamDirection eastwest,
int prepost)
const {
return 0;}
281 unsigned short StTriggerData::zdcAttenuated(StBeamDirection eastwest,
int prepost)
const {
return 0;}
282 unsigned short StTriggerData::zdcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
283 unsigned short StTriggerData::zdcTDC(StBeamDirection eastwest,
int prepost)
const {
return 0;}
284 unsigned short StTriggerData::zdcPmtTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
285 unsigned short StTriggerData::zdcHardwareSum(
int prepost)
const {
return 0;}
286 unsigned short StTriggerData::zdcEarliestTDC(StBeamDirection eastwest,
int prepost)
const {
return 0;}
287 bool StTriggerData::zdcSumADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
return 0;}
288 bool StTriggerData::zdcFrontADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
return 0;}
289 bool StTriggerData::zdcBackADCaboveThreshold(StBeamDirection eastwest,
int prepost)
const {
return 0;}
290 bool StTriggerData::zdcSumADCaboveThresholdL2(StBeamDirection eastwest)
const {
return 0;}
291 bool StTriggerData::zdcFrontADCaboveThresholdL2(StBeamDirection eastwest)
const {
return 0;}
292 bool StTriggerData::zdcBackADCaboveThresholdL2(StBeamDirection eastwest)
const {
return 0;}
293 unsigned short StTriggerData::zdcTimeDifference()
const {
return 0;}
294 bool StTriggerData::zdcSumADCaboveThresholdL3(StBeamDirection eastwest)
const {
return 0;}
295 bool StTriggerData::zdcFrontADCaboveThresholdL3(StBeamDirection eastwest)
const {
return 0;}
296 bool StTriggerData::zdcBackADCaboveThresholdL3(StBeamDirection eastwest)
const {
return 0;}
297 bool StTriggerData::zdcTimeDifferenceInWindow()
const {
return 0;}
298 bool StTriggerData::zdcSMDPresent(
int prepost)
const {
return 1;}
299 unsigned short StTriggerData::zdcTruncatedSum(StBeamDirection eastwest,
int prepost)
const {
return 0;}
300 unsigned short StTriggerData::zdcSMDHighestStrip(StBeamDirection eastwest,
int verthori,
int prepost)
const {
return 0;}
301 unsigned short StTriggerData::zdcSMD(StBeamDirection eastwest,
int verthori,
int strip,
int prepost)
const {
return 0;}
302 unsigned char StTriggerData::bemcHighTower(
int patch_id,
int prepost)
const {
return 0;}
303 unsigned char StTriggerData::bemcJetPatch (
int patch_id,
int prepost)
const {
return 0;}
304 unsigned char StTriggerData::eemcHighTower(
int patch_id,
int prepost)
const {
return 0;}
305 unsigned char StTriggerData::eemcJetPatch (
int patch_id,
int prepost)
const {
return 0;}
306 unsigned char StTriggerData::bemcHighestTowerADC(
int prepost)
const {
return 0;}
307 unsigned char StTriggerData::eemcHighestTowerADC(
int prepost)
const {
return 0;}
308 unsigned short StTriggerData::bbcADC(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
309 unsigned short StTriggerData::bbcTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
310 unsigned short StTriggerData::bbcTDC5bit(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
311 unsigned short StTriggerData::bbcADCSum(StBeamDirection eastwest,
int prepost)
const {
return 0;}
312 unsigned short StTriggerData::bbcADCSumLargeTile(StBeamDirection eastwest,
int prepost)
const {
return 0;}
313 unsigned short StTriggerData::bbcEarliestTDC(StBeamDirection eastwest,
int prepost)
const {
return 0;}
314 unsigned short StTriggerData::bbcTimeDifference()
const {
return 0;}
315 unsigned short StTriggerData::bbcTacSum()
const {
return 0;}
316 unsigned short StTriggerData::bbcEarliestTDCLarge(StBeamDirection eastwest,
int prepost)
const {
return 0;}
317 unsigned short StTriggerData::bbcTimeDifferenceLarge()
const {
return 0;}
318 unsigned short StTriggerData::bbcBB101(
int ch,
int prepost)
const {
return 0;}
319 unsigned short StTriggerData::bbcBB102(
int ch,
int prepost)
const {
return 0;}
320 unsigned short StTriggerData::fpd(StBeamDirection eastwest,
int module,
int pmt,
int prepost)
const {
return 0;}
321 unsigned short StTriggerData::fpdSum(StBeamDirection eastwest,
int module)
const {
return 0;}
322 unsigned short StTriggerData::nQTdata(
int prepost)
const {
return 0;}
323 unsigned int* StTriggerData::QTdata(
int prepost)
const {
return 0;}
324 unsigned short StTriggerData::vpdADC(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
325 unsigned short StTriggerData::vpdTDC(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
326 unsigned short StTriggerData::vpdADCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
327 unsigned short StTriggerData::vpdTDCHighThr(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
328 unsigned short StTriggerData::vpdEarliestTDC(StBeamDirection eastwest,
int prepost)
const {
return 0;}
329 unsigned short StTriggerData::vpdEarliestTDCHighThr(StBeamDirection eastwest,
int prepost)
const {
return 0;}
330 unsigned short StTriggerData::vpdADCSum(StBeamDirection eastwest,
int prepost)
const {
return 0;}
331 unsigned short StTriggerData::vpdTimeDifference()
const {
return 0;}
332 float StTriggerData::vpdMeanTimeDifference(
int prepost)
const {
return 0;}
333 unsigned short StTriggerData::bbcVP101(
int ch,
int prepost)
const {
return 0;}
334 unsigned short StTriggerData::mxqAtSlotAddress(
int address,
int prepost,
int slot)
const {
return 0;}
335 unsigned short StTriggerData::mtdQtAtCh(
int qtid,
int address,
int prepost)
const {
return 0;}
336 unsigned short StTriggerData::mtdAtAddress(
int address,
int prepost)
const {
return 0;}
337 unsigned short StTriggerData::mtdgemAtAddress(
int address,
int prepost)
const {
return 0;}
338 unsigned short StTriggerData::mtd3AtAddress(
int address,
int prepost)
const {
return 0;}
339 unsigned short StTriggerData::mtdAdc(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
340 unsigned short StTriggerData::mtdTdc(StBeamDirection eastwest,
int pmt,
int prepost)
const {
return 0;}
341 unsigned char StTriggerData::mtdDsmAtCh(
int ch,
int prepost)
const {
return 0;}
342 bool StTriggerData::mtdDsmHit(
int pmt,
int prepost)
const {
return 0;}
343 unsigned short StTriggerData::mtdVpdTacDiff()
const {
return 0;}
344 unsigned short StTriggerData::mtd4AtAddress(
int address,
int prepost)
const {
return 0;}
345 unsigned short StTriggerData::tofAtAddress(
int address,
int prepost)
const {
return 0;}
346 unsigned short StTriggerData::tofTrayMultiplicity(
int tray,
int prepost)
const {
return 0;}
347 unsigned short StTriggerData::tofMultiplicity(
int prepost)
const {
return 0;}
348 unsigned short StTriggerData::dsmTF201Ch(
int ch)
const {
return 0;}
349 unsigned short StTriggerData::pp2ppADC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const {
return 0;}
350 unsigned short StTriggerData::pp2ppTAC(StBeamDirection eastwest,
int vh,
int udio,
int ch,
int prepost)
const {
return 0;}
351 unsigned long StTriggerData::pp2ppDSM(
int prepost)
const {
return 0;}
352 unsigned short StTriggerData::fmsADC(
int crt,
int adr,
int ch,
int prepost)
const {
return 0;}
353 unsigned short StTriggerData::fmsTDC(
int crt,
int adr,
int ch,
int prepost)
const {
return 0;}
354 unsigned short StTriggerData::epdEarliestTDC(StBeamDirection eastwest,
int prepost)
const {
return 0;}
355 unsigned short StTriggerData::epdTimeDifference()
const {
return 0;}
356 bool StTriggerData::epdHitLayer2(StBeamDirection eastwest)
const {
return false;}
357 unsigned short StTriggerData::epdLayer1(
int ch,
int prepost)
const {
return 0;}
358 unsigned short StTriggerData::epdLayer1a(
int ch,
int prepost)
const {
return 0;}
359 unsigned short StTriggerData::epdLayer1b(
int ch,
int prepost)
const {
return 0;}
360 unsigned short StTriggerData::epdLayer0t(
int ch,
int prepost)
const {
return 0;}
361 unsigned short StTriggerData::epdLayer0a(
int ch,
int prepost)
const {
return 0;}
362 unsigned char StTriggerData::epdLayer0h(
int ch,
int prepost)
const {
return 0;}
363 unsigned short StTriggerData::epdADC(
int crt,
int adr,
int ch,
int prepost)
const {
return 0;}
364 unsigned short StTriggerData::epdTDC(
int crt,
int adr,
int ch,
int prepost)
const {
return 0;}
365 unsigned short StTriggerData::epdNHits(StBeamDirection eastwest,
int prepost)
const {
return 0;}
366 unsigned short StTriggerData::epdNHitsQT(
int crate,
int qt,
int mult12,
int prepost)
const {
return 0;}
367 unsigned short StTriggerData::epdLayer0aMult(
int ch,
int prepost)
const {
return 0;}
368 unsigned short StTriggerData::epdLayer0hMult(
int ch,
int mult12,
int prepost)
const {
return 0;}
369 unsigned short StTriggerData::epdLayer1bMult(StBeamDirection eastwest,
int ring,
int prepost)
const {
return 0;}
370 unsigned short StTriggerData::epdMultTotal(
int prepost)
const {
return 0;}
371 unsigned short StTriggerData::epdMultDiff(
int prepost)
const {
return 0;}
373 unsigned char* StTriggerData::getDsm_FMS(
int prepost)
const {
return 0;}
374 unsigned char* StTriggerData::getDsm01_FMS(
int prepost)
const {
return 0;}
375 unsigned char* StTriggerData::getDsm02_FMS(
int prepost)
const {
return 0;}
376 unsigned short* StTriggerData::getDsm1_FMS(
int prepost)
const {
return 0;}
377 unsigned short* StTriggerData::getDsm2_FMS()
const {
return 0;}
378 int StTriggerData::L2ResultsOffset(StL2AlgorithmId
id)
const {
return -1;}
379 bool StTriggerData::isL2Triggered(StL2TriggerResultType
id)
const {
return false;}
380 unsigned long long StTriggerData::l2sum()
const {
return 0;}
381 void StTriggerData::killFMS() {
return;}