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