Belle II Software  release-05-01-25
AcceptanceVariables.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Francesco Tenchini *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 // Own include
12 #include <analysis/variables/AcceptanceVariables.h>
13 #include <analysis/VariableManager/Manager.h>
14 
15 using namespace std;
16 
17 namespace Belle2 {
22  namespace Variable {
23 
24  //Theta Acceptance
25 
26  double thetaInCDCAcceptance(const Particle* particle)
27  {
28  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
29  if (theta > 17. && theta < 150.) {
30  return 1;
31  } else return 0;
32  }
33 
34  double thetaInTOPAcceptance(const Particle* particle)
35  {
36  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
37  if (theta > 31. && theta < 128.) {
38  return 1;
39  } else return 0;
40  }
41 
42  double thetaInARICHAcceptance(const Particle* particle)
43  {
44  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
45  if (theta > 14. && theta < 30.) {
46  return 1;
47  } else return 0;
48  }
49 
50  double thetaInECLAcceptance(const Particle* particle)
51  {
52  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
53  if (theta > 12.4 && theta < 31.4) { //forward
54  return 1;
55  } else if (theta > 32.2 && theta < 128.7) { //barrel
56  return 2;
57  } else if (theta > 130.7 && theta < 155.1) { //backwards
58  return 3;
59  } else return 0;
60  }
61 
62  double thetaInBECLAcceptance(const Particle* particle)
63  {
64  double acceptance = thetaInECLAcceptance(particle);
65  if (acceptance == 2) {
66  return 1;
67  } else return 0;
68  }
69 
70  double thetaInEECLAcceptance(const Particle* particle)
71  {
72  double acceptance = thetaInECLAcceptance(particle);
73  if (acceptance == 1 || acceptance == 3) {
74  return 1;
75  } else return 0;
76  }
77 
78  double thetaInKLMAcceptance(const Particle* particle)
79  {
80  double theta = particle->get4Vector().Theta() * 180. / TMath::Pi();
81  if (theta < 18.) return 0;
82  if (theta < 37.) return 1; //forward endcap
83  if (theta < 47.) return 2; //forward overlap
84  if (theta < 122.) return 3; //barrel
85  if (theta < 130.) return 4; //backward overlap
86  if (theta < 155.) return 5; //backward endcap
87  else return 0;
88  }
89 
90  double thetaInBKLMAcceptance(const Particle* particle)
91  {
92  double acceptance = thetaInKLMAcceptance(particle);
93  if (acceptance == 2 || acceptance == 3 || acceptance == 4) {
94  return 1;
95  } else return 0;
96  }
97 
98  double thetaInEKLMAcceptance(const Particle* particle)
99  {
100  double acceptance = thetaInKLMAcceptance(particle);
101  if (acceptance != 0 && acceptance != 3) {
102  return 1;
103  } else return 0;
104  }
105 
106  double thetaInKLMOverlapAcceptance(const Particle* particle)
107  {
108  double acceptance = thetaInKLMAcceptance(particle);
109  if (acceptance == 2 || acceptance == 4) {
110  return 1;
111  } else return 0;
112  }
113 
114  //Pt Acceptance
115 
116  double ptInTOPAcceptance(const Particle* particle)
117  {
118  if (particle->getCharge() == 0) return 1;
119  double pt = particle->get4Vector().Pt();
120  if (pt > 0.27) return 1;
121  else return 0;
122  }
123 
124  double ptInBECLAcceptance(const Particle* particle)
125  {
126  if (particle->getCharge() == 0) return 1;
127  double pt = particle->get4Vector().Pt();
128  if (pt > 0.28) return 1;
129  else return 0;
130  }
131 
132  double ptInBKLMAcceptance(const Particle* particle)
133  {
134  if (particle->getCharge() == 0) return 1;
135  double pt = particle->get4Vector().Pt();
136  if (pt > 0.6) return 1;
137  else return 0;
138  }
139 
140  //Combined Acceptance
141 
142  double inCDCAcceptance(const Particle* particle)
143  {
144  return thetaInCDCAcceptance(particle);
145  }
146 
147  double inTOPAcceptance(const Particle* particle)
148  {
149  return (thetaInTOPAcceptance(particle) && ptInTOPAcceptance(particle));
150  }
151 
152  double inARICHAcceptance(const Particle* particle)
153  {
154  return thetaInARICHAcceptance(particle);
155  }
156 
157  double inECLAcceptance(const Particle* particle)
158  {
159  return (thetaInEECLAcceptance(particle) || (thetaInBECLAcceptance(particle) && ptInBECLAcceptance(particle)));
160  }
161 
162  double inKLMAcceptance(const Particle* particle)
163  {
164  return (thetaInEKLMAcceptance(particle) || (thetaInBKLMAcceptance(particle) && ptInBKLMAcceptance(particle)));
165  }
166 
167  // ---
168 
169  VARIABLE_GROUP("Acceptance");
170 
171  REGISTER_VARIABLE("thetaInCDCAcceptance", thetaInCDCAcceptance, "Particle is within CDC angular acceptance.");
172  REGISTER_VARIABLE("thetaInTOPAcceptance", thetaInTOPAcceptance, "Particle is within TOP angular acceptance.");
173  REGISTER_VARIABLE("thetaInARICHAcceptance", thetaInARICHAcceptance, "Particle is within ARICH angular acceptance.");
174  REGISTER_VARIABLE("thetaInECLAcceptance", thetaInECLAcceptance,
175  "Particle is within ECL angular acceptance. 1: Forward; 2: Barrel; 3: Backwards.");
176  REGISTER_VARIABLE("thetaInBECLAcceptance", thetaInBECLAcceptance, "Particle is within Barrel ECL angular acceptance.");
177  REGISTER_VARIABLE("thetaInEECLAcceptance", thetaInEECLAcceptance, "Particle is within Endcap ECL angular acceptance.");
178  REGISTER_VARIABLE("thetaInKLMAcceptance", thetaInKLMAcceptance,
179  "Particle is within KLM angular acceptance. 1: Forward endcap; 2: Forward overalp; 3: Barrel; 4: Backward overlap; 5: Backward endcap.");
180  REGISTER_VARIABLE("thetaInBKLMAcceptance", thetaInBKLMAcceptance, "Particle is within Barrel KLM angular acceptance.");
181  REGISTER_VARIABLE("thetaInEKLMAcceptance", thetaInEKLMAcceptance, "Particle is within Endcap KLM angular acceptance.");
182  REGISTER_VARIABLE("thetaInKLMOverlapAcceptance", thetaInKLMOverlapAcceptance,
183  "Particle is within the angular region where KLM barrel and endcaps overlap.");
184 
185  REGISTER_VARIABLE("ptInTOPAcceptance", ptInTOPAcceptance, "Particle is within TOP transverse momentum acceptance.");
186  REGISTER_VARIABLE("ptInBECLAcceptance", ptInBECLAcceptance, "Particle is within Barrel ECL transverse momentum acceptance.");
187  REGISTER_VARIABLE("ptInBKLMAcceptance", ptInBKLMAcceptance, "Particle is within Barrel KLM transverse momentum acceptance.");
188 
189  REGISTER_VARIABLE("inCDCAcceptance", inCDCAcceptance, "Particle is within CDC geometrical acceptance.");
190  REGISTER_VARIABLE("inTOPAcceptance", inTOPAcceptance, "Particle is within TOP geometrical acceptance.");
191  REGISTER_VARIABLE("inARICHAcceptance", inARICHAcceptance, "Particle is within ARICH geometrical acceptance.");
192  REGISTER_VARIABLE("inECLAcceptance", inECLAcceptance, "Particle is within ECL geometrical acceptance.");
193  REGISTER_VARIABLE("inKLMAcceptance", inKLMAcceptance, "Particle is within KLM geometrical acceptance.");
194 
195  }
197 }
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19