Belle II Software  release-06-02-00
TrgEclBeamBKG.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 #define TRG_SHORT_NAMES
10 #define TRGECLCLUSTER_SHORT_NAMES
11 #include <framework/gearbox/Unit.h>
12 
13 #include <trg/ecl/TrgEclBeamBKG.h>
14 
15 using namespace std;
16 using namespace Belle2;
17 //
18 //
19 //
20 TrgEclBeamBKG::TrgEclBeamBKG()
21 {
22  for (int iii = 0; iii <= 2; iii++) {
23  for (int jjj = 0; jjj <= 3; jjj++) {
24  Quadrant[iii][jjj] = 0;
25  }
26  }
27  _TCMap = new TrgEclMapping();
28 
29 }
30 //
31 //
32 //
33 TrgEclBeamBKG::~TrgEclBeamBKG()
34 {
35 
36  delete _TCMap;
37 }
38 //
39 //
40 //
41 int TrgEclBeamBKG::GetBeamBkg(std::vector<std::vector<double>> ThetaRingSum)
42 {
43 
44  // forward
45  for (int iFwd = 0 ; iFwd < 32 ; iFwd++) {
46  int phiid = iFwd + 1;
47  if (ThetaRingSum[0][iFwd] > 0) {
48  if ((phiid >= 1 && phiid <= 9) || phiid == 32) {
49  Quadrant[0][0] = 1;
50  }
51  if (phiid >= 8 && phiid <= 17) {
52  Quadrant[0][1] = 1;
53  }
54  if (phiid >= 16 && phiid <= 25) {
55  Quadrant[0][2] = 1;
56  }
57  if ((phiid >= 24 && phiid <= 32) || phiid == 1) {
58  Quadrant[0][3] = 1;
59  }
60  }
61  }
62  // barrel
63  for (int iBr = 0 ; iBr < 36 ; iBr++) {
64  int phiid = iBr + 1;
65  if (ThetaRingSum[1][iBr] > 0) {
66  if ((phiid >= 1 && phiid <= 10) || phiid == 36) {
67  Quadrant[1][0] = 1;
68  }
69  if (phiid >= 9 && phiid <= 19) {
70  Quadrant[1][1] = 1;
71  }
72  if (phiid >= 18 && phiid <= 28) {
73  Quadrant[1][2] = 1;
74  }
75  if ((phiid >= 27 && phiid <= 36) || phiid == 1) {
76  Quadrant[1][3] = 1;
77  }
78  }
79  }
80  // selection for forward endcap
81  bool boolForward =
82  ((Quadrant[0][0] && Quadrant[0][2]) ||
83  (Quadrant[0][1] && Quadrant[0][3]));
84  // selection for barrel
85  bool boolBarrel =
86  ((Quadrant[1][0] && Quadrant[1][2]) ||
87  (Quadrant[1][1] && Quadrant[1][3]));
88  // bkg bit selection
89  int iBeamBkgVeto0 = 0;
90  int iBeamBkgVeto1 = 0;
91  int iBeamBkgVeto2 = 0;
92  if (boolForward || boolBarrel) {
93  iBeamBkgVeto0 = 1;
94  }
95  if ((!boolForward) && boolBarrel) {
96  iBeamBkgVeto1 = 1;
97  }
98  if (boolForward && (!boolBarrel)) {
99  iBeamBkgVeto2 = 1;
100  }
101  // set bkg bit parameter
102  int BeamBkgVeto = 0;
103  BeamBkgVeto |= (iBeamBkgVeto2 & 0x01);
104  BeamBkgVeto <<= 1;
105  BeamBkgVeto |= (iBeamBkgVeto1 & 0x01);
106  BeamBkgVeto <<= 1;
107  BeamBkgVeto |= (iBeamBkgVeto0 & 0x01);
108 
109  return BeamBkgVeto;
110 }
111 //
112 //
113 //
A class of TC Mapping.
Definition: TrgEclMapping.h:26
Abstract base class for different kinds of events.