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),
18 m_DegreesOfFreedom(0),
19 m_Outcome(0),
20 m_IsForward(true),
21 m_BarrelExtLayer(-1),
22 m_EndcapExtLayer(-1),
23 m_ExtLayer(-1),
24 m_BarrelHitLayer(-1),
25 m_EndcapHitLayer(-1),
26 m_HitLayer(-1),
27 m_ExtLayerPattern(0),
28 m_HitLayerPattern(0)
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
43{
44}
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.
float m_LogL[Const::ChargedStable::c_SetSize]
Array of log-likelihoods.
bool isExtrapolatedEndcapLayerCrossed(int layer) const
Check whether the given EKLM layer is crossed during 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.
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_ExtBKLMEfficiencyValue[BKLMElementNumbers::getMaximalLayerNumber()]
Array of BKLM layer efficiencies.
bool isExtrapolatedBarrelLayerCrossed(int layer) const
Check whether the given BKLM layer is crossed during extrapolation.
float m_PDFValue[Const::ChargedStable::c_SetSize]
Array of normalized PDFs.
Abstract base class for different kinds of events.