Belle II Software  release-08-01-10
MuidElementNumbers.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 #include <klm/dataobjects/KLMElementNumbers.h>
15 
16 /* C++ headers. */
17 #include <vector>
18 
19 namespace Belle2 {
29 
30  public:
31 
35  enum Outcome {
36  c_NotReached = 0,
37  c_StopInBarrel = 1,
38  c_StopInForwardEndcap = 2,
39  c_ExitBarrel = 3,
40  c_ExitForwardEndcap = 4,
41  c_StopInBackwardEndcap = 5,
42  c_ExitBackwardEndcap = 6,
43  c_CrossBarrelStopInForwardMin = 7,
44  c_CrossBarrelStopInForwardMax = 21,
45  c_CrossBarrelStopInBackwardMin = 22,
46  c_CrossBarrelStopInBackwardMax = 36,
47  c_CrossBarrelExitForwardMin = 37,
48  c_CrossBarrelExitForwardMax = 51,
49  c_CrossBarrelExitBackwardMin = 52,
50  c_CrossBarrelExitBackwardMax = 66
51  };
52 
57  c_Both = 0,
58  c_OnlyBarrel = KLMElementNumbers::c_BKLM,
59  c_OnlyEndcap = KLMElementNumbers::c_EKLM,
60  };
61 
65  enum Hypothesis {
66  c_NotValid = -1,
67  c_Positron = 0,
68  c_Electron = 1,
69  c_Deuteron = 2,
70  c_AntiDeuteron = 3,
71  c_Proton = 4,
72  c_AntiProton = 5,
73  c_PionPlus = 6,
74  c_PionMinus = 7,
75  c_KaonPlus = 8,
76  c_KaonMinus = 9,
77  c_MuonPlus = 10,
78  c_MuonMinus = 11,
79  };
80 
93  };
94 
99 
104 
110  static bool checkExtrapolationOutcome(unsigned int outcome, int lastLayer);
111 
119  static unsigned int calculateExtrapolationOutcome(bool isForward, bool escaped, int lastBarrelLayer, int lastEndcapLayer);
120 
125  static Hypothesis calculateHypothesisFromPDG(int pdg);
126 
130  static constexpr int getMaximalBarrelLayer()
131  {
132  return m_MaximalBarrelLayer;
133  }
134 
138  static constexpr int getMaximalEndcapForwardLayer()
139  {
141  }
142 
146  static constexpr int getMaximalEndcapBackwardLayer()
147  {
149  }
150 
154  static constexpr int getMaximalOutcome()
155  {
156  return m_MaximalOutcome;
157  }
158 
162  static constexpr int getMaximalDetector()
163  {
164  return m_MaximalDetector;
165  }
166 
170  static constexpr int getMaximalHalfNdof()
171  {
172  return m_MaximalHalfNDof;
173  }
174 
178  static constexpr int getSizeReducedChiSquared()
179  {
181  }
182 
186  static constexpr double getMaximalReducedChiSquared()
187  {
189  }
190 
196  static std::vector<int> getPDGVector(int charge);
197 
202  static std::vector<int> getPDGVector();
203 
213  static int getLongitudinalID(int hypothesis, int outcome, int lastLayer);
214 
224  static int getTransverseID(int hypothesis, int detector, int degreesOfFreedom);
225 
226  protected:
227 
230 
233 
236 
238  static constexpr int m_MaximalOutcome = c_CrossBarrelExitBackwardMax;
239 
241  static constexpr int m_MaximalDetector = c_OnlyEndcap;
242 
244  static constexpr int m_MaximalHalfNDof = 18;
245 
247  static constexpr int m_SizeReducedChiSquared = 100;
248 
250  static constexpr double m_MaximalReducedChiSquared = 10.;
251 
252  };
253 
255 }
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
static constexpr int getMaximalLayerNumber()
Get maximal layer number.
Muid element numbers.
DetectorsCrossed
Labels for detectors crossed.
static constexpr int m_MaximalEndcapForwardLayer
Maximal endcap-forward layer number (0-based).
static constexpr int getMaximalDetector()
Get maximal value of the detector selector (for transverse scattering).
static constexpr int m_SizeReducedChiSquared
Size of array with reduced chi-squared values (for transverse scattering).
static int getLongitudinalID(int hypothesis, int outcome, int lastLayer)
Get the unique longitudinal identifier for given hypothesis, outcome and last layer crossed.
static constexpr double m_MaximalReducedChiSquared
Maximal value of reduced chi-squared (for transverse scattering).
static constexpr int getMaximalEndcapForwardLayer()
Get maximal endcap-forward layer number (0-based).
static int getTransverseID(int hypothesis, int detector, int degreesOfFreedom)
Get the unique transverse identifier for given hypothesis, detector and degrees of freedom.
static unsigned int calculateExtrapolationOutcome(bool isForward, bool escaped, int lastBarrelLayer, int lastEndcapLayer)
Calculate the track extrapolation outcome.
static constexpr int getMaximalHalfNdof()
Get maximal value of NDof/2 (for transverse scattering).
static constexpr int getMaximalEndcapBackwardLayer()
Get maximal endcap-forward layer number (0-based).
static constexpr int getMaximalBarrelLayer()
Get maximal barrel layer number (0-based).
static constexpr double getMaximalReducedChiSquared()
Get maximal value of reduced chi-squared (for transverse scattering).
IdentifierBits
Bits used for unique identifiers in getLongitudinalID() and in getTransverseID().
@ c_OutcomeBit
Number of bits occupied by outcome in getLongitudinalID().
@ c_DetectorBit
Number of bits occupied by detector in getTransverseID().
@ c_DegreesOfFreedomBit
Number of bits occupied by degreesOfFreedom in getTransverseID().
@ c_LastLayerBit
Number of bits occupied by lastLayer in getLongitudinalID().
static constexpr int m_MaximalDetector
Maximal value of the detector selector (for transverse scattering).
static std::vector< int > getPDGVector()
Get a vector with all the hypothesis PDG codes used for Muid.
Outcome
Outcome of the track extrapolation.
static bool checkExtrapolationOutcome(unsigned int outcome, int lastLayer)
Check the track extrapolation outcome.
static constexpr int m_MaximalEndcapBackwardLayer
Maximal endcap-backward layer number (0-based).
static constexpr int m_MaximalOutcome
Maximal value of the outcome extrapolation.
static Hypothesis calculateHypothesisFromPDG(int pdg)
Calculate hypothesis number from PDG code.
static constexpr int m_MaximalHalfNDof
Maximal value of NDof/2 (for transverse scattering).
static constexpr int getSizeReducedChiSquared()
Get size of array with reduced chi-squared values (for transverse scattering).
static constexpr int m_MaximalBarrelLayer
Maximal barrel layer number (0-based).
static constexpr int getMaximalOutcome()
Get maximal value of the track extrapolation outcome.
Abstract base class for different kinds of events.