Belle II Software  release-08-01-10
Cluster.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 Cluster : public RelationsObject {
27 
28  public:
29 
33  Cluster();
34 
42  const Const::Cluster& cluster,
43  float logl);
44 
51 
58  float getLogL(const Const::Cluster& cluster,
60 
68  float getDeltaLogL(const Const::Cluster& c1,
69  const Const::Cluster& c2,
71  {
72  return getLogL(c1, set) - getLogL(c2, set);
73  }
74 
83  double getProbability(const Const::Cluster& c1,
84  const Const::Cluster& c2,
86  {
87  return getProbability(c1, c2, 1.0, set);
88  }
89 
98  double getProbability(const Const::Cluster& c1,
99  const Const::Cluster& c2,
100  double ratio,
102 
103 
112  double getProbability(const Const::Cluster& cluster,
113  const double* fractions = 0,
115 
123  Const::Cluster 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::ClusterDetectorSet detSet) const;
150 
151 
154  };
155 
157 } // end namespace Belle2
Class to collect log likelihoods from Clusters from ECL and KLM aimed for output to mdst includes fun...
Definition: Cluster.h:26
Cluster()
Default constructor: log likelihoods and flags set to 0.
Definition: Cluster.cc:19
bool isAvailable(Const::ClusterDetectorSet set) const
Check whether cluster information from a given set of detectors is available.
Definition: Cluster.h:50
Const::Cluster getMostLikely(const double *fractions=0, Const::ClusterDetectorSet set=Const::ClusterDetectorSet::set()) const
Return most likely particle among clusterSet; if prior fractions not given equal prior probabilities ...
Definition: Cluster.cc:102
float getLogL(const Const::Cluster &cluster, Const::ClusterDetectorSet set=Const::ClusterDetectorSet::set()) const
Return log likelihood for a given detector set and particle.
Definition: Cluster.cc:49
void probability(double probabilities[], const double *fractions, Const::ClusterDetectorSet detSet) const
Calculate likelihood probabilities.
Definition: Cluster.cc:119
float getDeltaLogL(const Const::Cluster &c1, const Const::Cluster &c2, Const::ClusterDetectorSet set=Const::ClusterDetectorSet::set()) const
Return log likelihood difference for a given detector set and clusters.
Definition: Cluster.h:68
std::string getInfoHTML() const override
Return HTML Info of cluster Likelihoods.
Definition: Cluster.cc:209
float m_logl[Const::ClusterDetectors::c_size][Const::Cluster::c_SetSize]
log likelihoods
Definition: Cluster.h:139
void printArray() const
Prints the content of a private array of log likelihoods.
Definition: Cluster.cc:159
ClassDefOverride(Cluster, 1)
Initial version.
void setLogLikelihood(Const::EDetector det, const Const::Cluster &cluster, float logl)
Set log likelihood for a given detector and particle.
Definition: Cluster.cc:29
Const::DetectorSet m_detectors
set of detectors with cluster information
Definition: Cluster.h:138
double getProbability(const Const::Cluster &c1, const Const::Cluster &c2, Const::ClusterDetectorSet set=Const::ClusterDetectorSet::set()) const
Return combined likelihood probability for a cluster being c1 and not c2, assuming equal prior probab...
Definition: Cluster.h:83
static const size_t c_size
Number of PID detectors, temporary workaround.
Definition: Const.h:380
Provides a type-safe way to pass members of the clusterSet set.
Definition: Const.h:617
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:643
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
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
Defines interface for accessing relations of objects in StoreArray.
Abstract base class for different kinds of events.