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