Belle II Software  release-06-00-14
TRGGRLProjectsModule.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <trg/grl/modules/trggrl/TRGGRLProjectsModule.h>
10 #include <trg/ecl/dataobjects/TRGECLCluster.h>
11 #include <trg/ecl/dataobjects/TRGECLTrg.h>
12 #include <trg/cdc/dataobjects/CDCTriggerTrack.h>
13 #include <trg/grl/dataobjects/TRGGRLMATCH.h>
14 #include <trg/grl/dataobjects/TRGGRLMATCHKLM.h>
15 #include <trg/klm/dataobjects/KLMTrgSummary.h>
16 #include <trg/grl/dataobjects/TRGGRLPHOTON.h>
17 #include <framework/dataobjects/BinnedEventT0.h>
18 #include <trg/ecl/TrgEclMapping.h>
19 #include <framework/datastore/StoreArray.h>
20 #include <ecl/geometry/ECLGeometryPar.h>
21 #include <analysis/utility/PCmsLabTransform.h>
22 #include <framework/logging/Logger.h>
23 #include <framework/database/DBObjPtr.h>
24 #include <mdst/dbobjects/TRGGDLDBInputBits.h>
25 
26 #include <TLorentzVector.h>
27 #include <TMath.h>
28 
29 #include <iostream>
30 #include <fstream>
31 
32 
33 using namespace std;
34 using namespace Belle2;
35 using namespace ECL;
36 
37 
38 //..ECL look up tables
39 std::vector<int> TCThetaID;
40 std::vector<float> TCPhiLab;
41 std::vector<float> TCcotThetaLab;
42 std::vector<float> TCPhiCOM;
43 std::vector<float> TCThetaCOM;
44 std::vector<float> TC1GeV;
45 
46 
47 //..Other
48 double radtodeg;
49 //int iEvent(0);
50 //int nInAcc=0;
51 
52 //..Trigger counters
53 //const int ntrig = 18;
54 //int trigbit[ntrig];
55 //int prescale[ntrig];
56 //int RawCount[ntrig];
57 //bool passBeforePrescale[ntrig];
58 //int pass2[ntrig][ntrig]={};
59 //int pass2Acc[ntrig][ntrig]={};
60 //std::vector<string> trigName;
61 
62 //int nUseful;
63 //std::vector<int> itUseful;
64 
65 //-----------------------------------------------------------------
66 // Register the Module
67 //-----------------------------------------------------------------
68 REG_MODULE(TRGGRLProjects)
69 
70 //-----------------------------------------------------------------
71 // Implementation
72 //-----------------------------------------------------------------
73 
75 {
76  // Set module properties
77 
78  // string desc = "TRGGRLProjectsModule(" + version() + ")";
79  setDescription("TRGGRLProjectsModule");
80  setPropertyFlags(c_ParallelProcessingCertified);
81 
82  addParam("DebugLevel", _debugLevel, "TRGGRL debug level", _debugLevel);
83  addParam("ConfigFile",
84  m_configFilename,
85  "The filename of CDC trigger config file",
86  m_configFilename);
87  addParam("SimulationMode",
88  m_simulationMode,
89  "TRGGRL simulation switch",
90  1);
91  addParam("FastSimulationMode",
92  m_fastSimulationMode,
93  "TRGGRL fast simulation mode",
94  m_fastSimulationMode);
95  addParam("FirmwareSimulationMode",
96  m_firmwareSimulationMode,
97  "TRGGRL firmware simulation mode",
98  m_firmwareSimulationMode);
99  addParam("2DfinderCollection", m_2DfinderCollectionName,
100  "Name of the StoreArray holding the tracks made by the 2D finder to be used as input.",
101  string("TRGCDC2DFinderTracks"));
102  addParam("3DfitterCollection", m_3DfitterCollectionName,
103  "Name of the StoreArray holding the tracks made by the 3D fitter to be used as input.",
104  string("TRGCDC3DFitterTracks"));
105  addParam("NNCollection", m_NNCollectionName,
106  "Name of the StoreArray holding the tracks made by the neural network (NN).",
107  string("TRGCDCNeuroTracks"));
108  addParam("2DmatchCollection", m_2DmatchCollectionName,
109  "Name of the StoreArray holding the macthed tracks and clusters made by the 2D fitter.",
110  string("TRG2DMatchTracks"));
111  addParam("PhimatchCollection", m_phimatch_tracklist, "the 2d tracklist with associated cluster", std::string("TRGPhiMatchTracks"));
112  addParam("KLMmatchCollection", m_klmmatch_tracklist, "the 2d tracklist with KLM", std::string("TRGKLMMatchTracks"));
113  addParam("KLMTrgSummaryCollection", m_KLMTrgSummaryName, "Name of the StoreObjPtr holding the information of KLM trigger",
114  std::string("KLMTrgSummary"));
115  addParam("3DmatchCollection", m_3DmatchCollectionName,
116  "Name of the StoreArray holding the matched 3D NN tracks and clusters made",
117  string("TRG3DMatchTracks"));
118  addParam("TrgGrlInformation", m_TrgGrlInformationName,
119  "Name of the StoreArray holding the information of tracks and clusters from cdc ecl klm.",
120  string("TRGGRLObjects"));
121  addParam("TRGECLClusters", m_TrgECLClusterName,
122  "Name of the StoreArray holding the information of trigger ecl clusters ",
123  string("TRGECLClusters"));
124  addParam("TRGECLTrgs", m_TrgECLTrgsName,
125  "Name of the StoreArray holding the information of ecl trigger",
126  string("TRGECLTrgs"));
127  addParam("GRLphotonCollection", m_grlphotonlist, "the isolated cluster list", std::string("TRGGRLPhotons"));
128  addParam("ECLClusterTimeWindow", m_eclClusterTimeWindow,
129  "The time window of the signal eclclusters",
130  100.0);
131  addParam("ClusEngThreshold", m_energythreshold, "The energy threshold of clusters", {0.1, 0.3, 1.0, 2.0});
132 }
133 
134 //-----------------------------------------------------------------------------------------
135 //-----------------------------------------------------------------------------------------
136 void TRGGRLProjectsModule::initialize()
137 {
138  radtodeg = 180. / TMath::Pi();
139  //..Trigger ThetaID for each trigger cell. Could be replaced by getMaxThetaId() for newer MC
140  TrgEclMapping* trgecl_obj = new TrgEclMapping();
141  for (int tc = 1; tc <= 576; tc++) {
142  TCThetaID.push_back(trgecl_obj->getTCThetaIdFromTCId(tc));
143  }
144 
145  //-----------------------------------------------------------------------------------------
146  //..ECL look up tables
147  PCmsLabTransform boostrotate;
148  for (int tc = 1; tc <= 576; tc++) {
149 
150  //..Four vector of a 1 GeV lab photon at this TC
151  TVector3 CellPosition = trgecl_obj->getTCPosition(tc);
152  TLorentzVector CellLab(1., 1., 1., 1.);
153  CellLab.SetTheta(CellPosition.Theta());
154  CellLab.SetPhi(CellPosition.Phi());
155  CellLab.SetRho(1.);
156  CellLab.SetE(1.);
157 
158  //..cotan Theta and phi in lab
159  TCPhiLab.push_back(CellPosition.Phi()*radtodeg);
160  double tantheta = tan(CellPosition.Theta());
161  TCcotThetaLab.push_back(1. / tantheta);
162 
163  //..Corresponding 4 vector in the COM frame
164  TLorentzVector CellCOM = boostrotate.rotateLabToCms() * CellLab;
165  TCThetaCOM.push_back(CellCOM.Theta()*radtodeg);
166  TCPhiCOM.push_back(CellCOM.Phi()*radtodeg);
167 
168  //..Scale to give 1 GeV in the COM frame
169  TC1GeV.push_back(1. / CellCOM.E());
170  }
171 
172  //m_TRGGRLInfo.registerInDataStore(m_TrgGrlInformationName);
173 
174 }
175 
176 void
177 TRGGRLProjectsModule::beginRun()
178 {
179  B2DEBUG(20, "TRGGDLModule ... beginRun called ");
180  //...GDL config. name...
181 }
182 //-----------------------------------------------------------------------------------------
183 //-----------------------------------------------------------------------------------------
184 void TRGGRLProjectsModule::event()
185 {
186  //cout << "TRGGRLProjects event " << iEvent << endl;
187  //iEvent++;
188 
189  //---------------------------------------------------------------------
190  //..Read in the necessary arrays
191  StoreArray<TRGECLTrg> trgArray;
192  //StoreArray<MCParticle> MCParticleArray;
193  StoreArray<CDCTriggerTrack> cdc2DTrkArray(m_2DfinderCollectionName);
194  StoreArray<CDCTriggerTrack> cdc3DTrkArray(m_3DfitterCollectionName);
195  StoreArray<CDCTriggerTrack> cdcNNTrkArray(m_NNCollectionName);
196  StoreArray<TRGECLCluster> eclTrgClusterArray(m_TrgECLClusterName);
197  StoreArray<TRGGRLMATCH> trackphimatch(m_phimatch_tracklist);
198  StoreArray<TRGGRLMATCHKLM> trackKLMmatch(m_klmmatch_tracklist);
199  StoreObjPtr<KLMTrgSummary> klmtrgsummary(m_KLMTrgSummaryName);
200  StoreArray<TRGGRLPHOTON> grlphoton(m_grlphotonlist);
201  StoreObjPtr<BinnedEventT0> m_eventTime;
202  StoreObjPtr<TRGGRLInfo> trgInfo(m_TrgGrlInformationName);
203  //trgInfo.create();
204  //---------------------------------------------------------------------
205  //..Use only clusters within 100 ns of event timing (from ECL).
206  int ntrgArray = trgArray.getEntries();
207  double EventTiming = -9999.;
208  if (ntrgArray > 0) {EventTiming = trgArray[0]->getEventTiming();}
209  std::vector<int> selTC;
210  std::vector<int> selTheta;
211  std::vector<float> selE;
212  for (int ic = 0; ic < eclTrgClusterArray.getEntries(); ic++) {
213  double tcT = abs(eclTrgClusterArray[ic]->getTimeAve() - EventTiming);
214  if (tcT < 100.) {
215  int TC = eclTrgClusterArray[ic]->getMaxTCId();
216  selTC.push_back(TC);
217  selTheta.push_back(TCThetaID[TC - 1]);
218  selE.push_back(eclTrgClusterArray[ic]->getEnergyDep());
219  }
220  }
221 
222  //---------------------------------------------------------------------
223  //..Trigger objects from CDC alone
224  // nTrk3D nTrkZ10 nTrkZ25
225  int nTrk2D = cdc2DTrkArray.getEntries();
226  int nTrk3D = cdc3DTrkArray.getEntries();
227  int nTrkZ10 = 0;
228  int nTrkZ25 = 0;
229  int nTrkZ35 = 0;
230  for (int itrk = 0; itrk < nTrk3D; itrk++) {
231  double z0 = cdc3DTrkArray[itrk]->getZ0();
232  if (abs(z0) < 10.) {nTrkZ10++;}
233  if (abs(z0) < 25.) {nTrkZ25++;}
234  if (abs(z0) < 35.) {nTrkZ35++;}
235  }
236  int nTrkNN = cdcNNTrkArray.getEntries();
237  int nTrkNNSTT = 0;
238  int nTrkNNSTT6 = 0;
239  int nTrkNNSTT5 = 0;
240  int nTrkNNSTT4 = 0;
241  int nTrkNN20 = 0;
242  int nTrkNN40 = 0;
243  for (int itrk = 0; itrk < nTrkNN; itrk++) {
244  double z0 = cdcNNTrkArray[itrk]->getZ0();
245 
246  double omega = 100 * cdcNNTrkArray[itrk]->getOmega();
247  int omega_bin = omega / 0.044;
248  omega = omega_bin * 0.044;
249 
250  double cottheta = cdcNNTrkArray[itrk]->getCotTheta();
251  double theta = 0;
252  if (cottheta != 0)theta = atan(1. / cottheta);
253  int theta_bin = theta / 0.098125;
254  theta = theta_bin * 0.098125;
255  int p = abs(10 * 0.3 * 1.5 / omega / sin(theta)); //0.1GeV unit
256 
257  double pt = cdcNNTrkArray[itrk]->getPt();
258  double p_abs = cdcNNTrkArray[itrk]->getPt() / sin(theta);
259  B2DEBUG(20, "NN momentum " << omega << " " << theta * 180 / 3.14 << " " << p * 0.1 << " " << p_abs << " " << pt);
260 
261  if (abs(z0) < 15. && p > 7) {nTrkNNSTT++;}
262  if (abs(z0) < 15. && p > 6) {nTrkNNSTT6++;}
263  if (abs(z0) < 15. && p > 5) {nTrkNNSTT5++;}
264  if (abs(z0) < 15. && p > 4) {nTrkNNSTT4++;}
265  if (abs(z0) < 20.) {nTrkNN20++;}
266  if (abs(z0) < 40.) {nTrkNN40++;}
267  }
268 
269  trgInfo->setN3Dfittertrk(nTrk3D);
270  trgInfo->setN3DfittertrkZ10(nTrkZ10);
271  trgInfo->setN3DfittertrkZ25(nTrkZ25);
272  trgInfo->setN3DfittertrkZ35(nTrkZ35);
273  trgInfo->setNNNtrk(nTrkNN);
274  trgInfo->setNNNtrkZ20(nTrkNN20);
275  trgInfo->setNNNtrkZ40(nTrkNN40);
276  trgInfo->setNNNtrkSTT(nTrkNNSTT);
277  //---------------------------------------------------------------------
278  //..Trigger objects using single ECL clusters
279  // nClust n300MeV n2GeV n2GeV414 n2GeV231516 n2GeV117 n1GeV415 n1GeV2316 n1GeV117
280  int nClust = selTC.size();
281  int n300MeV = 0;
282  int n2GeV = 0;
283  int n2GeV414 = 0;
284  int n2GeV231516 = 0;
285  int n2GeV117 = 0;
286  int n1GeV415 = 0;
287  int n1GeV2316 = 0;
288  int n1GeV117 = 0;
289  for (int ic = 0; ic < nClust; ic++) {
290  if (selE[ic] > 0.3) {n300MeV++;}
291  float thresh = TC1GeV[selTC[ic] - 1];
292  if (selE[ic] > (thresh + thresh)) {
293  n2GeV++;
294  if (selTheta[ic] >= 4 && selTheta[ic] <= 14) {n2GeV414++;}
295  if (selTheta[ic] == 2 || selTheta[ic] == 3 || selTheta[ic] == 15 || selTheta[ic] == 16) {n2GeV231516++;}
296  if (selTheta[ic] == 1 || selTheta[ic] == 17) {n2GeV117++;}
297  }
298  if (selE[ic] > thresh) {
299  if (selTheta[ic] >= 4 && selTheta[ic] <= 15) {n1GeV415++;}
300  if (selTheta[ic] == 2 || selTheta[ic] == 3 || selTheta[ic] == 16) {n1GeV2316++;}
301  if (selTheta[ic] == 1 || selTheta[ic] == 17) {n1GeV117++;}
302  }
303  }
304  trgInfo->setNcluster(nClust);
305  trgInfo->setNhigh300cluster(n300MeV);
306  trgInfo->setNhigh1GeVcluster415(n1GeV415);
307  trgInfo->setNhigh1GeVcluster2316(n1GeV2316);
308  trgInfo->setNhigh1GeVcluster117(n1GeV117);
309  trgInfo->setNhigh2GeVcluster(n2GeV);
310  trgInfo->setNhigh2GeVcluster414(n2GeV414);
311  trgInfo->setNhigh2GeVcluster231516(n2GeV231516);
312  trgInfo->setNhigh2GeVcluster117(n2GeV117);
313 
314  //---------------------------------------------------------------------
315  //..Trigger objects using back-to-back ECL clusters, plus Bhabha vetoes
316  // nPhiPairHigh nPhiPairLow n3DPair nECLBhabha nTrkBhabha
317  int nPhiPairHigh = 0;
318  int nPhiPairLow = 0;
319  int n3DPair = 0;
320  int nECLBhabha = 0;
321  int nTrkBhabha = 0;
322  for (int i0 = 0; i0 < nClust - 1; i0++) {
323  for (int i1 = i0 + 1; i1 < nClust; i1++) {
324 
325  //..back to back in phi
326  float dphi = abs(TCPhiCOM[selTC[i1] - 1] - TCPhiCOM[selTC[i0] - 1]);
327  if (dphi > 180.) {dphi = 360 - dphi;}
328  if (dphi > 170. && selE[i0] > 0.25 && selE[i1] > 0.25) {nPhiPairHigh++;}
329  if (dphi > 170. && (selE[i0] < 0.25 || selE[i1] < 0.25)) {nPhiPairLow++;}
330 
331  //..3D
332  float thetaSum = TCThetaCOM[selTC[i0] - 1] + TCThetaCOM[selTC[i1] - 1];
333  if (dphi > 160. && thetaSum > 160. && thetaSum < 200.) {n3DPair++;}
334 
335  //..ecl Bhabha
336  if (dphi > 160. && thetaSum > 165. && thetaSum < 190. && selE[i0] > 3.*TC1GeV[selTC[i0] - 1] && selE[i1] > 3.*TC1GeV[selTC[i1] - 1]
337  && (selE[i0] > 4.5 * TC1GeV[selTC[i0] - 1] || selE[i1] > 4.5 * TC1GeV[selTC[i1] - 1])) {
338  nECLBhabha++;
339 
340  //..Bhabha also using the CDC
341  bool c0matched = false;
342  bool c1matched = false;
343  for (int itrk = 0; itrk < nTrk3D; itrk++) {
344  double phiTrk = cdc3DTrkArray[itrk]->getPhi0() * radtodeg;
345  double ptTrk = cdc3DTrkArray[itrk]->getTransverseMomentum(1.5);
346  float dphi0 = abs(phiTrk - TCPhiLab[selTC[i0] - 1]);
347  if (dphi0 > 180.) {dphi0 = 360. - dphi0;}
348  float dphi1 = abs(phiTrk - TCPhiLab[selTC[i1] - 1]);
349  if (dphi1 > 180.) {dphi1 = 360. - dphi1;}
350  if (ptTrk > 1. && dphi0 < 15.) {c0matched = true;}
351  if (ptTrk > 1. && dphi1 < 15.) {c1matched = true;}
352  }
353  if (c0matched && c1matched) {nTrkBhabha++;}
354  }
355  }
356  }
357 
358  trgInfo->setBhabhaVeto(nTrkBhabha);
359  trgInfo->seteclBhabhaVeto(nECLBhabha);
360  trgInfo->setPairHigh(nPhiPairHigh);
361  trgInfo->setPairLow(nPhiPairLow);
362  trgInfo->set3DPair(n3DPair);
363 
364 
365  //---------------------------------------------------------------------
366  //..Trigger objects using 1 track and at least 1 cluster
367  // nSameHem1Trk nOppHem1Trk
368  int nSameHem1Trk = 0;
369  int nOppHem1Trk = 0;
370  if (nTrk3D == 1) {
371  double phiTrk = cdc3DTrkArray[0]->getPhi0() * radtodeg;
372  double cotTrk = cdc3DTrkArray[0]->getCotTheta();
373  for (int i0 = 0; i0 < nClust; i0++) {
374  float dphi = abs(phiTrk - TCPhiLab[selTC[i0] - 1]);
375  if (dphi > 180.) {dphi = 360. - dphi;}
376  float dCot = cotTrk - TCcotThetaLab[selTC[i0] - 1];
377  if (dphi > 80.) {nOppHem1Trk++;}
378  if (dphi < 80. && (dCot < -0.8 || dCot > 0.6)) {nSameHem1Trk++;}
379  }
380  }
381 
382  trgInfo->setNSameHem1Trk(nSameHem1Trk);
383  trgInfo->setNOppHem1Trk(nOppHem1Trk);
384 
385  //---------------------------------------------------------------------
386  //..Trk b2b
387  int Trk_b2b_1to3 = 0;
388  int Trk_b2b_1to5 = 0;
389  int Trk_b2b_1to7 = 0;
390  int Trk_b2b_1to9 = 0;
391  int Trk_open90 = 0;
392  int Trk_open30 = 0;
393  for (int itrk = 0; itrk < cdc2DTrkArray.getEntries(); itrk++) {
394 
395  int phi_i_itrk = (int)((cdc2DTrkArray[itrk]->getPhi0()) * (180 / M_PI) / 10);
396 
397  for (int jtrk = 0; jtrk < cdc2DTrkArray.getEntries(); jtrk++) {
398  if (itrk <= jtrk) continue;
399 
400  int phi_i_jtrk = (int)((cdc2DTrkArray[jtrk]->getPhi0()) * (180 / M_PI) / 10);
401  if (abs(phi_i_itrk - phi_i_jtrk) >= 17 && abs(phi_i_itrk - phi_i_jtrk) <= 19) {Trk_b2b_1to3 = 1;}
402  if (abs(phi_i_itrk - phi_i_jtrk) >= 16 && abs(phi_i_itrk - phi_i_jtrk) <= 20) {Trk_b2b_1to5 = 1;}
403  if (abs(phi_i_itrk - phi_i_jtrk) >= 15 && abs(phi_i_itrk - phi_i_jtrk) <= 21) {Trk_b2b_1to7 = 1;}
404  if (abs(phi_i_itrk - phi_i_jtrk) >= 14 && abs(phi_i_itrk - phi_i_jtrk) <= 22) {Trk_b2b_1to9 = 1;}
405  if (abs(phi_i_itrk - phi_i_jtrk) >= 9 && abs(phi_i_itrk - phi_i_jtrk) <= 27) {Trk_open90 = 1;}
406  if (abs(phi_i_itrk - phi_i_jtrk) >= 3 && abs(phi_i_itrk - phi_i_jtrk) <= 33) {Trk_open30 = 1;}
407  }
408  }
409  trgInfo->setTrk_b2b_1to3(Trk_b2b_1to3);
410  trgInfo->setTrk_b2b_1to5(Trk_b2b_1to5);
411  trgInfo->setTrk_b2b_1to7(Trk_b2b_1to7);
412  trgInfo->setTrk_b2b_1to9(Trk_b2b_1to9);
413  trgInfo->setTrk_open90(Trk_open90);
414  trgInfo->setTrk_open30(Trk_open30);
415 
416  //---------------------------------------------------------------------
417  //..cluster b2b
418  int cluster_b2b_1to3 = 0;
419  int cluster_b2b_1to5 = 0;
420  int cluster_b2b_1to7 = 0;
421  int cluster_b2b_1to9 = 0;
422  for (int iclu = 0; iclu < eclTrgClusterArray.getEntries(); iclu++) {
423 
424  double x_iclu = eclTrgClusterArray[iclu]->getPositionX();
425  double y_iclu = eclTrgClusterArray[iclu]->getPositionY();
426 
427  int phi_iclu = 0;
428  if (x_iclu >= 0 && y_iclu >= 0) {phi_iclu = (int)(atan(y_iclu / x_iclu) * (180.0 / M_PI) / 10);}
429  else if (x_iclu < 0 && y_iclu >= 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 180.0) / 10);}
430  else if (x_iclu < 0 && y_iclu < 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 180.0) / 10);}
431  else if (x_iclu >= 0 && y_iclu < 0) {phi_iclu = (int)((atan(y_iclu / x_iclu) * (180.0 / M_PI) + 360.0) / 10);}
432 
433  for (int jclu = 0; jclu < eclTrgClusterArray.getEntries(); jclu++) {
434  if (iclu <= jclu) continue;
435 
436  double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
437  double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
438 
439  int phi_jclu = 0;
440  if (x_jclu >= 0 && y_jclu >= 0) {phi_jclu = (int)(atan(y_jclu / x_jclu) * (180.0 / M_PI) / 10);}
441  else if (x_jclu < 0 && y_jclu >= 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
442  else if (x_jclu < 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
443  else if (x_jclu >= 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 360.0) / 10);}
444 
445  if (abs(phi_iclu - phi_jclu) >= 17 && abs(phi_iclu - phi_jclu) <= 19) {cluster_b2b_1to3 = 1;}
446  if (abs(phi_iclu - phi_jclu) >= 16 && abs(phi_iclu - phi_jclu) <= 20) {cluster_b2b_1to5 = 1;}
447  if (abs(phi_iclu - phi_jclu) >= 15 && abs(phi_iclu - phi_jclu) <= 21) {cluster_b2b_1to7 = 1;}
448  if (abs(phi_iclu - phi_jclu) >= 14 && abs(phi_iclu - phi_jclu) <= 22) {cluster_b2b_1to9 = 1;}
449  }
450  }
451  trgInfo->setcluster_b2b_1to3(cluster_b2b_1to3);
452  trgInfo->setcluster_b2b_1to5(cluster_b2b_1to5);
453  trgInfo->setcluster_b2b_1to7(cluster_b2b_1to7);
454  trgInfo->setcluster_b2b_1to9(cluster_b2b_1to9);
455 
456 
457  //---------------------------------------------------------------------
458  //..eed, fed
459 
460  int eed = 0, fed = 0;
461  if (cdc2DTrkArray.getEntries() == 2 && trackphimatch.getEntries() == 2 && cluster_b2b_1to5 == 1) {eed = 1;}
462  if (cdc2DTrkArray.getEntries() == 1 && trackphimatch.getEntries() == 1 && cluster_b2b_1to5 == 1) {fed = 1;}
463  trgInfo->seteed(eed);
464  trgInfo->setfed(fed);
465 
466  //---------------------------------------------------------------------
467  //..Track-cluster b2b
468  int Trkcluster_b2b_1to3 = 0;
469  int Trkcluster_b2b_1to5 = 0;
470  int Trkcluster_b2b_1to7 = 0;
471  int Trkcluster_b2b_1to9 = 0;
472  for (int itrk = 0; itrk < cdc2DTrkArray.getEntries(); itrk++) {
473  double _r = 1.0 / cdc2DTrkArray[itrk]->getOmega() ;
474  double _phi = cdc2DTrkArray[itrk]->getPhi0() ;
475  double phi_p = acos(126.0 / (2 * fabs(_r)));
476  int charge = 0;
477  if (_r > 0) {charge = 1;}
478  else if (_r < 0) {charge = -1;}
479  else {charge = 0;}
480 
481  double phi_CDC = 0.0;
482  if (charge == 1) {
483  phi_CDC = _phi + phi_p - 0.5 * M_PI;
484  } else if (charge == -1) {
485  phi_CDC = _phi - phi_p + 0.5 * M_PI;
486  } else {
487  phi_CDC = _phi;
488  }
489 
490  if (phi_CDC > 2 * M_PI) {phi_CDC = phi_CDC - 2 * M_PI;}
491  else if (phi_CDC < 0) {phi_CDC = phi_CDC + 2 * M_PI;}
492  int phi_itrk = (int)(phi_CDC * (180.0 / M_PI) / 10);
493 
494  for (int jclu = 0; jclu < eclTrgClusterArray.getEntries(); jclu++) {
495 
496  double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
497  double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
498 
499  int phi_jclu = 0;
500  if (x_jclu >= 0 && y_jclu >= 0) {phi_jclu = (int)(atan(y_jclu / x_jclu) * (180.0 / M_PI) / 10);}
501  else if (x_jclu < 0 && y_jclu >= 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
502  else if (x_jclu < 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 180.0) / 10);}
503  else if (x_jclu >= 0 && y_jclu < 0) {phi_jclu = (int)((atan(y_jclu / x_jclu) * (180.0 / M_PI) + 360.0) / 10);}
504 
505  if (abs(phi_itrk - phi_jclu) >= 17 && abs(phi_itrk - phi_jclu) <= 19) {Trkcluster_b2b_1to3 = 1;}
506  if (abs(phi_itrk - phi_jclu) >= 16 && abs(phi_itrk - phi_jclu) <= 20) {Trkcluster_b2b_1to5 = 1;}
507  if (abs(phi_itrk - phi_jclu) >= 15 && abs(phi_itrk - phi_jclu) <= 21) {Trkcluster_b2b_1to7 = 1;}
508  if (abs(phi_itrk - phi_jclu) >= 14 && abs(phi_itrk - phi_jclu) <= 22) {Trkcluster_b2b_1to9 = 1;}
509  }
510  }
511 
512  trgInfo->setTrkcluster_b2b_1to3(Trkcluster_b2b_1to3);
513  trgInfo->setTrkcluster_b2b_1to5(Trkcluster_b2b_1to5);
514  trgInfo->setTrkcluster_b2b_1to7(Trkcluster_b2b_1to7);
515  trgInfo->setTrkcluster_b2b_1to9(Trkcluster_b2b_1to9);
516 
517  //---------------------------------------------------------------------
518  //..fp, eeb, fep
519 
520  int fp = 0;
521  if (cdc2DTrkArray.getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fp = 1;}
522  trgInfo->setfp(fp);
523 
524  int eeb = 0;
525  if (trackphimatch.getEntries() == 2 && Trk_b2b_1to5 == 1) {eeb = 1;}
526  trgInfo->seteeb(eeb);
527 
528  int fep = 0;
529  if (cdc2DTrkArray.getEntries() == 1 && trackphimatch.getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fep = 1;}
530  trgInfo->setfep(fep);
531 
532 
533  //---------------------------------------------------------------------
534  //..Get input bits from StoreArray<TRGECLTrg> trgArray
535  //..Bit order is hard-coded in trg/ecl/src/TrgEclMaster.cc
536 
537  int ECLtoGDL[4] = {0, 0, 0, 0};
538  if (ntrgArray > 0) {
539  ECLtoGDL[0] = trgArray[0]->getECLtoGDL(0);
540  ECLtoGDL[1] = trgArray[0]->getECLtoGDL(1);
541  ECLtoGDL[2] = trgArray[0]->getECLtoGDL(2);
542  ECLtoGDL[3] = trgArray[0]->getECLtoGDL(3);
543  }
544 
545  // elow: 47
546  bool elow = (ECLtoGDL[1] & (1 << (47 - 32 * 1))) != 0;
547  // ehigh: 48
548  bool ehigh = (ECLtoGDL[1] & (1 << (48 - 32 * 1))) != 0;
549  // elum: 49
550  bool elum = (ECLtoGDL[1] & (1 << (49 - 32 * 1))) != 0;
551  // ecl_bha: 19
552  bool ecl_bha = (ECLtoGDL[0] & (1 << (19 - 32 * 0))) != 0;
553  // bha_type0: 20
554  bool bha_type0 = (ECLtoGDL[0] & (1 << (20 - 32 * 0))) != 0;
555  // bha_type1: 21
556  bool bha_type1 = (ECLtoGDL[0] & (1 << (21 - 32 * 0))) != 0;
557  // bha_type2: 22
558  bool bha_type2 = (ECLtoGDL[0] & (1 << (22 - 32 * 0))) != 0;
559  // bha_type3: 23
560  bool bha_type3 = (ECLtoGDL[0] & (1 << (23 - 32 * 0))) != 0;
561  // bha_type4: 24
562  bool bha_type4 = (ECLtoGDL[0] & (1 << (24 - 32 * 0))) != 0;
563  // bha_type5: 25
564  bool bha_type5 = (ECLtoGDL[0] & (1 << (25 - 32 * 0))) != 0;
565  // bha_type6: 26
566  bool bha_type6 = (ECLtoGDL[0] & (1 << (26 - 32 * 0))) != 0;
567  // bha_type7: 27
568  bool bha_type7 = (ECLtoGDL[0] & (1 << (27 - 32 * 0))) != 0;
569  // bha_type8: 28
570  bool bha_type8 = (ECLtoGDL[0] & (1 << (28 - 32 * 0))) != 0;
571  // bha_type9: 29
572  bool bha_type9 = (ECLtoGDL[0] & (1 << (29 - 32 * 0))) != 0;
573  // bha_type10: 30
574  bool bha_type10 = (ECLtoGDL[0] & (1 << (30 - 32 * 0))) != 0;
575  // bha_type11: 31
576  bool bha_type11 = (ECLtoGDL[0] & (1u << (31 - 32 * 0))) != 0;
577  // bha_type12: 32
578  bool bha_type12 = (ECLtoGDL[1] & (1 << (32 - 32 * 1))) != 0;
579  // bha_type13: 33
580  bool bha_type13 = (ECLtoGDL[1] & (1 << (33 - 32 * 1))) != 0;
581 
582  bool nclst_0 = (eclTrgClusterArray.getEntries() & (1 << 0)) != 0;
583  bool nclst_1 = (eclTrgClusterArray.getEntries() & (1 << 1)) != 0;
584  bool nclst_2 = (eclTrgClusterArray.getEntries() & (1 << 2)) != 0;
585  bool nclst_3 = (eclTrgClusterArray.getEntries() & (1 << 3)) != 0;
586 
587  // ecl_bg_0: 57
588  bool ecl_bg_0 = (ECLtoGDL[1] & (1 << (57 - 32 * 1))) != 0;
589  // ecl_bg_1: 58
590  bool ecl_bg_1 = (ECLtoGDL[1] & (1 << (58 - 32 * 1))) != 0;
591  // ecl_bg_2: 59
592  bool ecl_bg_2 = (ECLtoGDL[1] & (1 << (59 - 32 * 1))) != 0;
593 
594  bool ecl_active = ntrgArray > 0;
595 
596  // ecl_timing_fwd: 15
597  bool ecl_timing_fwd = (ECLtoGDL[0] & (1 << (15 - 32 * 0))) != 0;
598  // ecl_timing_brl: 16
599  bool ecl_timing_brl = (ECLtoGDL[0] & (1 << (16 - 32 * 0))) != 0;
600  // ecl_timing_bwd: 17
601  bool ecl_timing_bwd = (ECLtoGDL[0] & (1 << (17 - 32 * 0))) != 0;
602  // ecl_phys: 18
603  bool ecl_phys = (ECLtoGDL[0] & (1 << (18 - 32 * 0))) != 0;
604  // ecl_oflo: 60
605  bool ecl_oflo = (ECLtoGDL[1] & (1 << (60 - 32 * 1))) != 0;
606  // ecl_3dbha: 61
607  bool ecl_3dbha = (ECLtoGDL[1] & (1 << (61 - 32 * 1))) != 0;
608  // ecl_lml_0: 62
609  bool ecl_lml_0 = (ECLtoGDL[1] & (1 << (62 - 32 * 1))) != 0;
610  // ecl_lml_1: 63
611  bool ecl_lml_1 = (ECLtoGDL[1] & (1u << (63 - 32 * 1))) != 0;
612  // ecl_lml_2: 64
613  bool ecl_lml_2 = (ECLtoGDL[2] & (1 << (64 - 32 * 2))) != 0;
614  // ecl_lml_3: 65
615  bool ecl_lml_3 = (ECLtoGDL[2] & (1 << (65 - 32 * 2))) != 0;
616  // ecl_lml_4: 66
617  bool ecl_lml_4 = (ECLtoGDL[2] & (1 << (66 - 32 * 2))) != 0;
618  // ecl_lml_5: 67
619  bool ecl_lml_5 = (ECLtoGDL[2] & (1 << (67 - 32 * 2))) != 0;
620  // ecl_lml_6: 68
621  bool ecl_lml_6 = (ECLtoGDL[2] & (1 << (68 - 32 * 2))) != 0;
622  // ecl_lml_7: 69
623  bool ecl_lml_7 = (ECLtoGDL[2] & (1 << (69 - 32 * 2))) != 0;
624  // ecl_lml_8: 70
625  bool ecl_lml_8 = (ECLtoGDL[2] & (1 << (70 - 32 * 2))) != 0;
626  // ecl_lml_9: 71
627  bool ecl_lml_9 = (ECLtoGDL[2] & (1 << (71 - 32 * 2))) != 0;
628  // ecl_lml_10: 72
629  bool ecl_lml_10 = (ECLtoGDL[2] & (1 << (72 - 32 * 2))) != 0;
630  // ecl_lml_11: 73
631  bool ecl_lml_11 = (ECLtoGDL[2] & (1 << (73 - 32 * 2))) != 0;
632  // ecl_lml_11: 78
633  bool ecl_lml_12 = (ECLtoGDL[2] & (1 << (78 - 32 * 2))) != 0;
634  // ecl_lml_11: 79
635  bool ecl_lml_13 = (ECLtoGDL[2] & (1 << (79 - 32 * 2))) != 0;
636  // ecl_mumu: 75
637  bool ecl_mumu = (ECLtoGDL[2] & (1 << (75 - 32 * 2))) != 0;
638  // ecl_bst: 77
639  bool ecl_bst = (ECLtoGDL[2] & (1 << (77 - 32 * 2))) != 0;
640  // ecl_pur: 74
641  bool ecl_bhapur = (ECLtoGDL[2] & (1 << (74 - 32 * 2))) != 0;
642  //3D Bhabha Veto Intrk: 86
643  bool bha_intrk = (ECLtoGDL[2] & (1 << (86 - 32 * 2))) != 0;
644  //3D Bhabha selection theta flag: 87-88
645  bool bha_theta_0 = (ECLtoGDL[2] & (1 << (87 - 32 * 2))) != 0;
646  bool bha_theta_1 = (ECLtoGDL[2] & (1 << (88 - 32 * 2))) != 0;
647  //ecltaub2b
648  bool ecltaub2b = (ECLtoGDL[2] & (1 << (89 - 32 * 2))) != 0;
649  // ehigh1-3
650  bool ehigh1 = (ECLtoGDL[2] & (1 << (90 - 32 * 2))) != 0;
651  bool ehigh2 = (ECLtoGDL[2] & (1 << (91 - 32 * 2))) != 0;
652  bool ehigh3 = (ECLtoGDL[2] & (1 << (92 - 32 * 2))) != 0;
653 
654  //---------------------------------------------------------------------
655  //..Other input bits
656 
657  bool cdc_active = false;
658  if (m_eventTime->hasBinnedEventT0(Const::CDC)) {
659  if (m_eventTime->getBinnedEventT0(Const::CDC) != 0) { cdc_active = true; }
660  }
661 
662  //KLM alone bits from klmtrg summary----------------------------------
663  int n_klm_barrel = klmtrgsummary->getBKLM_n_trg_sectors();
664  bool klm_hit = n_klm_barrel > 0;
665  bool klm_0 = (n_klm_barrel & (1 << 0)) != 0;
666  bool klm_1 = (n_klm_barrel & (1 << 1)) != 0;
667  bool klm_2 = (n_klm_barrel & (1 << 2)) != 0;
668  int n_eklm_barrel = klmtrgsummary->getEKLM_n_trg_sectors();
669  bool eklm_hit = n_eklm_barrel > 0;
670  bool eklm_0 = (n_eklm_barrel & (1 << 0)) != 0;
671  bool eklm_1 = (n_eklm_barrel & (1 << 1)) != 0;
672  bool eklm_2 = (n_eklm_barrel & (1 << 2)) != 0;
673  int klmb2b = klmtrgsummary->getBKLM_back_to_back_flag();
674  int eklmb2b = klmtrgsummary->getEKLM_back_to_back_flag();
675 
676  //KLM/CDC/ECL matching bits-------------------------------------------
677  bool cdcklm_0 = (trackKLMmatch.getEntries() == 1);
678  bool cdcklm_1 = (trackKLMmatch.getEntries() > 1);
679  bool cdcklm_2 = (trackKLMmatch.getEntries() == 3);
680  bool cdcklm_3 = (trackKLMmatch.getEntries() > 3);
681  int n_seklm = trgInfo->getNsklm();
682  //int n_seklm_fwd = trgInfo->getNsklm_fwd();
683  //int n_seklm_bwd = trgInfo->getNsklm_bwd();
684  int n_ieklm = trgInfo->getNiklm();
685  bool ecleklm = (trgInfo->getNeecleklm() > 0);
686 
687  bool cdcecl_0 = (trackphimatch.getEntries() == 1);
688  bool cdcecl_1 = (trackphimatch.getEntries() == 2);
689  bool cdcecl_2 = (trackphimatch.getEntries() == 3);
690  bool cdcecl_3 = (trackphimatch.getEntries() > 3);
691  bool trkbha1 = ecl_3dbha && (trackphimatch.getEntries() == 1);
692  bool trkbha2 = ecl_3dbha && (trackphimatch.getEntries() == 2);
693 
694 
695 
696  int n_c2gev = 0;
697  for (int i = 0; i < trackphimatch.getEntries(); i++) {
698  if (trackphimatch[i]->get_e() >= 2.0) {n_c2gev++;}
699  }
700 
701  bool c2gev_0 = (n_c2gev == 1);
702  bool c2gev_1 = (n_c2gev == 2);
703  bool c2gev_2 = (n_c2gev == 3);
704  bool c2gev_3 = (n_c2gev > 3);
705 
706  int N_clst1 = 0, N_clst2 = 0;
707  for (int i = 0 ; i < grlphoton.getEntries() ; i++) {
708  if (grlphoton[i]->get_e() > 1.0) { N_clst1++; }
709  if (grlphoton[i]->get_e() > 2.0) { N_clst2++; }
710  }
711 
712  bool nclst1_0 = (N_clst1 == 1);
713  bool nclst1_1 = (N_clst1 == 2);
714  bool nclst1_2 = (N_clst1 == 3);
715  bool nclst1_3 = (N_clst1 > 3);
716 
717  bool nclst2_0 = (N_clst2 == 1);
718  bool nclst2_1 = (N_clst2 == 2);
719  bool nclst2_2 = (N_clst2 == 3);
720  bool nclst2_3 = (N_clst2 > 3);
721 
722  int N_ST = trgInfo->getNshorttrk();
723  int N_ST_fwd = trgInfo->getNshorttrk_fwd();
724  int N_ST_bwd = trgInfo->getNshorttrk_bwd();
725  int s2s3 = trgInfo->gets2s3();
726  int s2s5 = trgInfo->gets2s5();
727  int s2so = trgInfo->gets2so();
728  int s2f3 = trgInfo->gets2f3();
729  int s2f5 = trgInfo->gets2f5();
730  int s2fo = trgInfo->gets2fo();
731  int s2f30 = trgInfo->gets2f30();
732  int s2s30 = trgInfo->gets2s30();
733  int bwdsb = trgInfo->getbwdsb();
734  int bwdnb = trgInfo->getbwdnb();
735  int fwdsb = trgInfo->getfwdsb();
736  int fwdnb = trgInfo->getfwdnb();
737  int brlfb = trgInfo->getbrlfb();
738  int brlnb = trgInfo->getbrlnb();
739  int N_IT = trgInfo->getNinnertrk();
740  int i2fo = trgInfo->geti2fo();
741  int i2io = trgInfo->geti2io();
742  int n_secl = trgInfo->getNsecl();
743  int n_iecl = trgInfo->getNiecl();
744 
745  //std::cout << "klm " << klm_hit << " " << klm_0 << " " << klm_1 << " " << klm_2 << " " << klmb2b << std::endl;
746  //std::cout << "eklm " << eklm_hit << " " << eklm_0 << " " << eklm_1 << " " << eklm_2 << " " << eklmb2b << std::endl;
747  //std::cout << "2dklm " << nTrk2D << " " << cdcklm_0 << " " << cdcklm_1 << std::endl;
748  //std::cout << "sklm " << N_ST << " " << n_seklm << " " << n_seklm_fwd << " " << n_seklm_bwd << std::endl;
749  //std::cout << "tiklm " << N_IT << " " << n_ieklm << " " << trgInfo->getNiecl() << std::endl;
750  //std::cout << "eclklm " << trgInfo->getNeecleklm() << std::endl;
751 
752 
753  //---------------------------------------------------------------------
754  //..Filling InputBits
755  //..Naming is based on trg/gdl/dbobjects/log/
756 
757 
758  if (!m_InputBitsDB)B2INFO("no database of gdl input bits");
759 
760  int N_InputBits = m_InputBitsDB->getninbit();
761 
762  for (int i = 0; i < N_InputBits; i++) {
763  std::string bitname(m_InputBitsDB->getinbitname(i));
764 
765  bool bit = false;
766  if (bitname == "t3_0") {bit = nTrkZ35 == 1;}
767  else if (bitname == "t3_1") {bit = nTrkZ35 == 2;}
768  else if (bitname == "t3_2") {bit = nTrkZ35 == 3;}
769  else if (bitname == "t3_3") {bit = nTrkZ35 > 3;}
770  else if (bitname == "ty_0") {bit = nTrkNN20 == 1;}
771  else if (bitname == "ty_1") {bit = nTrkNN20 == 2;}
772  else if (bitname == "ty_2") {bit = nTrkNN20 == 3;}
773  else if (bitname == "ty_3") {bit = nTrkNN20 > 3;}
774  else if (bitname == "typ") {bit = nTrkNNSTT > 0;}
775  else if (bitname == "typ6") {bit = nTrkNNSTT6 > 0;}
776  else if (bitname == "typ5") {bit = nTrkNNSTT5 > 0;}
777  else if (bitname == "typ4") {bit = nTrkNNSTT4 > 0;}
778  else if (bitname == "t2_0") {bit = nTrk2D == 1;}
779  else if (bitname == "t2_1") {bit = nTrk2D == 2;}
780  else if (bitname == "t2_2") {bit = nTrk2D == 3;}
781  else if (bitname == "t2_3") {bit = nTrk2D > 3;}
782  else if (bitname == "ts_0") {bit = N_ST == 1;}
783  else if (bitname == "ts_1") {bit = N_ST == 2;}
784  else if (bitname == "ts_2") {bit = N_ST == 3;}
785  else if (bitname == "ts_3") {bit = N_ST > 3;}
786  else if (bitname == "fwd_s") {bit = N_ST_fwd > 0;}
787  else if (bitname == "bwd_s") {bit = N_ST_bwd > 0;}
788  else if (bitname == "cdc_open90") {bit = Trk_open90 == 1;}
789  else if (bitname == "f2f30") {bit = Trk_open30 == 1;}
790  else if (bitname == "cdc_active") {bit = cdc_active;}
791  else if (bitname == "cdc_b2b3") {bit = Trk_b2b_1to3;}
792  else if (bitname == "cdc_b2b5") {bit = Trk_b2b_1to5;}
793  else if (bitname == "cdc_b2b7") {bit = Trk_b2b_1to7;}
794  else if (bitname == "cdc_b2b9") {bit = Trk_b2b_1to9;}
795  else if (bitname == "s2s3") {bit = s2s3 > 0;}
796  else if (bitname == "s2s5") {bit = s2s5 > 0;}
797  else if (bitname == "s2so") {bit = s2so > 0;}
798  else if (bitname == "s2f3") {bit = s2f3 > 0;}
799  else if (bitname == "s2f5") {bit = s2f5 > 0;}
800  else if (bitname == "s2fo") {bit = s2fo > 0;}
801  else if (bitname == "s2f30") {bit = s2f30;}
802  else if (bitname == "s2s30") {bit = s2s30;}
803  else if (bitname == "bwdsb") {bit = bwdsb > 0;}
804  else if (bitname == "bwdnb") {bit = bwdnb > 0;}
805  else if (bitname == "fwdsb") {bit = fwdsb > 0;}
806  else if (bitname == "fwdnb") {bit = fwdnb > 0;}
807  else if (bitname == "brlfb1") {bit = brlfb == 1;}
808  else if (bitname == "brlfb2") {bit = brlfb == 2;}
809  else if (bitname == "brlnb1") {bit = brlnb == 1;}
810  else if (bitname == "brlnb2") {bit = brlnb == 2;}
811  else if (bitname == "seklm_0") {bit = n_seklm == 0;}
812  else if (bitname == "seklm_1") {bit = n_seklm > 0;}
813  else if (bitname == "ieklm") {bit = n_ieklm > 0;}
814  else if (bitname == "secl") {bit = n_secl > 0;}
815  else if (bitname == "iecl") {bit = n_iecl > 0;}
816  else if (bitname == "iecl_0") {bit = n_iecl == 1;}
817  else if (bitname == "iecl_1") {bit = n_iecl > 1;}
818  else if (bitname == "ti") {bit = N_IT > 0;}
819  else if (bitname == "i2fo") {bit = i2fo > 0;}
820  else if (bitname == "i2io") {bit = i2io > 0;}
821  else if (bitname == "ehigh") {bit = ehigh;}
822  else if (bitname == "elow") {bit = elow;}
823  else if (bitname == "elum") {bit = elum;}
824  else if (bitname == "ecl_bha") {bit = ecl_bha;}
825  else if (bitname == "bha_type_0") {bit = bha_type0;}
826  else if (bitname == "bha_type_1") {bit = bha_type1;}
827  else if (bitname == "bha_type_2") {bit = bha_type2;}
828  else if (bitname == "bha_type_3") {bit = bha_type3;}
829  else if (bitname == "bha_type_4") {bit = bha_type4;}
830  else if (bitname == "bha_type_5") {bit = bha_type5;}
831  else if (bitname == "bha_type_6") {bit = bha_type6;}
832  else if (bitname == "bha_type_7") {bit = bha_type7;}
833  else if (bitname == "bha_type_8") {bit = bha_type8;}
834  else if (bitname == "bha_type_9") {bit = bha_type9;}
835  else if (bitname == "bha_type_10") {bit = bha_type10;}
836  else if (bitname == "bha_type_11") {bit = bha_type11;}
837  else if (bitname == "bha_type_12") {bit = bha_type12;}
838  else if (bitname == "bha_type_13") {bit = bha_type13;}
839  else if (bitname == "clst_0") {bit = nclst_0;}
840  else if (bitname == "clst_1") {bit = nclst_1;}
841  else if (bitname == "clst_2") {bit = nclst_2;}
842  else if (bitname == "clst_3") {bit = nclst_3;}
843  else if (bitname == "ecl_bg_0") {bit = ecl_bg_0;}
844  else if (bitname == "ecl_bg_1") {bit = ecl_bg_1;}
845  else if (bitname == "ecl_bg_2") {bit = ecl_bg_2;}
846  else if (bitname == "ecl_active") {bit = ecl_active;}
847  else if (bitname == "ecl_timing_fwd") {bit = ecl_timing_fwd;}
848  else if (bitname == "ecl_timing_brl") {bit = ecl_timing_brl;}
849  else if (bitname == "ecl_timing_bwd") {bit = ecl_timing_bwd;}
850  else if (bitname == "ecl_phys") {bit = ecl_phys;}
851  else if (bitname == "ecl_oflo") {bit = ecl_oflo;}
852  else if (bitname == "ecl_3dbha") {bit = ecl_3dbha;}
853  else if (bitname == "bha_veto") {bit = ecl_3dbha;}
854  else if (bitname == "ecl_lml_0") {bit = ecl_lml_0;}
855  else if (bitname == "ecl_lml_1") {bit = ecl_lml_1;}
856  else if (bitname == "ecl_lml_2") {bit = ecl_lml_2;}
857  else if (bitname == "ecl_lml_3") {bit = ecl_lml_3;}
858  else if (bitname == "ecl_lml_4") {bit = ecl_lml_4;}
859  else if (bitname == "ecl_lml_5") {bit = ecl_lml_5;}
860  else if (bitname == "ecl_lml_6") {bit = ecl_lml_6;}
861  else if (bitname == "ecl_lml_7") {bit = ecl_lml_7;}
862  else if (bitname == "ecl_lml_8") {bit = ecl_lml_8;}
863  else if (bitname == "ecl_lml_9") {bit = ecl_lml_9;}
864  else if (bitname == "ecl_lml_10") {bit = ecl_lml_10;}
865  else if (bitname == "ecl_lml_11") {bit = ecl_lml_11;}
866  else if (bitname == "ecl_lml_12") {bit = ecl_lml_12;}
867  else if (bitname == "ecl_lml_13") {bit = ecl_lml_13;}
868  else if (bitname == "ecl_mumu") {bit = ecl_mumu;}
869  else if (bitname == "ecl_bst") {bit = ecl_bst;}
870  else if (bitname == "ecl_taub2b") {bit = ecltaub2b;}
871  else if (bitname == "klm_hit") {bit = klm_hit;}
872  else if (bitname == "klm_0") {bit = klm_0;}
873  else if (bitname == "klm_1") {bit = klm_1;}
874  else if (bitname == "klm_2") {bit = klm_2;}
875  else if (bitname == "klmb2b") {bit = klmb2b;}
876  else if (bitname == "eklm_hit") {bit = eklm_hit;}
877  else if (bitname == "eklm_0") {bit = eklm_0;}
878  else if (bitname == "eklm_1") {bit = eklm_1;}
879  else if (bitname == "eklm_2") {bit = eklm_2;}
880  else if (bitname == "eklmb2b") {bit = eklmb2b;}
881  else if (bitname == "ecleklm") {bit = ecleklm;}
882  else if (bitname == "revo") {bit = false;}
883  else if (bitname == "her_kick") {bit = false;}
884  else if (bitname == "ler_kick") {bit = false;}
885  else if (bitname == "bha_delay") {bit = false;}
886  else if (bitname == "pseud_rand") {bit = false;}
887  else if (bitname == "plsin") {bit = false;}
888  else if (bitname == "poissonin") {bit = false;}
889  else if (bitname == "periodin") {bit = false;}
890  else if (bitname == "veto") {bit = false;}
891  else if (bitname == "samhem") {bit = nSameHem1Trk > 0;}
892  else if (bitname == "opohem") {bit = nOppHem1Trk > 0;}
893  else if (bitname == "n1gev_0") {bit = nclst1_0;}
894  else if (bitname == "n1gev_1") {bit = nclst1_1;}
895  else if (bitname == "n1gev_2") {bit = nclst1_2;}
896  else if (bitname == "n1gev_3") {bit = nclst1_3;}
897  else if (bitname == "n2gev_0") {bit = nclst2_0;}
898  else if (bitname == "n2gev_1") {bit = nclst2_1;}
899  else if (bitname == "n2gev_2") {bit = nclst2_2;}
900  else if (bitname == "n2gev_3") {bit = nclst2_3;}
901  else if (bitname == "cdcecl_0") {bit = cdcecl_0;}
902  else if (bitname == "cdcecl_1") {bit = cdcecl_1;}
903  else if (bitname == "cdcecl_2") {bit = cdcecl_2;}
904  else if (bitname == "cdcecl_3") {bit = cdcecl_3;}
905  else if (bitname == "c2gev_0") {bit = c2gev_0;}
906  else if (bitname == "c2gev_1") {bit = c2gev_1;}
907  else if (bitname == "c2gev_2") {bit = c2gev_2;}
908  else if (bitname == "c2gev_3") {bit = c2gev_3;}
909  else if (bitname == "cdcklm_0") {bit = cdcklm_0;}
910  else if (bitname == "cdcklm_1") {bit = cdcklm_1;}
911  else if (bitname == "cdcklm_2") {bit = cdcklm_2;}
912  else if (bitname == "cdcklm_3") {bit = cdcklm_3;}
913  else if (bitname == "d3") {bit = cluster_b2b_1to3 > 0;}
914  else if (bitname == "d5") {bit = cluster_b2b_1to5 > 0;}
915  else if (bitname == "d7") {bit = cluster_b2b_1to7 > 0;}
916  else if (bitname == "d9") {bit = cluster_b2b_1to9 > 0;}
917  else if (bitname == "p3") {bit = Trkcluster_b2b_1to3 > 0;}
918  else if (bitname == "p5") {bit = Trkcluster_b2b_1to5 > 0;}
919  else if (bitname == "p7") {bit = Trkcluster_b2b_1to7 > 0;}
920  else if (bitname == "p9") {bit = Trkcluster_b2b_1to9 > 0;}
921  else if (bitname == "trkfit") {bit = false;}
922  else if (bitname == "injv") {bit = false;}
923  else if (bitname == "nimin0") {bit = false;}
924  else if (bitname == "nimin1") {bit = false;}
925  else if (bitname == "track") {bit = nTrk2D > 0;}
926  else if (bitname == "bha_intrk") {bit = bha_intrk;}
927  else if (bitname == "bha_theta_0") {bit = bha_theta_0;}
928  else if (bitname == "bha_theta_1") {bit = bha_theta_1;}
929  else if (bitname == "ecl_bhapur") {bit = ecl_bhapur;}
930  else if (bitname == "ehigh1") {bit = ehigh1;}
931  else if (bitname == "ehigh2") {bit = ehigh2;}
932  else if (bitname == "ehigh3") {bit = ehigh3;}
933 
934  //GRL related bits, not perfect. To do: judge bhabha cluster or not correctly
935  else if (bitname == "trkbha1") {bit = trkbha1;}
936  else if (bitname == "trkbha2") {bit = trkbha2;}
937 
938  //GRL related bits, not ready
939  else if (bitname == "ta_0") {bit = false;}
940  else if (bitname == "ta_1") {bit = false;}
941  else if (bitname == "ta_2") {bit = false;}
942  else if (bitname == "ta_3") {bit = false;}
943  else if (bitname == "trkflt") {bit = false;}
944  else if (bitname == "tsf0b2b") {bit = false;}
945  else if (bitname == "tsf1b2b") {bit = false;}
946  else if (bitname == "tsf2b2b") {bit = false;}
947  else if (bitname == "grlgg1") {bit = false;}
948  else if (bitname == "grlgg2") {bit = false;}
949 
950  //KLM TOP ECL not ready
951  else if (bitname == "ecl_bhauni") {bit = false;}
952  else if (bitname == "cdctop_0") {bit = false;}
953  else if (bitname == "cdctop_1") {bit = false;}
954  else if (bitname == "cdctop_2") {bit = false;}
955  else if (bitname == "cdctop_3") {bit = false;}
956  else if (bitname == "top_0") {bit = false;}
957  else if (bitname == "top_1") {bit = false;}
958  else if (bitname == "top_2") {bit = false;}
959  else if (bitname == "top_bb") {bit = false;}
960  else if (bitname == "top_active") {bit = false;}
961 
962  //other trigger bits
963  else if (bitname == "itsfb2b") {bit = false;}
964  else if (bitname == "inp159") {bit = false;}
965 
966  //DITTO: please don't change the WARNING message below.
967  //If you change it, please update the test trg_tsim_check_warnings.py accordingly.
968  else B2WARNING("Unknown bitname" << LogVar("bitname", bitname));
969 
970  trgInfo->setInputBits(i, bit);
971  }
972 
973 }
974 
975 void
976 TRGGRLProjectsModule::endRun()
977 {
978  B2DEBUG(20, "TRGGRLProjectsModule ... endRun called ");
979 }
980 
981 
982 
983 void TRGGRLProjectsModule::terminate()
984 {
985 
986 }
987 
988 
Base class for Modules.
Definition: Module.h:72
Class to hold Lorentz transformations from/to CMS and boost vector.
const TLorentzRotation rotateLabToCms() const
Returns Lorentz transformation from Lab to CMS.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
A module to simulate the Global Decision Logic.
A class of TC Mapping.
Definition: TrgEclMapping.h:26
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
TVector3 getTCPosition(int)
TC position (cm)
Class to store variables with their name which were sent to the logging service.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.