Belle II Software  release-05-02-19
TRGGRLProjectsModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: czhearty *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
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>
27 
28 #include <TLorentzVector.h>
29 #include <TMath.h>
30 
31 #include <iostream>
32 #include <fstream>
33 
34 
35 using namespace std;
36 using namespace Belle2;
37 using namespace ECL;
38 
39 
40 //..ECL look up tables
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;
47 
48 
49 //..Other
50 double radtodeg;
51 //int iEvent(0);
52 //int nInAcc=0;
53 
54 //..Trigger counters
55 //const int ntrig = 18;
56 //int trigbit[ntrig];
57 //int prescale[ntrig];
58 //int RawCount[ntrig];
59 //bool passBeforePrescale[ntrig];
60 //int pass2[ntrig][ntrig]={};
61 //int pass2Acc[ntrig][ntrig]={};
62 //std::vector<string> trigName;
63 
64 //int nUseful;
65 //std::vector<int> itUseful;
66 
67 //-----------------------------------------------------------------
68 // Register the Module
69 //-----------------------------------------------------------------
70 REG_MODULE(TRGGRLProjects)
71 
72 //-----------------------------------------------------------------
73 // Implementation
74 //-----------------------------------------------------------------
75 
77 {
78  // Set module properties
79 
80  // string desc = "TRGGRLProjectsModule(" + version() + ")";
81  setDescription("TRGGRLProjectsModule");
82  setPropertyFlags(c_ParallelProcessingCertified);
83 
84  addParam("DebugLevel", _debugLevel, "TRGGRL debug level", _debugLevel);
85  addParam("ConfigFile",
86  m_configFilename,
87  "The filename of CDC trigger config file",
88  m_configFilename);
89  addParam("SimulationMode",
90  m_simulationMode,
91  "TRGGRL simulation switch",
92  1);
93  addParam("FastSimulationMode",
94  m_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",
139  100.0);
140  addParam("ClusEngThreshold", m_energythreshold, "The energy threshold of clusters", {0.1, 0.3, 1.0, 2.0});
141 }
142 
143 //-----------------------------------------------------------------------------------------
144 //-----------------------------------------------------------------------------------------
145 void TRGGRLProjectsModule::initialize()
146 {
147  radtodeg = 180. / TMath::Pi();
148  //..Trigger ThetaID for each trigger cell. Could be replaced by getMaxThetaId() for newer MC
149  TrgEclMapping* trgecl_obj = new TrgEclMapping();
150  for (int tc = 1; tc <= 576; tc++) {
151  TCThetaID.push_back(trgecl_obj->getTCThetaIdFromTCId(tc));
152  }
153 
154  //-----------------------------------------------------------------------------------------
155  //..ECL look up tables
156  PCmsLabTransform boostrotate;
157  for (int tc = 1; tc <= 576; tc++) {
158 
159  //..Four vector of a 1 GeV lab photon at this TC
160  TVector3 CellPosition = trgecl_obj->getTCPosition(tc);
161  TLorentzVector CellLab(1., 1., 1., 1.);
162  CellLab.SetTheta(CellPosition.Theta());
163  CellLab.SetPhi(CellPosition.Phi());
164  CellLab.SetRho(1.);
165  CellLab.SetE(1.);
166 
167  //..cotan Theta and phi in lab
168  TCPhiLab.push_back(CellPosition.Phi()*radtodeg);
169  double tantheta = tan(CellPosition.Theta());
170  TCcotThetaLab.push_back(1. / tantheta);
171 
172  //..Corresponding 4 vector in the COM frame
173  TLorentzVector CellCOM = boostrotate.rotateLabToCms() * CellLab;
174  TCThetaCOM.push_back(CellCOM.Theta()*radtodeg);
175  TCPhiCOM.push_back(CellCOM.Phi()*radtodeg);
176 
177  //..Scale to give 1 GeV in the COM frame
178  TC1GeV.push_back(1. / CellCOM.E());
179  }
180 
181  //m_TRGGRLInfo.registerInDataStore(m_TrgGrlInformationName);
182 
183 }
184 
185 void
186 TRGGRLProjectsModule::beginRun()
187 {
188  B2DEBUG(20, "TRGGDLModule ... beginRun called ");
189  //...GDL config. name...
190 }
191 //-----------------------------------------------------------------------------------------
192 //-----------------------------------------------------------------------------------------
193 void TRGGRLProjectsModule::event()
194 {
195  //if(iEvent%1000==0) {cout << "TRGGRLProjects event " << iEvent << endl;}
196  //iEvent++;
197 
198  //---------------------------------------------------------------------
199  //..Read in the necessary arrays
200  StoreArray<TRGECLTrg> trgArray;
201  //StoreArray<MCParticle> MCParticleArray;
202  StoreArray<CDCTriggerTrack> cdc2DTrkArray("TRGCDC2DFinderTracks");
203  StoreArray<CDCTriggerTrack> cdc3DTrkArray("TRGCDC3DFitterTracks");
204  StoreArray<TRGECLCluster> eclTrgClusterArray("TRGECLClusters");
205  StoreArray<TRGGRLMATCH> trackphimatch("TRGPhiMatchTracks");
206  StoreArray<TRGGRLMATCHKLM> trackKLMmatch("TRGKLMMatchTracks");
207  StoreArray<KLMTriggerTrack> klmtracklist("TRGKLMTracks");
208  StoreArray<TRGGRLPHOTON> grlphoton("TRGGRLPhotons");
209  StoreObjPtr<BinnedEventT0> m_eventTime;
210  StoreObjPtr<TRGGRLInfo> trgInfo(m_TrgGrlInformationName);
211  //trgInfo.create();
212  //---------------------------------------------------------------------
213  //..Use only clusters within 100 ns of event timing (from ECL).
214  int ntrgArray = trgArray.getEntries();
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);
222  if (tcT < 100.) {
223  int TC = eclTrgClusterArray[ic]->getMaxTCId();
224  selTC.push_back(TC);
225  selTheta.push_back(TCThetaID[TC - 1]);
226  selE.push_back(eclTrgClusterArray[ic]->getEnergyDep());
227  }
228  }
229 
230  //---------------------------------------------------------------------
231  //..Trigger objects from CDC alone
232  // nTrk3D nTrkZ10 nTrkZ25
233  int nTrk2D = cdc2DTrkArray.getEntries();
234  int nTrk3D = cdc3DTrkArray.getEntries();
235  int nTrkZ10 = 0;
236  int nTrkZ25 = 0;
237  int nTrkZ40 = 0;
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++;}
243  }
244 
245  trgInfo->setN3Dfittertrk(nTrk3D);
246  trgInfo->setN3DfittertrkZ10(nTrkZ10);
247  trgInfo->setN3DfittertrkZ25(nTrkZ25);
248 
249  //---------------------------------------------------------------------
250  //..Trigger objects using single ECL clusters
251  // nClust n300MeV n2GeV n2GeV414 n2GeV231516 n2GeV117 n1GeV415 n1GeV2316 n1GeV117
252  int nClust = selTC.size();
253  int n300MeV = 0;
254  int n2GeV = 0;
255  int n2GeV414 = 0;
256  int n2GeV231516 = 0;
257  int n2GeV117 = 0;
258  int n1GeV415 = 0;
259  int n1GeV2316 = 0;
260  int n1GeV117 = 0;
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)) {
265  n2GeV++;
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++;}
269  }
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++;}
274  }
275  }
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);
285 
286  //---------------------------------------------------------------------
287  //..Trigger objects using back-to-back ECL clusters, plus Bhabha vetoes
288  // nPhiPairHigh nPhiPairLow n3DPair nECLBhabha nTrkBhabha
289  int nPhiPairHigh = 0;
290  int nPhiPairLow = 0;
291  int n3DPair = 0;
292  int nECLBhabha = 0;
293  int nTrkBhabha = 0;
294  for (int i0 = 0; i0 < nClust - 1; i0++) {
295  for (int i1 = i0 + 1; i1 < nClust; i1++) {
296 
297  //..back to back in phi
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++;}
302 
303  //..3D
304  float thetaSum = TCThetaCOM[selTC[i0] - 1] + TCThetaCOM[selTC[i1] - 1];
305  if (dphi > 160. && thetaSum > 160. && thetaSum < 200.) {n3DPair++;}
306 
307  //..ecl Bhabha
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])) {
310  nECLBhabha++;
311 
312  //..Bhabha also using the CDC
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;}
324  }
325  if (c0matched && c1matched) {nTrkBhabha++;}
326  }
327  }
328  }
329 
330  trgInfo->setBhabhaVeto(nTrkBhabha);
331  trgInfo->seteclBhabhaVeto(nECLBhabha);
332  trgInfo->setPairHigh(nPhiPairHigh);
333  trgInfo->setPairLow(nPhiPairLow);
334  trgInfo->set3DPair(n3DPair);
335 
336 
337  //---------------------------------------------------------------------
338  //..Trigger objects using 1 track and at least 1 cluster
339  // nSameHem1Trk nOppHem1Trk
340  int nSameHem1Trk = 0;
341  int nOppHem1Trk = 0;
342  if (nTrk3D == 1) {
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++;}
351  }
352  }
353 
354  trgInfo->setNSameHem1Trk(nSameHem1Trk);
355  trgInfo->setNOppHem1Trk(nOppHem1Trk);
356 
357  //---------------------------------------------------------------------
358  //..Trk b2b
359  int Trk_b2b_1to3 = 0;
360  int Trk_b2b_1to5 = 0;
361  int Trk_b2b_1to7 = 0;
362  int Trk_b2b_1to9 = 0;
363  int Trk_open90 = 0;
364  for (int itrk = 0; itrk < cdc2DTrkArray.getEntries(); itrk++) {
365 
366  int phi_i_itrk = (int)((cdc2DTrkArray[itrk]->getPhi0()) * (180 / M_PI) / 10);
367 
368  for (int jtrk = 0; jtrk < cdc2DTrkArray.getEntries(); jtrk++) {
369  if (itrk <= jtrk) continue;
370 
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;}
377  }
378  }
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);
384 
385  //---------------------------------------------------------------------
386  //..cluster b2b
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++) {
392 
393  double x_iclu = eclTrgClusterArray[iclu]->getPositionX();
394  double y_iclu = eclTrgClusterArray[iclu]->getPositionY();
395 
396  int phi_iclu = 0;
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);}
401 
402  for (int jclu = 0; jclu < eclTrgClusterArray.getEntries(); jclu++) {
403  if (iclu <= jclu) continue;
404 
405  double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
406  double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
407 
408  int phi_jclu = 0;
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);}
413 
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;}
418  }
419  }
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);
424 
425 
426  //---------------------------------------------------------------------
427  //..eed, fed
428 
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);
434 
435  //---------------------------------------------------------------------
436  //..Track-cluster b2b
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)));
445  int charge = 0;
446  if (_r > 0) {charge = 1;}
447  else if (_r < 0) {charge = -1;}
448  else {charge = 0;}
449 
450  double phi_CDC = 0.0;
451  if (charge == 1) {
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;
455  } else {
456  phi_CDC = _phi;
457  }
458 
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);
462 
463  for (int jclu = 0; jclu < eclTrgClusterArray.getEntries(); jclu++) {
464 
465  double x_jclu = eclTrgClusterArray[jclu]->getPositionX();
466  double y_jclu = eclTrgClusterArray[jclu]->getPositionY();
467 
468  int phi_jclu = 0;
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);}
473 
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;}
478  }
479  }
480 
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);
485 
486  //---------------------------------------------------------------------
487  //..fp, eeb, fep
488 
489  int fp = 0;
490  if (cdc2DTrkArray.getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fp = 1;}
491  trgInfo->setfp(fp);
492 
493  int eeb = 0;
494  if (trackphimatch.getEntries() == 2 && Trk_b2b_1to5 == 1) {eeb = 1;}
495  trgInfo->seteeb(eeb);
496 
497  int fep = 0;
498  if (cdc2DTrkArray.getEntries() == 1 && trackphimatch.getEntries() == 1 && Trkcluster_b2b_1to5 == 1) {fep = 1;}
499  trgInfo->setfep(fep);
500 
501 
502  //---------------------------------------------------------------------
503  //..Get input bits from StoreArray<TRGECLTrg> trgArray
504  //..Bit order is hard-coded in trg/ecl/src/TrgEclMaster.cc
505 
506  int ECLtoGDL[4] = {0, 0, 0, 0};
507  if (ntrgArray > 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);
512  }
513 
514  // elow: 47
515  bool elow = (ECLtoGDL[1] & (1 << (47 - 32 * 1))) != 0;
516  // ehigh: 48
517  bool ehigh = (ECLtoGDL[1] & (1 << (48 - 32 * 1))) != 0;
518  // elum: 49
519  bool elum = (ECLtoGDL[1] & (1 << (49 - 32 * 1))) != 0;
520  // ecl_bha: 19
521  bool ecl_bha = (ECLtoGDL[0] & (1 << (19 - 32 * 0))) != 0;
522  // bha_type0: 20
523  bool bha_type0 = (ECLtoGDL[0] & (1 << (20 - 32 * 0))) != 0;
524  // bha_type1: 21
525  bool bha_type1 = (ECLtoGDL[0] & (1 << (21 - 32 * 0))) != 0;
526  // bha_type2: 22
527  bool bha_type2 = (ECLtoGDL[0] & (1 << (22 - 32 * 0))) != 0;
528  // bha_type3: 23
529  bool bha_type3 = (ECLtoGDL[0] & (1 << (23 - 32 * 0))) != 0;
530  // bha_type4: 24
531  bool bha_type4 = (ECLtoGDL[0] & (1 << (24 - 32 * 0))) != 0;
532  // bha_type5: 25
533  bool bha_type5 = (ECLtoGDL[0] & (1 << (25 - 32 * 0))) != 0;
534  // bha_type6: 26
535  bool bha_type6 = (ECLtoGDL[0] & (1 << (26 - 32 * 0))) != 0;
536  // bha_type7: 27
537  bool bha_type7 = (ECLtoGDL[0] & (1 << (27 - 32 * 0))) != 0;
538  // bha_type8: 28
539  bool bha_type8 = (ECLtoGDL[0] & (1 << (28 - 32 * 0))) != 0;
540  // bha_type9: 29
541  bool bha_type9 = (ECLtoGDL[0] & (1 << (29 - 32 * 0))) != 0;
542  // bha_type10: 30
543  bool bha_type10 = (ECLtoGDL[0] & (1 << (30 - 32 * 0))) != 0;
544  // bha_type11: 31
545  bool bha_type11 = (ECLtoGDL[0] & (1 << (31 - 32 * 0))) != 0;
546  // bha_type12: 32
547  bool bha_type12 = (ECLtoGDL[1] & (1 << (32 - 32 * 1))) != 0;
548  // bha_type13: 33
549  bool bha_type13 = (ECLtoGDL[1] & (1 << (33 - 32 * 1))) != 0;
550 
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;
555 
556  // ecl_bg_0: 57
557  bool ecl_bg_0 = (ECLtoGDL[1] & (1 << (57 - 32 * 1))) != 0;
558  // ecl_bg_1: 58
559  bool ecl_bg_1 = (ECLtoGDL[1] & (1 << (58 - 32 * 1))) != 0;
560  // ecl_bg_2: 59
561  bool ecl_bg_2 = (ECLtoGDL[1] & (1 << (59 - 32 * 1))) != 0;
562 
563  bool ecl_active = ntrgArray > 0;
564 
565  // ecl_timing_fwd: 15
566  bool ecl_timing_fwd = (ECLtoGDL[0] & (1 << (15 - 32 * 0))) != 0;
567  // ecl_timing_brl: 16
568  bool ecl_timing_brl = (ECLtoGDL[0] & (1 << (16 - 32 * 0))) != 0;
569  // ecl_timing_bwd: 17
570  bool ecl_timing_bwd = (ECLtoGDL[0] & (1 << (17 - 32 * 0))) != 0;
571  // ecl_phys: 18
572  bool ecl_phys = (ECLtoGDL[0] & (1 << (18 - 32 * 0))) != 0;
573  // ecl_oflo: 60
574  bool ecl_oflo = (ECLtoGDL[1] & (1 << (60 - 32 * 1))) != 0;
575  // ecl_3dbha: 61
576  bool ecl_3dbha = (ECLtoGDL[1] & (1 << (61 - 32 * 1))) != 0;
577  // ecl_lml_0: 62
578  bool ecl_lml_0 = (ECLtoGDL[1] & (1 << (62 - 32 * 1))) != 0;
579  // ecl_lml_1: 63
580  bool ecl_lml_1 = (ECLtoGDL[1] & (1 << (63 - 32 * 1))) != 0;
581  // ecl_lml_2: 64
582  bool ecl_lml_2 = (ECLtoGDL[2] & (1 << (64 - 32 * 2))) != 0;
583  // ecl_lml_3: 65
584  bool ecl_lml_3 = (ECLtoGDL[2] & (1 << (65 - 32 * 2))) != 0;
585  // ecl_lml_4: 66
586  bool ecl_lml_4 = (ECLtoGDL[2] & (1 << (66 - 32 * 2))) != 0;
587  // ecl_lml_5: 67
588  bool ecl_lml_5 = (ECLtoGDL[2] & (1 << (67 - 32 * 2))) != 0;
589  // ecl_lml_6: 68
590  bool ecl_lml_6 = (ECLtoGDL[2] & (1 << (68 - 32 * 2))) != 0;
591  // ecl_lml_7: 69
592  bool ecl_lml_7 = (ECLtoGDL[2] & (1 << (69 - 32 * 2))) != 0;
593  // ecl_lml_8: 70
594  bool ecl_lml_8 = (ECLtoGDL[2] & (1 << (70 - 32 * 2))) != 0;
595  // ecl_lml_9: 71
596  bool ecl_lml_9 = (ECLtoGDL[2] & (1 << (71 - 32 * 2))) != 0;
597  // ecl_lml_10: 72
598  bool ecl_lml_10 = (ECLtoGDL[2] & (1 << (72 - 32 * 2))) != 0;
599  // ecl_lml_11: 73
600  bool ecl_lml_11 = (ECLtoGDL[2] & (1 << (73 - 32 * 2))) != 0;
601  // ecl_lml_11: 78
602  bool ecl_lml_12 = (ECLtoGDL[2] & (1 << (78 - 32 * 2))) != 0;
603  // ecl_lml_11: 79
604  bool ecl_lml_13 = (ECLtoGDL[2] & (1 << (79 - 32 * 2))) != 0;
605  // ecl_mumu: 75
606  bool ecl_mumu = (ECLtoGDL[2] & (1 << (75 - 32 * 2))) != 0;
607  // ecl_bst: 77
608  bool ecl_bst = (ECLtoGDL[2] & (1 << (77 - 32 * 2))) != 0;
609 
610  //---------------------------------------------------------------------
611  //..Other input bits
612 
613  bool cdc_active = false;
614  if (m_eventTime->hasBinnedEventT0(Const::CDC)) {
615  if (m_eventTime->getBinnedEventT0(Const::CDC) != 0) { cdc_active = true; }
616  }
617 
618  bool klm_hit = klmtracklist.getEntries() > 0;
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;
622 
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);
627 
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);
632 
633  int n_c2gev = 0;
634  for (int i = 0; i < trackphimatch.getEntries(); i++) {
635  if (trackphimatch[i]->get_e() >= 2.0) {n_c2gev++;}
636  }
637 
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);
642 
643  int N_KLMb2b = 0;
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++; }
650  }
651  }
652 
653  bool klmb2b_0 = (N_KLMb2b == 1);
654  bool klmb2b_1 = (N_KLMb2b == 2);
655  bool klmb2b_2 = (N_KLMb2b > 2);
656 
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++; }
661  }
662 
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);
667 
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);
672 
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();
686 
687  //---------------------------------------------------------------------
688  //..Filling InputBits
689  //..Naming is based on trg/gdl/src/TrgBitData.cc
690 
691 
692  if (!m_InputBitsDB)B2INFO("no database of gdl input bits");
693 
694  int N_InputBits = m_InputBitsDB->getninbit();
695 
696  for (int i = 0; i < N_InputBits; i++) {
697  std::string bitname(m_InputBitsDB->getinbitname(i));
698 
699  bool bit = false;
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;}
834 
835  // Neuro track, TSIM not ready
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;}
840 
841  //GRL related bits, not ready
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;}
854 
855  //KLM TOP ECL not ready
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;}
868 
869  //random trigger
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;}
874 
875  //other trigger bits
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;}
880 
881  //DITTO: please don't change the WARNING message below.
882  //If you change it, please update the test trg_tsim_check_warnings.py accordingly.
883  else B2WARNING("Unknown bitname" << LogVar("bitname", bitname));
884 
885  trgInfo->setInputBits(i, bit);
886  }
887 
888 }
889 
890 void
891 TRGGRLProjectsModule::endRun()
892 {
893  B2DEBUG(20, "TRGGRLProjectsModule ... endRun called ");
894 }
895 
896 
897 
898 void TRGGRLProjectsModule::terminate()
899 {
900 
901 }
902 
903 
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::TrgEclMapping
A class of TC Mapping.
Definition: TrgEclMapping.h:31
Belle2::TRGGRLProjectsModule
A module to simulate the Global Decision Logic.
Definition: TRGGRLProjectsModule.h:33
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::TrgEclMapping::getTCPosition
TVector3 getTCPosition(int)
TC position (cm)
Definition: TrgEclMapping.cc:251
LogVar
Class to store variables with their name which were sent to the logging service.
Definition: LogVariableStream.h:24
Belle2::PCmsLabTransform
Class to hold Lorentz transformations from/to CMS and boost vector.
Definition: PCmsLabTransform.h:37
Belle2::PCmsLabTransform::rotateLabToCms
const TLorentzRotation rotateLabToCms() const
Returns Lorentz transformation from Lab to CMS.
Definition: PCmsLabTransform.h:74
Belle2::TrgEclMapping::getTCThetaIdFromTCId
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
Definition: TrgEclMapping.cc:200
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226