Belle II Software  release-05-02-19
TrgEclBhabha.cc
1 //---------------------------------------------------------------
2 // $Id$
3 //---------------------------------------------------------------
4 // Filename : TrgEclBhabha.cc
5 // Section : TRG ECL
6 // Owner : InSoo Lee/Yuuji Unno
7 // Email : islee@hep.hanyang.ac.kr / yunno@post.kek.jp
8 //---------------------------------------------------------------
9 // Description : A class to tag Bhabha Veto
10 //
11 // Belle type Bhabha (Bhbha00())
12 //
13 // Theta Id combination
14 // bit id | combination(FWD|BWD) | Energy Threshold (FWD|BWD) GeV
15 // 0 | 1+2+3 | 16+17 | 4.0 | 2.5
16 // 1 | 3 | 15 | 4.0 | 2.5
17 // 2 | 4 | 14+15 | 4.0 | 2.5
18 // 3 | 5 | 14+15 | 4.0 | 2.5
19 // 4 | 4+5 | 14 | 4.0 | 2.5
20 // 5 | 5 | 13+14 | 4.0 | 2.5
21 // 6 | 5 | 12+13 | 4.0 | 2.5
22 // 7 | 5+6 | 13 | 4.0 | 2.5
23 // 8 | 5+6 | 12 | 4.0 | 2.5
24 // 9 | 6+7 | 12 | 4.0 | 2.5
25 // 10 | 6+7 | 11 | 4.0 | 2.5
26 // 11 | 7+8 | 11 | 4.0 | 2.5
27 // 12 | 8 | 10+11 | 3.0 | 3.0
28 // 13 | 8+9 | 9+10 | 3.5 | 3.0
29 //
30 // Belle 2 3D Bhabha (Bhabha01)
31 //
32 // - Cluster base Logic
33 // - Compare all clusters satisfying following conditions
34 // @ Bhabha for veto
35 // 160 degree < (CM Phi_Cluster 1 - CM Phi_Cluster 2) < 200 degree
36 // 165 degree < (CM Theta Cluster 1 + CM Theta Cluster 2 ) < 190 degree
37 // Boths Cluster CM E > 3 GeV and One of cluster CM E > 4.5 GeV
38 // @ Bhabha for calibration (selection bhabha)
39 // 140 degree < (CM Phi_Cluster 1 - CM Phi_Cluster 2) < 220 degree
40 // 160 degree < (CM Theta Cluster 1 + CM Theta Cluster 2 ) < 200 degree
41 // Boths Cluster CM E > 2.5 GeV and One of cluster CM E > 4.0 GeV
42 //
43 // ee->mumu selection
44 // 160 degree < (CM Phi_Cluster 1 - CM Phi_Cluster 2) < 200 degree
45 // 165 degree < (CM Theta Cluster 1 + CM Theta Cluster 2 ) < 190 degree
46 // Boths Cluster CM E < 2 GeV and One of cluster CM E < 2 GeV
47 //
48 //
49 //---------------------------------------------------------------
50 // $Log$ 2018-08-24 First Version
51 // $Log$ 2019-05-13 Update selection bhabha and mumu
52 //---------------------------------------------------------------
53 
54 #define TRG_SHORT_NAMES
55 #define TRGECLCLUSTER_SHORT_NAMES
56 #include <framework/gearbox/Unit.h>
57 #include "framework/datastore/StoreArray.h"
58 
59 
60 #include <trg/ecl/TrgEclBhabha.h>
61 
62 #include "trg/ecl/dataobjects/TRGECLCluster.h"
63 
64 using namespace std;
65 using namespace Belle2;
66 //
67 //
68 //
69 TrgEclBhabha::TrgEclBhabha(): _mumuThreshold(20)
70 {
71  BhabhaComb.clear();
72  MaxTCId.clear();
73  ClusterEnergy.clear();
74  ClusterTiming.clear();
75  ClusterPosition.clear();
76 
77  _TCMap = new TrgEclMapping();
78 
79  _database = new TrgEclDataBase();
80 
81  _2DBhabhaThresholdFWD.clear();
82  _2DBhabhaThresholdBWD.clear();
84  _3DBhabhaVetoThreshold.clear();
86  _3DBhabhaVetoAngle.clear();
87  _mumuAngle.clear();
88 
89 
90 
91  _2DBhabhaThresholdFWD = {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 30, 35}; // /100 MeV
92  _2DBhabhaThresholdBWD = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30}; // /100 MeV
93  _3DBhabhaVetoThreshold = {30, 45}; // /100 MeV
94  _3DBhabhaSelectionThreshold = {20, 40}; // /100 MeV
95  _3DBhabhaVetoAngle = {160, 200, 165, 190}; // /100 MeV
96  _3DBhabhaSelectionAngle = {140, 220, 160, 200}; // /100 MeV
97  _mumuAngle = {160, 200, 165, 190}; // degree
98 
99 
100 }
101 
103 {
104  delete _TCMap;
105 }
106 bool TrgEclBhabha::GetBhabha00(std::vector<double> PhiRingSum) //Belle 2D Bhabha veto method
107 {
108  bool BtoBflag = false;
109 
110 
111  vector<int> k011 = {3, 1, 2, 3 }; // (1) F1+F2 + F3 + B1+B2
112  vector<int> k012 = {2, 16, 17}; // (1) F1+F2 + F3 + B1+B2
113 
114  vector<int> k021 = {1, 3}; // (2) F3 + C12
115  vector<int> k022 = {1, 15}; // (2) F3 + C12
116 
117  vector<int> k03 = {2, 2, 3}; // (3) F2 + F3
118 
119  vector<int> k04 = {1, 4}; // (4) C1 + backward gap
120 
121  vector<int> k051 = {1, 4 }; // (5) C1+C11+C12
122  vector<int> k052 = {2, 14, 15}; // (5) C1+C11+C12
123 
124  vector<int> k061 = {1, 5}; // (6) C2+C11+C12
125  vector<int> k062 = {2, 14, 15}; // (6) C2+C11+C12
126 
127  vector<int> k071 = {2, 4, 5}; // (7) C1+C2+C11
128  vector<int> k072 = {1, 14}; // (7) C1+C2+C11
129 
130  vector<int> k081 = {1, 5}; // (8) C2+C10+C11
131  vector<int> k082 = {2, 13, 14}; // (8) C2+C10+C11
132 
133  vector<int> k091 = {1, 5 }; // (9) C2+C9+C10
134  vector<int> k092 = {2, 12, 13}; // (9) C2+C9+C10
135 
136  vector<int> k101 = {2, 5, 6}; // (10) C2+C3+C10
137  vector<int> k102 = {1, 13}; // (10) C2+C3+C10
138 
139  vector<int> k111 = {2, 5, 6}; // (11) C2+C3+C9
140  vector<int> k112 = {1, 12}; // (11) C2+C3+C9
141 
142  vector<int> k121 = {2, 6, 7}; // (9) C3+C4+C9
143  vector<int> k122 = {1, 12}; // (9) C3+C4+C9
144 
145  vector<int> k131 = {2, 6, 7}; // (10) C3+C4+C8
146  vector<int> k132 = {1, 11}; // (10) C3+C4+C8
147 
148  vector<int> k141 = {2, 7, 8}; // (11) C4+C5+C8
149  vector<int> k142 = {1, 11}; // (11) C4+C5+C8
150 
151 
152  vector<int> k151 = {1, 8}; // (9) C5+C7+C8
153  vector<int> k152 = {2, 10, 11}; // (9) C5+C7+C8
154 
155  vector<int> k161 = {2, 8, 9}; // (10) C5+C6+C7
156  vector<int> k162 = {2, 9, 10}; // (10) C5+C6+C7
157 
158  vector<int> k17 = {2, 14, 15}; // (11) C11+C12 +forward gap
159 
160  vector<int> k18 = {1, 16}; // (11) B1 + forward gap
161 
162  vector<int> kLOM1 = {2, 2, 3 }; // (1) F1+F2 + F3 + B1+B2
163  vector<int> kLOM2 = {2, 16, 17}; // (1) F1+F2 + F3 + B1+B2
164 
165  BhabhaComb.clear();
166  BhabhaComb.resize(32, 0.0);
167  for (int iii = 1; iii <= k011[0]; iii++) { BhabhaComb[0] += PhiRingSum[k011[iii] - 1];}
168  for (int iii = 1; iii <= k012[0]; iii++) { BhabhaComb[1] += PhiRingSum[k012[iii] - 1];}
169  for (int iii = 1; iii <= k021[0]; iii++) { BhabhaComb[2] += PhiRingSum[k021[iii] - 1]; }
170  for (int iii = 1; iii <= k022[0]; iii++) { BhabhaComb[3] += PhiRingSum[k022[iii] - 1]; }
171  for (int iii = 1; iii <= k03[0]; iii++) { BhabhaComb[4] += PhiRingSum[k03[iii] - 1]; }
172  for (int iii = 1; iii <= k04[0]; iii++) { BhabhaComb[5] += PhiRingSum[k04[iii] - 1]; }
173  for (int iii = 1; iii <= k051[0]; iii++) { BhabhaComb[6] += PhiRingSum[k051[iii] - 1]; }
174  for (int iii = 1; iii <= k052[0]; iii++) { BhabhaComb[7] += PhiRingSum[k052[iii] - 1]; }
175  for (int iii = 1; iii <= k061[0]; iii++) { BhabhaComb[8] += PhiRingSum[k061[iii] - 1]; }
176  for (int iii = 1; iii <= k062[0]; iii++) { BhabhaComb[9] += PhiRingSum[k062[iii] - 1]; }
177  for (int iii = 1; iii <= k071[0]; iii++) { BhabhaComb[10] += PhiRingSum[k071[iii] - 1]; }
178  for (int iii = 1; iii <= k072[0]; iii++) { BhabhaComb[11] += PhiRingSum[k072[iii] - 1]; }
179  for (int iii = 1; iii <= k081[0]; iii++) { BhabhaComb[12] += PhiRingSum[k081[iii] - 1]; }
180  for (int iii = 1; iii <= k082[0]; iii++) { BhabhaComb[13] += PhiRingSum[k082[iii] - 1]; }
181  for (int iii = 1; iii <= k091[0]; iii++) { BhabhaComb[14] += PhiRingSum[k091[iii] - 1]; }
182  for (int iii = 1; iii <= k092[0]; iii++) { BhabhaComb[15] += PhiRingSum[k092[iii] - 1]; }
183  for (int iii = 1; iii <= k101[0]; iii++) { BhabhaComb[16] += PhiRingSum[k101[iii] - 1]; }
184  for (int iii = 1; iii <= k102[0]; iii++) { BhabhaComb[17] += PhiRingSum[k102[iii] - 1]; }
185  for (int iii = 1; iii <= k111[0]; iii++) { BhabhaComb[18] += PhiRingSum[k111[iii] - 1]; }
186  for (int iii = 1; iii <= k112[0]; iii++) { BhabhaComb[19] += PhiRingSum[k112[iii] - 1]; }
187  for (int iii = 1; iii <= k121[0]; iii++) { BhabhaComb[20] += PhiRingSum[k121[iii] - 1]; }
188  for (int iii = 1; iii <= k122[0]; iii++) { BhabhaComb[21] += PhiRingSum[k122[iii] - 1]; }
189  for (int iii = 1; iii <= k131[0]; iii++) { BhabhaComb[22] += PhiRingSum[k131[iii] - 1]; }
190  for (int iii = 1; iii <= k132[0]; iii++) { BhabhaComb[23] += PhiRingSum[k132[iii] - 1]; }
191  for (int iii = 1; iii <= k141[0]; iii++) { BhabhaComb[24] += PhiRingSum[k141[iii] - 1]; }
192  for (int iii = 1; iii <= k142[0]; iii++) { BhabhaComb[25] += PhiRingSum[k142[iii] - 1]; }
193  for (int iii = 1; iii <= k151[0]; iii++) { BhabhaComb[26] += PhiRingSum[k151[iii] - 1]; }
194  for (int iii = 1; iii <= k152[0]; iii++) { BhabhaComb[27] += PhiRingSum[k152[iii] - 1]; }
195  for (int iii = 1; iii <= k161[0]; iii++) { BhabhaComb[28] += PhiRingSum[k161[iii] - 1]; }
196  for (int iii = 1; iii <= k162[0]; iii++) { BhabhaComb[29] += PhiRingSum[k162[iii] - 1]; }
197  for (int iii = 1; iii <= kLOM1[0]; iii++) { BhabhaComb[30] += PhiRingSum[kLOM1[iii] - 1];}
198  for (int iii = 1; iii <= kLOM2[0]; iii++) { BhabhaComb[31] += PhiRingSum[kLOM2[iii] - 1];}
199 
200 
201  BtoBflag =
202  ((BhabhaComb[0] * 10 >= _2DBhabhaThresholdFWD[0] && BhabhaComb[1] * 10 >= _2DBhabhaThresholdBWD[0]) ||
203  (BhabhaComb[2] * 10 >= _2DBhabhaThresholdFWD[1] && BhabhaComb[3] * 10 >= _2DBhabhaThresholdBWD[1]) ||
204  (BhabhaComb[6] * 10 >= _2DBhabhaThresholdFWD[2] && BhabhaComb[7] * 10 >= _2DBhabhaThresholdBWD[2]) ||
205  (BhabhaComb[8] * 10 >= _2DBhabhaThresholdFWD[3] && BhabhaComb[9] * 10 >= _2DBhabhaThresholdBWD[3]) ||
206  (BhabhaComb[10] * 10 >= _2DBhabhaThresholdFWD[4] && BhabhaComb[11] * 10 >= _2DBhabhaThresholdBWD[4]) ||
207  (BhabhaComb[12] * 10 >= _2DBhabhaThresholdFWD[5] && BhabhaComb[13] * 10 >= _2DBhabhaThresholdBWD[5]) ||
208  (BhabhaComb[14] * 10 >= _2DBhabhaThresholdFWD[6] && BhabhaComb[15] * 10 >= _2DBhabhaThresholdBWD[6]) ||
209  (BhabhaComb[16] * 10 >= _2DBhabhaThresholdFWD[7] && BhabhaComb[17] * 10 >= _2DBhabhaThresholdBWD[7]) ||
210  (BhabhaComb[18] * 10 >= _2DBhabhaThresholdFWD[8] && BhabhaComb[19] * 10 >= _2DBhabhaThresholdBWD[8]) ||
211  (BhabhaComb[20] * 10 >= _2DBhabhaThresholdFWD[9] && BhabhaComb[21] * 10 >= _2DBhabhaThresholdBWD[9]) ||
212  (BhabhaComb[22] * 10 >= _2DBhabhaThresholdFWD[10] && BhabhaComb[23] * 10 >= _2DBhabhaThresholdBWD[10]) ||
213  (BhabhaComb[24] * 10 >= _2DBhabhaThresholdFWD[11] && BhabhaComb[25] * 10 >= _2DBhabhaThresholdBWD[11]) ||
214  (BhabhaComb[26] * 10 >= _2DBhabhaThresholdFWD[12] && BhabhaComb[27] * 10 >= _2DBhabhaThresholdBWD[12]) ||
215  (BhabhaComb[28] * 10 >= _2DBhabhaThresholdFWD[13] && BhabhaComb[29] * 10 >= _2DBhabhaThresholdBWD[13]));
216 
217  int bhabha01 = 0;
218  int bhabha02 = 0;
219  int bhabha03 = 0;
220  int bhabha04 = 0;
221  int bhabha05 = 0;
222  int bhabha06 = 0;
223  int bhabha07 = 0;
224  int bhabha08 = 0;
225  int bhabha09 = 0;
226  int bhabha10 = 0;
227  int bhabha11 = 0;
228  int bhabha12 = 0;
229  int bhabha13 = 0;
230  int bhabha14 = 0;
231 
232  if ((BhabhaComb[0] * 10 >= _2DBhabhaThresholdFWD[0] && BhabhaComb[1] * 10 >= _2DBhabhaThresholdBWD[0])) {bhabha01 = 1;}
233  if ((BhabhaComb[2] * 10 >= _2DBhabhaThresholdFWD[1] && BhabhaComb[3] * 10 >= _2DBhabhaThresholdBWD[1])) {bhabha02 = 1;}
234  if ((BhabhaComb[6] * 10 >= _2DBhabhaThresholdFWD[2] && BhabhaComb[7] * 10 >= _2DBhabhaThresholdBWD[2])) {bhabha03 = 1;}
235  if ((BhabhaComb[8] * 10 >= _2DBhabhaThresholdFWD[3] && BhabhaComb[9] * 10 >= _2DBhabhaThresholdBWD[3])) {bhabha04 = 1;}
236  if ((BhabhaComb[10] * 10 >= _2DBhabhaThresholdFWD[4] && BhabhaComb[11] * 10 >= _2DBhabhaThresholdBWD[4])) {bhabha05 = 1;}
237  if ((BhabhaComb[12] * 10 >= _2DBhabhaThresholdFWD[5] && BhabhaComb[13] * 10 >= _2DBhabhaThresholdBWD[5])) {bhabha06 = 1;}
238  if ((BhabhaComb[14] * 10 >= _2DBhabhaThresholdFWD[6] && BhabhaComb[15] * 10 >= _2DBhabhaThresholdBWD[6])) {bhabha07 = 1;}
239  if ((BhabhaComb[16] * 10 >= _2DBhabhaThresholdFWD[7] && BhabhaComb[17] * 10 >= _2DBhabhaThresholdBWD[7])) {bhabha08 = 1;}
240  if ((BhabhaComb[18] * 10 >= _2DBhabhaThresholdFWD[8] && BhabhaComb[19] * 10 >= _2DBhabhaThresholdBWD[8])) {bhabha09 = 1;}
241  if ((BhabhaComb[20] * 10 >= _2DBhabhaThresholdFWD[9] && BhabhaComb[21] * 10 >= _2DBhabhaThresholdBWD[9])) {bhabha10 = 1;}
242  if ((BhabhaComb[22] * 10 >= _2DBhabhaThresholdFWD[10] && BhabhaComb[23] * 10 >= _2DBhabhaThresholdBWD[10])) {bhabha11 = 1;}
243  if ((BhabhaComb[24] * 10 >= _2DBhabhaThresholdFWD[11] && BhabhaComb[25] * 10 >= _2DBhabhaThresholdBWD[11])) {bhabha12 = 1;}
244  if ((BhabhaComb[26] * 10 >= _2DBhabhaThresholdFWD[12] && BhabhaComb[27] * 10 >= _2DBhabhaThresholdBWD[12])) {bhabha13 = 1;}
245  if ((BhabhaComb[28] * 10 >= _2DBhabhaThresholdFWD[13] && BhabhaComb[29] * 10 >= _2DBhabhaThresholdBWD[13])) {bhabha14 = 1;}
246 
247 
248  BhabhaComb.clear();
249  BhabhaComb.push_back(bhabha01);
250  BhabhaComb.push_back(bhabha02);
251  BhabhaComb.push_back(bhabha03);
252  BhabhaComb.push_back(bhabha04);
253  BhabhaComb.push_back(bhabha05);
254  BhabhaComb.push_back(bhabha06);
255  BhabhaComb.push_back(bhabha07);
256  BhabhaComb.push_back(bhabha08);
257  BhabhaComb.push_back(bhabha09);
258  BhabhaComb.push_back(bhabha10);
259  BhabhaComb.push_back(bhabha11);
260  BhabhaComb.push_back(bhabha12);
261  BhabhaComb.push_back(bhabha13);
262  BhabhaComb.push_back(bhabha14);
263  BhabhaComb.push_back(0);
264  BhabhaComb.push_back(0);
265  BhabhaComb.push_back(0);
266  BhabhaComb.push_back(0);
267 
268  return BtoBflag;
269 }
270 
271 bool TrgEclBhabha::GetBhabha01() // veto bhabha
272 {
273  //-----------------------
274  // 3D Bhabha veto
275  //------------------------
276  bool BtoBFlag = false;
277  bool BhabhaFlag = false;
278 
279  //
280  //
281  // Read Cluster Table
282  //
283  //
284  MaxTCId.clear();
285  ClusterEnergy.clear();
286  ClusterTiming.clear();
287  ClusterPosition.clear();
288  // int EventId = 0;
289  StoreArray<TRGECLCluster> trgeclClusterArray;
290  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
291  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
292  // EventId = aTRGECLCluster ->getEventId();
293  int maxTCId = aTRGECLCluster ->getMaxTCId();
294  double clusterenergy = aTRGECLCluster ->getEnergyDep();
295  double clustertiming = aTRGECLCluster -> getTimeAve();
296  TVector3 clusterposition(aTRGECLCluster ->getPositionX(), aTRGECLCluster ->getPositionY(), aTRGECLCluster ->getPositionZ());
297  ClusterTiming.push_back(clustertiming);
298  ClusterEnergy.push_back(clusterenergy);
299  ClusterPosition.push_back(clusterposition);
300  MaxTCId.push_back(maxTCId);
301  }
302  const int ncluster = ClusterEnergy.size();
303  //
304  //
305  //
306  //
307  BhabhaComb.clear();
308  BhabhaComb.resize(18, 0);
309 
310  BhabhaFlag = false;
311  for (int icluster = 0; icluster < ncluster ; icluster++) {
312  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
313  BtoBFlag = false;
314 
315  if (icluster == jcluster) {continue;}
316  int lut1 = _database->Get3DBhabhaLUT(MaxTCId[icluster]);
317  int lut2 = _database->Get3DBhabhaLUT(MaxTCId[jcluster]);
318  int energy1 = 15 & lut1;
319  int energy2 = 15 & lut2;
320  lut1 >>= 4;
321  lut2 >>= 4;
322  int phi1 = 511 & lut1;
323  int phi2 = 511 & lut2;
324  lut1 >>= 9;
325  lut2 >>= 9;
326  int theta1 = lut1;
327  int theta2 = lut2;
328 
329 
330  int dphi = abs(phi1 - phi2);
331  if (dphi > 180) {dphi = 360 - dphi;}
332  int thetaSum = theta1 + theta2;
333 
334  if (dphi > _3DBhabhaVetoAngle[0] && thetaSum > _3DBhabhaVetoAngle[2] && thetaSum < _3DBhabhaVetoAngle[3]) {BtoBFlag = true;}
335  if ((ClusterEnergy[icluster] * 100.) > _3DBhabhaVetoThreshold[0] * energy1
336  && (ClusterEnergy[jcluster] * 100.) > _3DBhabhaVetoThreshold[0] * (energy2)
337  && ((ClusterEnergy[icluster] * 100.) > _3DBhabhaVetoThreshold[1] * energy1
338  || (ClusterEnergy[jcluster] * 100.) > _3DBhabhaVetoThreshold[1] * (energy2))) {
339  if (BtoBFlag) {BhabhaFlag = true;}
340  }
341 
342  }
343 
344 
345 
346 
347  }
348 
349 
350 
351  return BhabhaFlag;
352 }
353 
354 bool TrgEclBhabha::GetBhabha02() // selection bhabha
355 {
356  //-----------------------
357  // 3D Bhabha veto
358  //------------------------
359  bool BtoBFlag = false;
360  bool BhabhaFlag = false;
361 
362  //
363  //
364  // Read Cluster Table
365  //
366  //
367  MaxTCId.clear();
368  ClusterEnergy.clear();
369  ClusterTiming.clear();
370  ClusterPosition.clear();
371  // int EventId = 0;
372  StoreArray<TRGECLCluster> trgeclClusterArray;
373  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
374  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
375  // EventId = aTRGECLCluster ->getEventId();
376  int maxTCId = aTRGECLCluster ->getMaxTCId();
377  double clusterenergy = aTRGECLCluster ->getEnergyDep();
378  double clustertiming = aTRGECLCluster -> getTimeAve();
379  TVector3 clusterposition(aTRGECLCluster ->getPositionX(), aTRGECLCluster ->getPositionY(), aTRGECLCluster ->getPositionZ());
380  ClusterTiming.push_back(clustertiming);
381  ClusterEnergy.push_back(clusterenergy);
382  ClusterPosition.push_back(clusterposition);
383  MaxTCId.push_back(maxTCId);
384  }
385  const int ncluster = ClusterEnergy.size();
386  //
387  //
388  //
389  //
390  BhabhaComb.clear();
391  BhabhaComb.resize(18, 0);
392 
393  BhabhaFlag = false;
394  for (int icluster = 0; icluster < ncluster ; icluster++) {
395  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
396  BtoBFlag = false;
397 
398  if (icluster == jcluster) {continue;}
399  int lut1 = _database->Get3DBhabhaLUT(MaxTCId[icluster]);
400  int lut2 = _database->Get3DBhabhaLUT(MaxTCId[jcluster]);
401  int energy1 = 15 & lut1;
402  int energy2 = 15 & lut2;
403  lut1 >>= 4;
404  lut2 >>= 4;
405  int phi1 = 511 & lut1;
406  int phi2 = 511 & lut2;
407  lut1 >>= 9;
408  lut2 >>= 9;
409  int theta1 = lut1;
410  int theta2 = lut2;
411 
412 
413  int dphi = abs(phi1 - phi2);
414  if (dphi > 180) {dphi = 360 - dphi;}
415  int thetaSum = theta1 + theta2;
416 
417 
418  if (dphi > _3DBhabhaSelectionAngle[0] && dphi < _3DBhabhaSelectionAngle[1] && thetaSum > _3DBhabhaSelectionAngle[2]
419  && thetaSum < _3DBhabhaSelectionAngle[3]) {BtoBFlag = true;}
420  if ((ClusterEnergy[icluster] * 100.) > _3DBhabhaSelectionThreshold[0] * energy1
421  && (ClusterEnergy[jcluster] * 100.) > _3DBhabhaSelectionThreshold[0] * (energy2)
422  && ((ClusterEnergy[icluster] * 100.) > _3DBhabhaSelectionThreshold[1] * energy1
423  || (ClusterEnergy[jcluster] * 100.) > _3DBhabhaSelectionThreshold[1] * (energy2))) {
424  if (BtoBFlag) {BhabhaFlag = true;}
425  }
426 
427  }
428 
429 
430 
431 
432  }
433 
434 
435 
436  return BhabhaFlag;
437 }
438 
439 
440 
441 bool TrgEclBhabha::Getmumu() // MuMu bit
442 {
443  //-----------------------
444  // 3D Bhabha veto
445  //------------------------
446  bool BtoBFlag = false;
447  bool BhabhaFlag = false;
448 
449  //
450  //
451  // Read Cluster Table
452  //
453  //
454  MaxTCId.clear();
455  ClusterEnergy.clear();
456  ClusterTiming.clear();
457  ClusterPosition.clear();
458  // int EventId = 0;
459  StoreArray<TRGECLCluster> trgeclClusterArray;
460  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
461  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
462  // EventId = aTRGECLCluster ->getEventId();
463  int maxTCId = aTRGECLCluster ->getMaxTCId();
464  double clusterenergy = aTRGECLCluster ->getEnergyDep();
465  double clustertiming = aTRGECLCluster -> getTimeAve();
466  TVector3 clusterposition(aTRGECLCluster ->getPositionX(), aTRGECLCluster ->getPositionY(), aTRGECLCluster ->getPositionZ());
467  ClusterTiming.push_back(clustertiming);
468  ClusterEnergy.push_back(clusterenergy);
469  ClusterPosition.push_back(clusterposition);
470  MaxTCId.push_back(maxTCId);
471  }
472  const int ncluster = ClusterEnergy.size();
473  //
474  //
475  //
476  //
477  BhabhaComb.clear();
478  BhabhaComb.resize(18, 0);
479 
480  BtoBFlag = false;
481 
482  for (int icluster = 0; icluster < ncluster ; icluster++) {
483  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
484 
485  if (icluster == jcluster) {continue;}
486  int lut1 = _database->Get3DBhabhaLUT(MaxTCId[icluster]);
487  int lut2 = _database->Get3DBhabhaLUT(MaxTCId[jcluster]);
488  lut1 >>= 4;
489  lut2 >>= 4;
490  int phi1 = 511 & lut1;
491  int phi2 = 511 & lut2;
492  lut1 >>= 9;
493  lut2 >>= 9;
494  int theta1 = lut1;
495  int theta2 = lut2;
496 
497 
498  int dphi = abs(phi1 - phi2);
499  if (dphi > 180) {dphi = 360 - dphi;}
500  int thetaSum = theta1 + theta2;
501 
502 
503  if (dphi > _mumuAngle[0] && dphi < _mumuAngle[1] && thetaSum > _mumuAngle[2] && thetaSum < _mumuAngle[3]) {BtoBFlag = true;}
504  if ((ClusterEnergy[icluster] * 10.) < _mumuThreshold && (ClusterEnergy[jcluster] * 10.) < _mumuThreshold) {
505  if (BtoBFlag) {BhabhaFlag = true;}
506  }
507 
508  }
509 
510 
511 
512 
513 
514  }
515 
516 
517 
518  return BhabhaFlag;
519 }
Belle2::TRGECLCluster::getMaxTCId
int getMaxTCId() const
The method to get the Maximum(center) TC id.
Definition: TRGECLCluster.h:113
Belle2::TRGECLCluster
Example Detector.
Definition: TRGECLCluster.h:25
Belle2::TrgEclBhabha::GetBhabha02
bool GetBhabha02()
Belle II 3D Bhabha method for selection.
Definition: TrgEclBhabha.cc:354
Belle2::TrgEclBhabha::~TrgEclBhabha
virtual ~TrgEclBhabha()
Constructor.
Definition: TrgEclBhabha.cc:102
Belle2::TrgEclBhabha::ClusterTiming
std::vector< double > ClusterTiming
Cluster Timing.
Definition: TrgEclBhabha.h:92
Belle2::TrgEclBhabha::_database
TrgEclDataBase * _database
Object of Trigger ECL DataBase.
Definition: TrgEclBhabha.h:83
Belle2::TrgEclDataBase
class TrgEclDataBase;
Definition: TrgEclDataBase.h:24
Belle2::TrgEclBhabha::GetBhabha01
bool GetBhabha01()
Belle II 3D Bhabha method for veto.
Definition: TrgEclBhabha.cc:271
Belle2::TrgEclMapping
A class of TC Mapping.
Definition: TrgEclMapping.h:31
Belle2::TrgEclBhabha::_3DBhabhaVetoThreshold
std::vector< double > _3DBhabhaVetoThreshold
3D Veto Bhabha Energy Threshold
Definition: TrgEclBhabha.h:102
Belle2::TrgEclBhabha::ClusterEnergy
std::vector< double > ClusterEnergy
Cluster Energy.
Definition: TrgEclBhabha.h:90
Belle2::TrgEclBhabha::Getmumu
bool Getmumu()
MuMu selection for calibration.
Definition: TrgEclBhabha.cc:441
Belle2::TrgEclBhabha::BhabhaComb
std::vector< double > BhabhaComb
Bhabha Combination.
Definition: TrgEclBhabha.h:86
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrgEclBhabha::_TCMap
TrgEclMapping * _TCMap
Object of TC Mapping.
Definition: TrgEclBhabha.h:81
Belle2::TrgEclBhabha::MaxTCId
std::vector< double > MaxTCId
Max TC Id.
Definition: TrgEclBhabha.h:88
Belle2::TrgEclBhabha::ClusterPosition
std::vector< TVector3 > ClusterPosition
Cluster Timing.
Definition: TrgEclBhabha.h:94
Belle2::TrgEclBhabha::_3DBhabhaSelectionThreshold
std::vector< double > _3DBhabhaSelectionThreshold
3D Selection Bhabha Energy Threshold
Definition: TrgEclBhabha.h:100
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::TrgEclBhabha::_2DBhabhaThresholdBWD
std::vector< double > _2DBhabhaThresholdBWD
2D Bhabha Energy Threshold
Definition: TrgEclBhabha.h:98
Belle2::TrgEclBhabha::_2DBhabhaThresholdFWD
std::vector< double > _2DBhabhaThresholdFWD
2D Bhabha Energy Threshold
Definition: TrgEclBhabha.h:96
Belle2::TRGECLCluster::getEnergyDep
double getEnergyDep() const
The method to get deposited energy.
Definition: TRGECLCluster.h:120
Belle2::TrgEclBhabha::_3DBhabhaVetoAngle
std::vector< double > _3DBhabhaVetoAngle
3D Veto Bhabha Energy Angle
Definition: TrgEclBhabha.h:106
Belle2::TrgEclDataBase::Get3DBhabhaLUT
int Get3DBhabhaLUT(int)
TC CM Phi
Definition: TrgEclDataBase.cc:580
Belle2::TrgEclBhabha::_3DBhabhaSelectionAngle
std::vector< double > _3DBhabhaSelectionAngle
3D Selection Bhabha Energy Angle
Definition: TrgEclBhabha.h:104
Belle2::TrgEclBhabha::_mumuThreshold
double _mumuThreshold
mumu bit Energy Threshold
Definition: TrgEclBhabha.h:108
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226
Belle2::TrgEclBhabha::GetBhabha00
bool GetBhabha00(std::vector< double >)
Destructor.
Definition: TrgEclBhabha.cc:106
Belle2::TrgEclBhabha::_mumuAngle
std::vector< double > _mumuAngle
mumu bit Angle
Definition: TrgEclBhabha.h:110