Belle II Software  release-06-02-00
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 #include <analysis/utility/PCmsLabTransform.h>
61 
62 using namespace std;
63 using namespace Belle2;
64 //
65 //
66 //
67 TrgEclBhabha::TrgEclBhabha():
68  _mumuThreshold(20),
69  m_3DBhabhaVetoInTrackThetaRegion(3, 15)
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  m_3DBhabhaAddAngleCut.clear();
89 
90  _2DBhabhaThresholdFWD = {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 30, 35}; // (100 MeV)
91  _2DBhabhaThresholdBWD = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30}; // (100 MeV)
92  _3DBhabhaVetoThreshold = {30, 45}; // (low, high) (100 MeV)
93  _3DBhabhaSelectionThreshold = {25, 40}; // (low, high) (100 MeV)
94  _3DBhabhaVetoAngle = {160, 200, 165, 190}; // (phi_low, phi_high, theta_low, theta_high) (degree)
95  _3DBhabhaSelectionAngle = {140, 220, 160, 200}; // (phi_low, phi_high, theta_low, theta_high) (degree)
96  _mumuAngle = {160, 200, 165, 190}; // (phi_low, phi_high, theta_low, theta_high) (degree)
97  m_3DBhabhaAddAngleCut = {150, 210, 160, 200}; // (phi_low, phi_high, theta_low, theta_high) (degree)
98 
99  m_3DBhabhaVetoInTrackFlag = -10;
100  m_3DBhabhaVetoClusterTCIds.clear();
101  m_3DBhabhaVetoClusterEnergies.clear();
102  m_3DBhabhaVetoClusterTimings.clear();
103  m_3DBhabhaVetoClusterThetaIds.clear();
104 
105  m_3DBhabhaVetoInTrackFlag = -10;
106 
107  m_taub2bEtotCut = 7.0;
108  m_taub2bClusterECut1 = 1.9;
109  m_taub2bClusterECut2 = 999.0;
110  m_taub2bAngleFlag = 0;
111  m_taub2bEtotFlag = 0;
112  m_taub2bClusterEFlag = 0;
113 
114  m_taub2b2EtotCut = 7.0;
115  m_taub2b2CLEEndcapCut = 3.0;
116  m_taub2b2CLECut = 1.62;
117 
118 }
119 //
120 //
121 //
123 {
124  delete _TCMap;
125  delete _database;
126 }
127 //
128 //
129 //
130 bool TrgEclBhabha::GetBhabha00(std::vector<double> PhiRingSum) //Belle 2D Bhabha veto method
131 {
132  bool BtoBflag = false;
133 
134 
135  vector<int> k011 = {3, 1, 2, 3 }; // (1) F1+F2 + F3 + B1+B2
136  vector<int> k012 = {2, 16, 17}; // (1) F1+F2 + F3 + B1+B2
137 
138  vector<int> k021 = {1, 3}; // (2) F3 + C12
139  vector<int> k022 = {1, 15}; // (2) F3 + C12
140 
141  vector<int> k03 = {2, 2, 3}; // (3) F2 + F3
142 
143  vector<int> k04 = {1, 4}; // (4) C1 + backward gap
144 
145  vector<int> k051 = {1, 4 }; // (5) C1+C11+C12
146  vector<int> k052 = {2, 14, 15}; // (5) C1+C11+C12
147 
148  vector<int> k061 = {1, 5}; // (6) C2+C11+C12
149  vector<int> k062 = {2, 14, 15}; // (6) C2+C11+C12
150 
151  vector<int> k071 = {2, 4, 5}; // (7) C1+C2+C11
152  vector<int> k072 = {1, 14}; // (7) C1+C2+C11
153 
154  vector<int> k081 = {1, 5}; // (8) C2+C10+C11
155  vector<int> k082 = {2, 13, 14}; // (8) C2+C10+C11
156 
157  vector<int> k091 = {1, 5 }; // (9) C2+C9+C10
158  vector<int> k092 = {2, 12, 13}; // (9) C2+C9+C10
159 
160  vector<int> k101 = {2, 5, 6}; // (10) C2+C3+C10
161  vector<int> k102 = {1, 13}; // (10) C2+C3+C10
162 
163  vector<int> k111 = {2, 5, 6}; // (11) C2+C3+C9
164  vector<int> k112 = {1, 12}; // (11) C2+C3+C9
165 
166  vector<int> k121 = {2, 6, 7}; // (9) C3+C4+C9
167  vector<int> k122 = {1, 12}; // (9) C3+C4+C9
168 
169  vector<int> k131 = {2, 6, 7}; // (10) C3+C4+C8
170  vector<int> k132 = {1, 11}; // (10) C3+C4+C8
171 
172  vector<int> k141 = {2, 7, 8}; // (11) C4+C5+C8
173  vector<int> k142 = {1, 11}; // (11) C4+C5+C8
174 
175 
176  vector<int> k151 = {1, 8}; // (9) C5+C7+C8
177  vector<int> k152 = {2, 10, 11}; // (9) C5+C7+C8
178 
179  vector<int> k161 = {2, 8, 9}; // (10) C5+C6+C7
180  vector<int> k162 = {2, 9, 10}; // (10) C5+C6+C7
181 
182  //vector<int> k17 = {2, 14, 15}; // (11) C11+C12 +forward gap
183 
184  //vector<int> k18 = {1, 16}; // (11) B1 + forward gap
185 
186  vector<int> kLOM1 = {2, 2, 3 }; // (1) F1+F2 + F3 + B1+B2
187  vector<int> kLOM2 = {2, 16, 17}; // (1) F1+F2 + F3 + B1+B2
188 
189  BhabhaComb.clear();
190  BhabhaComb.resize(32, 0.0);
191  for (int iii = 1; iii <= k011[0]; iii++) { BhabhaComb[0] += PhiRingSum[k011[iii] - 1];}
192  for (int iii = 1; iii <= k012[0]; iii++) { BhabhaComb[1] += PhiRingSum[k012[iii] - 1];}
193  for (int iii = 1; iii <= k021[0]; iii++) { BhabhaComb[2] += PhiRingSum[k021[iii] - 1]; }
194  for (int iii = 1; iii <= k022[0]; iii++) { BhabhaComb[3] += PhiRingSum[k022[iii] - 1]; }
195  for (int iii = 1; iii <= k03[0]; iii++) { BhabhaComb[4] += PhiRingSum[k03[iii] - 1]; }
196  for (int iii = 1; iii <= k04[0]; iii++) { BhabhaComb[5] += PhiRingSum[k04[iii] - 1]; }
197  for (int iii = 1; iii <= k051[0]; iii++) { BhabhaComb[6] += PhiRingSum[k051[iii] - 1]; }
198  for (int iii = 1; iii <= k052[0]; iii++) { BhabhaComb[7] += PhiRingSum[k052[iii] - 1]; }
199  for (int iii = 1; iii <= k061[0]; iii++) { BhabhaComb[8] += PhiRingSum[k061[iii] - 1]; }
200  for (int iii = 1; iii <= k062[0]; iii++) { BhabhaComb[9] += PhiRingSum[k062[iii] - 1]; }
201  for (int iii = 1; iii <= k071[0]; iii++) { BhabhaComb[10] += PhiRingSum[k071[iii] - 1]; }
202  for (int iii = 1; iii <= k072[0]; iii++) { BhabhaComb[11] += PhiRingSum[k072[iii] - 1]; }
203  for (int iii = 1; iii <= k081[0]; iii++) { BhabhaComb[12] += PhiRingSum[k081[iii] - 1]; }
204  for (int iii = 1; iii <= k082[0]; iii++) { BhabhaComb[13] += PhiRingSum[k082[iii] - 1]; }
205  for (int iii = 1; iii <= k091[0]; iii++) { BhabhaComb[14] += PhiRingSum[k091[iii] - 1]; }
206  for (int iii = 1; iii <= k092[0]; iii++) { BhabhaComb[15] += PhiRingSum[k092[iii] - 1]; }
207  for (int iii = 1; iii <= k101[0]; iii++) { BhabhaComb[16] += PhiRingSum[k101[iii] - 1]; }
208  for (int iii = 1; iii <= k102[0]; iii++) { BhabhaComb[17] += PhiRingSum[k102[iii] - 1]; }
209  for (int iii = 1; iii <= k111[0]; iii++) { BhabhaComb[18] += PhiRingSum[k111[iii] - 1]; }
210  for (int iii = 1; iii <= k112[0]; iii++) { BhabhaComb[19] += PhiRingSum[k112[iii] - 1]; }
211  for (int iii = 1; iii <= k121[0]; iii++) { BhabhaComb[20] += PhiRingSum[k121[iii] - 1]; }
212  for (int iii = 1; iii <= k122[0]; iii++) { BhabhaComb[21] += PhiRingSum[k122[iii] - 1]; }
213  for (int iii = 1; iii <= k131[0]; iii++) { BhabhaComb[22] += PhiRingSum[k131[iii] - 1]; }
214  for (int iii = 1; iii <= k132[0]; iii++) { BhabhaComb[23] += PhiRingSum[k132[iii] - 1]; }
215  for (int iii = 1; iii <= k141[0]; iii++) { BhabhaComb[24] += PhiRingSum[k141[iii] - 1]; }
216  for (int iii = 1; iii <= k142[0]; iii++) { BhabhaComb[25] += PhiRingSum[k142[iii] - 1]; }
217  for (int iii = 1; iii <= k151[0]; iii++) { BhabhaComb[26] += PhiRingSum[k151[iii] - 1]; }
218  for (int iii = 1; iii <= k152[0]; iii++) { BhabhaComb[27] += PhiRingSum[k152[iii] - 1]; }
219  for (int iii = 1; iii <= k161[0]; iii++) { BhabhaComb[28] += PhiRingSum[k161[iii] - 1]; }
220  for (int iii = 1; iii <= k162[0]; iii++) { BhabhaComb[29] += PhiRingSum[k162[iii] - 1]; }
221  for (int iii = 1; iii <= kLOM1[0]; iii++) { BhabhaComb[30] += PhiRingSum[kLOM1[iii] - 1];}
222  for (int iii = 1; iii <= kLOM2[0]; iii++) { BhabhaComb[31] += PhiRingSum[kLOM2[iii] - 1];}
223 
224 
225  BtoBflag =
226  ((BhabhaComb[0] * 10 >= _2DBhabhaThresholdFWD[0] &&
227  BhabhaComb[1] * 10 >= _2DBhabhaThresholdBWD[0]) ||
228  (BhabhaComb[2] * 10 >= _2DBhabhaThresholdFWD[1] &&
229  BhabhaComb[3] * 10 >= _2DBhabhaThresholdBWD[1]) ||
230  (BhabhaComb[6] * 10 >= _2DBhabhaThresholdFWD[2] &&
231  BhabhaComb[7] * 10 >= _2DBhabhaThresholdBWD[2]) ||
232  (BhabhaComb[8] * 10 >= _2DBhabhaThresholdFWD[3] &&
233  BhabhaComb[9] * 10 >= _2DBhabhaThresholdBWD[3]) ||
234  (BhabhaComb[10] * 10 >= _2DBhabhaThresholdFWD[4] &&
235  BhabhaComb[11] * 10 >= _2DBhabhaThresholdBWD[4]) ||
236  (BhabhaComb[12] * 10 >= _2DBhabhaThresholdFWD[5] &&
237  BhabhaComb[13] * 10 >= _2DBhabhaThresholdBWD[5]) ||
238  (BhabhaComb[14] * 10 >= _2DBhabhaThresholdFWD[6] &&
239  BhabhaComb[15] * 10 >= _2DBhabhaThresholdBWD[6]) ||
240  (BhabhaComb[16] * 10 >= _2DBhabhaThresholdFWD[7] &&
241  BhabhaComb[17] * 10 >= _2DBhabhaThresholdBWD[7]) ||
242  (BhabhaComb[18] * 10 >= _2DBhabhaThresholdFWD[8] &&
243  BhabhaComb[19] * 10 >= _2DBhabhaThresholdBWD[8]) ||
244  (BhabhaComb[20] * 10 >= _2DBhabhaThresholdFWD[9] &&
245  BhabhaComb[21] * 10 >= _2DBhabhaThresholdBWD[9]) ||
246  (BhabhaComb[22] * 10 >= _2DBhabhaThresholdFWD[10] &&
247  BhabhaComb[23] * 10 >= _2DBhabhaThresholdBWD[10]) ||
248  (BhabhaComb[24] * 10 >= _2DBhabhaThresholdFWD[11] &&
249  BhabhaComb[25] * 10 >= _2DBhabhaThresholdBWD[11]) ||
250  (BhabhaComb[26] * 10 >= _2DBhabhaThresholdFWD[12] &&
251  BhabhaComb[27] * 10 >= _2DBhabhaThresholdBWD[12]) ||
252  (BhabhaComb[28] * 10 >= _2DBhabhaThresholdFWD[13] &&
253  BhabhaComb[29] * 10 >= _2DBhabhaThresholdBWD[13]));
254 
255  int bhabha01 = 0;
256  int bhabha02 = 0;
257  int bhabha03 = 0;
258  int bhabha04 = 0;
259  int bhabha05 = 0;
260  int bhabha06 = 0;
261  int bhabha07 = 0;
262  int bhabha08 = 0;
263  int bhabha09 = 0;
264  int bhabha10 = 0;
265  int bhabha11 = 0;
266  int bhabha12 = 0;
267  int bhabha13 = 0;
268  int bhabha14 = 0;
269 
270  if ((BhabhaComb[0] * 10 >= _2DBhabhaThresholdFWD[0] &&
271  BhabhaComb[1] * 10 >= _2DBhabhaThresholdBWD[0])) {bhabha01 = 1;}
272  if ((BhabhaComb[2] * 10 >= _2DBhabhaThresholdFWD[1] &&
273  BhabhaComb[3] * 10 >= _2DBhabhaThresholdBWD[1])) {bhabha02 = 1;}
274  if ((BhabhaComb[6] * 10 >= _2DBhabhaThresholdFWD[2] &&
275  BhabhaComb[7] * 10 >= _2DBhabhaThresholdBWD[2])) {bhabha03 = 1;}
276  if ((BhabhaComb[8] * 10 >= _2DBhabhaThresholdFWD[3] &&
277  BhabhaComb[9] * 10 >= _2DBhabhaThresholdBWD[3])) {bhabha04 = 1;}
278  if ((BhabhaComb[10] * 10 >= _2DBhabhaThresholdFWD[4] &&
279  BhabhaComb[11] * 10 >= _2DBhabhaThresholdBWD[4])) {bhabha05 = 1;}
280  if ((BhabhaComb[12] * 10 >= _2DBhabhaThresholdFWD[5] &&
281  BhabhaComb[13] * 10 >= _2DBhabhaThresholdBWD[5])) {bhabha06 = 1;}
282  if ((BhabhaComb[14] * 10 >= _2DBhabhaThresholdFWD[6] &&
283  BhabhaComb[15] * 10 >= _2DBhabhaThresholdBWD[6])) {bhabha07 = 1;}
284  if ((BhabhaComb[16] * 10 >= _2DBhabhaThresholdFWD[7] &&
285  BhabhaComb[17] * 10 >= _2DBhabhaThresholdBWD[7])) {bhabha08 = 1;}
286  if ((BhabhaComb[18] * 10 >= _2DBhabhaThresholdFWD[8] &&
287  BhabhaComb[19] * 10 >= _2DBhabhaThresholdBWD[8])) {bhabha09 = 1;}
288  if ((BhabhaComb[20] * 10 >= _2DBhabhaThresholdFWD[9] &&
289  BhabhaComb[21] * 10 >= _2DBhabhaThresholdBWD[9])) {bhabha10 = 1;}
290  if ((BhabhaComb[22] * 10 >= _2DBhabhaThresholdFWD[10] &&
291  BhabhaComb[23] * 10 >= _2DBhabhaThresholdBWD[10])) {bhabha11 = 1;}
292  if ((BhabhaComb[24] * 10 >= _2DBhabhaThresholdFWD[11] &&
293  BhabhaComb[25] * 10 >= _2DBhabhaThresholdBWD[11])) {bhabha12 = 1;}
294  if ((BhabhaComb[26] * 10 >= _2DBhabhaThresholdFWD[12] &&
295  BhabhaComb[27] * 10 >= _2DBhabhaThresholdBWD[12])) {bhabha13 = 1;}
296  if ((BhabhaComb[28] * 10 >= _2DBhabhaThresholdFWD[13] &&
297  BhabhaComb[29] * 10 >= _2DBhabhaThresholdBWD[13])) {bhabha14 = 1;}
298 
299  BhabhaComb.clear();
300  BhabhaComb.push_back(bhabha01);
301  BhabhaComb.push_back(bhabha02);
302  BhabhaComb.push_back(bhabha03);
303  BhabhaComb.push_back(bhabha04);
304  BhabhaComb.push_back(bhabha05);
305  BhabhaComb.push_back(bhabha06);
306  BhabhaComb.push_back(bhabha07);
307  BhabhaComb.push_back(bhabha08);
308  BhabhaComb.push_back(bhabha09);
309  BhabhaComb.push_back(bhabha10);
310  BhabhaComb.push_back(bhabha11);
311  BhabhaComb.push_back(bhabha12);
312  BhabhaComb.push_back(bhabha13);
313  BhabhaComb.push_back(bhabha14);
314  BhabhaComb.push_back(0);
315  BhabhaComb.push_back(0);
316  BhabhaComb.push_back(0);
317  BhabhaComb.push_back(0);
318 
319  return BtoBflag;
320 }
321 //========================================================
322 // 3D Bhabha veto
323 //========================================================
325 {
326  //
327  // Read Cluster Table
328  //
329  MaxTCId.clear();
330  ClusterEnergy.clear();
331  ClusterTiming.clear();
332  ClusterPosition.clear();
333  m_3DBhabhaVetoInTrackFlag = -1;
334  m_3DBhabhaVetoClusterTCIds.clear();
335  m_3DBhabhaVetoClusterEnergies.clear();
336  m_3DBhabhaVetoClusterTimings.clear();
337  m_3DBhabhaVetoClusterThetaIds.clear();
338  // int EventId = 0;
339  StoreArray<TRGECLCluster> trgeclClusterArray;
340  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
341  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
342  // EventId = aTRGECLCluster->getEventId();
343  int maxTCId = aTRGECLCluster->getMaxTCId();
344  double clusterenergy = aTRGECLCluster->getEnergyDep();
345  double clustertiming = aTRGECLCluster->getTimeAve();
346  TVector3 clusterposition(aTRGECLCluster->getPositionX(),
347  aTRGECLCluster->getPositionY(),
348  aTRGECLCluster->getPositionZ());
349  ClusterTiming.push_back(clustertiming);
350  ClusterEnergy.push_back(clusterenergy);
351  ClusterPosition.push_back(clusterposition);
352  MaxTCId.push_back(maxTCId);
353  }
354  const int ncluster = ClusterEnergy.size();
355  //
356  //
357  //
358  BhabhaComb.clear();
359  BhabhaComb.resize(18, 0);
360 
361  int cl_idx1 = -1;
362  int cl_idx2 = -1;
363  bool BhabhaFlag = false;
364  for (int icluster = 0; icluster < ncluster ; icluster++) {
365  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
366  bool BtoBFlag = false;
367 
368  if (icluster == jcluster) {continue;}
369 
370  int energy1 = 0;
371  int energy2 = 0;
372  int dphi = 0;
373  int thetaSum = 0;
374  get2CLETP(MaxTCId[icluster],
375  MaxTCId[jcluster],
376  energy1,
377  energy2,
378  dphi,
379  thetaSum);
380 
381  if (dphi > _3DBhabhaVetoAngle[0] &&
382  thetaSum > _3DBhabhaVetoAngle[2] &&
383  thetaSum < _3DBhabhaVetoAngle[3]) {BtoBFlag = true;}
384  if ((ClusterEnergy[icluster] * 100. > _3DBhabhaVetoThreshold[0] * energy1 &&
385  ClusterEnergy[jcluster] * 100. > _3DBhabhaVetoThreshold[0] * energy2) &&
386  (ClusterEnergy[icluster] * 100. > _3DBhabhaVetoThreshold[1] * energy1 ||
387  ClusterEnergy[jcluster] * 100. > _3DBhabhaVetoThreshold[1] * energy2)) {
388  if (BtoBFlag) {
389  BhabhaFlag = true;
390  cl_idx1 = icluster;
391  cl_idx2 = jcluster;
392  }
393  }
394  }
395  }
396 
397  if (BhabhaFlag) {
398  m_3DBhabhaVetoClusterTCIds.push_back(MaxTCId[cl_idx1]);
399  m_3DBhabhaVetoClusterTCIds.push_back(MaxTCId[cl_idx2]);
400  m_3DBhabhaVetoClusterEnergies.push_back(ClusterEnergy[cl_idx1]);
401  m_3DBhabhaVetoClusterEnergies.push_back(ClusterEnergy[cl_idx2]);
402  m_3DBhabhaVetoClusterTimings.push_back(ClusterTiming[cl_idx1]);
403  m_3DBhabhaVetoClusterTimings.push_back(ClusterTiming[cl_idx2]);
404  int cl_thetaid1 = _TCMap->getTCThetaIdFromTCId(MaxTCId[cl_idx1]);
405  int cl_thetaid2 = _TCMap->getTCThetaIdFromTCId(MaxTCId[cl_idx2]);
406  m_3DBhabhaVetoClusterThetaIds.push_back(cl_thetaid1);
407  m_3DBhabhaVetoClusterThetaIds.push_back(cl_thetaid2);
408  // set InTrack flag
409  if (cl_thetaid1 >= m_3DBhabhaVetoInTrackThetaRegion[0] &&
410  cl_thetaid1 <= m_3DBhabhaVetoInTrackThetaRegion[1] &&
411  cl_thetaid2 >= m_3DBhabhaVetoInTrackThetaRegion[0] &&
412  cl_thetaid2 <= m_3DBhabhaVetoInTrackThetaRegion[1]) {
413  m_3DBhabhaVetoInTrackFlag = 1;
414  } else {
415  m_3DBhabhaVetoInTrackFlag = 0;
416  }
417  }
418 
419  return BhabhaFlag;
420 }
421 //========================================================
422 // 3D Bhabha Selection
423 //========================================================
425 {
426  //
427  // Read Cluster Table
428  //
429  MaxTCId.clear();
430  ClusterEnergy.clear();
431  ClusterTiming.clear();
432  ClusterPosition.clear();
433  m_3DBhabhaSelectionThetaFlag = -1;
434  // int EventId = 0;
435  StoreArray<TRGECLCluster> trgeclClusterArray;
436  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
437  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
438  // EventId = aTRGECLCluster->getEventId();
439  int maxTCId = aTRGECLCluster->getMaxTCId();
440  double clusterenergy = aTRGECLCluster->getEnergyDep();
441  double clustertiming = aTRGECLCluster->getTimeAve();
442  TVector3 clusterposition(aTRGECLCluster->getPositionX(),
443  aTRGECLCluster->getPositionY(),
444  aTRGECLCluster->getPositionZ());
445  ClusterTiming.push_back(clustertiming);
446  ClusterEnergy.push_back(clusterenergy);
447  ClusterPosition.push_back(clusterposition);
448  MaxTCId.push_back(maxTCId);
449  }
450  const int ncluster = ClusterEnergy.size();
451  //
452  //
453  //
454  BhabhaComb.clear();
455  BhabhaComb.resize(18, 0);
456 
457  int cl_idx1 = -1;
458  int cl_idx2 = -1;
459  bool BhabhaFlag = false;
460  for (int icluster = 0; icluster < ncluster ; icluster++) {
461  for (int jcluster = icluster + 1; jcluster < ncluster; ++jcluster) {
462  bool BtoBFlag = false;
463 
464  if (icluster == jcluster) {continue;}
465 
466  int energy1 = 0;
467  int energy2 = 0;
468  int dphi = 0;
469  int thetaSum = 0;
470  get2CLETP(MaxTCId[icluster],
471  MaxTCId[jcluster],
472  energy1,
473  energy2,
474  dphi,
475  thetaSum);
476 
477  if (dphi > _3DBhabhaSelectionAngle[0] &&
478  dphi < _3DBhabhaSelectionAngle[1] &&
479  thetaSum > _3DBhabhaSelectionAngle[2] &&
480  thetaSum < _3DBhabhaSelectionAngle[3]) {BtoBFlag = true;}
481  if ((ClusterEnergy[icluster] * 100. > _3DBhabhaSelectionThreshold[0] * energy1 &&
482  ClusterEnergy[jcluster] * 100. > _3DBhabhaSelectionThreshold[0] * energy2) &&
483  (ClusterEnergy[icluster] * 100. > _3DBhabhaSelectionThreshold[1] * energy1 ||
484  ClusterEnergy[jcluster] * 100. > _3DBhabhaSelectionThreshold[1] * energy2)) {
485  if (BtoBFlag) {
486  BhabhaFlag = true;
487  cl_idx1 = icluster;
488  cl_idx2 = jcluster;
489  }
490  }
491  }
492  }
493  if (BhabhaFlag) {
494  m_3DBhabhaSelectionClusterTCIds.push_back(MaxTCId[cl_idx1]);
495  m_3DBhabhaSelectionClusterTCIds.push_back(MaxTCId[cl_idx2]);
496  m_3DBhabhaSelectionClusterEnergies.push_back(ClusterEnergy[cl_idx1]);
497  m_3DBhabhaSelectionClusterEnergies.push_back(ClusterEnergy[cl_idx2]);
498  m_3DBhabhaSelectionClusterTimings.push_back(ClusterTiming[cl_idx1]);
499  m_3DBhabhaSelectionClusterTimings.push_back(ClusterTiming[cl_idx2]);
500  int cl_thetaid1 = _TCMap->getTCThetaIdFromTCId(MaxTCId[cl_idx1]);
501  int cl_thetaid2 = _TCMap->getTCThetaIdFromTCId(MaxTCId[cl_idx2]);
502  m_3DBhabhaSelectionClusterThetaIds.push_back(cl_thetaid1);
503  m_3DBhabhaSelectionClusterThetaIds.push_back(cl_thetaid2);
504  // set theta flag(2bits) for prescale in GDL
505  int cl_thetaid0 = (cl_thetaid1 < cl_thetaid2) ? cl_thetaid1 : cl_thetaid2;
506  if (cl_thetaid0 <= 0 || cl_thetaid0 >= 18) {
507  m_3DBhabhaSelectionThetaFlag = -2;
508  } else {
509  if (cl_thetaid0 == 1) { m_3DBhabhaSelectionThetaFlag = 0; }
510  else if (cl_thetaid0 == 2) { m_3DBhabhaSelectionThetaFlag = 1; }
511  else if (cl_thetaid0 == 3) { m_3DBhabhaSelectionThetaFlag = 2; }
512  else { m_3DBhabhaSelectionThetaFlag = 3; }
513  }
514  }
515 
516  return BhabhaFlag;
517 }
518 //========================================================
519 // mu pair trigger
520 //========================================================
522 {
523  bool BtoBFlag = false;
524  bool BhabhaFlag = false;
525  //
526  // Read Cluster Table
527  //
528  MaxTCId.clear();
529  ClusterEnergy.clear();
530  ClusterTiming.clear();
531  ClusterPosition.clear();
532  // int EventId = 0;
533  StoreArray<TRGECLCluster> trgeclClusterArray;
534  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
535  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
536  // EventId = aTRGECLCluster->getEventId();
537  int maxTCId = aTRGECLCluster->getMaxTCId();
538  double clusterenergy = aTRGECLCluster->getEnergyDep();
539  double clustertiming = aTRGECLCluster->getTimeAve();
540  TVector3 clusterposition(aTRGECLCluster->getPositionX(),
541  aTRGECLCluster->getPositionY(),
542  aTRGECLCluster->getPositionZ());
543  ClusterTiming.push_back(clustertiming);
544  ClusterEnergy.push_back(clusterenergy);
545  ClusterPosition.push_back(clusterposition);
546  MaxTCId.push_back(maxTCId);
547  }
548  const int ncluster = ClusterEnergy.size();
549  //
550  //
551  //
552  BhabhaComb.clear();
553  BhabhaComb.resize(18, 0);
554 
555  BtoBFlag = false;
556 
557  for (int icluster = 0; icluster < ncluster ; icluster++) {
558  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
559 
560  if (icluster == jcluster) {continue;}
561 
562  int energy1 = 0;
563  int energy2 = 0;
564  int dphi = 0;
565  int thetaSum = 0;
566  get2CLETP(MaxTCId[icluster],
567  MaxTCId[jcluster],
568  energy1,
569  energy2,
570  dphi,
571  thetaSum);
572 
573  if (dphi > _mumuAngle[0] &&
574  dphi < _mumuAngle[1] &&
575  thetaSum > _mumuAngle[2] &&
576  thetaSum < _mumuAngle[3]) {BtoBFlag = true;}
577  if (ClusterEnergy[icluster] * 10. < _mumuThreshold &&
578  ClusterEnergy[jcluster] * 10. < _mumuThreshold) {
579  if (BtoBFlag) {BhabhaFlag = true;}
580  }
581  }
582  }
583  return BhabhaFlag;
584 }
585 //========================================================
586 // taub2b selection for tau 1x1 process
587 //========================================================
588 bool TrgEclBhabha::GetTaub2b(double E_total1to17)
589 {
590  //
591  // Read Cluster Table
592  //
593  MaxTCId.clear();
594  ClusterEnergy.clear();
595  ClusterTiming.clear();
596  ClusterPosition.clear();
597 
598  m_taub2bAngleFlag = 0;
599  m_taub2bEtotFlag = 0;
600  m_taub2bClusterEFlag = 0;
601 
602  if (E_total1to17 < m_taub2bEtotCut) {
603  m_taub2bEtotFlag = 1;
604  }
605 
606  StoreArray<TRGECLCluster> trgeclClusterArray;
607  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
608  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
609  int maxTCId = aTRGECLCluster->getMaxTCId();
610  double clusterenergy = aTRGECLCluster->getEnergyDep();
611  ClusterEnergy.push_back(clusterenergy);
612  MaxTCId.push_back(maxTCId);
613  }
614 
615  const int ncluster = ClusterEnergy.size();
616 
617  for (int icluster = 0; icluster < ncluster ; icluster++) {
618  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
619 
620  if (icluster == jcluster) {continue;}
621 
622  int energy1 = 0;
623  int energy2 = 0;
624  int dphi = 0;
625  int thetaSum = 0;
626  get2CLETP(MaxTCId[icluster],
627  MaxTCId[jcluster],
628  energy1,
629  energy2,
630  dphi,
631  thetaSum);
632 
633  if (dphi > m_taub2bAngleCut[0] &&
634  dphi < m_taub2bAngleCut[1] &&
635  thetaSum > m_taub2bAngleCut[2] &&
636  thetaSum < m_taub2bAngleCut[3]) {
637  m_taub2bAngleFlag++;
638  //
639  if ((ClusterEnergy[icluster] < m_taub2bClusterECut1 &&
640  ClusterEnergy[jcluster] < m_taub2bClusterECut2) ||
641  (ClusterEnergy[icluster] < m_taub2bClusterECut2 &&
642  ClusterEnergy[jcluster] < m_taub2bClusterECut1)) {
643  m_taub2bClusterEFlag++;
644  }
645  }
646  }
647  }
648 
649  bool Taub2bFlag = false;
650  if (m_taub2bAngleFlag > 0 &&
651  m_taub2bEtotFlag > 0 &&
652  m_taub2bClusterEFlag > 0) {
653  Taub2bFlag = true;
654  }
655 
656  return Taub2bFlag;
657 }
658 //========================================================
659 // taub2b selection for tau 1x1 process (tigher selection than taub2b
660 //========================================================
661 bool TrgEclBhabha::GetTaub2b2(double E_total1to17)
662 {
663  //
664  // Read Cluster Table
665  //
666  MaxTCId.clear();
667  ClusterEnergy.clear();
668  ClusterTiming.clear();
669  ClusterPosition.clear();
670 
671  int taub2b2EtotFlag = 0;
672  int taub2b2AngleFlag = 0;
673  int taub2b2NCLEndcapFlag = 0;
674  int taub2b2AngleCLEFlag = 0;
675 
676  if (E_total1to17 < m_taub2b2EtotCut) {
677  taub2b2EtotFlag = 1;
678  }
679 
680  // countor of cluster for E(cluster)>threshold in endcap
681  int ncl_clecut_endcap = 0;
682  // cluster array loop
683  StoreArray<TRGECLCluster> trgeclClusterArray;
684  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
685  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
686  int maxTCId = aTRGECLCluster->getMaxTCId();
687  double clusterenergy = aTRGECLCluster->getEnergyDep();
688  double clusterthetaid = aTRGECLCluster->getMaxThetaId();
689  ClusterEnergy.push_back(clusterenergy);
690  MaxTCId.push_back(maxTCId);
691  // count N(cluster) of E(cluster) > threshold in endcap
692  if ((clusterthetaid <= 3 ||
693  clusterthetaid >= 16) &&
694  clusterenergy > m_taub2b2CLEEndcapCut) {
695  ncl_clecut_endcap++;
696  }
697  }
698 
699  // bool for N(cluster) of E(cluster)>threshold in endcap
700  if (ncl_clecut_endcap < 2) {
701  taub2b2NCLEndcapFlag = 1;
702  }
703 
704  // total number of cluster
705  const int ncluster = ClusterEnergy.size();
706 
707  // 2 cluster combination
708  for (int icluster = 0; icluster < ncluster ; icluster++) {
709  for (int jcluster = icluster + 1; jcluster < ncluster; jcluster ++) {
710  if (icluster == jcluster) {continue;}
711  int energy1 = 0;
712  int energy2 = 0;
713  int dphi = 0;
714  int thetaSum = 0;
715  get2CLETP(MaxTCId[icluster],
716  MaxTCId[jcluster],
717  energy1,
718  energy2,
719  dphi,
720  thetaSum);
721  // delta phi and theta sum selection
722  if (dphi > m_taub2b2AngleCut[0] &&
723  dphi < m_taub2b2AngleCut[1] &&
724  thetaSum > m_taub2b2AngleCut[2] &&
725  thetaSum < m_taub2b2AngleCut[3]) {
726  taub2b2AngleFlag++;
727  if (ClusterEnergy[icluster] > m_taub2b2CLECut &&
728  ClusterEnergy[jcluster] > m_taub2b2CLECut) {
729  taub2b2AngleCLEFlag++;
730  }
731  }
732  }
733  }
734  //
735  bool taub2b2Flag = false;
736  if (taub2b2EtotFlag > 0 &&
737  taub2b2AngleFlag > 0 &&
738  taub2b2NCLEndcapFlag > 0 &&
739  taub2b2AngleCLEFlag > 0) {
740  taub2b2Flag = true;
741  }
742 
743  return taub2b2Flag;
744 }
745 //========================================================
746 // additional Bhabha veto
747 //========================================================
748 int TrgEclBhabha::GetBhabhaAddition(void)
749 {
750 
751  std::vector<int> MaxThetaId;
752  MaxThetaId.clear();
753  int bit_bhabha_addition = 0;
754 
755  StoreArray<TRGECLCluster> trgeclClusterArray;
756  for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
757  TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
758  int maxTCId = aTRGECLCluster->getMaxTCId();
759  MaxTCId.push_back(maxTCId);
760  int maxThetaId = aTRGECLCluster->getMaxThetaId();
761  MaxThetaId.push_back(maxThetaId);
762  }
763  int NofCluster1to17 = MaxThetaId.size();
764 
765  if (NofCluster1to17 == 1) {
766  if (MaxThetaId[0] <= 3) {
767  bit_bhabha_addition |= 0x01;
768  }
769  } else if (NofCluster1to17 == 2) {
770 
771  int energy1 = 0;
772  int energy2 = 0;
773  int dphi = 0;
774  int thetaSum = 0;
775  get2CLETP(MaxTCId[0],
776  MaxTCId[1],
777  energy1,
778  energy2,
779  dphi,
780  thetaSum);
781 
782  if ((dphi > m_3DBhabhaAddAngleCut[0] &&
783  dphi < m_3DBhabhaAddAngleCut[1]) &&
784  (thetaSum > m_3DBhabhaAddAngleCut[2] &&
785  thetaSum < m_3DBhabhaAddAngleCut[3])) {
786  bit_bhabha_addition |= 0x02;
787  }
788  if ((dphi > m_3DBhabhaAddAngleCut[0] &&
789  dphi < m_3DBhabhaAddAngleCut[1]) ||
790  (thetaSum > m_3DBhabhaAddAngleCut[2] &&
791  thetaSum < m_3DBhabhaAddAngleCut[3])) {
792  bit_bhabha_addition |= 0x04;
793  }
794 
795  int lowe_MaxThetaId = 0;
796  if (energy1 < energy2) {
797  lowe_MaxThetaId = MaxThetaId[0];
798  } else {
799  lowe_MaxThetaId = MaxThetaId[1];
800  }
801  if (lowe_MaxThetaId <= 3 ||
802  lowe_MaxThetaId >= 16) {
803  bit_bhabha_addition |= 0x08;
804  }
805 
806  }
807 
808  return bit_bhabha_addition;
809 }
810 //========================================================
811 // get cluster energy and angles(dphi and theta_sum) from LUT
812 //========================================================
813 void TrgEclBhabha::get2CLETP(int TCId1,
814  int TCId2,
815  int& energy1,
816  int& energy2,
817  int& dphi,
818  int& thetaSum)
819 {
820  int lut1 = _database->Get3DBhabhaLUT(TCId1);
821  int lut2 = _database->Get3DBhabhaLUT(TCId2);
822  energy1 = 15 & lut1;
823  energy2 = 15 & lut2;
824  lut1 >>= 4;
825  lut2 >>= 4;
826  int phi1 = 511 & lut1;
827  int phi2 = 511 & lut2;
828  lut1 >>= 9;
829  lut2 >>= 9;
830  int theta1 = lut1;
831  int theta2 = lut2;
832  dphi = abs(phi1 - phi2);
833  if (dphi > 180) {dphi = 360 - dphi;}
834  thetaSum = theta1 + theta2;
835 
836  return;
837 }
838 //========================================================
839 //
840 //========================================================
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:239
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:245
double _mumuThreshold
mumu bit Energy Threshold
Definition: TrgEclBhabha.h:259
TrgEclDataBase * _database
Object of Trigger ECL DataBase.
Definition: TrgEclBhabha.h:231
std::vector< double > _mumuAngle
mumu bit Angle
Definition: TrgEclBhabha.h:261
std::vector< double > _3DBhabhaVetoThreshold
3D Veto Bhabha Energy Threshold
Definition: TrgEclBhabha.h:253
std::vector< double > ClusterTiming
Cluster Timing.
Definition: TrgEclBhabha.h:243
bool GetBhabha02()
Belle II 3D Bhabha method for selection.
std::vector< double > _3DBhabhaSelectionAngle
3D Selection Bhabha Energy Angle
Definition: TrgEclBhabha.h:255
std::vector< double > _2DBhabhaThresholdBWD
2D Bhabha Energy Threshold
Definition: TrgEclBhabha.h:249
std::vector< double > BhabhaComb
Bhabha Combination.
Definition: TrgEclBhabha.h:237
std::vector< double > _3DBhabhaSelectionThreshold
3D Selection Bhabha Energy Threshold
Definition: TrgEclBhabha.h:251
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:241
TrgEclMapping * _TCMap
Object of TC Mapping.
Definition: TrgEclBhabha.h:228
std::vector< double > _2DBhabhaThresholdFWD
2D Bhabha Energy Threshold
Definition: TrgEclBhabha.h:247
std::vector< double > _3DBhabhaVetoAngle
3D Veto Bhabha Energy Angle
Definition: TrgEclBhabha.h:257
bool GetTaub2b2(double)
Taub2b selection (tighter selection than Taub2b)
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.