Belle II Software  light-2212-foldex
AcceptanceVariables.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 // Own include
10 #include <analysis/variables/AcceptanceVariables.h>
11 
12 // include VariableManager
13 #include <analysis/VariableManager/Manager.h>
14 
15 #include <analysis/dataobjects/Particle.h>
16 
17 using namespace std;
18 
19 namespace Belle2 {
24  namespace Variable {
25 
26  //Theta Acceptance
27 
28  bool thetaInCDCAcceptance(const Particle* particle)
29  {
30  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
31  if (theta > 17. && theta < 150.) {
32  return true;
33  } else return false;
34  }
35 
36  bool thetaInTOPAcceptance(const Particle* particle)
37  {
38  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
39  if (theta > 32.20 && theta < 123.86) {
40  return true;
41  } else return false;
42  }
43 
44  bool thetaInARICHAcceptance(const Particle* particle)
45  {
46  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
47  if (theta > 14. && theta < 30.) {
48  return true;
49  } else return false;
50  }
51 
52  int thetaInECLAcceptance(const Particle* particle)
53  {
54  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
55  if (theta > 12.4 && theta < 31.4) { //forward
56  return 1;
57  } else if (theta > 32.2 && theta < 128.7) { //barrel
58  return 2;
59  } else if (theta > 130.7 && theta < 155.1) { //backwards
60  return 3;
61  } else return 0;
62  }
63 
64  bool thetaInBECLAcceptance(const Particle* particle)
65  {
66  double acceptance = thetaInECLAcceptance(particle);
67  if (acceptance == 2) {
68  return true;
69  } else return false;
70  }
71 
72  bool thetaInEECLAcceptance(const Particle* particle)
73  {
74  double acceptance = thetaInECLAcceptance(particle);
75  if (acceptance == 1 || acceptance == 3) {
76  return true;
77  } else return false;
78  }
79 
80  int thetaInKLMAcceptance(const Particle* particle)
81  {
82  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
83  if (theta < 18.) return 0;
84  if (theta < 37.) return 1; //forward endcap
85  if (theta < 47.) return 2; //forward overlap
86  if (theta < 122.) return 3; //barrel
87  if (theta < 130.) return 4; //backward overlap
88  if (theta < 155.) return 5; //backward endcap
89  else return 0;
90  }
91 
92  bool thetaInBKLMAcceptance(const Particle* particle)
93  {
94  double acceptance = thetaInKLMAcceptance(particle);
95  if (acceptance == 2 || acceptance == 3 || acceptance == 4) {
96  return true;
97  } else return false;
98  }
99 
100  bool thetaInEKLMAcceptance(const Particle* particle)
101  {
102  double acceptance = thetaInKLMAcceptance(particle);
103  if (acceptance != 0 && acceptance != 3) {
104  return true;
105  } else return false;
106  }
107 
108  bool thetaInKLMOverlapAcceptance(const Particle* particle)
109  {
110  double acceptance = thetaInKLMAcceptance(particle);
111  if (acceptance == 2 || acceptance == 4) {
112  return true;
113  } else return false;
114  }
115 
116  //Pt Acceptance
117 
118  bool ptInTOPAcceptance(const Particle* particle)
119  {
120  if (particle->getCharge() == 0) return 1;
121  double pt = particle->get4Vector().Pt();
122  if (pt > 0.27) return true;
123  else return false;
124  }
125 
126  bool ptInBECLAcceptance(const Particle* particle)
127  {
128  if (particle->getCharge() == 0) return 1;
129  double pt = particle->get4Vector().Pt();
130  if (pt > 0.28) return true;
131  else return false;
132  }
133 
134  bool ptInBKLMAcceptance(const Particle* particle)
135  {
136  if (particle->getCharge() == 0) return 1;
137  double pt = particle->get4Vector().Pt();
138  if (pt > 0.6) return true;
139  else return false;
140  }
141 
142  //Combined Acceptance
143 
144  bool inCDCAcceptance(const Particle* particle)
145  {
146  return thetaInCDCAcceptance(particle);
147  }
148 
149  bool inTOPAcceptance(const Particle* particle)
150  {
151  return (thetaInTOPAcceptance(particle) && ptInTOPAcceptance(particle));
152  }
153 
154  bool inARICHAcceptance(const Particle* particle)
155  {
156  return thetaInARICHAcceptance(particle);
157  }
158 
159  bool inECLAcceptance(const Particle* particle)
160  {
161  return (thetaInEECLAcceptance(particle) || (thetaInBECLAcceptance(particle) && ptInBECLAcceptance(particle)));
162  }
163 
164  bool inKLMAcceptance(const Particle* particle)
165  {
166  return (thetaInEKLMAcceptance(particle) || (thetaInBKLMAcceptance(particle) && ptInBKLMAcceptance(particle)));
167  }
168 
169  // ---
170 
171  VARIABLE_GROUP("Acceptance");
172 
173  REGISTER_VARIABLE("thetaInCDCAcceptance", thetaInCDCAcceptance, R"DOC(
174 Returns true if particle is within CDC angular acceptance, false otherwise.
175 This variable checks if the particle polar angle :math:`\theta` is within the range :math:`17^\circ < \theta < 150^\circ`.
176 The polar angle is computed using only the initial particle momentum.
177 )DOC");
178  REGISTER_VARIABLE("thetaInTOPAcceptance", thetaInTOPAcceptance, R"DOC(
179 Returns true if particle is within TOP angular acceptance, false otherwise.
180 This variable checks if the particle polar angle :math:`\theta` is within the range :math:`31^\circ < \theta < 128^\circ`.
181 The polar angle is computed using only the initial particle momentum.
182 )DOC");
183  REGISTER_VARIABLE("thetaInARICHAcceptance", thetaInARICHAcceptance, R"DOC(
184 Returns true if particle is within ARICH angular acceptance, false otherwise.
185 This variable checks if the particle polar angle :math:`\theta` is within the range :math:`14^\circ < \theta < 30^\circ`.
186 The polar angle is computed using only the initial particle momentum.
187 )DOC");
188  REGISTER_VARIABLE("thetaInECLAcceptance", thetaInECLAcceptance, R"DOC(
189 Checks if particle is within ECL angular acceptance.
190 This variable checks if the particle polar angle :math:`\theta` is within certain ranges.
191 Return values and the corresponding :math:`\theta` ranges are the following:
192 
193 * 0: Outside of ECL acceptance, :math:`\theta < 12.4^\circ` or :math:`\theta > 155.1^\circ`,
194  or in one of the acceptance gaps at :math:`31.4^{\circ} < \theta < 32.2^{\circ}`
195  or :math:`128.7^{\circ} < \theta < 130.7^{\circ}`;
196 * 1: Forward ECL, :math:`12.4^\circ < \theta < 31.4^\circ`;
197 * 2: Barrel ECL, :math:`32.2^\circ < \theta < 128.7^\circ`;
198 * 3: Backward ECL, :math:`130.7^\circ < \theta < 155.1^\circ`.
199 
200 The polar angle is computed using only the initial particle momentum.
201 )DOC");
202  REGISTER_VARIABLE("thetaInBECLAcceptance", thetaInBECLAcceptance, R"DOC(
203 Returns true if particle is within Barrel ECL angular acceptance, false otherwise.
204 This variable checks if the particle polar angle :math:`\theta` is within the range :math:`32.2^\circ < \theta < 128.7^\circ`.
205 The polar angle is computed using only the initial particle momentum.
206 )DOC");
207  REGISTER_VARIABLE("thetaInEECLAcceptance", thetaInEECLAcceptance, R"DOC(
208 Returns true if particle is within Endcap ECL angular acceptance, false otherwise.
209 This variable checks if the particle polar angle :math:`\theta` is within the range :math:`12.4^\circ < \theta < 31.4^\circ`
210 or :math:`130.7^\circ < \theta < 155.1^\circ`.
211 The polar angle is computed using only the initial particle momentum.
212 )DOC");
213  REGISTER_VARIABLE("thetaInKLMAcceptance", thetaInKLMAcceptance, R"DOC(
214 Checks if particle is within KLM angular acceptance.
215 This variable checks if the particle polar angle :math:`\theta` is within certain ranges.
216 Return values and the corresponding :math:`\theta` ranges are the following:
217 
218 * 0: Outside of KLM acceptance, :math:`\theta < 18^\circ` or :math:`\theta < 155^\circ`.
219 * 1: Forward endcap, :math:`18^\circ < \theta < 37^\circ`;
220 * 2: Forward overlap, :math:`37^\circ < \theta < 47^\circ`;
221 * 3: Barrel, :math:`47^\circ < \theta < 122^\circ`;
222 * 4: Backward overlap, :math:`122^\circ < \theta < 130^\circ`;
223 * 5: Backward endcap, :math:`130^\circ < \theta < 155^\circ`.
224 
225 The polar angle is computed using only the initial particle momentum.
226 )DOC");
227 
228  REGISTER_VARIABLE("thetaInBKLMAcceptance", thetaInBKLMAcceptance, R"DOC(
229 Returns true if particle is within Barrel KLM angular acceptance, false otherwise.
230 This variable checks if the particle polar angle :math:`\theta` is within the range :math:`37^\circ < \theta < 130^\circ`.
231 The polar angle is computed using only the initial particle momentum.
232 )DOC");
233  REGISTER_VARIABLE("thetaInEKLMAcceptance", thetaInEKLMAcceptance, R"DOC(
234 Returns true if particle is within Endcap KLM angular acceptance, false otherwise.
235 This variable checks if the particle polar angle :math:`\theta` is within the range :math:`18^\circ < \theta < 47^\circ` or :math:`122^\circ < \theta < 155^\circ`.
236 The polar angle is computed using only the initial particle momentum.
237 )DOC");
238  REGISTER_VARIABLE("thetaInKLMOverlapAcceptance", thetaInKLMOverlapAcceptance, R"DOC(
239 Returns true if particle is within the angular region where KLM barrel and endcaps overlap, false otherwise.
240 This variable checks if the particle polar angle :math:`\theta` is within the range :math:`37^\circ < \theta < 47^\circ` or :math:`122^\circ < \theta < 130^\circ`.
241 The polar angle is computed using only the initial particle momentum.
242 )DOC");
243 
244  REGISTER_VARIABLE("ptInTOPAcceptance", ptInTOPAcceptance, "Returns true if particle transverse momentum :math:`p_t` is within TOP acceptance, :math:`p_t > 0.27` GeV, false otherwise.");
245  REGISTER_VARIABLE("ptInBECLAcceptance", ptInBECLAcceptance, "Returns true if particle transverse momentum :math:`p_t` is within Barrel ECL acceptance, :math:`p_t > 0.28` GeV, false otherwise.");
246  REGISTER_VARIABLE("ptInBKLMAcceptance", ptInBKLMAcceptance, "Returns true if particle transverse momentum :math:`p_t` is within Barrel KLM acceptance, :math:`p_t > 0.6` GeV, false otherwise.");
247 
248  REGISTER_VARIABLE("inCDCAcceptance", inCDCAcceptance, R"DOC(
249 Returns true if particle is within CDC geometrical and kinematical acceptance, false otherwise.
250 This variable is an alias for :b2:var:`thetaInCDCAcceptance`.
251 )DOC");
252  REGISTER_VARIABLE("inTOPAcceptance", inTOPAcceptance, R"DOC(
253 Returns true if particle is within TOP geometrical and kinematical acceptance, false otherwise.
254 This variable is a combination of :b2:var:`thetaInTOPAcceptance` and :b2:var:`ptInTOPAcceptance`.
255 )DOC");
256  REGISTER_VARIABLE("inARICHAcceptance", inARICHAcceptance, R"DOC(
257 Returns true if particle is within ARICH geometrical and kinematical acceptance, false otherwise.
258 This variable is an alias for :b2:var:`thetaInARICHAcceptance`.
259 )DOC");
260  REGISTER_VARIABLE("inECLAcceptance", inECLAcceptance, R"DOC(
261 Returns true if particle is within ECL geometrical and kinematical acceptance, false otherwise.");
262 This variable is a combination of :b2:var:`thetaInEECLAcceptance`, :b2:var:`thetaInBECLAcceptance` and :b2:var:`ptInBECLAcceptance`.
263 )DOC");
264  REGISTER_VARIABLE("inKLMAcceptance", inKLMAcceptance, R"DOC(
265 Returns true if particle is within KLM geometrical and kinematical acceptance, false otherwise.
266 This variable is a combination of :b2:var:`thetaInEKLMAcceptance`, :b2:var:`thetaInBKLMAcceptance` and :b2:var:`ptInBKLMAcceptance`.
267 )DOC");
268 
269  }
271 }
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:23