Belle II Software  release-08-01-10
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  // cppcheck-suppress knownConditionTrueFalse
58  if ((phiid >= 24 && phiid <= 32) || phiid == 1) {
59  Quadrant[0][3] = 1;
60  }
61  }
62  }
63  // barrel
64  for (int iBr = 0 ; iBr < 36 ; iBr++) {
65  int phiid = iBr + 1;
66  if (ThetaRingSum[1][iBr] > 0) {
67  if ((phiid >= 1 && phiid <= 10) || phiid == 36) {
68  Quadrant[1][0] = 1;
69  }
70  if (phiid >= 9 && phiid <= 19) {
71  Quadrant[1][1] = 1;
72  }
73  if (phiid >= 18 && phiid <= 28) {
74  Quadrant[1][2] = 1;
75  }
76  // cppcheck-suppress knownConditionTrueFalse
77  if ((phiid >= 27 && phiid <= 36) || phiid == 1) {
78  Quadrant[1][3] = 1;
79  }
80  }
81  }
82  // selection for forward endcap
83  bool boolForward =
84  ((Quadrant[0][0] && Quadrant[0][2]) ||
85  (Quadrant[0][1] && Quadrant[0][3]));
86  // selection for barrel
87  bool boolBarrel =
88  ((Quadrant[1][0] && Quadrant[1][2]) ||
89  (Quadrant[1][1] && Quadrant[1][3]));
90  // bkg bit selection
91  int iBeamBkgVeto0 = 0;
92  int iBeamBkgVeto1 = 0;
93  int iBeamBkgVeto2 = 0;
94  if (boolForward || boolBarrel) {
95  iBeamBkgVeto0 = 1;
96  }
97  if ((!boolForward) && boolBarrel) {
98  iBeamBkgVeto1 = 1;
99  }
100  if (boolForward && (!boolBarrel)) {
101  iBeamBkgVeto2 = 1;
102  }
103  // set bkg bit parameter
104  int BeamBkgVeto = 0;
105  BeamBkgVeto |= (iBeamBkgVeto2 & 0x01);
106  BeamBkgVeto <<= 1;
107  BeamBkgVeto |= (iBeamBkgVeto1 & 0x01);
108  BeamBkgVeto <<= 1;
109  BeamBkgVeto |= (iBeamBkgVeto0 & 0x01);
110 
111  return BeamBkgVeto;
112 }
113 //
114 //
115 //
A class of TC Mapping.
Definition: TrgEclMapping.h:26
Abstract base class for different kinds of events.