Belle II Software  release-08-01-10
KLMMuidLikelihoodVariables.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 /* KLM headers. */
10 #include <klm/dataobjects/KLMMuidLikelihood.h>
11 
12 /* Basf2 headers. */
13 #include <analysis/dataobjects/Particle.h>
14 #include <analysis/VariableManager/Manager.h>
15 #include <mdst/dataobjects/Track.h>
16 
17 namespace Belle2 {
22  namespace Variable {
23 
25  KLMMuidLikelihood* getMuid(const Particle* particle)
26  {
27  const Track* track = particle->getTrack();
28  if (!track)
29  return nullptr;
30  return track->getRelatedTo<KLMMuidLikelihood>();
31  }
32 
34  double muidMuonProbability(const Particle* particle)
35  {
36  KLMMuidLikelihood* muid = getMuid(particle);
37  if (!muid)
38  return std::numeric_limits<double>::quiet_NaN();
39  return muid->getMuonPDFValue();
40  }
41 
43  double muidPionProbability(const Particle* particle)
44  {
45  KLMMuidLikelihood* muid = getMuid(particle);
46  if (!muid)
47  return std::numeric_limits<double>::quiet_NaN();
48  return muid->getPionPDFValue();
49  }
50 
52  double muidKaonProbability(const Particle* particle)
53  {
54  KLMMuidLikelihood* muid = getMuid(particle);
55  if (!muid)
56  return std::numeric_limits<double>::quiet_NaN();
57  return muid->getKaonPDFValue();
58  }
59 
61  double muidElectronProbability(const Particle* particle)
62  {
63  KLMMuidLikelihood* muid = getMuid(particle);
64  if (!muid)
65  return std::numeric_limits<double>::quiet_NaN();
66  return muid->getElectronPDFValue();
67  }
68 
70  double muidProtonProbability(const Particle* particle)
71  {
72  KLMMuidLikelihood* muid = getMuid(particle);
73  if (!muid)
74  return std::numeric_limits<double>::quiet_NaN();
75  return muid->getProtonPDFValue();
76  }
77 
79  double muidDeuteronProbability(const Particle* particle)
80  {
81  KLMMuidLikelihood* muid = getMuid(particle);
82  if (!muid)
83  return std::numeric_limits<double>::quiet_NaN();
84  return muid->getDeuteronPDFValue();
85  }
86 
88  double muidMuonLogLikelihood(const Particle* particle)
89  {
90  KLMMuidLikelihood* muid = getMuid(particle);
91  if (!muid)
92  return std::numeric_limits<double>::quiet_NaN();
93  return muid->getLogL_mu();
94  }
95 
97  double muidPionLogLikelihood(const Particle* particle)
98  {
99  KLMMuidLikelihood* muid = getMuid(particle);
100  if (!muid)
101  return std::numeric_limits<double>::quiet_NaN();
102  return muid->getLogL_pi();
103  }
104 
106  double muidKaonLogLikelihood(const Particle* particle)
107  {
108  KLMMuidLikelihood* muid = getMuid(particle);
109  if (!muid)
110  return std::numeric_limits<double>::quiet_NaN();
111  return muid->getLogL_K();
112  }
113 
115  double muidElectronLogLikelihood(const Particle* particle)
116  {
117  KLMMuidLikelihood* muid = getMuid(particle);
118  if (!muid)
119  return std::numeric_limits<double>::quiet_NaN();
120  return muid->getLogL_e();
121  }
122 
124  double muidProtonLogLikelihood(const Particle* particle)
125  {
126  KLMMuidLikelihood* muid = getMuid(particle);
127  if (!muid)
128  return std::numeric_limits<double>::quiet_NaN();
129  return muid->getLogL_p();
130  }
131 
133  double muidDeuteronLogLikelihood(const Particle* particle)
134  {
135  KLMMuidLikelihood* muid = getMuid(particle);
136  if (!muid)
137  return std::numeric_limits<double>::quiet_NaN();
138  return muid->getLogL_d();
139  }
140 
142  double muidOutcomeExtTrack(const Particle* particle)
143  {
144  KLMMuidLikelihood* muid = getMuid(particle);
145  if (!muid)
146  return std::numeric_limits<double>::quiet_NaN();
147  return muid->getOutcome();
148  }
149 
151  double muidChiSquared(const Particle* particle)
152  {
153  KLMMuidLikelihood* muid = getMuid(particle);
154  if (!muid)
155  return std::numeric_limits<double>::quiet_NaN();
156  return muid->getChiSquared();
157  }
158 
160  double muidDegreesOfFreedom(const Particle* particle)
161  {
162  KLMMuidLikelihood* muid = getMuid(particle);
163  if (!muid)
164  return std::numeric_limits<double>::quiet_NaN();
165  return muid->getDegreesOfFreedom();
166  }
167 
169  double muidEndcapExtLayer(const Particle* particle)
170  {
171  KLMMuidLikelihood* muid = getMuid(particle);
172  if (!muid)
173  return std::numeric_limits<double>::quiet_NaN();
174  return muid->getEndcapExtLayer();
175  }
176 
178  double muidBarrelExtLayer(const Particle* particle)
179  {
180  KLMMuidLikelihood* muid = getMuid(particle);
181  if (!muid)
182  return std::numeric_limits<double>::quiet_NaN();
183  return muid->getBarrelExtLayer();
184  }
185 
187  double muidExtLayer(const Particle* particle)
188  {
189  KLMMuidLikelihood* muid = getMuid(particle);
190  if (!muid)
191  return std::numeric_limits<double>::quiet_NaN();
192  return muid->getExtLayer();
193  }
194 
196  double muidEndcapHitLayer(const Particle* particle)
197  {
198  KLMMuidLikelihood* muid = getMuid(particle);
199  if (!muid)
200  return std::numeric_limits<double>::quiet_NaN();
201  return muid->getEndcapHitLayer();
202  }
203 
205  double muidBarrelHitLayer(const Particle* particle)
206  {
207  KLMMuidLikelihood* muid = getMuid(particle);
208  if (!muid)
209  return std::numeric_limits<double>::quiet_NaN();
210  return muid->getBarrelHitLayer();
211  }
212 
214  double muidHitLayer(const Particle* particle)
215  {
216  KLMMuidLikelihood* muid = getMuid(particle);
217  if (!muid)
218  return std::numeric_limits<double>::quiet_NaN();
219  return muid->getHitLayer();
220  }
221 
223  double muidExtLayerPattern(const Particle* particle)
224  {
225  KLMMuidLikelihood* muid = getMuid(particle);
226  if (!muid)
227  return std::numeric_limits<double>::quiet_NaN();
228  return muid->getExtLayerPattern();
229  }
230 
232  double muidHitLayerPattern(const Particle* particle)
233  {
234  KLMMuidLikelihood* muid = getMuid(particle);
235  if (!muid)
236  return std::numeric_limits<double>::quiet_NaN();
237  return muid->getHitLayerPattern();
238  }
239 
241  double muidTotalBarrelHits(const Particle* particle)
242  {
243  KLMMuidLikelihood* muid = getMuid(particle);
244  if (!muid)
245  return std::numeric_limits<double>::quiet_NaN();
246  return muid->getTotalBarrelHits();
247  }
248 
250  double muidTotalEndcapHits(const Particle* particle)
251  {
252  KLMMuidLikelihood* muid = getMuid(particle);
253  if (!muid)
254  return std::numeric_limits<double>::quiet_NaN();
255  return muid->getTotalEndcapHits();
256  }
257 
259  double muidTotalHits(const Particle* particle)
260  {
261  return muidTotalBarrelHits(particle) + muidTotalEndcapHits(particle);
262  }
263 
264  VARIABLE_GROUP("KLMMuidLikelihood calibration");
265  REGISTER_VARIABLE("muidMuonProbability", muidMuonProbability,
266  "[Calibration] Returns the muon probability stored in the KLMMuidLikelihood dataobject");
267  REGISTER_VARIABLE("muidPionProbability", muidPionProbability,
268  "[Calibration] Returns the pion probability stored in the KLMMuidLikelihood dataobject");
269  REGISTER_VARIABLE("muidKaonProbability", muidKaonProbability,
270  "[Calibration] Returns the kaon probability stored in the KLMMuidLikelihood dataobject");
271  REGISTER_VARIABLE("muidElectronProbability", muidElectronProbability,
272  "[Calibration] Returns the electron probability stored in the KLMMuidLikelihood dataobject");
273  REGISTER_VARIABLE("muidProtonProbability", muidProtonProbability,
274  "[Calibration] Returns the proton probability stored in the KLMMuidLikelihood dataobject");
275  REGISTER_VARIABLE("muidDeuteronProbability", muidDeuteronProbability,
276  "[Calibration] Returns the deuteron probability stored in the KLMMuidLikelihood dataobject");
277  REGISTER_VARIABLE("muidMuonLogLikelihood", muidMuonLogLikelihood,
278  "[Calibration] Returns the muon log-likelihood stored in the KLMMuidLikelihood dataobject");
279  REGISTER_VARIABLE("muidPionLogLikelihood", muidPionLogLikelihood,
280  "[Calibration] Returns the pion log-likelihood stored in the KLMMuidLikelihood dataobject");
281  REGISTER_VARIABLE("muidKaonLogLikelihood", muidKaonLogLikelihood,
282  "[Calibration] Returns the kaon log-likelihood stored in the KLMMuidLikelihood dataobject");
283  REGISTER_VARIABLE("muidElectronLogLikelihood", muidElectronLogLikelihood,
284  "[Calibration] Returns the electron log-likelihood stored in the KLMMuidLikelihood dataobject");
285  REGISTER_VARIABLE("muidProtonLogLikelihood", muidProtonLogLikelihood,
286  "[Calibration] Returns the proton log-likelihood stored in the KLMMuidLikelihood dataobject");
287  REGISTER_VARIABLE("muidDeuteronLogLikelihood", muidDeuteronLogLikelihood,
288  "[Calibration] Returns the deuteron log-likelihood stored in the KLMMuidLikelihood dataobject");
289  REGISTER_VARIABLE("muidOutcomeExtTrack", muidOutcomeExtTrack,
290  "[Calibration] Returns outcome of muon extrapolation (see MuidElementNumbers for the complete list of the outcome values)");
291  REGISTER_VARIABLE("muidChiSquared", muidChiSquared,
292  "[Calibration] Returns chi-squared for this extrapolation");
293  REGISTER_VARIABLE("muidDegreesOfFreedom", muidDegreesOfFreedom,
294  "[Calibration] Returns number of degrees of freedom in chi-squared calculation");
295  REGISTER_VARIABLE("muidEndcapExtLayer", muidEndcapExtLayer,
296  "[Calibration] Returns outermost EKLM layer crossed by track during extrapolation");
297  REGISTER_VARIABLE("muidBarrelExtLayer", muidBarrelExtLayer,
298  "[Calibration] Returns outermost BKLM layer crossed by track during extrapolation");
299  REGISTER_VARIABLE("muidExtLayer", muidExtLayer,
300  "[Calibration] Returns outermost BKLM or EKLM layer crossed by track during extrapolation");
301  REGISTER_VARIABLE("muidEndcapHitLayer", muidEndcapHitLayer, "[Calibration] Returns outermost EKLM layer with a matching hit");
302  REGISTER_VARIABLE("muidBarrelHitLayer", muidBarrelHitLayer, "[Calibration] Returns outermost BKLM layer with a matching hit");
303  REGISTER_VARIABLE("muidHitLayer", muidHitLayer, "[Calibration] Return outermost BKLM or EKLM layer with a matching hit");
304  REGISTER_VARIABLE("muidExtLayerPattern", muidExtLayerPattern,
305  "[Calibration] Returns layer-crossing bit pattern during extrapolation");
306  REGISTER_VARIABLE("muidHitLayerPattern", muidHitLayerPattern, "[Calibration] Returns matching-hit bit pattern");
307  REGISTER_VARIABLE("muidTotalBarrelHits", muidTotalBarrelHits, "[Calibration] Returns total number of matching BKLM hits");
308  REGISTER_VARIABLE("muidTotalEndcapHits", muidTotalEndcapHits, "[Calibration] Returns total number of matching EKLM hits");
309  REGISTER_VARIABLE("muidTotalHits", muidTotalHits, "[Calibration] Returns total number of matching KLM hits");
310  }
312 }
Abstract base class for different kinds of events.