Belle II Software  release-08-01-10
OrcaKinFitVariables.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 <analysis/variables/OrcaKinFitVariables.h>
11 
12 // include VariableManager
13 #include <analysis/VariableManager/Manager.h>
14 
15 #include <analysis/dataobjects/Particle.h>
16 
17 #include <framework/logging/Logger.h>
18 
19 using namespace std;
20 
21 namespace Belle2 {
26  namespace Variable {
27 
28  // Chi2 and Prob -------------------------------------------
29  double OrcaKinFitChi2(const Particle* part)
30  {
31  if (part->hasExtraInfo("OrcaKinFitChi2")) return part->getExtraInfo("OrcaKinFitChi2");
32  else {
33  B2WARNING("The ExtraInfo 'OrcaKinFitChi2' not found!");
34  return Const::doubleNaN;
35  }
36  }
37 
38  double OrcaKinFitProb(const Particle* part)
39  {
40  if (part->hasExtraInfo("OrcaKinFitProb")) return part->getExtraInfo("OrcaKinFitProb");
41  else {
42  B2WARNING("The ExtraInfo 'OrcaKinFitProb' not found!");
43  return Const::doubleNaN;
44  }
45  }
46 
47  double ErrorCode(const Particle* part)
48  {
49  if (part->hasExtraInfo("OrcaKinFitErrorCode")) return part->getExtraInfo("OrcaKinFitErrorCode");
50  else {
51  B2WARNING("The ExtraInfo 'OrcaKinFitErrorCode' not found!");
52  return Const::doubleNaN;
53  }
54  }
55 
56 
57  // For 1C fit ------------------------------------------------------------
58  double UnmeasuredTheta(const Particle* part)
59  {
60  if (part->hasExtraInfo("OrcaKinFitUnmeasuredTheta")) return part->getExtraInfo("OrcaKinFitUnmeasuredTheta");
61  else {
62  B2WARNING("The ExtraInfo 'OrcaKinFitUnmeasuredTheta' not found!");
63  return Const::doubleNaN;
64  }
65  }
66 
67  double UnmeasuredPhi(const Particle* part)
68  {
69  if (part->hasExtraInfo("OrcaKinFitUnmeasuredPhi")) return part->getExtraInfo("OrcaKinFitUnmeasuredPhi");
70  else {
71  B2WARNING("The ExtraInfo 'OrcaKinFitUnmeasuredPhi' not found!");
72  return Const::doubleNaN;
73  }
74  }
75 
76  double UnmeasuredE(const Particle* part)
77  {
78  if (part->hasExtraInfo("OrcaKinFitUnmeasuredE")) return part->getExtraInfo("OrcaKinFitUnmeasuredE");
79  else {
80  B2WARNING("The ExtraInfo 'OrcaKinFitUnmeasuredE' not found!");
81  return Const::doubleNaN;
82  }
83  }
84 
85  double UnmeasuredErrorTheta(const Particle* part)
86  {
87  if (part->hasExtraInfo("OrcaKinFitUnmeasuredErrorTheta")) return part->getExtraInfo("OrcaKinFitUnmeasuredErrorTheta");
88  else {
89  B2WARNING("The ExtraInfo 'OrcaKinFitUnmeasuredErrorTheta' not found!");
90  return Const::doubleNaN;
91  }
92  }
93 
94  double UnmeasuredErrorPhi(const Particle* part)
95  {
96  if (part->hasExtraInfo("OrcaKinFitUnmeasuredErrorPhi")) return part->getExtraInfo("OrcaKinFitUnmeasuredErrorPhi");
97  else {
98  B2WARNING("The ExtraInfo 'OrcaKinFitUnmeasuredErrorPhi' not found!");
99  return Const::doubleNaN;
100  }
101  }
102 
103  double UnmeasuredErrorE(const Particle* part)
104  {
105  if (part->hasExtraInfo("OrcaKinFitUnmeasuredErrorE")) return part->getExtraInfo("OrcaKinFitUnmeasuredErrorE");
106  else {
107  B2WARNING("The ExtraInfo 'OrcaKinFitUnmeasuredErrorE' not found!");
108  return Const::doubleNaN;
109  }
110  }
111 
112 
113  VARIABLE_GROUP("OrcaKinFit");
114  REGISTER_VARIABLE("OrcaKinFitChi2", OrcaKinFitChi2, R"DOC(
115 The :math:`\chi^2` returned by the Orca kinematic fitter.
116 Returns NaN if Orca was not run.
117 
118 .. warning:: this is the raw :math:`\chi^2`, not over ndf.
119 
120 .. seealso:: :ref:`kinfit`
121  )DOC");
122  REGISTER_VARIABLE("OrcaKinFitProb", OrcaKinFitProb, R"DOC(
123 The p-value returned by the Orca kinematic fitter.
124 Returns NaN if Orca was not run.
125 
126 .. seealso:: :ref:`kinfit`
127  )DOC");
128  // TODO: explain the actual error codes
129  REGISTER_VARIABLE("OrcaKinFitErrorCode", ErrorCode, R"DOC(
130 The error code returned by the Orca kinematic fitter.
131 Returns NaN if Orca was not run.
132 
133 .. seealso:: :ref:`kinfit`
134  )DOC");
135  REGISTER_VARIABLE("OrcaKinFitUnmeasuredTheta", UnmeasuredTheta, R"DOC(
136 The polar angle of the "unmeasured photon" returned by Orca kinematic fitter for specific 1C fits with the ``addUnmeasuredPhoton`` parameter set.
137 I.e. for fits with sufficient constraints remaining to constrain a missing 3-vector.
138 Returns NaN if Orca was not run or if the ``addUnmeasuredPhoton`` parameter was not set.
139 
140 .. seealso:: :ref:`kinfit`
141 
142 )DOC", "rad");
143  REGISTER_VARIABLE("OrcaKinFitUnmeasuredPhi", UnmeasuredPhi, R"DOC(
144 The azimuthal angle of the "unmeasured photon" returned by Orca kinematic fitter for specific 1C fits with the ``addUnmeasuredPhoton`` parameter set.
145 I.e. for fits with sufficient constraints remaining to constrain a missing 3-vector.
146 Returns NaN if Orca was not run or if the ``addUnmeasuredPhoton`` parameter was not set.
147 
148 .. seealso:: :ref:`kinfit`
149 
150 )DOC", "rad");
151  REGISTER_VARIABLE("OrcaKinFitUnmeasuredE", UnmeasuredE, R"DOC(
152 The energy of the "unmeasured photon" returned by Orca kinematic fitter for specific 1C fits with the ``addUnmeasuredPhoton`` parameter set.
153 I.e. for fits with sufficient constraints remaining to constrain a missing 3-vector.
154 Returns NaN if Orca was not run or if the ``addUnmeasuredPhoton`` parameter was not set.
155 
156 .. seealso:: :ref:`kinfit`
157 
158 )DOC", "GeV");
159  REGISTER_VARIABLE("OrcaKinFitUnmeasuredErrorTheta", UnmeasuredErrorTheta,
160  "The uncertainty on :b2:var:`OrcaKinFitUnmeasuredTheta`.\n\n", "rad");
161  REGISTER_VARIABLE("OrcaKinFitUnmeasuredErrorPhi", UnmeasuredErrorPhi, "The uncertainty on :b2:var:`OrcaKinFitUnmeasuredPhi`.\n\n",
162  "rad");
163  REGISTER_VARIABLE("OrcaKinFitUnmeasuredErrorE", UnmeasuredErrorE, "The uncertainty on :b2:var:`OrcaKinFitUnmeasuredE`.\n\n", "GeV");
164  }
166 }
Abstract base class for different kinds of events.