Belle II Software development
KLMMuidLikelihood.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 <klm/dataobjects/KLMMuidLikelihood.h>
11
12using namespace Belle2;
13
15 m_PDGCode(0),
16 m_JunkPDFValue(false),
17 m_ChiSquared(0.0),
19 m_Outcome(0),
20 m_IsForward(true),
23 m_ExtLayer(-1),
26 m_HitLayer(-1),
29{
30 for (const Const::ChargedStable particle : Const::chargedStableSet) {
31 m_PDFValue[particle.getIndex()] = 0.0;
32 m_LogL[particle.getIndex()] = -1.0E20;
33 }
34 for (int i = 0; i < BKLMElementNumbers::getMaximalLayerNumber(); ++i) {
36 }
37 for (int i = 0; i < EKLMElementNumbers::getMaximalLayerNumber(); ++i) {
39 }
40}
41
45
47{
48 int charge = 1;
50 if (pdg < 0)
51 charge = -charge;
52 if ((std::abs(pdg) == Const::muon.getPDGCode()) || (std::abs(pdg) == Const::electron.getPDGCode()))
53 charge = -charge;
54 return charge;
55}
56
58{
59 unsigned int hits = 0;
60 unsigned int pattern = m_HitLayerPattern;
61 for (int bit = 0; bit < BKLMElementNumbers::getMaximalLayerNumber(); ++bit) {
62 if (pattern & (1 << bit)) {
63 hits++;
64 }
65 }
66 return hits;
67}
68
70{
71 unsigned int hits = 0;
72 unsigned int pattern = m_HitLayerPattern;
75 if (pattern & (1 << bit)) {
76 hits++;
77 }
78 }
79 return hits;
80}
81
83{
84 if ((layer < 0) || (layer >= BKLMElementNumbers::getMaximalLayerNumber()))
85 return false;
86 return m_ExtLayerPattern & (1 << layer);
87};
88
90{
91 if ((layer < 0) || (layer >= EKLMElementNumbers::getMaximalLayerNumber()))
92 return false;
94};
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:589
static const ChargedStable muon
muon particle
Definition Const.h:660
static const ParticleSet chargedStableSet
set of charged stable particles
Definition Const.h:618
static const ChargedStable electron
electron particle
Definition Const.h:659
static constexpr int getMaximalLayerNumber()
Get maximal layer number.
int getPDGCode() const
Get the PDG code of the particle hypothesis used during the extrapolation.
int m_ExtLayer
Outermost KLM layer crossed in the extrapolation.
unsigned int m_Outcome
Outcome of this extrapolation.
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.
int m_EndcapHitLayer
Outermost EKLM layer actually crossed by the track.
int m_BarrelHitLayer
Outermost BKLM layer actually crossed by the track.
bool isExtrapolatedEndcapLayerCrossed(int layer) const
Check whether the given EKLM layer is crossed during extrapolation.
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,...
unsigned int m_HitLayerPattern
Pattern of the layers actually crossed by the track (bits 0..14 = BKLM layers 1..15,...
unsigned int getTotalBarrelHits() const
Get the total number of crossed BKLM layers.
float m_ExtEKLMEfficiencyValue[EKLMElementNumbers::getMaximalLayerNumber()]
Array of EKLM layer efficiencies.
int m_HitLayer
Outermost KLM layer actually crossed by the track.
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.
float m_ChiSquared
Chi-squared of the extrapolation.
int m_DegreesOfFreedom
Number of degrees of freedom (= 2 times the number of KLM hits) for the chi-squared computation.
bool m_JunkPDFValue
Junk flag (1 if junk, 0 if not).
float m_ExtBKLMEfficiencyValue[BKLMElementNumbers::getMaximalLayerNumber()]
Array of BKLM layer efficiencies.
bool isExtrapolatedBarrelLayerCrossed(int layer) const
Check whether the given BKLM layer is crossed during extrapolation.
int m_PDGCode
PDG code of the particle hypothesis used during the extrapolation.
float m_PDFValue[Const::ChargedStable::c_SetSize]
Array of normalized PDFs.
Abstract base class for different kinds of events.