Belle II Software  release-06-00-14
TrgEclBhabha.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 //---------------------------------------------------------------
10 // Description : A class to tag Bhabha Veto
11 //
12 // Belle type Bhabha (Bhbha00())
13 //
14 // Theta Id combination
15 // bit id | combination(FWD|BWD) | Energy Threshold (FWD|BWD) GeV
16 // 0 | 1+2+3 | 16+17 | 4.0 | 2.5
17 // 1 | 3 | 15 | 4.0 | 2.5
18 // 2 | 4 | 14+15 | 4.0 | 2.5
19 // 3 | 5 | 14+15 | 4.0 | 2.5
20 // 4 | 4+5 | 14 | 4.0 | 2.5
21 // 5 | 5 | 13+14 | 4.0 | 2.5
22 // 6 | 5 | 12+13 | 4.0 | 2.5
23 // 7 | 5+6 | 13 | 4.0 | 2.5
24 // 8 | 5+6 | 12 | 4.0 | 2.5
25 // 9 | 6+7 | 12 | 4.0 | 2.5
26 // 10 | 6+7 | 11 | 4.0 | 2.5
27 // 11 | 7+8 | 11 | 4.0 | 2.5
28 // 12 | 8 | 10+11 | 3.0 | 3.0
29 // 13 | 8+9 | 9+10 | 3.5 | 3.0
30 //
31 // Belle 2 3D Bhabha (Bhabha01)
32 //
33 // - Cluster base Logic
34 // - Compare all clusters satisfying following conditions
35 // @ Bhabha for veto
36 // 160 degree < (CM Phi_Cluster 1 - CM Phi_Cluster 2) < 200 degree
37 // 165 degree < (CM Theta Cluster 1 + CM Theta Cluster 2 ) < 190 degree
38 // Boths Cluster CM E > 3 GeV and One of cluster CM E > 4.5 GeV
39 // @ Bhabha for calibration (selection bhabha)
40 // 140 degree < (CM Phi_Cluster 1 - CM Phi_Cluster 2) < 220 degree
41 // 160 degree < (CM Theta Cluster 1 + CM Theta Cluster 2 ) < 200 degree
42 // Boths Cluster CM E > 2.5 GeV and One of cluster CM E > 4.0 GeV
43 //
44 // ee->mumu selection
45 // 160 degree < (CM Phi_Cluster 1 - CM Phi_Cluster 2) < 200 degree
46 // 165 degree < (CM Theta Cluster 1 + CM Theta Cluster 2 ) < 190 degree
47 // Boths Cluster CM E < 2 GeV and One of cluster CM E < 2 GeV
48 //
49 //---------------------------------------------------------------
50 
51 #define TRG_SHORT_NAMES
52 #define TRGECLCLUSTER_SHORT_NAMES
53 #include <framework/gearbox/Unit.h>
54 #include "framework/datastore/StoreArray.h"
55 
56 #include <trg/ecl/TrgEclBhabha.h>
57 
58 #include "trg/ecl/dataobjects/TRGECLCluster.h"
59 
60 using namespace std;
61 using namespace Belle2;
62 //
63 //
64 //
65 TrgEclBhabha::TrgEclBhabha():
66  _mumuThreshold(20),
67  m_3DBhabhaVetoInTrackThetaRegion(3, 15)
68 {
69  BhabhaComb.clear();
70  MaxTCId.clear();
71  ClusterEnergy.clear();
72  ClusterTiming.clear();
73  ClusterPosition.clear();
74 
75  _TCMap = new TrgEclMapping();
76 
77  _database = new TrgEclDataBase();
78 
79  _2DBhabhaThresholdFWD.clear();
80  _2DBhabhaThresholdBWD.clear();
82  _3DBhabhaVetoThreshold.clear();
84  _3DBhabhaVetoAngle.clear();
85  _mumuAngle.clear();
86  m_3DBhabhaAddAngleCut.clear();
87 
88  _2DBhabhaThresholdFWD = {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 30, 35}; // (100 MeV)
89  _2DBhabhaThresholdBWD = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30}; // (100 MeV)
90  _3DBhabhaVetoThreshold = {30, 45}; // (low, high) (100 MeV)
91  _3DBhabhaSelectionThreshold = {25, 40}; // (low, high) (100 MeV)
92  _3DBhabhaVetoAngle = {160, 200, 165, 190}; // (phi_low, phi_high, theta_low, theta_high) (degree)
93  _3DBhabhaSelectionAngle = {140, 220, 160, 200}; // (phi_low, phi_high, theta_low, theta_high) (degree)
94  _mumuAngle = {160, 200, 165, 190}; // (phi_low, phi_high, theta_low, theta_high) (degree)
95  m_3DBhabhaAddAngleCut = {150, 210, 160, 200}; // (phi_low, phi_high, theta_low, theta_high) (degree)
96 
97  m_3DBhabhaVetoInTrackFlag = -10;
98  m_3DBhabhaVetoClusterTCIds.clear();
99  m_3DBhabhaVetoClusterEnergies.clear();
100  m_3DBhabhaVetoClusterTimings.clear();
101  m_3DBhabhaVetoClusterThetaIds.clear();
102 
103  m_3DBhabhaVetoInTrackFlag = -10;
104 
105 }
106 //
107 //
108 //
110 {
111  delete _TCMap;
112  delete _database;
113 }
114 //
115 //
116 //
117 bool TrgEclBhabha::GetBhabha00(std::vector<double> PhiRingSum) //Belle 2D Bhabha veto method
118 {
119  bool BtoBflag = false;
120 
121 
122  vector<int> k011 = {3, 1, 2, 3 }; // (1) F1+F2 + F3 + B1+B2
123  vector<int> k012 = {2, 16, 17}; // (1) F1+F2 + F3 + B1+B2
124 
125  vector<int> k021 = {1, 3}; // (2) F3 + C12
126  vector<int> k022 = {1, 15}; // (2) F3 + C12
127 
128  vector<int> k03 = {2, 2, 3}; // (3) F2 + F3
129 
130  vector<int> k04 = {1, 4}; // (4) C1 + backward gap
131 
132  vector<int> k051 = {1, 4 }; // (5) C1+C11+C12
133  vector<int> k052 = {2, 14, 15}; // (5) C1+C11+C12
134 
135  vector<int> k061 = {1, 5}; // (6) C2+C11+C12
136  vector<int> k062 = {2, 14, 15}; // (6) C2+C11+C12
137 
138  vector<int> k071 = {2, 4, 5}; // (7) C1+C2+C11
139  vector<int> k072 = {1, 14}; // (7) C1+C2+C11
140 
141  vector<int> k081 = {1, 5}; // (8) C2+C10+C11
142  vector<int> k082 = {2, 13, 14}; // (8) C2+C10+C11
143 
144  vector<int> k091 = {1, 5 }; // (9) C2+C9+C10
145  vector<int> k092 = {2, 12, 13}; // (9) C2+C9+C10
146 
147  vector<int> k101 = {2, 5, 6}; // (10) C2+C3+C10
148  vector<int> k102 = {1, 13}; // (10) C2+C3+C10
149 
150  vector<int> k111 = {2, 5, 6}; // (11) C2+C3+C9
151  vector<int> k112 = {1, 12}; // (11) C2+C3+C9
152 
153  vector<int> k121 = {2, 6, 7}; // (9) C3+C4+C9
154  vector<int> k122 = {1, 12}; // (9) C3+C4+C9
155 
156  vector<int> k131 = {2, 6, 7}; // (10) C3+C4+C8
157  vector<int> k132 = {1, 11}; // (10) C3+C4+C8
158 
159  vector<int> k141 = {2, 7, 8}; // (11) C4+C5+C8
160  vector<int> k142 = {1, 11}; // (11) C4+C5+C8
161 
162 
163  vector<int> k151 = {1, 8}; // (9) C5+C7+C8
164  vector<int> k152 = {2, 10, 11}; // (9) C5+C7+C8
165 
166  vector<int> k161 = {2, 8, 9}; // (10) C5+C6+C7
167  vector<int> k162 = {2, 9, 10}; // (10) C5+C6+C7
168 
169  //vector<int> k17 = {2, 14, 15}; // (11) C11+C12 +forward gap
170 
171  //vector<int> k18 = {1, 16}; // (11) B1 + forward gap
172 
173  vector<int> kLOM1 = {2, 2, 3 }; // (1) F1+F2 + F3 + B1+B2
174  vector<int> kLOM2 = {2, 16, 17}; // (1) F1+F2 + F3 + B1+B2
175 
176  BhabhaComb.clear();
177  BhabhaComb.resize(32, 0.0);
178  for (int iii = 1; iii <= k011[0]; iii++) { BhabhaComb[0] += PhiRingSum[k011[iii] - 1];}
179  for (int iii = 1; iii <= k012[0]; iii++) { BhabhaComb[1] += PhiRingSum[k012[iii] - 1];}
180  for (int iii = 1; iii <= k021[0]; iii++) { BhabhaComb[2] += PhiRingSum[k021[iii] - 1]; }
181  for (int iii = 1; iii <= k022[0]; iii++) { BhabhaComb[3] += PhiRingSum[k022[iii] - 1]; }
182  for (int iii = 1; iii <= k03[0]; iii++) { BhabhaComb[4] += PhiRingSum[k03[iii] - 1]; }
183  for (int iii = 1; iii <= k04[0]; iii++) { BhabhaComb[5] += PhiRingSum[k04[iii] - 1]; }
184  for (int iii = 1; iii <= k051[0]; iii++) { BhabhaComb[6] += PhiRingSum[k051[iii] - 1]; }
185  for (int iii = 1; iii <= k052[0]; iii++) { BhabhaComb[7] += PhiRingSum[k052[iii] - 1]; }
186  for (int iii = 1; iii <= k061[0]; iii++) { BhabhaComb[8] += PhiRingSum[k061[iii] - 1]; }
187  for (int iii = 1; iii <= k062[0]; iii++) { BhabhaComb[9] += PhiRingSum[k062[iii] - 1]; }
188  for (int iii = 1; iii <= k071[0]; iii++) { BhabhaComb[10] += PhiRingSum[k071[iii] - 1]; }
189  for (int iii = 1; iii <= k072[0]; iii++) { BhabhaComb[11] += PhiRingSum[k072[iii] - 1]; }
190  for (int iii = 1; iii <= k081[0]; iii++) { BhabhaComb[12] += PhiRingSum[k081[iii] - 1]; }
191  for (int iii = 1; iii <= k082[0]; iii++) { BhabhaComb[13] += PhiRingSum[k082[iii] - 1]; }
192  for (int iii = 1; iii <= k091[0]; iii++) { BhabhaComb[14] += PhiRingSum[k091[iii] - 1]; }
193  for (int iii = 1; iii <= k092[0]; iii++) { BhabhaComb[15] += PhiRingSum[k092[iii] - 1]; }
194  for (int iii = 1; iii <= k101[0]; iii++) { BhabhaComb[16] += PhiRingSum[k101[iii] - 1]; }
195  for (int iii = 1; iii <= k102[0]; iii++) { BhabhaComb[17] += PhiRingSum[k102[iii] - 1]; }
196  for (int iii = 1; iii <= k111[0]; iii++) { BhabhaComb[18] += PhiRingSum[k111[iii] - 1]; }
197  for (int iii = 1; iii <= k112[0]; iii++) { BhabhaComb[19] += PhiRingSum[k112[iii] - 1]; }
198  for (int iii = 1; iii <= k121[0]; iii++) { BhabhaComb[20] += PhiRingSum[k121[iii] - 1]; }
199  for (int iii = 1; iii <= k122[0]; iii++) { BhabhaComb[21] += PhiRingSum[k122[iii] - 1]; }
200  for (int iii = 1; iii <= k131[0]; iii++) { BhabhaComb[22] += PhiRingSum[k131[iii] - 1]; }
201  for (int iii = 1; iii <= k132[0]; iii++) { BhabhaComb[23] += PhiRingSum[k132[iii] - 1]; }
202  for (int iii = 1; iii <= k141[0]; iii++) { BhabhaComb[24] += PhiRingSum[k141[iii] - 1]; }
203  for (int iii = 1; iii <= k142[0]; iii++) { BhabhaComb[25] += PhiRingSum[k142[iii] - 1]; }
204  for (int iii = 1; iii <= k151[0]; iii++) { BhabhaComb[26] += PhiRingSum[k151[iii] - 1]; }
205  for (int iii = 1; iii <= k152[0]; iii++) { BhabhaComb[27] += PhiRingSum[k152[iii] - 1]; }
206  for (int iii = 1; iii <= k161[0]; iii++) { BhabhaComb[28] += PhiRingSum[k161[iii] - 1]; }
207  for (int iii = 1; iii <= k162[0]; iii++) { BhabhaComb[29] += PhiRingSum[k162[iii] - 1]; }
208  for (int iii = 1; iii <= kLOM1[0]; iii++) { BhabhaComb[30] += PhiRingSum[kLOM1[iii] - 1];}
209  for (int iii = 1; iii <= kLOM2[0]; iii++) { BhabhaComb[31] += PhiRingSum[kLOM2[iii] - 1];}
210 
211 
212  BtoBflag =
213  ((BhabhaComb[0] * 10 >= _2DBhabhaThresholdFWD[0] &&
214  BhabhaComb[1] * 10 >= _2DBhabhaThresholdBWD[0]) ||
215  (BhabhaComb[2] * 10 >= _2DBhabhaThresholdFWD[1] &&
216  BhabhaComb[3] * 10 >= _2DBhabhaThresholdBWD[1]) ||
217  (BhabhaComb[6] * 10 >= _2DBhabhaThresholdFWD[2] &&
218  BhabhaComb[7] * 10 >= _2DBhabhaThresholdBWD[2]) ||
219  (BhabhaComb[8] * 10 >= _2DBhabhaThresholdFWD[3] &&
220  BhabhaComb[9] * 10 >= _2DBhabhaThresholdBWD[3]) ||
221  (BhabhaComb[10] * 10 >= _2DBhabhaThresholdFWD[4] &&
222  BhabhaComb[11] * 10 >= _2DBhabhaThresholdBWD[4]) ||
223  (BhabhaComb[12] * 10 >= _2DBhabhaThresholdFWD[5] &&
224  BhabhaComb[13] * 10 >= _2DBhabhaThresholdBWD[5]) ||
225  (BhabhaComb[14] * 10 >= _2DBhabhaThresholdFWD[6] &&
226  BhabhaComb[15] * 10 >= _2DBhabhaThresholdBWD[6]) ||
227  (BhabhaComb[16] * 10 >= _2DBhabhaThresholdFWD[7] &&
228  BhabhaComb[17] * 10 >= _2DBhabhaThresholdBWD[7]) ||
229  (BhabhaComb[18] * 10 >= _2DBhabhaThresholdFWD[8] &&
230  BhabhaComb[19] * 10 >= _2DBhabhaThresholdBWD[8]) ||
231  (BhabhaComb[20] * 10 >= _2DBhabhaThresholdFWD[9] &&
232  BhabhaComb[21] * 10 >= _2DBhabhaThresholdBWD[9]) ||
233  (BhabhaComb[22] * 10 >= _2DBhabhaThresholdFWD[10] &&
234  BhabhaComb[23] * 10 >= _2DBhabhaThresholdBWD[10]) ||
235  (BhabhaComb[24] * 10 >= _2DBhabhaThresholdFWD[11] &&
236  BhabhaComb[25] * 10 >= _2DBhabhaThresholdBWD[11]) ||
237  (BhabhaComb[26] * 10 >= _2DBhabhaThresholdFWD[12] &&
238  BhabhaComb[27] * 10 >= _2DBhabhaThresholdBWD[12]) ||
239  (BhabhaComb[28] * 10 >= _2DBhabhaThresholdFWD[13] &&
240  BhabhaComb[29] * 10 >= _2DBhabhaThresholdBWD[13]));
241 
242  int bhabha01 = 0;
243  int bhabha02 = 0;
244  int bhabha03 = 0;
245  int bhabha04 = 0;
246  int bhabha05 = 0;
247  int bhabha06 = 0;
248  int bhabha07 = 0;
249  int bhabha08 = 0;
250  int bhabha09 = 0;
251  int bhabha10 = 0;
252  int bhabha11 = 0;
253  int bhabha12 = 0;
254  int bhabha13 = 0;
255  int bhabha14 = 0;
256 
257  if ((BhabhaComb[0] * 10 >= _2DBhabhaThresholdFWD[0] &&
258  BhabhaComb[1] * 10 >= _2DBhabhaThresholdBWD[0])) {bhabha01 = 1;}
259  if ((BhabhaComb[2] * 10 >= _2DBhabhaThresholdFWD[1] &&
260  BhabhaComb[3] * 10 >= _2DBhabhaThresholdBWD[1])) {bhabha02 = 1;}
261  if ((BhabhaComb[6] * 10 >= _2DBhabhaThresholdFWD[2] &&
262  BhabhaComb[7] * 10 >= _2DBhabhaThresholdBWD[2])) {bhabha03 = 1;}
263  if ((BhabhaComb[8] * 10 >= _2DBhabhaThresholdFWD[3] &&
264  BhabhaComb[9] * 10 >= _2DBhabhaThresholdBWD[3])) {bhabha04 = 1;}
265  if ((BhabhaComb[10] * 10 >= _2DBhabhaThresholdFWD[4] &&
266  BhabhaComb[11] * 10 >= _2DBhabhaThresholdBWD[4])) {bhabha05 = 1;}
267  if ((BhabhaComb[12] * 10 >= _2DBhabhaThresholdFWD[5] &&
268  BhabhaComb[13] * 10 >= _2DBhabhaThresholdBWD[5])) {bhabha06 = 1;}
269  if ((BhabhaComb[14] * 10 >= _2DBhabhaThresholdFWD[6] &&
270  BhabhaComb[15] * 10 >= _2DBhabhaThresholdBWD[6])) {bhabha07 = 1;}
271  if ((BhabhaComb[16] * 10 >= _2DBhabhaThresholdFWD[7] &&
272  BhabhaComb[17] * 10 >= _2DBhabhaThresholdBWD[7])) {bhabha08 = 1;}
273  if ((BhabhaComb[18] * 10 >= _2DBhabhaThresholdFWD[8] &&
274  BhabhaComb[19] * 10 >= _2DBhabhaThresholdBWD[8])) {bhabha09 = 1;}
275  if ((BhabhaComb[20] * 10 >= _2DBhabhaThresholdFWD[9] &&
276  BhabhaComb[21] * 10 >= _2DBhabhaThresholdBWD[9])) {bhabha10 = 1;}
277  if ((BhabhaComb[22] * 10 >= _2DBhabhaThresholdFWD[10] &&
278  BhabhaComb[23] * 10 >= _2DBhabhaThresholdBWD[10])) {bhabha11 = 1;}
279  if ((BhabhaComb[24] * 10 >= _2DBhabhaThresholdFWD[11] &&
280  BhabhaComb[25] * 10 >= _2DBhabhaThresholdBWD[11])) {bhabha12 = 1;}
281  if ((BhabhaComb[26] * 10 >= _2DBhabhaThresholdFWD[12] &&
282  BhabhaComb[27] * 10 >= _2DBhabhaThresholdBWD[12])) {bhabha13 = 1;}
283  if ((BhabhaComb[28] * 10 >= _2DBhabhaThresholdFWD[13] &&
284  BhabhaComb[29] * 10 >= _2DBhabhaThresholdBWD[13])) {bhabha14 = 1;}
285 
286  BhabhaComb.clear();
287  BhabhaComb.push_back(bhabha01);
288  BhabhaComb.push_back(bhabha02);
289  BhabhaComb.push_back(bhabha03);
290  BhabhaComb.push_back(bhabha04);
291  BhabhaComb.push_back(bhabha05);
292  BhabhaComb.push_back(bhabha06);
293  BhabhaComb.push_back(bhabha07);
294  BhabhaComb.push_back(bhabha08);
295  BhabhaComb.push_back(bhabha09);
296  BhabhaComb.push_back(bhabha10);
297  BhabhaComb.push_back(bhabha11);
298  BhabhaComb.push_back(bhabha12);
299  BhabhaComb.push_back(bhabha13);
300  BhabhaComb.push_back(bhabha14);
301  BhabhaComb.push_back(0);
302  BhabhaComb.push_back(0);
303  BhabhaComb.push_back(0);
304  BhabhaComb.push_back(0);
305 
306  return BtoBflag;
307 }
308 //========================================================
309 // 3D Bhabha veto
310 //========================================================
312 {
313  //
314  // Read Cluster Table
315  //
316  MaxTCId.clear();
317  ClusterEnergy.clear();
318  ClusterTiming.clear();
319  ClusterPosition.clear();
320  m_3DBhabhaVetoInTrackFlag = -1;
321  m_3DBhabhaVetoClusterTCIds.clear();
322  m_3DBhabhaVetoClusterEnergies.clear();
323  m_3DBhabhaVetoClusterTimings.clear();
324  m_3DBhabhaVetoClusterThetaIds.clear();
325  // int EventId = 0;
326  StoreArray<TRGECLCluster> trgeclClusterArray;
327  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
328  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
329  // EventId = aTRGECLCluster->getEventId();
330  int maxTCId = aTRGECLCluster->getMaxTCId();
331  double clusterenergy = aTRGECLCluster->getEnergyDep();
332  double clustertiming = aTRGECLCluster->getTimeAve();
333  TVector3 clusterposition(aTRGECLCluster->getPositionX(),
334  aTRGECLCluster->getPositionY(),
335  aTRGECLCluster->getPositionZ());
336  ClusterTiming.push_back(clustertiming);
337  ClusterEnergy.push_back(clusterenergy);
338  ClusterPosition.push_back(clusterposition);
339  MaxTCId.push_back(maxTCId);
340  }
341  const int ncluster = ClusterEnergy.size();
342  //
343  //
344  //
345  BhabhaComb.clear();
346  BhabhaComb.resize(18, 0);
347 
348  int cl_idx1 = -1;
349  int cl_idx2 = -1;
350  bool BhabhaFlag = false;
351  for (int icluster = 0; icluster < ncluster ; icluster++) {
352  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
353  bool BtoBFlag = false;
354 
355  if (icluster == jcluster) {continue;}
356 
357  int energy1 = 0;
358  int energy2 = 0;
359  int dphi = 0;
360  int thetaSum = 0;
361  get2CLETP(MaxTCId[icluster],
362  MaxTCId[jcluster],
363  energy1,
364  energy2,
365  dphi,
366  thetaSum);
367 
368  if (dphi > _3DBhabhaVetoAngle[0] &&
369  thetaSum > _3DBhabhaVetoAngle[2] &&
370  thetaSum < _3DBhabhaVetoAngle[3]) {BtoBFlag = true;}
371  if ((ClusterEnergy[icluster] * 100. > _3DBhabhaVetoThreshold[0] * energy1 &&
372  ClusterEnergy[jcluster] * 100. > _3DBhabhaVetoThreshold[0] * energy2) &&
373  (ClusterEnergy[icluster] * 100. > _3DBhabhaVetoThreshold[1] * energy1 ||
374  ClusterEnergy[jcluster] * 100. > _3DBhabhaVetoThreshold[1] * energy2)) {
375  if (BtoBFlag) {
376  BhabhaFlag = true;
377  cl_idx1 = icluster;
378  cl_idx2 = jcluster;
379  }
380  }
381  }
382  }
383  if (BhabhaFlag) {
384  m_3DBhabhaVetoClusterTCIds.push_back(MaxTCId[cl_idx1]);
385  m_3DBhabhaVetoClusterTCIds.push_back(MaxTCId[cl_idx2]);
386  m_3DBhabhaVetoClusterEnergies.push_back(ClusterEnergy[cl_idx1]);
387  m_3DBhabhaVetoClusterEnergies.push_back(ClusterEnergy[cl_idx2]);
388  m_3DBhabhaVetoClusterTimings.push_back(ClusterTiming[cl_idx1]);
389  m_3DBhabhaVetoClusterTimings.push_back(ClusterTiming[cl_idx2]);
390  int cl_thetaid1 = _TCMap->getTCThetaIdFromTCId(MaxTCId[cl_idx1]);
391  int cl_thetaid2 = _TCMap->getTCThetaIdFromTCId(MaxTCId[cl_idx2]);
392  m_3DBhabhaVetoClusterThetaIds.push_back(cl_thetaid1);
393  m_3DBhabhaVetoClusterThetaIds.push_back(cl_thetaid2);
394  // set InTrack flag
395  if (cl_thetaid1 >= m_3DBhabhaVetoInTrackThetaRegion[0] &&
396  cl_thetaid1 <= m_3DBhabhaVetoInTrackThetaRegion[1] &&
397  cl_thetaid2 >= m_3DBhabhaVetoInTrackThetaRegion[0] &&
398  cl_thetaid2 <= m_3DBhabhaVetoInTrackThetaRegion[1]) {
399  m_3DBhabhaVetoInTrackFlag = 1;
400  } else {
401  m_3DBhabhaVetoInTrackFlag = 0;
402  }
403  }
404 
405  return BhabhaFlag;
406 }
407 //========================================================
408 // 3D Bhabha Selection
409 //========================================================
411 {
412  //
413  // Read Cluster Table
414  //
415  MaxTCId.clear();
416  ClusterEnergy.clear();
417  ClusterTiming.clear();
418  ClusterPosition.clear();
419  m_3DBhabhaSelectionThetaFlag = -1;
420  // int EventId = 0;
421  StoreArray<TRGECLCluster> trgeclClusterArray;
422  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
423  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
424  // EventId = aTRGECLCluster->getEventId();
425  int maxTCId = aTRGECLCluster->getMaxTCId();
426  double clusterenergy = aTRGECLCluster->getEnergyDep();
427  double clustertiming = aTRGECLCluster->getTimeAve();
428  TVector3 clusterposition(aTRGECLCluster->getPositionX(),
429  aTRGECLCluster->getPositionY(),
430  aTRGECLCluster->getPositionZ());
431  ClusterTiming.push_back(clustertiming);
432  ClusterEnergy.push_back(clusterenergy);
433  ClusterPosition.push_back(clusterposition);
434  MaxTCId.push_back(maxTCId);
435  }
436  const int ncluster = ClusterEnergy.size();
437  //
438  //
439  //
440  BhabhaComb.clear();
441  BhabhaComb.resize(18, 0);
442 
443  int cl_idx1 = -1;
444  int cl_idx2 = -1;
445  bool BhabhaFlag = false;
446  for (int icluster = 0; icluster < ncluster ; icluster++) {
447  for (int jcluster = icluster + 1; jcluster < ncluster; ++jcluster) {
448  bool BtoBFlag = false;
449 
450  if (icluster == jcluster) {continue;}
451 
452  int energy1 = 0;
453  int energy2 = 0;
454  int dphi = 0;
455  int thetaSum = 0;
456  get2CLETP(MaxTCId[icluster],
457  MaxTCId[jcluster],
458  energy1,
459  energy2,
460  dphi,
461  thetaSum);
462 
463  if (dphi > _3DBhabhaSelectionAngle[0] &&
464  dphi < _3DBhabhaSelectionAngle[1] &&
465  thetaSum > _3DBhabhaSelectionAngle[2] &&
466  thetaSum < _3DBhabhaSelectionAngle[3]) {BtoBFlag = true;}
467  if ((ClusterEnergy[icluster] * 100. > _3DBhabhaSelectionThreshold[0] * energy1 &&
468  ClusterEnergy[jcluster] * 100. > _3DBhabhaSelectionThreshold[0] * energy2) &&
469  (ClusterEnergy[icluster] * 100. > _3DBhabhaSelectionThreshold[1] * energy1 ||
470  ClusterEnergy[jcluster] * 100. > _3DBhabhaSelectionThreshold[1] * energy2)) {
471  if (BtoBFlag) {
472  BhabhaFlag = true;
473  cl_idx1 = icluster;
474  cl_idx2 = jcluster;
475  }
476  }
477  }
478  }
479  if (BhabhaFlag) {
480  m_3DBhabhaSelectionClusterTCIds.push_back(MaxTCId[cl_idx1]);
481  m_3DBhabhaSelectionClusterTCIds.push_back(MaxTCId[cl_idx2]);
482  m_3DBhabhaSelectionClusterEnergies.push_back(ClusterEnergy[cl_idx1]);
483  m_3DBhabhaSelectionClusterEnergies.push_back(ClusterEnergy[cl_idx2]);
484  m_3DBhabhaSelectionClusterTimings.push_back(ClusterTiming[cl_idx1]);
485  m_3DBhabhaSelectionClusterTimings.push_back(ClusterTiming[cl_idx2]);
486  int cl_thetaid1 = _TCMap->getTCThetaIdFromTCId(MaxTCId[cl_idx1]);
487  int cl_thetaid2 = _TCMap->getTCThetaIdFromTCId(MaxTCId[cl_idx2]);
488  m_3DBhabhaSelectionClusterThetaIds.push_back(cl_thetaid1);
489  m_3DBhabhaSelectionClusterThetaIds.push_back(cl_thetaid2);
490  // set theta flag(2bits) for prescale in GDL
491  int cl_thetaid0 = (cl_thetaid1 < cl_thetaid2) ? cl_thetaid1 : cl_thetaid2;
492  if (cl_thetaid0 <= 0 || cl_thetaid0 >= 18) {
493  m_3DBhabhaSelectionThetaFlag = -2;
494  } else {
495  if (cl_thetaid0 == 1) { m_3DBhabhaSelectionThetaFlag = 0; }
496  else if (cl_thetaid0 == 2) { m_3DBhabhaSelectionThetaFlag = 1; }
497  else if (cl_thetaid0 == 3) { m_3DBhabhaSelectionThetaFlag = 2; }
498  else { m_3DBhabhaSelectionThetaFlag = 3; }
499  }
500  }
501 
502  return BhabhaFlag;
503 }
504 //========================================================
505 // mu pair trigger
506 //========================================================
508 {
509  bool BtoBFlag = false;
510  bool BhabhaFlag = false;
511  //
512  // Read Cluster Table
513  //
514  MaxTCId.clear();
515  ClusterEnergy.clear();
516  ClusterTiming.clear();
517  ClusterPosition.clear();
518  // int EventId = 0;
519  StoreArray<TRGECLCluster> trgeclClusterArray;
520  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
521  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
522  // EventId = aTRGECLCluster->getEventId();
523  int maxTCId = aTRGECLCluster->getMaxTCId();
524  double clusterenergy = aTRGECLCluster->getEnergyDep();
525  double clustertiming = aTRGECLCluster->getTimeAve();
526  TVector3 clusterposition(aTRGECLCluster->getPositionX(),
527  aTRGECLCluster->getPositionY(),
528  aTRGECLCluster->getPositionZ());
529  ClusterTiming.push_back(clustertiming);
530  ClusterEnergy.push_back(clusterenergy);
531  ClusterPosition.push_back(clusterposition);
532  MaxTCId.push_back(maxTCId);
533  }
534  const int ncluster = ClusterEnergy.size();
535  //
536  //
537  //
538  BhabhaComb.clear();
539  BhabhaComb.resize(18, 0);
540 
541  BtoBFlag = false;
542 
543  for (int icluster = 0; icluster < ncluster ; icluster++) {
544  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
545 
546  if (icluster == jcluster) {continue;}
547 
548  int energy1 = 0;
549  int energy2 = 0;
550  int dphi = 0;
551  int thetaSum = 0;
552  get2CLETP(MaxTCId[icluster],
553  MaxTCId[jcluster],
554  energy1,
555  energy2,
556  dphi,
557  thetaSum);
558 
559  if (dphi > _mumuAngle[0] &&
560  dphi < _mumuAngle[1] &&
561  thetaSum > _mumuAngle[2] &&
562  thetaSum < _mumuAngle[3]) {BtoBFlag = true;}
563  if (ClusterEnergy[icluster] * 10. < _mumuThreshold &&
564  ClusterEnergy[jcluster] * 10. < _mumuThreshold) {
565  if (BtoBFlag) {BhabhaFlag = true;}
566  }
567  }
568  }
569  return BhabhaFlag;
570 }
571 //========================================================
572 // taub2b selection for tau 1x1 process
573 //========================================================
574 bool TrgEclBhabha::GetTaub2b(double E_total1to17)
575 {
576  //
577  // Read Cluster Table
578  //
579  MaxTCId.clear();
580  ClusterEnergy.clear();
581  ClusterTiming.clear();
582  ClusterPosition.clear();
583 
584  m_Taub2bAngleFlag = 0;
585  m_Taub2bEtotFlag = 0;
586  m_Taub2bClusterEFlag = 0;
587 
588  if (E_total1to17 < m_Taub2bEtotCut) {
589  m_Taub2bEtotFlag = 1;
590  }
591 
592  StoreArray<TRGECLCluster> trgeclClusterArray;
593  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
594  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
595  int maxTCId = aTRGECLCluster->getMaxTCId();
596  double clusterenergy = aTRGECLCluster->getEnergyDep();
597  ClusterEnergy.push_back(clusterenergy);
598  MaxTCId.push_back(maxTCId);
599  }
600 
601  const int ncluster = ClusterEnergy.size();
602 
603  for (int icluster = 0; icluster < ncluster ; icluster++) {
604  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
605 
606  if (icluster == jcluster) {continue;}
607 
608  int energy1 = 0;
609  int energy2 = 0;
610  int dphi = 0;
611  int thetaSum = 0;
612  get2CLETP(MaxTCId[icluster],
613  MaxTCId[jcluster],
614  energy1,
615  energy2,
616  dphi,
617  thetaSum);
618 
619  if (dphi > m_Taub2bAngleCut[0] &&
620  dphi < m_Taub2bAngleCut[1] &&
621  thetaSum > m_Taub2bAngleCut[2] &&
622  thetaSum < m_Taub2bAngleCut[3]) {
623  m_Taub2bAngleFlag++;
624  //
625  if ((ClusterEnergy[icluster] < m_Taub2bClusterECut1 &&
626  ClusterEnergy[jcluster] < m_Taub2bClusterECut2) ||
627  (ClusterEnergy[icluster] < m_Taub2bClusterECut2 &&
628  ClusterEnergy[jcluster] < m_Taub2bClusterECut1)) {
629  m_Taub2bClusterEFlag++;
630  }
631  }
632  }
633  }
634 
635  bool Taub2bFlag = false;
636  if (m_Taub2bAngleFlag > 0 &&
637  m_Taub2bEtotFlag > 0 &&
638  m_Taub2bClusterEFlag > 0) {
639  Taub2bFlag = true;
640  }
641 
642  return Taub2bFlag;
643 }
644 //========================================================
645 // additional Bhabha veto
646 //========================================================
647 int TrgEclBhabha::GetBhabhaAddition(void)
648 {
649 
650  std::vector<int> MaxThetaId;
651  MaxThetaId.clear();
652  int bit_bhabha_addition = 0;
653 
654  StoreArray<TRGECLCluster> trgeclClusterArray;
655  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
656  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
657  int maxTCId = aTRGECLCluster->getMaxTCId();
658  MaxTCId.push_back(maxTCId);
659  int maxThetaId = aTRGECLCluster->getMaxThetaId();
660  MaxThetaId.push_back(maxThetaId);
661  }
662  int NofCluster1to17 = MaxThetaId.size();
663 
664  if (NofCluster1to17 == 1) {
665  if (MaxThetaId[0] <= 3) {
666  bit_bhabha_addition |= 0x01;
667  }
668  } else if (NofCluster1to17 == 2) {
669 
670  int energy1 = 0;
671  int energy2 = 0;
672  int dphi = 0;
673  int thetaSum = 0;
674  get2CLETP(MaxTCId[0],
675  MaxTCId[1],
676  energy1,
677  energy2,
678  dphi,
679  thetaSum);
680 
681  if ((dphi > m_3DBhabhaAddAngleCut[0] &&
682  dphi < m_3DBhabhaAddAngleCut[1]) &&
683  (thetaSum > m_3DBhabhaAddAngleCut[2] &&
684  thetaSum < m_3DBhabhaAddAngleCut[3])) {
685  bit_bhabha_addition |= 0x02;
686  }
687  if ((dphi > m_3DBhabhaAddAngleCut[0] &&
688  dphi < m_3DBhabhaAddAngleCut[1]) ||
689  (thetaSum > m_3DBhabhaAddAngleCut[2] &&
690  thetaSum < m_3DBhabhaAddAngleCut[3])) {
691  bit_bhabha_addition |= 0x04;
692  }
693 
694  int lowe_MaxThetaId = 0;
695  if (energy1 < energy2) {
696  lowe_MaxThetaId = MaxThetaId[0];
697  } else {
698  lowe_MaxThetaId = MaxThetaId[1];
699  }
700  if (lowe_MaxThetaId <= 3 ||
701  lowe_MaxThetaId >= 16) {
702  bit_bhabha_addition |= 0x08;
703  }
704 
705  }
706 
707  return bit_bhabha_addition;
708 }
709 //========================================================
710 // get cluster energy and angles(dphi and theta_sum) from LUT
711 //========================================================
712 void TrgEclBhabha::get2CLETP(int TCId1,
713  int TCId2,
714  int& energy1,
715  int& energy2,
716  int& dphi,
717  int& thetaSum)
718 {
719  int lut1 = _database->Get3DBhabhaLUT(TCId1);
720  int lut2 = _database->Get3DBhabhaLUT(TCId2);
721  energy1 = 15 & lut1;
722  energy2 = 15 & lut2;
723  lut1 >>= 4;
724  lut2 >>= 4;
725  int phi1 = 511 & lut1;
726  int phi2 = 511 & lut2;
727  lut1 >>= 9;
728  lut2 >>= 9;
729  int theta1 = lut1;
730  int theta2 = lut2;
731  dphi = abs(phi1 - phi2);
732  if (dphi > 180) {dphi = 360 - dphi;}
733  thetaSum = theta1 + theta2;
734 
735  return;
736 }
737 //========================================================
738 //
739 //========================================================
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
Example Detector.
Definition: TRGECLCluster.h:24
double getTimeAve() const
The method to get hit average time.
double getPositionZ() const
Get Energy weighted position Z.
int getMaxThetaId()
The method to set Theta Id of maximum TC in Cluster.
double getEnergyDep() const
The method to get deposited energy.
double getPositionX() const
The method to get hit average time Get Energy weighted position X.
double getPositionY() const
Get Energy weighted position Y.
int getMaxTCId() const
The method to get the Maximum(center) TC id.
bool GetBhabha00(std::vector< double >)
Belle 2D Bhabha veto method.
bool Getmumu()
MuMu selection for calibration.
std::vector< double > MaxTCId
Max TC Id.
Definition: TrgEclBhabha.h:226
void get2CLETP(int, int, int &, int &, int &, int &)
2 cluster energies, phi difference and theta sum
std::vector< TVector3 > ClusterPosition
Cluster Timing.
Definition: TrgEclBhabha.h:232
double _mumuThreshold
mumu bit Energy Threshold
Definition: TrgEclBhabha.h:246
TrgEclDataBase * _database
Object of Trigger ECL DataBase.
Definition: TrgEclBhabha.h:218
std::vector< double > _mumuAngle
mumu bit Angle
Definition: TrgEclBhabha.h:248
std::vector< double > _3DBhabhaVetoThreshold
3D Veto Bhabha Energy Threshold
Definition: TrgEclBhabha.h:240
std::vector< double > ClusterTiming
Cluster Timing.
Definition: TrgEclBhabha.h:230
bool GetBhabha02()
Belle II 3D Bhabha method for selection.
std::vector< double > _3DBhabhaSelectionAngle
3D Selection Bhabha Energy Angle
Definition: TrgEclBhabha.h:242
std::vector< double > _2DBhabhaThresholdBWD
2D Bhabha Energy Threshold
Definition: TrgEclBhabha.h:236
std::vector< double > BhabhaComb
Bhabha Combination.
Definition: TrgEclBhabha.h:224
std::vector< double > _3DBhabhaSelectionThreshold
3D Selection Bhabha Energy Threshold
Definition: TrgEclBhabha.h:238
bool GetTaub2b(double)
Taub2b selection.
bool GetBhabha01()
Belle II 3D Bhabha method for veto.
virtual ~TrgEclBhabha()
Constructor.
std::vector< double > ClusterEnergy
Cluster Energy.
Definition: TrgEclBhabha.h:228
TrgEclMapping * _TCMap
Object of TC Mapping.
Definition: TrgEclBhabha.h:215
std::vector< double > _2DBhabhaThresholdFWD
2D Bhabha Energy Threshold
Definition: TrgEclBhabha.h:234
std::vector< double > _3DBhabhaVetoAngle
3D Veto Bhabha Energy Angle
Definition: TrgEclBhabha.h:244
class TrgEclDataBase;
int Get3DBhabhaLUT(int)
TC CM Phi
A class of TC Mapping.
Definition: TrgEclMapping.h:26
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
Abstract base class for different kinds of events.