11 #include <trg/grl/modules/trggrl/TRGGRLProjectsModule.h>
12 #include <trg/ecl/dataobjects/TRGECLCluster.h>
13 #include <trg/ecl/dataobjects/TRGECLTrg.h>
14 #include <trg/cdc/dataobjects/CDCTriggerTrack.h>
15 #include <trg/grl/dataobjects/TRGGRLMATCH.h>
16 #include <trg/grl/dataobjects/TRGGRLMATCHKLM.h>
17 #include <trg/grl/dataobjects/TRGGRLPHOTON.h>
18 #include <trg/klm/dataobjects/KLMTriggerTrack.h>
19 #include <framework/dataobjects/BinnedEventT0.h>
20 #include <trg/ecl/TrgEclMapping.h>
21 #include <framework/datastore/StoreArray.h>
22 #include <ecl/geometry/ECLGeometryPar.h>
23 #include <analysis/utility/PCmsLabTransform.h>
24 #include <framework/logging/Logger.h>
25 #include <framework/database/DBObjPtr.h>
26 #include <mdst/dbobjects/TRGGDLDBInputBits.h>
28 #include <TLorentzVector.h>
41 std::vector<int> TCThetaID;
42 std::vector<float> TCPhiLab;
43 std::vector<float> TCcotThetaLab;
44 std::vector<float> TCPhiCOM;
45 std::vector<float> TCThetaCOM;
46 std::vector<float> TC1GeV;
81 setDescription(
"TRGGRLProjectsModule");
82 setPropertyFlags(c_ParallelProcessingCertified);
84 addParam(
"DebugLevel", _debugLevel,
"TRGGRL debug level", _debugLevel);
85 addParam(
"ConfigFile",
87 "The filename of CDC trigger config file",
89 addParam(
"SimulationMode",
91 "TRGGRL simulation switch",
93 addParam(
"FastSimulationMode",
95 "TRGGRL fast simulation mode",
96 m_fastSimulationMode);
97 addParam(
"FirmwareSimulationMode",
98 m_firmwareSimulationMode,
99 "TRGGRL firmware simulation mode",
100 m_firmwareSimulationMode);
101 addParam(
"2DfinderCollection", m_2DfinderCollectionName,
102 "Name of the StoreArray holding the tracks made by the 2D finder to be used as input.",
103 string(
"TRGCDC2DFinderTracks"));
104 addParam(
"2DfitterCollection", m_2DfitterCollectionName,
105 "Name of the StoreArray holding the tracks made by the 2D fitter to be used as input.",
106 string(
"TRGCDC2DFitterTracks"));
107 addParam(
"3DfitterCollection", m_3DfitterCollectionName,
108 "Name of the StoreArray holding the tracks made by the 3D fitter to be used as input.",
109 string(
"TRGCDC3DFitterTracks"));
110 addParam(
"NNCollection", m_NNCollectionName,
111 "Name of the StoreArray holding the tracks made by the neural network (NN).",
112 string(
"TRGCDCNeuroTracks"));
113 addParam(
"2DmatchCollection", m_2DmatchCollectionName,
114 "Name of the StoreArray holding the macthed tracks and clusters made by the 2D fitter.",
115 string(
"TRG2DMatchTracks"));
116 addParam(
"PhimatchCollection", m_phimatch_tracklist,
"the 2d tracklist with associated cluster", std::string(
"TRGPhiMatchTracks"));
117 addParam(
"3DmatchCollection", m_3DmatchCollectionName,
118 "Name of the StoreArray holding the matched 3D NN tracks and clusters made",
119 string(
"TRG3DMatchTracks"));
120 addParam(
"KLMmatchCollection", m_klmmatch_tracklist,
"the 2d tracklist with associated KLM track",
121 std::string(
"TRGKLMMatchTracks"));
122 addParam(
"TrgGrlInformation", m_TrgGrlInformationName,
123 "Name of the StoreArray holding the information of tracks and clusters from cdc ecl klm.",
124 string(
"TRGGRLObjects"));
125 addParam(
"TRGECLClusters", m_TrgECLClusterName,
126 "Name of the StoreArray holding the information of trigger ecl clusters ",
127 string(
"TRGECLClusters"));
128 addParam(
"TRGECLTrgs", m_TrgECLTrgsName,
129 "Name of the StoreArray holding the information of ecl trigger",
130 string(
"TRGECLTrgs"));
131 addParam(
"TrgKLMTracks", m_KLMTrackName,
132 "Name of the StoreArray holding the information of klm track ",
133 string(
"TRGKLMTracks"));
134 addParam(
"TrgKLMHits", m_KLMHitName,
135 "Name of the StoreArray holding the information of klm hit",
136 string(
"TRGKLMHits"));
137 addParam(
"ECLClusterTimeWindow", m_eclClusterTimeWindow,
138 "The time window of the signal eclclusters",
140 addParam(
"ClusEngThreshold", m_energythreshold,
"The energy threshold of clusters", {0.1, 0.3, 1.0, 2.0});
145 void TRGGRLProjectsModule::initialize()
147 radtodeg = 180. / TMath::Pi();
150 for (
int tc = 1; tc <= 576; tc++) {
157 for (
int tc = 1; tc <= 576; tc++) {
161 TLorentzVector CellLab(1., 1., 1., 1.);
162 CellLab.SetTheta(CellPosition.Theta());
163 CellLab.SetPhi(CellPosition.Phi());
168 TCPhiLab.push_back(CellPosition.Phi()*radtodeg);
169 double tantheta = tan(CellPosition.Theta());
170 TCcotThetaLab.push_back(1. / tantheta);
174 TCThetaCOM.push_back(CellCOM.Theta()*radtodeg);
175 TCPhiCOM.push_back(CellCOM.Phi()*radtodeg);
178 TC1GeV.push_back(1. / CellCOM.E());
186 TRGGRLProjectsModule::beginRun()
188 B2DEBUG(20,
"TRGGDLModule ... beginRun called ");
193 void TRGGRLProjectsModule::event()
215 double EventTiming = -9999.;
216 if (ntrgArray > 0) {EventTiming = trgArray[0]->getEventTiming();}
217 std::vector<int> selTC;
218 std::vector<int> selTheta;
219 std::vector<float> selE;
220 for (
int ic = 0; ic < eclTrgClusterArray.
getEntries(); ic++) {
221 double tcT = abs(eclTrgClusterArray[ic]->getTimeAve() - EventTiming);
223 int TC = eclTrgClusterArray[ic]->getMaxTCId();
225 selTheta.push_back(TCThetaID[TC - 1]);
226 selE.push_back(eclTrgClusterArray[ic]->getEnergyDep());
238 for (
int itrk = 0; itrk < nTrk3D; itrk++) {
239 double z0 = cdc3DTrkArray[itrk]->getZ0();
240 if (abs(z0) < 10.) {nTrkZ10++;}
241 if (abs(z0) < 25.) {nTrkZ25++;}
242 if (abs(z0) < 40.) {nTrkZ40++;}
245 trgInfo->setN3Dfittertrk(nTrk3D);
246 trgInfo->setN3DfittertrkZ10(nTrkZ10);
247 trgInfo->setN3DfittertrkZ25(nTrkZ25);
252 int nClust = selTC.size();
261 for (
int ic = 0; ic < nClust; ic++) {
262 if (selE[ic] > 0.3) {n300MeV++;}
263 float thresh = TC1GeV[selTC[ic] - 1];
264 if (selE[ic] > (thresh + thresh)) {
266 if (selTheta[ic] >= 4 && selTheta[ic] <= 14) {n2GeV414++;}
267 if (selTheta[ic] == 2 || selTheta[ic] == 3 || selTheta[ic] == 15 || selTheta[ic] == 16) {n2GeV231516++;}
268 if (selTheta[ic] == 1 || selTheta[ic] == 17) {n2GeV117++;}
270 if (selE[ic] > thresh) {
271 if (selTheta[ic] >= 4 && selTheta[ic] <= 15) {n1GeV415++;}
272 if (selTheta[ic] == 2 || selTheta[ic] == 3 || selTheta[ic] == 16) {n1GeV2316++;}
273 if (selTheta[ic] == 1 || selTheta[ic] == 17) {n1GeV117++;}
276 trgInfo->setNcluster(nClust);
277 trgInfo->setNhigh300cluster(n300MeV);
278 trgInfo->setNhigh1GeVcluster415(n1GeV415);
279 trgInfo->setNhigh1GeVcluster2316(n1GeV2316);
280 trgInfo->setNhigh1GeVcluster117(n1GeV117);
281 trgInfo->setNhigh2GeVcluster(n2GeV);
282 trgInfo->setNhigh2GeVcluster414(n2GeV414);
283 trgInfo->setNhigh2GeVcluster231516(n2GeV231516);
284 trgInfo->setNhigh2GeVcluster117(n2GeV117);
289 int nPhiPairHigh = 0;
294 for (
int i0 = 0; i0 < nClust - 1; i0++) {
295 for (
int i1 = i0 + 1; i1 < nClust; i1++) {
298 float dphi = abs(TCPhiCOM[selTC[i1] - 1] - TCPhiCOM[selTC[i0] - 1]);
299 if (dphi > 180.) {dphi = 360 - dphi;}
300 if (dphi > 170. && selE[i0] > 0.25 && selE[i1] > 0.25) {nPhiPairHigh++;}
301 if (dphi > 170. && (selE[i0] < 0.25 || selE[i1] < 0.25)) {nPhiPairLow++;}
304 float thetaSum = TCThetaCOM[selTC[i0] - 1] + TCThetaCOM[selTC[i1] - 1];
305 if (dphi > 160. && thetaSum > 160. && thetaSum < 200.) {n3DPair++;}
308 if (dphi > 160. && thetaSum > 165. && thetaSum < 190. && selE[i0] > 3.*TC1GeV[selTC[i0] - 1] && selE[i1] > 3.*TC1GeV[selTC[i1] - 1]
309 && (selE[i0] > 4.5 * TC1GeV[selTC[i0] - 1] || selE[i1] > 4.5 * TC1GeV[selTC[i1] - 1])) {
313 bool c0matched =
false;
314 bool c1matched =
false;
315 for (
int itrk = 0; itrk < nTrk3D; itrk++) {
316 double phiTrk = cdc3DTrkArray[itrk]->getPhi0() * radtodeg;
317 double ptTrk = cdc3DTrkArray[itrk]->getTransverseMomentum(1.5);
318 float dphi0 = abs(phiTrk - TCPhiLab[selTC[i0] - 1]);
319 if (dphi0 > 180.) {dphi0 = 360. - dphi0;}
320 float dphi1 = abs(phiTrk - TCPhiLab[selTC[i1] - 1]);
321 if (dphi1 > 180.) {dphi1 = 360. - dphi1;}
322 if (ptTrk > 1. && dphi0 < 15.) {c0matched =
true;}
323 if (ptTrk > 1. && dphi1 < 15.) {c1matched =
true;}
325 if (c0matched && c1matched) {nTrkBhabha++;}
330 trgInfo->setBhabhaVeto(nTrkBhabha);
331 trgInfo->seteclBhabhaVeto(nECLBhabha);
332 trgInfo->setPairHigh(nPhiPairHigh);
333 trgInfo->setPairLow(nPhiPairLow);
334 trgInfo->set3DPair(n3DPair);
340 int nSameHem1Trk = 0;
343 double phiTrk = cdc3DTrkArray[0]->getPhi0() * radtodeg;
344 double cotTrk = cdc3DTrkArray[0]->getCotTheta();
345 for (
int i0 = 0; i0 < nClust; i0++) {
346 float dphi = abs(phiTrk - TCPhiLab[selTC[i0] - 1]);
347 if (dphi > 180.) {dphi = 360. - dphi;}
348 float dCot = cotTrk - TCcotThetaLab[selTC[i0] - 1];
349 if (dphi > 80.) {nOppHem1Trk++;}
350 if (dphi < 80. && (dCot < -0.8 || dCot > 0.6)) {nSameHem1Trk++;}
354 trgInfo->setNSameHem1Trk(nSameHem1Trk);
355 trgInfo->setNOppHem1Trk(nOppHem1Trk);
359 int Trk_b2b_1to3 = 0;
360 int Trk_b2b_1to5 = 0;
361 int Trk_b2b_1to7 = 0;
362 int Trk_b2b_1to9 = 0;
364 for (
int itrk = 0; itrk < cdc2DTrkArray.
getEntries(); itrk++) {
366 int phi_i_itrk = (int)((cdc2DTrkArray[itrk]->getPhi0()) * (180 / M_PI) / 10);
368 for (
int jtrk = 0; jtrk < cdc2DTrkArray.
getEntries(); jtrk++) {
369 if (itrk <= jtrk)
continue;
371 int phi_i_jtrk = (int)((cdc2DTrkArray[jtrk]->getPhi0()) * (180 / M_PI) / 10);
372 if (abs(phi_i_itrk - phi_i_jtrk) >= 17 && abs(phi_i_itrk - phi_i_jtrk) <= 19) {Trk_b2b_1to3 = 1;}
373 if (abs(phi_i_itrk - phi_i_jtrk) >= 16 && abs(phi_i_itrk - phi_i_jtrk) <= 20) {Trk_b2b_1to5 = 1;}
374 if (abs(phi_i_itrk - phi_i_jtrk) >= 15 && abs(phi_i_itrk - phi_i_jtrk) <= 21) {Trk_b2b_1to7 = 1;}
375 if (abs(phi_i_itrk - phi_i_jtrk) >= 14 && abs(phi_i_itrk - phi_i_jtrk) <= 22) {Trk_b2b_1to9 = 1;}
376 if (abs(phi_i_itrk - phi_i_jtrk) >= 9 && abs(phi_i_itrk - phi_i_jtrk) <= 27) {Trk_open90 = 1;}
379 trgInfo->setTrk_b2b_1to3(Trk_b2b_1to3);
380 trgInfo->setTrk_b2b_1to5(Trk_b2b_1to5);
381 trgInfo->setTrk_b2b_1to7(Trk_b2b_1to7);
382 trgInfo->setTrk_b2b_1to9(Trk_b2b_1to9);
383 trgInfo->setTrk_open90(Trk_open90);
387 int cluster_b2b_1to3 = 0;
388 int cluster_b2b_1to5 = 0;
389 int cluster_b2b_1to7 = 0;
390 int cluster_b2b_1to9 = 0;
391 for (
int iclu = 0; iclu < eclTrgClusterArray.
getEntries(); iclu++) {
393 double x_iclu = eclTrgClusterArray[iclu]->getPositionX();
394 double y_iclu = eclTrgClusterArray[iclu]->getPositionY();
397 if (x_iclu >= 0 && y_iclu >= 0) {phi_iclu = (int)(atan(y_iclu / x_iclu) * (180.0 / M_PI) / 10);}
398 else if (x_iclu < 0 && y_iclu >= 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 180.0) / 10);}
399 else if (x_iclu < 0 && y_iclu < 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 180.0) / 10);}
400 else if (x_iclu >= 0 && y_iclu < 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 360.0) / 10);}
402 for (
int jclu = 0; jclu < eclTrgClusterArray.
getEntries(); jclu++) {
403 if (iclu <= jclu)
continue;
405 double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
406 double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
409 if (x_jclu >= 0 && y_jclu >= 0) {phi_jclu = (int)(atan(y_jclu / x_jclu) * (180.0 / M_PI) / 10);}
410 else if (x_jclu < 0 && y_jclu >= 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
411 else if (x_jclu < 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
412 else if (x_jclu >= 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 360.0) / 10);}
414 if (abs(phi_iclu - phi_jclu) >= 17 && abs(phi_iclu - phi_jclu) <= 19) {cluster_b2b_1to3 = 1;}
415 if (abs(phi_iclu - phi_jclu) >= 16 && abs(phi_iclu - phi_jclu) <= 20) {cluster_b2b_1to5 = 1;}
416 if (abs(phi_iclu - phi_jclu) >= 15 && abs(phi_iclu - phi_jclu) <= 21) {cluster_b2b_1to7 = 1;}
417 if (abs(phi_iclu - phi_jclu) >= 14 && abs(phi_iclu - phi_jclu) <= 22) {cluster_b2b_1to9 = 1;}
420 trgInfo->setcluster_b2b_1to3(cluster_b2b_1to3);
421 trgInfo->setcluster_b2b_1to5(cluster_b2b_1to5);
422 trgInfo->setcluster_b2b_1to7(cluster_b2b_1to7);
423 trgInfo->setcluster_b2b_1to9(cluster_b2b_1to9);
429 int eed = 0, fed = 0;
430 if (cdc2DTrkArray.
getEntries() == 2 && trackphimatch.
getEntries() == 2 && cluster_b2b_1to5 == 1) {eed = 1;}
431 if (cdc2DTrkArray.
getEntries() == 1 && trackphimatch.
getEntries() == 1 && cluster_b2b_1to5 == 1) {fed = 1;}
432 trgInfo->seteed(eed);
433 trgInfo->setfed(fed);
437 int Trkcluster_b2b_1to3 = 0;
438 int Trkcluster_b2b_1to5 = 0;
439 int Trkcluster_b2b_1to7 = 0;
440 int Trkcluster_b2b_1to9 = 0;
441 for (
int itrk = 0; itrk < cdc2DTrkArray.
getEntries(); itrk++) {
442 double _r = 1.0 / cdc2DTrkArray[itrk]->getOmega() ;
443 double _phi = cdc2DTrkArray[itrk]->getPhi0() ;
444 double phi_p = acos(126.0 / (2 * fabs(_r)));
446 if (_r > 0) {charge = 1;}
447 else if (_r < 0) {charge = -1;}
450 double phi_CDC = 0.0;
452 phi_CDC = _phi + phi_p - 0.5 * M_PI;
453 }
else if (charge == -1) {
454 phi_CDC = _phi - phi_p + 0.5 * M_PI;
459 if (phi_CDC > 2 * M_PI) {phi_CDC = phi_CDC - 2 * M_PI;}
460 else if (phi_CDC < 0) {phi_CDC = phi_CDC + 2 * M_PI;}
461 int phi_itrk = (int)(phi_CDC * (180.0 / M_PI) / 10);
463 for (
int jclu = 0; jclu < eclTrgClusterArray.
getEntries(); jclu++) {
465 double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
466 double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
469 if (x_jclu >= 0 && y_jclu >= 0) {phi_jclu = (int)(atan(y_jclu / x_jclu) * (180.0 / M_PI) / 10);}
470 else if (x_jclu < 0 && y_jclu >= 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
471 else if (x_jclu < 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
472 else if (x_jclu >= 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 360.0) / 10);}
474 if (abs(phi_itrk - phi_jclu) >= 17 && abs(phi_itrk - phi_jclu) <= 19) {Trkcluster_b2b_1to3 = 1;}
475 if (abs(phi_itrk - phi_jclu) >= 16 && abs(phi_itrk - phi_jclu) <= 20) {Trkcluster_b2b_1to5 = 1;}
476 if (abs(phi_itrk - phi_jclu) >= 15 && abs(phi_itrk - phi_jclu) <= 21) {Trkcluster_b2b_1to7 = 1;}
477 if (abs(phi_itrk - phi_jclu) >= 14 && abs(phi_itrk - phi_jclu) <= 22) {Trkcluster_b2b_1to9 = 1;}
481 trgInfo->setTrkcluster_b2b_1to3(Trkcluster_b2b_1to3);
482 trgInfo->setTrkcluster_b2b_1to5(Trkcluster_b2b_1to5);
483 trgInfo->setTrkcluster_b2b_1to7(Trkcluster_b2b_1to7);
484 trgInfo->setTrkcluster_b2b_1to9(Trkcluster_b2b_1to9);
490 if (cdc2DTrkArray.
getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fp = 1;}
494 if (trackphimatch.
getEntries() == 2 && Trk_b2b_1to5 == 1) {eeb = 1;}
495 trgInfo->seteeb(eeb);
498 if (cdc2DTrkArray.
getEntries() == 1 && trackphimatch.
getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fep = 1;}
499 trgInfo->setfep(fep);
506 int ECLtoGDL[4] = {0, 0, 0, 0};
508 ECLtoGDL[0] = trgArray[0]->getECLtoGDL(0);
509 ECLtoGDL[1] = trgArray[0]->getECLtoGDL(1);
510 ECLtoGDL[2] = trgArray[0]->getECLtoGDL(2);
511 ECLtoGDL[3] = trgArray[0]->getECLtoGDL(3);
515 bool elow = (ECLtoGDL[1] & (1 << (47 - 32 * 1))) != 0;
517 bool ehigh = (ECLtoGDL[1] & (1 << (48 - 32 * 1))) != 0;
519 bool elum = (ECLtoGDL[1] & (1 << (49 - 32 * 1))) != 0;
521 bool ecl_bha = (ECLtoGDL[0] & (1 << (19 - 32 * 0))) != 0;
523 bool bha_type0 = (ECLtoGDL[0] & (1 << (20 - 32 * 0))) != 0;
525 bool bha_type1 = (ECLtoGDL[0] & (1 << (21 - 32 * 0))) != 0;
527 bool bha_type2 = (ECLtoGDL[0] & (1 << (22 - 32 * 0))) != 0;
529 bool bha_type3 = (ECLtoGDL[0] & (1 << (23 - 32 * 0))) != 0;
531 bool bha_type4 = (ECLtoGDL[0] & (1 << (24 - 32 * 0))) != 0;
533 bool bha_type5 = (ECLtoGDL[0] & (1 << (25 - 32 * 0))) != 0;
535 bool bha_type6 = (ECLtoGDL[0] & (1 << (26 - 32 * 0))) != 0;
537 bool bha_type7 = (ECLtoGDL[0] & (1 << (27 - 32 * 0))) != 0;
539 bool bha_type8 = (ECLtoGDL[0] & (1 << (28 - 32 * 0))) != 0;
541 bool bha_type9 = (ECLtoGDL[0] & (1 << (29 - 32 * 0))) != 0;
543 bool bha_type10 = (ECLtoGDL[0] & (1 << (30 - 32 * 0))) != 0;
545 bool bha_type11 = (ECLtoGDL[0] & (1 << (31 - 32 * 0))) != 0;
547 bool bha_type12 = (ECLtoGDL[1] & (1 << (32 - 32 * 1))) != 0;
549 bool bha_type13 = (ECLtoGDL[1] & (1 << (33 - 32 * 1))) != 0;
551 bool nclst_0 = (eclTrgClusterArray.
getEntries() & (1 << 0)) != 0;
552 bool nclst_1 = (eclTrgClusterArray.
getEntries() & (1 << 1)) != 0;
553 bool nclst_2 = (eclTrgClusterArray.
getEntries() & (1 << 2)) != 0;
554 bool nclst_3 = (eclTrgClusterArray.
getEntries() & (1 << 3)) != 0;
557 bool ecl_bg_0 = (ECLtoGDL[1] & (1 << (57 - 32 * 1))) != 0;
559 bool ecl_bg_1 = (ECLtoGDL[1] & (1 << (58 - 32 * 1))) != 0;
561 bool ecl_bg_2 = (ECLtoGDL[1] & (1 << (59 - 32 * 1))) != 0;
563 bool ecl_active = ntrgArray > 0;
566 bool ecl_timing_fwd = (ECLtoGDL[0] & (1 << (15 - 32 * 0))) != 0;
568 bool ecl_timing_brl = (ECLtoGDL[0] & (1 << (16 - 32 * 0))) != 0;
570 bool ecl_timing_bwd = (ECLtoGDL[0] & (1 << (17 - 32 * 0))) != 0;
572 bool ecl_phys = (ECLtoGDL[0] & (1 << (18 - 32 * 0))) != 0;
574 bool ecl_oflo = (ECLtoGDL[1] & (1 << (60 - 32 * 1))) != 0;
576 bool ecl_3dbha = (ECLtoGDL[1] & (1 << (61 - 32 * 1))) != 0;
578 bool ecl_lml_0 = (ECLtoGDL[1] & (1 << (62 - 32 * 1))) != 0;
580 bool ecl_lml_1 = (ECLtoGDL[1] & (1 << (63 - 32 * 1))) != 0;
582 bool ecl_lml_2 = (ECLtoGDL[2] & (1 << (64 - 32 * 2))) != 0;
584 bool ecl_lml_3 = (ECLtoGDL[2] & (1 << (65 - 32 * 2))) != 0;
586 bool ecl_lml_4 = (ECLtoGDL[2] & (1 << (66 - 32 * 2))) != 0;
588 bool ecl_lml_5 = (ECLtoGDL[2] & (1 << (67 - 32 * 2))) != 0;
590 bool ecl_lml_6 = (ECLtoGDL[2] & (1 << (68 - 32 * 2))) != 0;
592 bool ecl_lml_7 = (ECLtoGDL[2] & (1 << (69 - 32 * 2))) != 0;
594 bool ecl_lml_8 = (ECLtoGDL[2] & (1 << (70 - 32 * 2))) != 0;
596 bool ecl_lml_9 = (ECLtoGDL[2] & (1 << (71 - 32 * 2))) != 0;
598 bool ecl_lml_10 = (ECLtoGDL[2] & (1 << (72 - 32 * 2))) != 0;
600 bool ecl_lml_11 = (ECLtoGDL[2] & (1 << (73 - 32 * 2))) != 0;
602 bool ecl_lml_12 = (ECLtoGDL[2] & (1 << (78 - 32 * 2))) != 0;
604 bool ecl_lml_13 = (ECLtoGDL[2] & (1 << (79 - 32 * 2))) != 0;
606 bool ecl_mumu = (ECLtoGDL[2] & (1 << (75 - 32 * 2))) != 0;
608 bool ecl_bst = (ECLtoGDL[2] & (1 << (77 - 32 * 2))) != 0;
613 bool cdc_active =
false;
614 if (m_eventTime->hasBinnedEventT0(Const::CDC)) {
615 if (m_eventTime->getBinnedEventT0(Const::CDC) != 0) { cdc_active =
true; }
619 bool klm_0 = (klmtracklist.
getEntries() & (1 << 0)) != 0;
620 bool klm_1 = (klmtracklist.
getEntries() & (1 << 1)) != 0;
621 bool klm_2 = (klmtracklist.
getEntries() & (1 << 2)) != 0;
623 bool cdcklm_0 = (trackKLMmatch.
getEntries() == 1);
624 bool cdcklm_1 = (trackKLMmatch.
getEntries() == 2);
625 bool cdcklm_2 = (trackKLMmatch.
getEntries() == 3);
626 bool cdcklm_3 = (trackKLMmatch.
getEntries() > 3);
628 bool cdcecl_0 = (trackphimatch.
getEntries() == 1);
629 bool cdcecl_1 = (trackphimatch.
getEntries() == 2);
630 bool cdcecl_2 = (trackphimatch.
getEntries() == 3);
631 bool cdcecl_3 = (trackphimatch.
getEntries() > 3);
634 for (
int i = 0; i < trackphimatch.
getEntries(); i++) {
635 if (trackphimatch[i]->get_e() >= 2.0) {n_c2gev++;}
638 bool c2gev_0 = (n_c2gev == 1);
639 bool c2gev_1 = (n_c2gev == 2);
640 bool c2gev_2 = (n_c2gev == 3);
641 bool c2gev_3 = (n_c2gev > 3);
644 for (
int i = 0; i < klmtracklist.
getEntries(); i++) {
645 for (
int j = 0; j < klmtracklist.
getEntries(); j++) {
646 if (i <= j)
continue;
647 int sector_i = klmtracklist[i]->getSector();
648 int sector_j = klmtracklist[j]->getSector();
649 if (abs(sector_i - sector_j) == 4) { N_KLMb2b++; }
653 bool klmb2b_0 = (N_KLMb2b == 1);
654 bool klmb2b_1 = (N_KLMb2b == 2);
655 bool klmb2b_2 = (N_KLMb2b > 2);
657 int N_clst1 = 0, N_clst2 = 0;
658 for (
int i = 0 ; i < grlphoton.
getEntries() ; i++) {
659 if (grlphoton[i]->get_e() > 1.0) { N_clst1++; }
660 if (grlphoton[i]->get_e() > 2.0) { N_clst2++; }
663 bool nclst1_0 = (N_clst1 == 1);
664 bool nclst1_1 = (N_clst1 == 2);
665 bool nclst1_2 = (N_clst1 == 3);
666 bool nclst1_3 = (N_clst1 > 3);
668 bool nclst2_0 = (N_clst2 == 1);
669 bool nclst2_1 = (N_clst2 == 2);
670 bool nclst2_2 = (N_clst2 == 3);
671 bool nclst2_3 = (N_clst2 > 3);
673 int N_ST = trgInfo->getNshorttrk();
674 int s2s3 = trgInfo->gets2s3();
675 int s2s5 = trgInfo->gets2s5();
676 int s2so = trgInfo->gets2so();
677 int s2f3 = trgInfo->gets2f3();
678 int s2f5 = trgInfo->gets2f5();
679 int s2fo = trgInfo->gets2fo();
680 int bwdsb = trgInfo->getbwdsb();
681 int bwdnb = trgInfo->getbwdnb();
682 int fwdsb = trgInfo->getfwdsb();
683 int fwdnb = trgInfo->getfwdnb();
684 int brlfb = trgInfo->getbrlfb();
685 int brlnb = trgInfo->getbrlnb();
692 if (!m_InputBitsDB)B2INFO(
"no database of gdl input bits");
694 int N_InputBits = m_InputBitsDB->getninbit();
696 for (
int i = 0; i < N_InputBits; i++) {
697 std::string bitname(m_InputBitsDB->getinbitname(i));
700 if (bitname ==
"t3_0") {bit = nTrkZ40 == 1;}
701 else if (bitname ==
"t3_1") {bit = nTrkZ40 == 2;}
702 else if (bitname ==
"t3_2") {bit = nTrkZ40 == 3;}
703 else if (bitname ==
"t3_3") {bit = nTrkZ40 > 3;}
704 else if (bitname ==
"t2_0") {bit = nTrk2D == 1;}
705 else if (bitname ==
"t2_1") {bit = nTrk2D == 2;}
706 else if (bitname ==
"t2_2") {bit = nTrk2D == 3;}
707 else if (bitname ==
"t2_3") {bit = nTrk2D > 3;}
708 else if (bitname ==
"ts_0") {bit = N_ST == 1;}
709 else if (bitname ==
"ts_1") {bit = N_ST == 2;}
710 else if (bitname ==
"ts_2") {bit = N_ST == 3;}
711 else if (bitname ==
"ts_3") {bit = N_ST > 3;}
712 else if (bitname ==
"cdc_open90") {bit = Trk_open90 == 1;}
713 else if (bitname ==
"cdc_active") {bit = cdc_active;}
714 else if (bitname ==
"cdc_b2b3") {bit = Trk_b2b_1to3;}
715 else if (bitname ==
"cdc_b2b5") {bit = Trk_b2b_1to5;}
716 else if (bitname ==
"cdc_b2b7") {bit = Trk_b2b_1to7;}
717 else if (bitname ==
"cdc_b2b9") {bit = Trk_b2b_1to9;}
718 else if (bitname ==
"s2s3") {bit = s2s3 > 0;}
719 else if (bitname ==
"s2s5") {bit = s2s5 > 0;}
720 else if (bitname ==
"s2so") {bit = s2so > 0;}
721 else if (bitname ==
"s2f3") {bit = s2f3 > 0;}
722 else if (bitname ==
"s2f5") {bit = s2f5 > 0;}
723 else if (bitname ==
"s2fo") {bit = s2fo > 0;}
724 else if (bitname ==
"bwdsb") {bit = bwdsb > 0;}
725 else if (bitname ==
"bwdnb") {bit = bwdnb > 0;}
726 else if (bitname ==
"fwdsb") {bit = fwdsb > 0;}
727 else if (bitname ==
"fwdnb") {bit = fwdnb > 0;}
728 else if (bitname ==
"brlfb1") {bit = brlfb == 1;}
729 else if (bitname ==
"brlfb2") {bit = brlfb == 2;}
730 else if (bitname ==
"brlnb1") {bit = brlnb == 1;}
731 else if (bitname ==
"brlnb2") {bit = brlnb == 2;}
732 else if (bitname ==
"ehigh") {bit = ehigh;}
733 else if (bitname ==
"elow") {bit = elow;}
734 else if (bitname ==
"elum") {bit = elum;}
735 else if (bitname ==
"ecl_bha") {bit = ecl_bha;}
736 else if (bitname ==
"bha_type_0") {bit = bha_type0;}
737 else if (bitname ==
"bha_type_1") {bit = bha_type1;}
738 else if (bitname ==
"bha_type_2") {bit = bha_type2;}
739 else if (bitname ==
"bha_type_3") {bit = bha_type3;}
740 else if (bitname ==
"bha_type_4") {bit = bha_type4;}
741 else if (bitname ==
"bha_type_5") {bit = bha_type5;}
742 else if (bitname ==
"bha_type_6") {bit = bha_type6;}
743 else if (bitname ==
"bha_type_7") {bit = bha_type7;}
744 else if (bitname ==
"bha_type_8") {bit = bha_type8;}
745 else if (bitname ==
"bha_type_9") {bit = bha_type9;}
746 else if (bitname ==
"bha_type_10") {bit = bha_type10;}
747 else if (bitname ==
"bha_type_11") {bit = bha_type11;}
748 else if (bitname ==
"bha_type_12") {bit = bha_type12;}
749 else if (bitname ==
"bha_type_13") {bit = bha_type13;}
750 else if (bitname ==
"clst_0") {bit = nclst_0;}
751 else if (bitname ==
"clst_1") {bit = nclst_1;}
752 else if (bitname ==
"clst_2") {bit = nclst_2;}
753 else if (bitname ==
"clst_3") {bit = nclst_3;}
754 else if (bitname ==
"ecl_bg_0") {bit = ecl_bg_0;}
755 else if (bitname ==
"ecl_bg_1") {bit = ecl_bg_1;}
756 else if (bitname ==
"ecl_bg_2") {bit = ecl_bg_2;}
757 else if (bitname ==
"ecl_active") {bit = ecl_active;}
758 else if (bitname ==
"ecl_timing_fwd") {bit = ecl_timing_fwd;}
759 else if (bitname ==
"ecl_timing_brl") {bit = ecl_timing_brl;}
760 else if (bitname ==
"ecl_timing_bwd") {bit = ecl_timing_bwd;}
761 else if (bitname ==
"ecl_phys") {bit = ecl_phys;}
762 else if (bitname ==
"ecl_oflo") {bit = ecl_oflo;}
763 else if (bitname ==
"ecl_3dbha") {bit = ecl_3dbha;}
764 else if (bitname ==
"bha_veto") {bit = ecl_3dbha;}
765 else if (bitname ==
"ecl_lml_0") {bit = ecl_lml_0;}
766 else if (bitname ==
"ecl_lml_1") {bit = ecl_lml_1;}
767 else if (bitname ==
"ecl_lml_2") {bit = ecl_lml_2;}
768 else if (bitname ==
"ecl_lml_3") {bit = ecl_lml_3;}
769 else if (bitname ==
"ecl_lml_4") {bit = ecl_lml_4;}
770 else if (bitname ==
"ecl_lml_5") {bit = ecl_lml_5;}
771 else if (bitname ==
"ecl_lml_6") {bit = ecl_lml_6;}
772 else if (bitname ==
"ecl_lml_7") {bit = ecl_lml_7;}
773 else if (bitname ==
"ecl_lml_8") {bit = ecl_lml_8;}
774 else if (bitname ==
"ecl_lml_9") {bit = ecl_lml_9;}
775 else if (bitname ==
"ecl_lml_10") {bit = ecl_lml_10;}
776 else if (bitname ==
"ecl_lml_11") {bit = ecl_lml_11;}
777 else if (bitname ==
"ecl_lml_12") {bit = ecl_lml_12;}
778 else if (bitname ==
"ecl_lml_13") {bit = ecl_lml_13;}
779 else if (bitname ==
"ecl_mumu") {bit = ecl_mumu;}
780 else if (bitname ==
"ecl_bst") {bit = ecl_bst;}
781 else if (bitname ==
"top_0") {bit =
false;}
782 else if (bitname ==
"top_1") {bit =
false;}
783 else if (bitname ==
"top_2") {bit =
false;}
784 else if (bitname ==
"top_bb") {bit =
false;}
785 else if (bitname ==
"top_active") {bit =
false;}
786 else if (bitname ==
"klm_hit") {bit = klm_hit;}
787 else if (bitname ==
"klm_0") {bit = klm_0;}
788 else if (bitname ==
"klm_1") {bit = klm_1;}
789 else if (bitname ==
"klm_2") {bit = klm_2;}
790 else if (bitname ==
"klmb2b_0") {bit = klmb2b_0;}
791 else if (bitname ==
"klmb2b_1") {bit = klmb2b_1;}
792 else if (bitname ==
"klmb2b_2") {bit = klmb2b_2;}
793 else if (bitname ==
"revo") {bit =
false;}
794 else if (bitname ==
"her_kick") {bit =
false;}
795 else if (bitname ==
"ler_kick") {bit =
false;}
796 else if (bitname ==
"bha_delay") {bit =
false;}
797 else if (bitname ==
"pseud_rand") {bit =
false;}
798 else if (bitname ==
"plsin") {bit =
false;}
799 else if (bitname ==
"poissonin") {bit =
false;}
800 else if (bitname ==
"periodin") {bit =
false;}
801 else if (bitname ==
"veto") {bit =
false;}
802 else if (bitname ==
"samhem") {bit = nSameHem1Trk > 0;}
803 else if (bitname ==
"opohem") {bit = nOppHem1Trk > 0;}
804 else if (bitname ==
"n1gev_0") {bit = nclst1_0;}
805 else if (bitname ==
"n1gev_1") {bit = nclst1_1;}
806 else if (bitname ==
"n1gev_2") {bit = nclst1_2;}
807 else if (bitname ==
"n1gev_3") {bit = nclst1_3;}
808 else if (bitname ==
"n2gev_0") {bit = nclst2_0;}
809 else if (bitname ==
"n2gev_1") {bit = nclst2_1;}
810 else if (bitname ==
"n2gev_2") {bit = nclst2_2;}
811 else if (bitname ==
"n2gev_3") {bit = nclst2_3;}
812 else if (bitname ==
"cdcecl_0") {bit = cdcecl_0;}
813 else if (bitname ==
"cdcecl_1") {bit = cdcecl_1;}
814 else if (bitname ==
"cdcecl_2") {bit = cdcecl_2;}
815 else if (bitname ==
"cdcecl_3") {bit = cdcecl_3;}
816 else if (bitname ==
"c2gev_0") {bit = c2gev_0;}
817 else if (bitname ==
"c2gev_1") {bit = c2gev_1;}
818 else if (bitname ==
"c2gev_2") {bit = c2gev_2;}
819 else if (bitname ==
"c2gev_3") {bit = c2gev_3;}
820 else if (bitname ==
"cdcklm_0") {bit = cdcklm_0;}
821 else if (bitname ==
"cdcklm_1") {bit = cdcklm_1;}
822 else if (bitname ==
"cdcklm_2") {bit = cdcklm_2;}
823 else if (bitname ==
"cdcklm_3") {bit = cdcklm_3;}
824 else if (bitname ==
"d3") {bit = cluster_b2b_1to3 > 0;}
825 else if (bitname ==
"d5") {bit = cluster_b2b_1to5 > 0;}
826 else if (bitname ==
"d7") {bit = cluster_b2b_1to7 > 0;}
827 else if (bitname ==
"d9") {bit = cluster_b2b_1to9 > 0;}
828 else if (bitname ==
"p3") {bit = Trkcluster_b2b_1to3 > 0;}
829 else if (bitname ==
"p5") {bit = Trkcluster_b2b_1to5 > 0;}
830 else if (bitname ==
"p7") {bit = Trkcluster_b2b_1to7 > 0;}
831 else if (bitname ==
"p9") {bit = Trkcluster_b2b_1to9 > 0;}
832 else if (bitname ==
"track") {bit =
false;}
833 else if (bitname ==
"trkfit") {bit =
false;}
836 else if (bitname ==
"ty_0") {bit =
false;}
837 else if (bitname ==
"ty_1") {bit =
false;}
838 else if (bitname ==
"ty_2") {bit =
false;}
839 else if (bitname ==
"ty_3") {bit =
false;}
842 else if (bitname ==
"ta_0") {bit =
false;}
843 else if (bitname ==
"ta_1") {bit =
false;}
844 else if (bitname ==
"ta_2") {bit =
false;}
845 else if (bitname ==
"ta_3") {bit =
false;}
846 else if (bitname ==
"trkflt") {bit =
false;}
847 else if (bitname ==
"tsf0b2b") {bit =
false;}
848 else if (bitname ==
"tsf1b2b") {bit =
false;}
849 else if (bitname ==
"tsf2b2b") {bit =
false;}
850 else if (bitname ==
"trkbha1") {bit =
false;}
851 else if (bitname ==
"trkbha2") {bit =
false;}
852 else if (bitname ==
"grlgg1") {bit =
false;}
853 else if (bitname ==
"grlgg2") {bit =
false;}
856 else if (bitname ==
"ecl_bhauni") {bit =
false;}
857 else if (bitname ==
"ecl_bhapur") {bit =
false;}
858 else if (bitname ==
"klmb2b") {bit =
false;}
859 else if (bitname ==
"eklm_hit") {bit =
false;}
860 else if (bitname ==
"eklm_0") {bit =
false;}
861 else if (bitname ==
"eklm_1") {bit =
false;}
862 else if (bitname ==
"eklm_2") {bit =
false;}
863 else if (bitname ==
"eklmb2b") {bit =
false;}
864 else if (bitname ==
"cdctop_0") {bit =
false;}
865 else if (bitname ==
"cdctop_1") {bit =
false;}
866 else if (bitname ==
"cdctop_2") {bit =
false;}
867 else if (bitname ==
"cdctop_3") {bit =
false;}
870 else if (bitname ==
"injv") {bit =
false;}
871 else if (bitname ==
"nimin0") {bit =
false;}
872 else if (bitname ==
"nimin1") {bit =
false;}
873 else if (bitname ==
"inp159") {bit =
false;}
876 else if (bitname ==
"itsfb2b") {bit =
false;}
877 else if (bitname ==
"f2f30") {bit =
false;}
878 else if (bitname ==
"s2f30") {bit =
false;}
879 else if (bitname ==
"s2s30") {bit =
false;}
883 else B2WARNING(
"Unknown bitname" <<
LogVar(
"bitname", bitname));
885 trgInfo->setInputBits(i, bit);
891 TRGGRLProjectsModule::endRun()
893 B2DEBUG(20,
"TRGGRLProjectsModule ... endRun called ");
898 void TRGGRLProjectsModule::terminate()