Belle II Software  release-08-01-10
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 namespace Belle2 {
26  class PIDLikelihood : public RelationsObject {
27 
28  public:
29 
33  PIDLikelihood();
34 
42  const Const::ChargedStable& part,
43  float logl);
44 
50  bool isAvailable(Const::PIDDetectorSet set) const {return m_detectors.contains(set);}
51 
58  float getLogL(const Const::ChargedStable& part,
60 
69  const Const::ChargedStable& p2,
71  {
72  return getLogL(p1, set) - getLogL(p2, set);
73  }
74 
84  const Const::ChargedStable& p2,
86  {
87  return getProbability(p1, p2, 1.0, set);
88  }
89 
98  double getProbability(const Const::ChargedStable& p1,
99  const Const::ChargedStable& p2,
100  double ratio,
102 
103 
112  double getProbability(const Const::ChargedStable& part,
113  const double* fractions = 0,
115 
123  Const::ChargedStable getMostLikely(const double* fractions = 0,
129  void printArray() const;
130 
134  std::string getInfoHTML() const override;
135 
136  private:
137 
147  void probability(double probabilities[],
148  const double* fractions,
149  Const::PIDDetectorSet detSet) const;
150 
151 
154  };
155 
157 } // end namespace Belle2
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:580
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:606
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:71
bool contains(const DetectorSet &set) const
Check whether this set contains another set.
Definition: Const.h:226
static const size_t c_size
Number of PID detectors, temporary workaround.
Definition: Const.h:367
A class for sets of detector IDs whose content is limited to restricted set of valid detector IDs.
Definition: Const.h:287
static DetectorSet set()
Accessor for the set of valid detector IDs.
Definition: Const.h:324
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:26
PIDLikelihood()
Default constructor: log likelihoods and flags set to 0.
bool isAvailable(Const::PIDDetectorSet set) const
Check whether PID information from a given set of detectors is available.
Definition: PIDLikelihood.h:50
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.
ClassDefOverride(PIDLikelihood, 3)
Collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM.
void probability(double probabilities[], const double *fractions, Const::PIDDetectorSet detSet) const
Calculate likelihood probabilities.
Const::ChargedStable getMostLikely(const double *fractions=0, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return most likely particle among chargedStableSet; if prior fractions not given equal prior probabil...
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...
Definition: PIDLikelihood.h:83
Const::DetectorSet m_detectors
set of detectors with PID information
float getDeltaLogL(const Const::ChargedStable &p1, const Const::ChargedStable &p2, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return log likelihood difference for a given detector set and particles.
Definition: PIDLikelihood.h:68
Defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.