Belle II Software light-2406-ragdoll
PIDLikelihood.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#include <framework/datastore/RelationsObject.h>
12#include <framework/gearbox/Const.h>
13
14#include <map>
15#include <string>
16
17namespace Belle2 {
30
31 public:
32
37
45 const Const::ChargedStable& part,
46 float logl);
47
52 void subtractMaximum();
53
61
69 {
70 return m_detectors.contains(set);
71 }
72
79 float getLogL(const Const::ChargedStable& part,
81
90 const Const::ChargedStable& p2,
92 {
93 return getLogL(p1, set) - getLogL(p2, set);
94 }
95
105 const Const::ChargedStable& p2,
107 {
108 return getProbability(p1, p2, 1.0, set);
109 }
110
119 double getProbability(const Const::ChargedStable& p1,
120 const Const::ChargedStable& p2,
121 double ratio,
123
124
133 double getProbability(const Const::ChargedStable& part,
134 const double* fractions = nullptr,
136
148 const double* fractions = nullptr,
150
158 Const::ChargedStable getMostLikely(const double* fractions = nullptr,
163 void printArray() const;
164
168 std::string getInfoHTML() const override;
169
175 void addPreOfficialLikelihood(const std::string& preOfficialIdentifier,
176 const double preOfficialLikelihood);
177
183 double getPreOfficialLikelihood(const std::string& preOfficialIdentifier) const;
184
185 private:
186
193 void probability(double probabilities[],
194 const double* fractions,
195 Const::PIDDetectorSet detSet) const;
196
201 std::map<std::string, double> m_preOfficialLikelihoods;
202
205 };
206
208} // end namespace Belle2
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:589
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:615
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:80
bool contains(const DetectorSet &set) const
Check whether this set contains another set.
Definition: Const.h:235
static const size_t c_size
Number of PID detectors, temporary workaround.
Definition: Const.h:376
A class for sets of detector IDs whose content is limited to restricted set of valid detector IDs.
Definition: Const.h:296
static DetectorSet set()
Accessor for the set of valid detector IDs.
Definition: Const.h:333
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:42
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Definition: PIDLikelihood.h:29
PIDLikelihood()
Default constructor: log likelihoods and flags set to 0.
Const::ChargedStable getMostLikely(const double *fractions=nullptr, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return most likely particle among chargedStableSet; if prior fractions not given equal prior probabil...
void subtractMaximum()
Subtract the maximum of log likelihoods of each detector component in order to reduce the range of va...
std::map< std::string, double > m_preOfficialLikelihoods
Internal storage of pre-official likelihood.
double getLogarithmicProbability(const Const::ChargedStable &part, const double *fractions=nullptr, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return logarithmic equivalent of likelihood probability defined as log(p/(1-p)), where p is the combi...
bool isAvailable(Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Check whether PID information is available for at least one of the detectors in a given set.
std::string getInfoHTML() const override
Return HTML Info of PID Likelihoods.
float m_logl[Const::PIDDetectors::c_size][Const::ChargedStable::c_SetSize]
log likelihoods
void printArray() const
Prints the content of a private array of log likelihoods.
float getLogL(const Const::ChargedStable &part, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return log likelihood for a given detector set and particle.
void setLogLikelihood(Const::EDetector det, const Const::ChargedStable &part, float logl)
Set log likelihood for a given detector and particle.
void addPreOfficialLikelihood(const std::string &preOfficialIdentifier, const double preOfficialLikelihood)
Add the pre-official likelihood.
bool areAllAvailable(Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Check whether PID information is available for all detectors in a given set.
Definition: PIDLikelihood.h:68
void probability(double probabilities[], const double *fractions, Const::PIDDetectorSet detSet) const
Calculate likelihood probabilities.
double getProbability(const Const::ChargedStable &p1, const Const::ChargedStable &p2, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return combined likelihood probability for a particle being p1 and not p2, assuming equal prior proba...
Const::DetectorSet m_detectors
set of detectors with PID information
ClassDefOverride(PIDLikelihood, 4)
Collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM.
float getDeltaLogL(const Const::ChargedStable &p1, const Const::ChargedStable &p2, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return log likelihood difference between two particles for a given detector set.
Definition: PIDLikelihood.h:89
double getPreOfficialLikelihood(const std::string &preOfficialIdentifier) const
Get the pre-official likelihood.
Defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24