Belle II Software  release-08-01-10
KLMMuidLikelihood.h
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 #pragma once
10 
11 /* KLM headers. */
12 #include <klm/dataobjects/bklm/BKLMElementNumbers.h>
13 #include <klm/dataobjects/eklm/EKLMElementNumbers.h>
14 
15 /* Basf2 headers. */
16 #include <framework/datastore/RelationsObject.h>
17 #include <framework/gearbox/Const.h>
18 
19 namespace Belle2 {
29 
30  public:
31 
36 
41 
45  int getPDGCode() const
46  {
47  return m_PDGCode;
48  }
49 
53  int getCharge() const;
54 
59  double getPDFValue(int pdg) const
60  {
62  }
63 
67  double getMuonPDFValue() const
68  {
70  }
71 
75  double getPionPDFValue() const
76  {
78  }
79 
83  double getKaonPDFValue() const
84  {
86  }
87 
91  double getProtonPDFValue() const
92  {
94  }
95 
99  double getDeuteronPDFValue() const
100  {
102  }
103 
107  double getElectronPDFValue() const
108  {
110  }
111 
115  bool getJunkPDFValue() const
116  {
117  return m_JunkPDFValue;
118  }
119 
124  double getLogL(int pdg) const
125  {
126  return m_LogL[Const::ChargedStable(pdg).getIndex()];
127  }
128 
132  double getLogL_mu() const
133  {
134  return getLogL(Const::muon.getPDGCode());
135  }
136 
140  double getLogL_pi() const
141  {
142  return getLogL(Const::pion.getPDGCode());
143  }
144 
148  double getLogL_K() const
149  {
150  return getLogL(Const::kaon.getPDGCode());
151  }
152 
156  double getLogL_p() const
157  {
158  return getLogL(Const::proton.getPDGCode());
159  }
160 
164  double getLogL_d() const
165  {
167  }
168 
172  double getLogL_e() const
173  {
175  }
176 
180  double getChiSquared() const
181  {
182  return m_ChiSquared;
183  }
184 
189  {
190  return m_DegreesOfFreedom;
191  }
192 
198  unsigned int getOutcome() const
199  {
200  return m_Outcome;
201  }
202 
206  bool getIsForward() const
207  {
208  return m_IsForward;
209  }
210 
214  int getBarrelExtLayer() const
215  {
216  return m_BarrelExtLayer;
217  }
218 
222  int getEndcapExtLayer() const
223  {
224  return m_EndcapExtLayer;
225  }
226 
230  int getExtLayer() const
231  {
232  return m_ExtLayer;
233  }
234 
238  int getBarrelHitLayer() const
239  {
240  return m_BarrelHitLayer;
241  }
242 
246  int getEndcapHitLayer() const
247  {
248  return m_EndcapHitLayer;
249  }
250 
254  int getHitLayer() const
255  {
256  return m_HitLayer;
257  }
258 
262  unsigned int getExtLayerPattern() const
263  {
264  return m_ExtLayerPattern;
265  }
266 
270  unsigned int getHitLayerPattern() const
271  {
272  return m_HitLayerPattern;
273  }
274 
278  unsigned int getTotalBarrelHits() const;
279 
283  unsigned int getTotalEndcapHits() const;
284 
289  float getExtBKLMEfficiencyValue(int layer) const
290  {
291  return m_ExtBKLMEfficiencyValue[layer];
292  }
293 
298  float getExtEKLMEfficiencyValue(int layer) const
299  {
300  return m_ExtEKLMEfficiencyValue[layer];
301  }
302 
307  void setPDGCode(int pdg)
308  {
309  m_PDGCode = pdg;
310  }
311 
317  void setPDFValue(double pdfValue, int pdg)
318  {
319  m_PDFValue[Const::ChargedStable(pdg).getIndex()] = pdfValue;
320  }
321 
326  void setMuonPDFValue(double pdfValue)
327  {
328  setPDFValue(pdfValue, Const::muon.getPDGCode());
329  }
330 
335  void setPionPDFValue(double pdfValue)
336  {
337  setPDFValue(pdfValue, Const::pion.getPDGCode());
338  }
339 
344  void setKaonPDFValue(double pdfValue)
345  {
346  setPDFValue(pdfValue, Const::kaon.getPDGCode());
347  }
348 
353  void setProtonPDFValue(double pdfValue)
354  {
355  setPDFValue(pdfValue, Const::proton.getPDGCode());
356  }
357 
362  void setDeuteronPDFValue(double pdfValue)
363  {
365  }
366 
371  void setElectronPDFValue(double pdfValue)
372  {
374  }
375 
380  void setJunkPDFValue(bool flag)
381  {
382  m_JunkPDFValue = flag;
383  }
384 
390  void setLogL(double logL, int pdg)
391  {
392  m_LogL[Const::ChargedStable(pdg).getIndex()] = logL;
393  }
394 
399  void setLogL_mu(double logL)
400  {
401  setLogL(logL, Const::muon.getPDGCode());
402  }
403 
408  void setLogL_pi(double logL)
409  {
410  setLogL(logL, Const::pion.getPDGCode());
411  }
412 
417  void setLogL_K(double logL)
418  {
419  setLogL(logL, Const::kaon.getPDGCode());
420  }
421 
426  void setLogL_p(double logL)
427  {
429  }
430 
435  void setLogL_d(double logL)
436  {
438  }
439 
444  void setLogL_e(double logL)
445  {
447  }
448 
453  void setChiSquared(double chiSquared)
454  {
455  m_ChiSquared = chiSquared;
456  }
457 
462  void setDegreesOfFreedom(int dof)
463  {
464  m_DegreesOfFreedom = dof;
465  }
466 
473  void setOutcome(unsigned int outcome)
474  {
475  m_Outcome = outcome;
476  }
477 
482  void setIsForward(bool isForward)
483  {
484  m_IsForward = isForward;
485  }
486 
491  void setBarrelExtLayer(int layer)
492  {
493  m_BarrelExtLayer = layer;
494  }
495 
500  void setEndcapExtLayer(int layer)
501  {
502  m_EndcapExtLayer = layer;
503  }
504 
509  void setExtLayer(int layer)
510  {
511  m_ExtLayer = layer;
512  }
513 
518  void setBarrelHitLayer(int layer)
519  {
520  m_BarrelHitLayer = layer;
521  }
522 
527  void setEndcapHitLayer(int layer)
528  {
529  m_EndcapHitLayer = layer;
530  }
531 
536  void setHitLayer(int layer)
537  {
538  m_HitLayer = layer;
539  }
540 
545  void setExtLayerPattern(unsigned int pattern)
546  {
547  m_ExtLayerPattern = pattern;
548  }
549 
554  void setHitLayerPattern(unsigned int pattern)
555  {
556  m_HitLayerPattern = pattern;
557  }
558 
564  void setExtBKLMEfficiencyValue(int layer, float efficiency)
565  {
566  m_ExtBKLMEfficiencyValue[layer] = efficiency;
567  }
568 
574  void setExtEKLMEfficiencyValue(int layer, float efficiency)
575  {
576  m_ExtEKLMEfficiencyValue[layer] = efficiency;
577  }
578 
583  bool isExtrapolatedBarrelLayerCrossed(int layer) const;
584 
589  bool isExtrapolatedEndcapLayerCrossed(int layer) const;
590 
591  private:
592 
595 
598 
601 
604 
607 
610 
612  unsigned int m_Outcome;
613 
616 
619 
622 
625 
628 
631 
634 
639  unsigned int m_ExtLayerPattern;
640 
645  unsigned int m_HitLayerPattern;
646 
649 
652 
655 
656  };
658 }
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:580
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:606
int getIndex() const
This particle's index in the associated set.
Definition: Const.h:452
static const ChargedStable muon
muon particle
Definition: Const.h:651
static const ChargedStable pion
charged pion particle
Definition: Const.h:652
static const ChargedStable proton
proton particle
Definition: Const.h:654
static const ChargedStable kaon
charged kaon particle
Definition: Const.h:653
static const ChargedStable electron
electron particle
Definition: Const.h:650
static const ChargedStable deuteron
deuteron particle
Definition: Const.h:655
static constexpr int getMaximalLayerNumber()
Get maximal layer number.
Class to store the likelihoods from KLM with additional informations related to the extrapolation.
double getLogL_pi() const
Get the log-likelihood for the pion hypothesis.
int getPDGCode() const
Get the PDG code of the particle hypothesis used during the extrapolation.
void setExtLayer(int layer)
Set the outermost EKLM layer crossed in the extrapolation.
double getLogL_d() const
Get the log-likelihood for the deuteron hypothesis.
int m_ExtLayer
Outermost KLM layer crossed in the extrapolation.
void setExtLayerPattern(unsigned int pattern)
Set the pattern of the layers crossed in the extrapolation.
void setLogL(double logL, int pdg)
Set the log-likelihood.
void setLogL_pi(double logL)
Set the log-likelihood for the pion hypothesis.
void setExtEKLMEfficiencyValue(int layer, float efficiency)
Set the efficiency of a given EKLM layer.
void setExtBKLMEfficiencyValue(int layer, float efficiency)
Set the efficiency of a given BKLM layer.
int getEndcapHitLayer() const
Get the outermost EKLM layer actually crossed by the track.
void setPionPDFValue(double pdfValue)
Set the normalized PDF for the pion hypothesis.
void setChiSquared(double chiSquared)
Set the chi-squared of the extrapolation.
void setHitLayerPattern(unsigned int pattern)
Set the pattern of the layers actually crossed by the track.
unsigned int m_Outcome
Outcome of this extrapolation.
double getElectronPDFValue() const
Get the normalized PDF for the electron hypothesis.
unsigned int getHitLayerPattern() const
Get the pattern of the layers actually crossed by the track.
bool m_IsForward
Flag to determine if this extrapolation is in forward or backward B/EKLM.
int m_BarrelExtLayer
Outermost BKLM layer crossed in the extrapolation.
float m_LogL[Const::ChargedStable::c_SetSize]
Array of log-likelihoods.
double getLogL_e() const
Get the log-likelihood for the electron hypothesis.
void setLogL_d(double logL)
Set the log-likelihood for the deuteron hypothesis.
void setBarrelExtLayer(int layer)
Set the outermost BKLM layer crossed in the extrapolation.
void setLogL_mu(double logL)
Set the log-likelihood for the muon hypothesis.
void setIsForward(bool isForward)
Set if this extrapolation is in forward or backward B/EKLM.
int m_EndcapHitLayer
Outermost EKLM layer actually crossed by the track.
void setJunkPDFValue(bool flag)
Set the junk flag (1 if junk, 0 if not).
int m_BarrelHitLayer
Outermost BKLM layer actually crossed by the track.
void setPDGCode(int pdg)
Set the PDG code of the particle hypothesis used during the extrapolation.
bool isExtrapolatedEndcapLayerCrossed(int layer) const
Check whether the given EKLM layer is crossed during extrapolation.
double getLogL_p() const
Get the log-likelihood for the proton hypothesis.
int m_EndcapExtLayer
Outermost EKLM layer crossed in the extrapolation.
unsigned int m_ExtLayerPattern
Pattern of the layers crossed in the extrapolation (bits 0..14 = BKLM layers 1..15,...
void setLogL_p(double logL)
Set the log-likelihood for the proton hypothesis.
bool getIsForward() const
Return if this extrapolation is in forward or backward B/EKLM.
unsigned int m_HitLayerPattern
Pattern of the layers actually crossed by the track (bits 0..14 = BKLM layers 1..15,...
void setDeuteronPDFValue(double pdfValue)
Set the normalized PDF for the deuteron hypothesis.
void setElectronPDFValue(double pdfValue)
Set the normalized PDF for the electron hypothesis.
void setDegreesOfFreedom(int dof)
Set the number of degrees of freedom (= 2 times the number of KLM hits) for the chi-square computatio...
int getDegreesOfFreedom() const
Get the number of degrees of freedom (= 2 times the number of KLM hits) for the chi-squared computati...
unsigned int getTotalBarrelHits() const
Get the total number of crossed BKLM layers.
void setLogL_e(double logL)
Set the log-likelihood for the electron hypothesis.
float m_ExtEKLMEfficiencyValue[EKLMElementNumbers::getMaximalLayerNumber()]
Array of EKLM layer efficiencies.
int m_HitLayer
Outermost KLM layer actually crossed by the track.
float getExtEKLMEfficiencyValue(int layer) const
Get the efficiency of a given EKLM layer.
double getKaonPDFValue() const
Get the normalized PDF for the kaon hypothesis.
unsigned int getOutcome() const
Get the outcome of this extrapolation.
unsigned int getTotalEndcapHits() const
Get the total number of crossed EKLM layers.
int getCharge() const
Get the charge of the particle hypothesis used during the extrapolation.
int getHitLayer() const
Get the outermost KLM layer actually crossed by the track.
void setKaonPDFValue(double pdfValue)
Set the normalized PDF for the kaon hypothesis.
double getPionPDFValue() const
Get the normalized PDF for the pion hypothesis.
int getExtLayer() const
Get the outermost KLM layer crossed in the extrapolation.
double getDeuteronPDFValue() const
Get the normalized PDF for the deuteron hypothesis.
void setPDFValue(double pdfValue, int pdg)
Set the normalized PDF.
double getChiSquared() const
Get the chi-squared of the extrapolation.
int getBarrelExtLayer() const
Get the outermost BKLM layer crossed in the extrapolation.
void setEndcapExtLayer(int layer)
Set the outermost EKLM layer crossed in the extrapolation.
float m_ChiSquared
Chi-squared of the extrapolation.
double getPDFValue(int pdg) const
Get the normalized PDF.
void setMuonPDFValue(double pdfValue)
Set the normalized PDF for the muon hypothesis.
void setProtonPDFValue(double pdfValue)
Set the normalized PDF for the proton hypothesis.
float getExtBKLMEfficiencyValue(int layer) const
Get the efficiency of a given BKLM layer.
double getProtonPDFValue() const
Get the normalized PDF for the proton hypothesis.
void setBarrelHitLayer(int layer)
Set the outermost BKLM layer actually crossed by the track.
int m_DegreesOfFreedom
Number of degrees of freedom (= 2 times the number of KLM hits) for the chi-squared computation.
double getLogL_mu() const
Get the log-likelihood for the muon hypothesis.
bool getJunkPDFValue() const
Get the junk flag (1 if junk, 0 if not).
bool m_JunkPDFValue
Junk flag (1 if junk, 0 if not).
void setOutcome(unsigned int outcome)
Set the outcome of this extrapolation.
float m_ExtBKLMEfficiencyValue[BKLMElementNumbers::getMaximalLayerNumber()]
Array of BKLM layer efficiencies.
void setLogL_K(double logL)
Set the log-likelihood for the kaon hypothesis.
double getLogL(int pdg) const
Get the log-likelihood.
bool isExtrapolatedBarrelLayerCrossed(int layer) const
Check whether the given BKLM layer is crossed during extrapolation.
double getMuonPDFValue() const
Get the normalized PDF for the muon hypothesis.
void setHitLayer(int layer)
Set the outermost KLM layer actually crossed by the track.
double getLogL_K() const
Get the log-likelihood for the kaon hypothesis.
unsigned int getExtLayerPattern() const
Get the pattern of the layers crossed in the extrapolation.
int m_PDGCode
PDG code of the particle hypothesis used during the extrapolation.
void setEndcapHitLayer(int layer)
Set the outermost EKLM layer actually crossed by the track.
float m_PDFValue[Const::ChargedStable::c_SetSize]
Array of normalized PDFs.
int getEndcapExtLayer() const
Get the outermost EKLM layer crossed in the extrapolation.
int getBarrelHitLayer() const
Get the outermost BKLM layer actually crossed by the track.
Defines interface for accessing relations of objects in StoreArray.
ClassDef(RelationsInterface, 0)
defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.