Belle II Software  release-05-02-19
PIDLikelihood.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marko Staric, Thomas Kuhr *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef PIDLIKELIHOOD_H
12 #define PIDLIKELIHOOD_H
13 
14 #include <framework/datastore/RelationsObject.h>
15 #include <framework/gearbox/Const.h>
16 
17 namespace Belle2 {
29  class PIDLikelihood : public RelationsObject {
30 
31  public:
32 
36  PIDLikelihood();
37 
45  const Const::ChargedStable& part,
46  float logl);
47 
53  bool isAvailable(Const::PIDDetectorSet set) const {return m_detectors.contains(set);}
54 
61  float getLogL(const Const::ChargedStable& part,
63 
71  float getDeltaLogL(const Const::ChargedStable& p1,
72  const Const::ChargedStable& p2,
74  {
75  return getLogL(p1, set) - getLogL(p2, set);
76  }
77 
86  double getProbability(const Const::ChargedStable& p1,
87  const Const::ChargedStable& p2,
89  {
90  return getProbability(p1, p2, 1.0, set);
91  }
92 
101  double getProbability(const Const::ChargedStable& p1,
102  const Const::ChargedStable& p2,
103  double ratio,
105 
106 
115  double getProbability(const Const::ChargedStable& part,
116  const double* fractions = 0,
118 
126  Const::ChargedStable getMostLikely(const double* fractions = 0,
132  void printArray() const;
133 
137  std::string getInfoHTML() const;
138 
139  private:
140 
141  Const::DetectorSet m_detectors;
150  void probability(double probabilities[],
151  const double* fractions,
152  Const::PIDDetectorSet detSet) const;
153 
154 
155  ClassDef(PIDLikelihood, 3);
157  };
158 
160 } // end namespace Belle2
161 
162 #endif
Belle2::PIDLikelihood::m_detectors
Const::DetectorSet m_detectors
set of detectors with PID information
Definition: PIDLikelihood.h:149
Belle2::Const::ChargedStable::c_SetSize
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:491
Belle2::Const::RestrictedDetectorSet::set
static DetectorSet set()
Accessor for the set of valid detector IDs.
Definition: Const.h:209
Belle2::PIDLikelihood::getMostLikely
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...
Definition: PIDLikelihood.cc:108
Belle2::PIDLikelihood::setLogLikelihood
void setLogLikelihood(Const::EDetector det, const Const::ChargedStable &part, float logl)
Set log likelihood for a given detector and particle.
Definition: PIDLikelihood.cc:35
Belle2::PIDLikelihood
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Definition: PIDLikelihood.h:37
Belle2::PIDLikelihood::printArray
void printArray() const
Prints the content of a private array of log likelihoods.
Definition: PIDLikelihood.cc:165
Belle2::PIDLikelihood::isAvailable
bool isAvailable(Const::PIDDetectorSet set) const
Check whether PID information from a given set of detectors is available.
Definition: PIDLikelihood.h:61
Belle2::Const::EDetector
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:44
Belle2::Const::PIDDetectorSet
RestrictedDetectorSet< PIDDetectors > PIDDetectorSet
Typedef for set of PID detectors.
Definition: Const.h:255
Belle2::PIDLikelihood::getLogL
float getLogL(const Const::ChargedStable &part, Const::PIDDetectorSet set=Const::PIDDetectorSet::set()) const
Return log likelihood for a given detector set and particle.
Definition: PIDLikelihood.cc:56
Belle2::Const::RestrictedDetectorSet
A class for sets of detector IDs whose content is limited to restricted set of valid detector IDs.
Definition: Const.h:172
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::PIDLikelihood::getDeltaLogL
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:79
Belle2::PIDLikelihood::getInfoHTML
std::string getInfoHTML() const
Return HTML Info of PID Likelihoods.
Definition: PIDLikelihood.cc:217
Belle2::PIDLikelihood::m_logl
float m_logl[Const::PIDDetectors::c_size][Const::ChargedStable::c_SetSize]
log likelihoods
Definition: PIDLikelihood.h:150
Belle2::PIDLikelihood::ClassDef
ClassDef(PIDLikelihood, 3)
Collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM.
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::Const::ChargedStable
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:465
Belle2::Const::PIDDetectors::c_size
static const size_t c_size
Number of PID detectors, temporary workaround.
Definition: Const.h:252
Belle2::PIDLikelihood::PIDLikelihood
PIDLikelihood()
Default constructor: log likelihoods and flags set to 0.
Definition: PIDLikelihood.cc:25
Belle2::Const::DetectorSet::contains
bool contains(const DetectorSet &set) const
Check whether this set contains another set.
Definition: Const.h:116
Belle2::PIDLikelihood::probability
void probability(double probabilities[], const double *fractions, Const::PIDDetectorSet detSet) const
Calculate likelihood probabilities.
Definition: PIDLikelihood.cc:125
Belle2::PIDLikelihood::getProbability
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:94