Called event by event.
176{
177
178
179
180
181
182 StoreArray<TRGECLTrg> trgArray;
183
192 StoreObjPtr<BinnedEventT0> m_eventTime;
194
195
196
198 double EventTiming = -9999.;
199 if (ntrgArray > 0) {EventTiming = trgArray[0]->getEventTiming();}
200 std::vector<int> selTC;
201 std::vector<int> selTheta;
202 std::vector<float> selE;
203 for (int ic = 0; ic < eclTrgClusterArray.getEntries(); ic++) {
204 double tcT = abs(eclTrgClusterArray[ic]->getTimeAve() - EventTiming);
205 if (tcT < 100.) {
206 int TC = eclTrgClusterArray[ic]->getMaxTCId();
207 selTC.push_back(TC);
208 selTheta.push_back(TCThetaID[TC - 1]);
209 selE.push_back(eclTrgClusterArray[ic]->getEnergyDep());
210 }
211 }
212
213
214
215
216 int nTrk2D = cdc2DTrkArray.getEntries();
217 int nTrk3D = cdc3DTrkArray.getEntries();
218 int nTrkZ10 = 0;
219 int nTrkZ25 = 0;
220 int nTrkZ35 = 0;
221 for (int itrk = 0; itrk < nTrk3D; itrk++) {
222 double z0 = cdc3DTrkArray[itrk]->getZ0();
223 if (abs(z0) < 10.) {nTrkZ10++;}
224 if (abs(z0) < 25.) {nTrkZ25++;}
225 if (abs(z0) < 35.) {nTrkZ35++;}
226 }
227 int nTrkNN = cdcNNTrkArray.getEntries();
228 int nTrkNNSTT = 0;
229 int nTrkNNSTT6 = 0;
230 int nTrkNNSTT5 = 0;
231 int nTrkNNSTT4 = 0;
232 int nTrkNN20 = 0;
233 int nTrkNN40 = 0;
234 for (int itrk = 0; itrk < nTrkNN; itrk++) {
235 double z0 = cdcNNTrkArray[itrk]->getZ0();
236
237 double omega = 100 * cdcNNTrkArray[itrk]->getOmega();
238 int omega_bin = omega / 0.044;
239 omega = omega_bin * 0.044;
240
241 double cottheta = cdcNNTrkArray[itrk]->getCotTheta();
242 double theta = 0;
243 if (cottheta != 0)theta =
atan(1. / cottheta);
244 int theta_bin = theta / 0.098125;
245 theta = theta_bin * 0.098125;
246 int p = abs(10 * 0.3 * 1.5 / omega / sin(theta));
247
248 double pt = cdcNNTrkArray[itrk]->getPt();
249 double p_abs = cdcNNTrkArray[itrk]->getPt() / sin(theta);
250 B2DEBUG(20, "NN momentum " << omega << " " << theta * 180 / 3.14 << " " << p * 0.1 << " " << p_abs << " " << pt);
251
252 if (abs(z0) < 15. && p > 7) {nTrkNNSTT++;}
253 if (abs(z0) < 15. && p > 6) {nTrkNNSTT6++;}
254 if (abs(z0) < 15. && p > 5) {nTrkNNSTT5++;}
255 if (abs(z0) < 15. && p > 4) {nTrkNNSTT4++;}
256 if (abs(z0) < 20.) {nTrkNN20++;}
257 if (abs(z0) < 40.) {nTrkNN40++;}
258 }
259
260 trgInfo->setN3Dfittertrk(nTrk3D);
261 trgInfo->setN3DfittertrkZ10(nTrkZ10);
262 trgInfo->setN3DfittertrkZ25(nTrkZ25);
263 trgInfo->setN3DfittertrkZ35(nTrkZ35);
264 trgInfo->setNNNtrk(nTrkNN);
265 trgInfo->setNNNtrkZ20(nTrkNN20);
266 trgInfo->setNNNtrkZ40(nTrkNN40);
267 trgInfo->setNNNtrkSTT(nTrkNNSTT);
268
269
270
271 int nClust = selTC.size();
272 int n300MeV = 0;
273 int n2GeV = 0;
274 int n2GeV414 = 0;
275 int n2GeV231516 = 0;
276 int n2GeV117 = 0;
277 int n1GeV415 = 0;
278 int n1GeV2316 = 0;
279 int n1GeV117 = 0;
280 for (int ic = 0; ic < nClust; ic++) {
281 if (selE[ic] > 0.3) {n300MeV++;}
282 float thresh = TC1GeV[selTC[ic] - 1];
283 if (selE[ic] > (thresh + thresh)) {
284 n2GeV++;
285 if (selTheta[ic] >= 4 && selTheta[ic] <= 14) {n2GeV414++;}
286 if (selTheta[ic] == 2 || selTheta[ic] == 3 || selTheta[ic] == 15 || selTheta[ic] == 16) {n2GeV231516++;}
287 if (selTheta[ic] == 1 || selTheta[ic] == 17) {n2GeV117++;}
288 }
289 if (selE[ic] > thresh) {
290 if (selTheta[ic] >= 4 && selTheta[ic] <= 15) {n1GeV415++;}
291 if (selTheta[ic] == 2 || selTheta[ic] == 3 || selTheta[ic] == 16) {n1GeV2316++;}
292 if (selTheta[ic] == 1 || selTheta[ic] == 17) {n1GeV117++;}
293 }
294 }
295 trgInfo->setNcluster(nClust);
296 trgInfo->setNhigh300cluster(n300MeV);
297 trgInfo->setNhigh1GeVcluster415(n1GeV415);
298 trgInfo->setNhigh1GeVcluster2316(n1GeV2316);
299 trgInfo->setNhigh1GeVcluster117(n1GeV117);
300 trgInfo->setNhigh2GeVcluster(n2GeV);
301 trgInfo->setNhigh2GeVcluster414(n2GeV414);
302 trgInfo->setNhigh2GeVcluster231516(n2GeV231516);
303 trgInfo->setNhigh2GeVcluster117(n2GeV117);
304
305
306
307
308 int nPhiPairHigh = 0;
309 int nPhiPairLow = 0;
310 int n3DPair = 0;
311 int nECLBhabha = 0;
312 int nTrkBhabha = 0;
313 for (int i0 = 0; i0 < nClust - 1; i0++) {
314 for (int i1 = i0 + 1; i1 < nClust; i1++) {
315
316
317 float dphi = abs(TCPhiCOM[selTC[i1] - 1] - TCPhiCOM[selTC[i0] - 1]);
318 if (dphi > 180.) {dphi = 360 - dphi;}
319 if (dphi > 170. && selE[i0] > 0.25 && selE[i1] > 0.25) {nPhiPairHigh++;}
320 if (dphi > 170. && (selE[i0] < 0.25 || selE[i1] < 0.25)) {nPhiPairLow++;}
321
322
323 float thetaSum = TCThetaCOM[selTC[i0] - 1] + TCThetaCOM[selTC[i1] - 1];
324 if (dphi > 160. && thetaSum > 160. && thetaSum < 200.) {n3DPair++;}
325
326
327 if (dphi > 160. && thetaSum > 165. && thetaSum < 190. && selE[i0] > 3.*TC1GeV[selTC[i0] - 1] && selE[i1] > 3.*TC1GeV[selTC[i1] - 1]
328 && (selE[i0] > 4.5 * TC1GeV[selTC[i0] - 1] || selE[i1] > 4.5 * TC1GeV[selTC[i1] - 1])) {
329 nECLBhabha++;
330
331
332 bool c0matched = false;
333 bool c1matched = false;
334 for (int itrk = 0; itrk < nTrk3D; itrk++) {
335 double phiTrk = cdc3DTrkArray[itrk]->getPhi0() * radtodeg;
336 double ptTrk = cdc3DTrkArray[itrk]->getTransverseMomentum(1.5);
337 float dphi0 = abs(phiTrk - TCPhiLab[selTC[i0] - 1]);
338 if (dphi0 > 180.) {dphi0 = 360. - dphi0;}
339 float dphi1 = abs(phiTrk - TCPhiLab[selTC[i1] - 1]);
340 if (dphi1 > 180.) {dphi1 = 360. - dphi1;}
341 if (ptTrk > 1. && dphi0 < 15.) {c0matched = true;}
342 if (ptTrk > 1. && dphi1 < 15.) {c1matched = true;}
343 }
344 if (c0matched && c1matched) {nTrkBhabha++;}
345 }
346 }
347 }
348
349 trgInfo->setBhabhaVeto(nTrkBhabha);
350 trgInfo->seteclBhabhaVeto(nECLBhabha);
351 trgInfo->setPairHigh(nPhiPairHigh);
352 trgInfo->setPairLow(nPhiPairLow);
353 trgInfo->set3DPair(n3DPair);
354
355
356
357
358
359 int nSameHem1Trk = 0;
360 int nOppHem1Trk = 0;
361 if (nTrk3D == 1) {
362 double phiTrk = cdc3DTrkArray[0]->getPhi0() * radtodeg;
363 double cotTrk = cdc3DTrkArray[0]->getCotTheta();
364 for (int i0 = 0; i0 < nClust; i0++) {
365 float dphi = abs(phiTrk - TCPhiLab[selTC[i0] - 1]);
366 if (dphi > 180.) {dphi = 360. - dphi;}
367 float dCot = cotTrk - TCcotThetaLab[selTC[i0] - 1];
368 if (dphi > 80.) {nOppHem1Trk++;}
369 if (dphi < 80. && (dCot < -0.8 || dCot > 0.6)) {nSameHem1Trk++;}
370 }
371 }
372
373 trgInfo->setNSameHem1Trk(nSameHem1Trk);
374 trgInfo->setNOppHem1Trk(nOppHem1Trk);
375
376
377
378 int Trk_b2b_1to3 = 0;
379 int Trk_b2b_1to5 = 0;
380 int Trk_b2b_1to7 = 0;
381 int Trk_b2b_1to9 = 0;
382 int Trk_open90 = 0;
383 int Trk_open30 = 0;
384 for (int itrk = 0; itrk < cdc2DTrkArray.getEntries(); itrk++) {
385
386 int phi_i_itrk = (int)((cdc2DTrkArray[itrk]->getPhi0()) * (180 / M_PI) / 10);
387
388 for (int jtrk = 0; jtrk < cdc2DTrkArray.getEntries(); jtrk++) {
389 if (itrk <= jtrk) continue;
390
391 int phi_i_jtrk = (int)((cdc2DTrkArray[jtrk]->getPhi0()) * (180 / M_PI) / 10);
392 if (abs(phi_i_itrk - phi_i_jtrk) >= 17 && abs(phi_i_itrk - phi_i_jtrk) <= 19) {Trk_b2b_1to3 = 1;}
393 if (abs(phi_i_itrk - phi_i_jtrk) >= 16 && abs(phi_i_itrk - phi_i_jtrk) <= 20) {Trk_b2b_1to5 = 1;}
394 if (abs(phi_i_itrk - phi_i_jtrk) >= 15 && abs(phi_i_itrk - phi_i_jtrk) <= 21) {Trk_b2b_1to7 = 1;}
395 if (abs(phi_i_itrk - phi_i_jtrk) >= 14 && abs(phi_i_itrk - phi_i_jtrk) <= 22) {Trk_b2b_1to9 = 1;}
396 if (abs(phi_i_itrk - phi_i_jtrk) >= 9 && abs(phi_i_itrk - phi_i_jtrk) <= 27) {Trk_open90 = 1;}
397 if (abs(phi_i_itrk - phi_i_jtrk) >= 3 && abs(phi_i_itrk - phi_i_jtrk) <= 33) {Trk_open30 = 1;}
398 }
399 }
400 trgInfo->setTrk_b2b_1to3(Trk_b2b_1to3);
401 trgInfo->setTrk_b2b_1to5(Trk_b2b_1to5);
402 trgInfo->setTrk_b2b_1to7(Trk_b2b_1to7);
403 trgInfo->setTrk_b2b_1to9(Trk_b2b_1to9);
404 trgInfo->setTrk_open90(Trk_open90);
405 trgInfo->setTrk_open30(Trk_open30);
406
407
408
409 int cluster_b2b_1to3 = 0;
410 int cluster_b2b_1to5 = 0;
411 int cluster_b2b_1to7 = 0;
412 int cluster_b2b_1to9 = 0;
413 for (int iclu = 0; iclu < eclTrgClusterArray.getEntries(); iclu++) {
414
415 double x_iclu = eclTrgClusterArray[iclu]->getPositionX();
416 double y_iclu = eclTrgClusterArray[iclu]->getPositionY();
417
418 int phi_iclu = 0;
419 if (x_iclu >= 0 && y_iclu >= 0) {phi_iclu = (int)(
atan(y_iclu / x_iclu) * (180.0 / M_PI) / 10);}
420 else if (x_iclu < 0 && y_iclu >= 0) {phi_iclu = (int)((
atan(y_iclu / x_iclu) * (180.0 / M_PI) + 180.0) / 10);}
421 else if (x_iclu < 0 && y_iclu < 0) {phi_iclu = (int)((
atan(y_iclu / x_iclu) * (180.0 / M_PI) + 180.0) / 10);}
422 else if (x_iclu >= 0 && y_iclu < 0) {phi_iclu = (int)((
atan(y_iclu / x_iclu) * (180.0 / M_PI) + 360.0) / 10);}
423
424 for (int jclu = 0; jclu < eclTrgClusterArray.getEntries(); jclu++) {
425 if (iclu <= jclu) continue;
426
427 double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
428 double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
429
430 int phi_jclu = 0;
431 if (x_jclu >= 0 && y_jclu >= 0) {phi_jclu = (int)(
atan(y_jclu / x_jclu) * (180.0 / M_PI) / 10);}
432 else if (x_jclu < 0 && y_jclu >= 0) {phi_jclu = (int)((
atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
433 else if (x_jclu < 0 && y_jclu < 0) {phi_jclu = (int)((
atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
434 else if (x_jclu >= 0 && y_jclu < 0) {phi_jclu = (int)((
atan(y_jclu / x_jclu) * (180.0 / M_PI) + 360.0) / 10);}
435
436 if (abs(phi_iclu - phi_jclu) >= 17 && abs(phi_iclu - phi_jclu) <= 19) {cluster_b2b_1to3 = 1;}
437 if (abs(phi_iclu - phi_jclu) >= 16 && abs(phi_iclu - phi_jclu) <= 20) {cluster_b2b_1to5 = 1;}
438 if (abs(phi_iclu - phi_jclu) >= 15 && abs(phi_iclu - phi_jclu) <= 21) {cluster_b2b_1to7 = 1;}
439 if (abs(phi_iclu - phi_jclu) >= 14 && abs(phi_iclu - phi_jclu) <= 22) {cluster_b2b_1to9 = 1;}
440 }
441 }
442 trgInfo->setcluster_b2b_1to3(cluster_b2b_1to3);
443 trgInfo->setcluster_b2b_1to5(cluster_b2b_1to5);
444 trgInfo->setcluster_b2b_1to7(cluster_b2b_1to7);
445 trgInfo->setcluster_b2b_1to9(cluster_b2b_1to9);
446
447
448
449
450
451 int eed = 0, fed = 0;
452 if (cdc2DTrkArray.getEntries() == 2 && trackphimatch.getEntries() == 2 && cluster_b2b_1to5 == 1) {eed = 1;}
453 if (cdc2DTrkArray.getEntries() == 1 && trackphimatch.getEntries() == 1 && cluster_b2b_1to5 == 1) {fed = 1;}
454 trgInfo->seteed(eed);
455 trgInfo->setfed(fed);
456
457
458
459 int Trkcluster_b2b_1to3 = 0;
460 int Trkcluster_b2b_1to5 = 0;
461 int Trkcluster_b2b_1to7 = 0;
462 int Trkcluster_b2b_1to9 = 0;
463 for (int itrk = 0; itrk < cdc2DTrkArray.getEntries(); itrk++) {
464 double _r = 1.0 / cdc2DTrkArray[itrk]->getOmega() ;
465 double _phi = cdc2DTrkArray[itrk]->getPhi0() ;
466 double phi_p = acos(126.0 / (2 * fabs(_r)));
469 else if (_r < 0) {
charge = -1;}
471
472 double phi_CDC = 0.0;
473 if (charge == 1) {
474 phi_CDC = _phi + phi_p - 0.5 * M_PI;
475 } else if (charge == -1) {
476 phi_CDC = _phi - phi_p + 0.5 * M_PI;
477 } else {
478 phi_CDC = _phi;
479 }
480
481 if (phi_CDC > 2 * M_PI) {phi_CDC = phi_CDC - 2 * M_PI;}
482 else if (phi_CDC < 0) {phi_CDC = phi_CDC + 2 * M_PI;}
483 int phi_itrk = (int)(phi_CDC * (180.0 / M_PI) / 10);
484
485 for (int jclu = 0; jclu < eclTrgClusterArray.getEntries(); jclu++) {
486
487 double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
488 double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
489
490 int phi_jclu = 0;
491 if (x_jclu >= 0 && y_jclu >= 0) {phi_jclu = (int)(
atan(y_jclu / x_jclu) * (180.0 / M_PI) / 10);}
492 else if (x_jclu < 0 && y_jclu >= 0) {phi_jclu = (int)((
atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
493 else if (x_jclu < 0 && y_jclu < 0) {phi_jclu = (int)((
atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
494 else if (x_jclu >= 0 && y_jclu < 0) {phi_jclu = (int)((
atan(y_jclu / x_jclu) * (180.0 / M_PI) + 360.0) / 10);}
495
496 if (abs(phi_itrk - phi_jclu) >= 17 && abs(phi_itrk - phi_jclu) <= 19) {Trkcluster_b2b_1to3 = 1;}
497 if (abs(phi_itrk - phi_jclu) >= 16 && abs(phi_itrk - phi_jclu) <= 20) {Trkcluster_b2b_1to5 = 1;}
498 if (abs(phi_itrk - phi_jclu) >= 15 && abs(phi_itrk - phi_jclu) <= 21) {Trkcluster_b2b_1to7 = 1;}
499 if (abs(phi_itrk - phi_jclu) >= 14 && abs(phi_itrk - phi_jclu) <= 22) {Trkcluster_b2b_1to9 = 1;}
500 }
501 }
502
503 trgInfo->setTrkcluster_b2b_1to3(Trkcluster_b2b_1to3);
504 trgInfo->setTrkcluster_b2b_1to5(Trkcluster_b2b_1to5);
505 trgInfo->setTrkcluster_b2b_1to7(Trkcluster_b2b_1to7);
506 trgInfo->setTrkcluster_b2b_1to9(Trkcluster_b2b_1to9);
507
508
509
510
511 int fp = 0;
512 if (cdc2DTrkArray.getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fp = 1;}
513 trgInfo->setfp(fp);
514
515 int eeb = 0;
516 if (trackphimatch.getEntries() == 2 && Trk_b2b_1to5 == 1) {eeb = 1;}
517 trgInfo->seteeb(eeb);
518
519 int fep = 0;
520 if (cdc2DTrkArray.getEntries() == 1 && trackphimatch.getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fep = 1;}
521 trgInfo->setfep(fep);
522
523
524
525
526
527
528 int ECLtoGDL[4] = {0, 0, 0, 0};
529 if (ntrgArray > 0) {
530 ECLtoGDL[0] = trgArray[0]->getECLtoGDL(0);
531 ECLtoGDL[1] = trgArray[0]->getECLtoGDL(1);
532 ECLtoGDL[2] = trgArray[0]->getECLtoGDL(2);
533 ECLtoGDL[3] = trgArray[0]->getECLtoGDL(3);
534 }
535
536
537 bool elow = (ECLtoGDL[1] & (1 << (47 - 32 * 1))) != 0;
538
539 bool ehigh = (ECLtoGDL[1] & (1 << (48 - 32 * 1))) != 0;
540
541 bool elum = (ECLtoGDL[1] & (1 << (49 - 32 * 1))) != 0;
542
543 bool ecl_bha = (ECLtoGDL[0] & (1 << (19 - 32 * 0))) != 0;
544
545 bool bha_type0 = (ECLtoGDL[0] & (1 << (20 - 32 * 0))) != 0;
546
547 bool bha_type1 = (ECLtoGDL[0] & (1 << (21 - 32 * 0))) != 0;
548
549 bool bha_type2 = (ECLtoGDL[0] & (1 << (22 - 32 * 0))) != 0;
550
551 bool bha_type3 = (ECLtoGDL[0] & (1 << (23 - 32 * 0))) != 0;
552
553 bool bha_type4 = (ECLtoGDL[0] & (1 << (24 - 32 * 0))) != 0;
554
555 bool bha_type5 = (ECLtoGDL[0] & (1 << (25 - 32 * 0))) != 0;
556
557 bool bha_type6 = (ECLtoGDL[0] & (1 << (26 - 32 * 0))) != 0;
558
559 bool bha_type7 = (ECLtoGDL[0] & (1 << (27 - 32 * 0))) != 0;
560
561 bool bha_type8 = (ECLtoGDL[0] & (1 << (28 - 32 * 0))) != 0;
562
563 bool bha_type9 = (ECLtoGDL[0] & (1 << (29 - 32 * 0))) != 0;
564
565 bool bha_type10 = (ECLtoGDL[0] & (1 << (30 - 32 * 0))) != 0;
566
567 bool bha_type11 = (ECLtoGDL[0] & (1u << (31 - 32 * 0))) != 0;
568
569 bool bha_type12 = (ECLtoGDL[1] & (1 << (32 - 32 * 1))) != 0;
570
571 bool bha_type13 = (ECLtoGDL[1] & (1 << (33 - 32 * 1))) != 0;
572
573 unsigned int icn = (ECLtoGDL[1] >> (50 - 32 * 1)) & 0x7F;
574 if (icn > 14)
575 icn = 15;
576 bool nclst_0 = (icn >> 0) & 0x1;
577 bool nclst_1 = (icn >> 1) & 0x1;
578 bool nclst_2 = (icn >> 2) & 0x1;
579 bool nclst_3 = (icn >> 3) & 0x1;
580
581
582 bool ecl_bg_0 = (ECLtoGDL[1] & (1 << (57 - 32 * 1))) != 0;
583
584 bool ecl_bg_1 = (ECLtoGDL[1] & (1 << (58 - 32 * 1))) != 0;
585
586 bool ecl_bg_2 = (ECLtoGDL[1] & (1 << (59 - 32 * 1))) != 0;
587
588 bool ecl_active = ntrgArray > 0;
589
590
591 bool ecl_timing_fwd = (ECLtoGDL[0] & (1 << (15 - 32 * 0))) != 0;
592
593 bool ecl_timing_brl = (ECLtoGDL[0] & (1 << (16 - 32 * 0))) != 0;
594
595 bool ecl_timing_bwd = (ECLtoGDL[0] & (1 << (17 - 32 * 0))) != 0;
596
597 bool ecl_phys = (ECLtoGDL[0] & (1 << (18 - 32 * 0))) != 0;
598
599 bool ecl_oflo = (ECLtoGDL[1] & (1 << (60 - 32 * 1))) != 0;
600
601 bool ecl_3dbha = (ECLtoGDL[1] & (1 << (61 - 32 * 1))) != 0;
602
603 bool ecl_lml_0 = (ECLtoGDL[1] & (1 << (62 - 32 * 1))) != 0;
604
605 bool ecl_lml_1 = (ECLtoGDL[1] & (1u << (63 - 32 * 1))) != 0;
606
607 bool ecl_lml_2 = (ECLtoGDL[2] & (1 << (64 - 32 * 2))) != 0;
608
609 bool ecl_lml_3 = (ECLtoGDL[2] & (1 << (65 - 32 * 2))) != 0;
610
611 bool ecl_lml_4 = (ECLtoGDL[2] & (1 << (66 - 32 * 2))) != 0;
612
613 bool ecl_lml_5 = (ECLtoGDL[2] & (1 << (67 - 32 * 2))) != 0;
614
615 bool ecl_lml_6 = (ECLtoGDL[2] & (1 << (68 - 32 * 2))) != 0;
616
617 bool ecl_lml_7 = (ECLtoGDL[2] & (1 << (69 - 32 * 2))) != 0;
618
619 bool ecl_lml_8 = (ECLtoGDL[2] & (1 << (70 - 32 * 2))) != 0;
620
621 bool ecl_lml_9 = (ECLtoGDL[2] & (1 << (71 - 32 * 2))) != 0;
622
623 bool ecl_lml_10 = (ECLtoGDL[2] & (1 << (72 - 32 * 2))) != 0;
624
625 bool ecl_lml_11 = (ECLtoGDL[2] & (1 << (73 - 32 * 2))) != 0;
626
627 bool ecl_lml_12 = (ECLtoGDL[2] & (1 << (78 - 32 * 2))) != 0;
628
629 bool ecl_lml_13 = (ECLtoGDL[2] & (1 << (79 - 32 * 2))) != 0;
630
631 bool ecl_mumu = (ECLtoGDL[2] & (1 << (75 - 32 * 2))) != 0;
632
633 bool ecl_bst = (ECLtoGDL[2] & (1 << (77 - 32 * 2))) != 0;
634
635 bool ecl_bhapur = (ECLtoGDL[2] & (1 << (74 - 32 * 2))) != 0;
636
637 bool bha_intrk = (ECLtoGDL[2] & (1 << (86 - 32 * 2))) != 0;
638
639 bool bha_theta_0 = (ECLtoGDL[2] & (1 << (87 - 32 * 2))) != 0;
640 bool bha_theta_1 = (ECLtoGDL[2] & (1 << (88 - 32 * 2))) != 0;
641
642 bool ecltaub2b = (ECLtoGDL[2] & (1 << (89 - 32 * 2))) != 0;
643 bool ecltaub2b2 = (ECLtoGDL[2] & (1 << (93 - 32 * 2))) != 0;
644 bool ecltaub2b3 = (ECLtoGDL[2] & (1 << (94 - 32 * 2))) != 0;
645
646 bool ehigh1 = (ECLtoGDL[2] & (1 << (90 - 32 * 2))) != 0;
647 bool ehigh2 = (ECLtoGDL[2] & (1 << (91 - 32 * 2))) != 0;
648 bool ehigh3 = (ECLtoGDL[2] & (1 << (92 - 32 * 2))) != 0;
649 bool ehigh4 = (ECLtoGDL[2] & (1u << (95 - 32 * 2))) != 0;
650
651
652
653
654 bool cdc_active = false;
655 if (m_eventTime->hasBinnedEventT0(Const::CDC)) {
656 if (m_eventTime->getBinnedEventT0(Const::CDC) != 0) { cdc_active = true; }
657 }
658
659
660 int n_klm_barrel = klmtrgsummary->getBKLM_n_trg_sectors();
661 bool klm_hit = n_klm_barrel > 0;
662 bool klm_0 = (n_klm_barrel & (1 << 0)) != 0;
663 bool klm_1 = (n_klm_barrel & (1 << 1)) != 0;
664 bool klm_2 = (n_klm_barrel & (1 << 2)) != 0;
665 int n_eklm_barrel = klmtrgsummary->getEKLM_n_trg_sectors();
666 bool eklm_hit = n_eklm_barrel > 0;
667 bool eklm_0 = (n_eklm_barrel & (1 << 0)) != 0;
668 bool eklm_1 = (n_eklm_barrel & (1 << 1)) != 0;
669 bool eklm_2 = (n_eklm_barrel & (1 << 2)) != 0;
670 int klmb2b = klmtrgsummary->getBKLM_back_to_back_flag();
671 int eklmb2b = klmtrgsummary->getEKLM_back_to_back_flag();
672
673
674 bool cdcklm_0 = (trackKLMmatch.getEntries() == 1);
675 bool cdcklm_1 = (trackKLMmatch.getEntries() > 1);
676 bool cdcklm_2 = (trackKLMmatch.getEntries() == 3);
677 bool cdcklm_3 = (trackKLMmatch.getEntries() > 3);
678 int n_seklm = trgInfo->getNsklm();
679
680
681 int n_ieklm = trgInfo->getNiklm();
682 bool ecleklm = (trgInfo->getNeecleklm() > 0);
683
684 bool cdcecl_0 = (trackphimatch.getEntries() == 1);
685 bool cdcecl_1 = (trackphimatch.getEntries() == 2);
686 bool cdcecl_2 = (trackphimatch.getEntries() == 3);
687 bool cdcecl_3 = (trackphimatch.getEntries() > 3);
688 bool trkbha1 = ecl_3dbha && (trackphimatch.getEntries() == 1);
689 bool trkbha2 = ecl_3dbha && (trackphimatch.getEntries() == 2);
690
691
692
693 int n_c2gev = 0;
694 for (int i = 0; i < trackphimatch.getEntries(); i++) {
695 if (trackphimatch[i]->get_e() >= 2.0) {n_c2gev++;}
696 }
697
698 bool c2gev_0 = (n_c2gev == 1);
699 bool c2gev_1 = (n_c2gev == 2);
700 bool c2gev_2 = (n_c2gev == 3);
701 bool c2gev_3 = (n_c2gev > 3);
702
703 int N_clst1 = 0, N_clst2 = 0;
704 for (int i = 0 ; i < grlphoton.getEntries() ; i++) {
705 if (grlphoton[i]->get_e() > 1.0) { N_clst1++; }
706 if (grlphoton[i]->get_e() > 2.0) { N_clst2++; }
707 }
708
709 bool nclst1_0 = (N_clst1 == 1);
710 bool nclst1_1 = (N_clst1 == 2);
711 bool nclst1_2 = (N_clst1 == 3);
712 bool nclst1_3 = (N_clst1 > 3);
713
714 bool nclst2_0 = (N_clst2 == 1);
715 bool nclst2_1 = (N_clst2 == 2);
716 bool nclst2_2 = (N_clst2 == 3);
717 bool nclst2_3 = (N_clst2 > 3);
718
719 int N_ST = trgInfo->getNshorttrk();
720 int N_ST_fwd = trgInfo->getNshorttrk_fwd();
721 int N_ST_bwd = trgInfo->getNshorttrk_bwd();
722 int s2s3 = trgInfo->gets2s3();
723 int s2s5 = trgInfo->gets2s5();
724 int s2so = trgInfo->gets2so();
725 int s2f3 = trgInfo->gets2f3();
726 int s2f5 = trgInfo->gets2f5();
727 int s2fo = trgInfo->gets2fo();
728 int s2f30 = trgInfo->gets2f30();
729 int s2s30 = trgInfo->gets2s30();
730 int bwdsb = trgInfo->getbwdsb();
731 int bwdnb = trgInfo->getbwdnb();
732 int fwdsb = trgInfo->getfwdsb();
733 int fwdnb = trgInfo->getfwdnb();
734 int brlfb = trgInfo->getbrlfb();
735 int brlnb = trgInfo->getbrlnb();
736 int N_IT = trgInfo->getNinnertrk();
737 int i2fo = trgInfo->geti2fo();
738 int i2io = trgInfo->geti2io();
739 int n_secl = trgInfo->getNsecl();
740 int n_iecl = trgInfo->getNiecl();
741
742 bool ecltaunn = trgInfo->getTauNN();
743
744
745
746
747
748
749
750
751
752
753
754
755
756
758
760
761 for (int i = 0; i < N_InputBits; i++) {
763
764 bool bit = false;
765 if (bitname == "t3_0") {bit = nTrkZ35 == 1;}
766 else if (bitname == "t3_1") {bit = nTrkZ35 == 2;}
767 else if (bitname == "t3_2") {bit = nTrkZ35 == 3;}
768 else if (bitname == "t3_3") {bit = nTrkZ35 > 3;}
769 else if (bitname == "ty_0") {bit = nTrkNN20 == 1;}
770 else if (bitname == "ty_1") {bit = nTrkNN20 == 2;}
771 else if (bitname == "ty_2") {bit = nTrkNN20 == 3;}
772 else if (bitname == "ty_3") {bit = nTrkNN20 > 3;}
773 else if (bitname == "typ") {bit = nTrkNNSTT > 0;}
774 else if (bitname == "typ6") {bit = nTrkNNSTT6 > 0;}
775 else if (bitname == "typ5") {bit = nTrkNNSTT5 > 0;}
776 else if (bitname == "typ4") {bit = nTrkNNSTT4 > 0;}
777 else if (bitname == "t2_0") {bit = nTrk2D == 1;}
778 else if (bitname == "t2_1") {bit = nTrk2D == 2;}
779 else if (bitname == "t2_2") {bit = nTrk2D == 3;}
780 else if (bitname == "t2_3") {bit = nTrk2D > 3;}
781 else if (bitname == "ts_0") {bit = N_ST == 1;}
782 else if (bitname == "ts_1") {bit = N_ST == 2;}
783 else if (bitname == "ts_2") {bit = N_ST == 3;}
784 else if (bitname == "ts_3") {bit = N_ST > 3;}
785 else if (bitname == "fwd_s") {bit = N_ST_fwd > 0;}
786 else if (bitname == "bwd_s") {bit = N_ST_bwd > 0;}
787 else if (bitname == "cdc_open90") {bit = Trk_open90 == 1;}
788 else if (bitname == "f2f30") {bit = Trk_open30 == 1;}
789 else if (bitname == "cdc_active") {bit = cdc_active;}
790 else if (bitname == "cdc_b2b3") {bit = Trk_b2b_1to3;}
791 else if (bitname == "cdc_b2b5") {bit = Trk_b2b_1to5;}
792 else if (bitname == "cdc_b2b7") {bit = Trk_b2b_1to7;}
793 else if (bitname == "cdc_b2b9") {bit = Trk_b2b_1to9;}
794 else if (bitname == "s2s3") {bit = s2s3 > 0;}
795 else if (bitname == "s2s5") {bit = s2s5 > 0;}
796 else if (bitname == "s2so") {bit = s2so > 0;}
797 else if (bitname == "s2f3") {bit = s2f3 > 0;}
798 else if (bitname == "s2f5") {bit = s2f5 > 0;}
799 else if (bitname == "s2fo") {bit = s2fo > 0;}
800 else if (bitname == "s2f30") {bit = s2f30;}
801 else if (bitname == "s2s30") {bit = s2s30;}
802 else if (bitname == "bwdsb") {bit = bwdsb > 0;}
803 else if (bitname == "bwdnb") {bit = bwdnb > 0;}
804 else if (bitname == "fwdsb") {bit = fwdsb > 0;}
805 else if (bitname == "fwdnb") {bit = fwdnb > 0;}
806 else if (bitname == "brlfb1") {bit = brlfb == 1;}
807 else if (bitname == "brlfb2") {bit = brlfb == 2;}
808 else if (bitname == "brlnb1") {bit = brlnb == 1;}
809 else if (bitname == "brlnb2") {bit = brlnb == 2;}
810 else if (bitname == "seklm_0") {bit = n_seklm == 1;}
811 else if (bitname == "seklm_1") {bit = n_seklm > 1;}
812 else if (bitname == "ieklm") {bit = n_ieklm > 0;}
813 else if (bitname == "secl") {bit = n_secl > 0;}
814 else if (bitname == "iecl") {bit = n_iecl > 0;}
815 else if (bitname == "iecl_0") {bit = n_iecl == 1;}
816 else if (bitname == "iecl_1") {bit = n_iecl > 1;}
817 else if (bitname == "ti") {bit = N_IT > 0;}
818 else if (bitname == "i2fo") {bit = i2fo > 0;}
819 else if (bitname == "i2io") {bit = i2io > 0;}
820 else if (bitname == "ehigh") {bit = ehigh;}
821 else if (bitname == "elow") {bit = elow;}
822 else if (bitname == "elum") {bit = elum;}
823 else if (bitname == "ecl_bha") {bit = ecl_bha;}
824 else if (bitname == "bha_type_0") {bit = bha_type0;}
825 else if (bitname == "bha_type_1") {bit = bha_type1;}
826 else if (bitname == "bha_type_2") {bit = bha_type2;}
827 else if (bitname == "bha_type_3") {bit = bha_type3;}
828 else if (bitname == "bha_type_4") {bit = bha_type4;}
829 else if (bitname == "bha_type_5") {bit = bha_type5;}
830 else if (bitname == "bha_type_6") {bit = bha_type6;}
831 else if (bitname == "bha_type_7") {bit = bha_type7;}
832 else if (bitname == "bha_type_8") {bit = bha_type8;}
833 else if (bitname == "bha_type_9") {bit = bha_type9;}
834 else if (bitname == "bha_type_10") {bit = bha_type10;}
835 else if (bitname == "bha_type_11") {bit = bha_type11;}
836 else if (bitname == "bha_type_12") {bit = bha_type12;}
837 else if (bitname == "bha_type_13") {bit = bha_type13;}
838 else if (bitname == "clst_0") {bit = nclst_0;}
839 else if (bitname == "clst_1") {bit = nclst_1;}
840 else if (bitname == "clst_2") {bit = nclst_2;}
841 else if (bitname == "clst_3") {bit = nclst_3;}
842 else if (bitname == "ecl_bg_0") {bit = ecl_bg_0;}
843 else if (bitname == "ecl_bg_1") {bit = ecl_bg_1;}
844 else if (bitname == "ecl_bg_2") {bit = ecl_bg_2;}
845 else if (bitname == "ecl_active") {bit = ecl_active;}
846 else if (bitname == "ecl_timing_fwd") {bit = ecl_timing_fwd;}
847 else if (bitname == "ecl_timing_brl") {bit = ecl_timing_brl;}
848 else if (bitname == "ecl_timing_bwd") {bit = ecl_timing_bwd;}
849 else if (bitname == "ecl_phys") {bit = ecl_phys;}
850 else if (bitname == "ecl_oflo") {bit = ecl_oflo;}
851 else if (bitname == "ecl_3dbha") {bit = ecl_3dbha;}
852 else if (bitname == "bha_veto") {bit = ecl_3dbha;}
853 else if (bitname == "ecl_lml_0") {bit = ecl_lml_0;}
854 else if (bitname == "ecl_lml_1") {bit = ecl_lml_1;}
855 else if (bitname == "ecl_lml_2") {bit = ecl_lml_2;}
856 else if (bitname == "ecl_lml_3") {bit = ecl_lml_3;}
857 else if (bitname == "ecl_lml_4") {bit = ecl_lml_4;}
858 else if (bitname == "ecl_lml_5") {bit = ecl_lml_5;}
859 else if (bitname == "ecl_lml_6") {bit = ecl_lml_6;}
860 else if (bitname == "ecl_lml_7") {bit = ecl_lml_7;}
861 else if (bitname == "ecl_lml_8") {bit = ecl_lml_8;}
862 else if (bitname == "ecl_lml_9") {bit = ecl_lml_9;}
863 else if (bitname == "ecl_lml_10") {bit = ecl_lml_10;}
864 else if (bitname == "ecl_lml_11") {bit = ecl_lml_11;}
865 else if (bitname == "ecl_lml_12") {bit = ecl_lml_12;}
866 else if (bitname == "ecl_lml_13") {bit = ecl_lml_13;}
867 else if (bitname == "ecl_mumu") {bit = ecl_mumu;}
868 else if (bitname == "ecl_bst") {bit = ecl_bst;}
869 else if (bitname == "ecl_taub2b") {bit = ecltaub2b;}
870 else if (bitname == "ecl_taub2b2") {bit = ecltaub2b2;}
871 else if (bitname == "ecl_taub2b3") {bit = ecltaub2b3;}
872 else if (bitname == "ehigh1") {bit = ehigh1;}
873 else if (bitname == "ehigh2") {bit = ehigh2;}
874 else if (bitname == "ehigh3") {bit = ehigh3;}
875 else if (bitname == "ehigh4") {bit = ehigh4;}
876
877 else if (bitname == "klm_hit") {bit = klm_hit;}
878 else if (bitname == "klm_0") {bit = klm_0;}
879 else if (bitname == "klm_1") {bit = klm_1;}
880 else if (bitname == "klm_2") {bit = klm_2;}
881 else if (bitname == "klmb2b") {bit = klmb2b;}
882 else if (bitname == "eklm_hit") {bit = eklm_hit;}
883 else if (bitname == "eklm_0") {bit = eklm_0;}
884 else if (bitname == "eklm_1") {bit = eklm_1;}
885 else if (bitname == "eklm_2") {bit = eklm_2;}
886 else if (bitname == "eklmb2b") {bit = eklmb2b;}
887 else if (bitname == "ecleklm") {bit = ecleklm;}
888 else if (bitname == "revo") {bit = false;}
889 else if (bitname == "her_kick") {bit = false;}
890 else if (bitname == "ler_kick") {bit = false;}
891 else if (bitname == "bha_delay") {bit = false;}
892 else if (bitname == "pseud_rand") {bit = false;}
893 else if (bitname == "plsin") {bit = false;}
894 else if (bitname == "poissonin") {bit = false;}
895 else if (bitname == "periodin") {bit = false;}
896 else if (bitname == "veto") {bit = false;}
897 else if (bitname == "samhem") {bit = nSameHem1Trk > 0;}
898 else if (bitname == "opohem") {bit = nOppHem1Trk > 0;}
899 else if (bitname == "n1gev_0") {bit = nclst1_0;}
900 else if (bitname == "n1gev_1") {bit = nclst1_1;}
901 else if (bitname == "n1gev_2") {bit = nclst1_2;}
902 else if (bitname == "n1gev_3") {bit = nclst1_3;}
903 else if (bitname == "n2gev_0") {bit = nclst2_0;}
904 else if (bitname == "n2gev_1") {bit = nclst2_1;}
905 else if (bitname == "n2gev_2") {bit = nclst2_2;}
906 else if (bitname == "n2gev_3") {bit = nclst2_3;}
907 else if (bitname == "cdcecl_0") {bit = cdcecl_0;}
908 else if (bitname == "cdcecl_1") {bit = cdcecl_1;}
909 else if (bitname == "cdcecl_2") {bit = cdcecl_2;}
910 else if (bitname == "cdcecl_3") {bit = cdcecl_3;}
911 else if (bitname == "c2gev_0") {bit = c2gev_0;}
912 else if (bitname == "c2gev_1") {bit = c2gev_1;}
913 else if (bitname == "c2gev_2") {bit = c2gev_2;}
914 else if (bitname == "c2gev_3") {bit = c2gev_3;}
915 else if (bitname == "cdcklm_0") {bit = cdcklm_0;}
916 else if (bitname == "cdcklm_1") {bit = cdcklm_1;}
917 else if (bitname == "cdcklm_2") {bit = cdcklm_2;}
918 else if (bitname == "cdcklm_3") {bit = cdcklm_3;}
919 else if (bitname == "d3") {bit = cluster_b2b_1to3 > 0;}
920 else if (bitname == "d5") {bit = cluster_b2b_1to5 > 0;}
921 else if (bitname == "d7") {bit = cluster_b2b_1to7 > 0;}
922 else if (bitname == "d9") {bit = cluster_b2b_1to9 > 0;}
923 else if (bitname == "p3") {bit = Trkcluster_b2b_1to3 > 0;}
924 else if (bitname == "p5") {bit = Trkcluster_b2b_1to5 > 0;}
925 else if (bitname == "p7") {bit = Trkcluster_b2b_1to7 > 0;}
926 else if (bitname == "p9") {bit = Trkcluster_b2b_1to9 > 0;}
927 else if (bitname == "trkfit") {bit = false;}
928 else if (bitname == "injv") {bit = false;}
929 else if (bitname == "nimin0") {bit = false;}
930 else if (bitname == "nimin1") {bit = false;}
931 else if (bitname == "track") {bit = nTrk2D > 0;}
932 else if (bitname == "bha_intrk") {bit = bha_intrk;}
933 else if (bitname == "bha_theta_0") {bit = bha_theta_0;}
934 else if (bitname == "bha_theta_1") {bit = bha_theta_1;}
935 else if (bitname == "ecl_bhapur") {bit = ecl_bhapur;}
936
937
938 else if (bitname == "trkbha1") {bit = trkbha1;}
939 else if (bitname == "trkbha2") {bit = trkbha2;}
940
941
942 else if (bitname == "ta_0") {bit = false;}
943 else if (bitname == "ta_1") {bit = false;}
944 else if (bitname == "ta_2") {bit = false;}
945 else if (bitname == "ta_3") {bit = false;}
946 else if (bitname == "trkflt") {bit = false;}
947 else if (bitname == "tsf0b2b") {bit = false;}
948 else if (bitname == "tsf1b2b") {bit = false;}
949 else if (bitname == "tsf2b2b") {bit = false;}
950 else if (bitname == "grlgg1") {bit = false;}
951 else if (bitname == "grlgg2") {bit = false;}
952
953
954 else if (bitname == "ecl_bhauni") {bit = false;}
955 else if (bitname == "cdctop_0") {bit = false;}
956 else if (bitname == "cdctop_1") {bit = false;}
957 else if (bitname == "cdctop_2") {bit = false;}
958 else if (bitname == "cdctop_3") {bit = false;}
959 else if (bitname == "top_0") {bit = false;}
960 else if (bitname == "top_1") {bit = false;}
961 else if (bitname == "top_2") {bit = false;}
962 else if (bitname == "top_bb") {bit = false;}
963 else if (bitname == "top_active") {bit = false;}
964
965
966 else if (bitname == "itsfb2b") {bit = false;}
967 else if (bitname == "inp156") {bit = false;}
968 else if (bitname == "inp157") {bit = false;}
969 else if (bitname == "inp158") {bit = false;}
970 else if (bitname == "inp159") {bit = false;}
971
972
973 else if (bitname == "ecl_taunn") {bit = ecltaunn;}
974
975
976
977
978 else {
979 bit = false;
982 }
983
984 trgInfo->setInputBits(i, bit);
985 }
986
987}
int getEntries() const
Get the number of objects in the array.
DBObjPtr< TRGGDLDBInputBits > m_InputBitsDB
Data base of GDL input bits.
double atan(double a)
atan for double
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.