Belle II Software  release-05-02-19
ECLPidLikelihood.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Guglielmo De Nardo (denardo@na.infn.it) *
7  * Marco Milesi (marco.milesi@unimelb.edu.au) *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <framework/datastore/RelationsObject.h>
15 #include <framework/gearbox/Const.h>
16 #include <cmath>
17 
18 namespace Belle2 {
25  class ECLPidLikelihood : public RelationsObject {
26  public:
29  {
30  //for all particles
31  for (unsigned int i = 0; i < Const::ChargedStable::c_SetSize; i++) {
32  m_logl[i] = 0.0;
33  }
34  setVariables(0, 0, 0, 0, 0, 0, 0, 0, 0);
35  }
36 
38  ECLPidLikelihood(const float* logl, float energy = 0, float eop = 0, float e9e25 = 0, float lat = 0, float dist = 0,
39  float trkDepth = 0, float shDepth = 0, int ncrystals = 0, int nclusters = 0): RelationsObject()
40  {
41  //for all particles
42  for (unsigned int i = 0; i < Const::ChargedStable::c_SetSize; i++) {
43  m_logl[i] = logl[i];
44  }
45  setVariables(energy, eop, e9e25, lat, dist, trkDepth, shDepth, ncrystals, nclusters);
46  }
47 
57  float getLogLikelihood(const Const::ChargedStable& type) const
58  {
59  return m_logl[type.getIndex()];
60  }
61 
63  double getLikelihood(const Const::ChargedStable& type) const
64  {
65  return exp((double)m_logl[type.getIndex()]);
66  }
67 
69  void setLogLikelihood(const Const::ChargedStable& type, float logl)
70  {
71  m_logl[type.getIndex()] = logl;
72  }
73 
75  void setVariables(float energy, float eop, float e9e25, float lat, float dist, float trkDepth, float shDepth, int ncrystals,
76  int nclusters)
77  {
78  m_energy = energy; m_eop = eop; m_e9e25 = e9e25; m_nCrystals = ncrystals; m_nClusters = nclusters;
79  m_lat = lat; m_dist = dist; m_trkDepth = trkDepth; m_shDepth = shDepth;
80  }
81 
82  double energy() const { return m_energy; }
83  double eop() const { return m_eop; }
84  double e9e25() const { return m_e9e25; }
85  float lat() const { return m_lat; }
86  float dist() const { return m_dist; }
87  float trkDepth() const { return m_trkDepth; }
88  float shDepth() const { return m_shDepth; }
89  int nCrystals() const { return m_nCrystals; }
90  int nClusters() const { return m_nClusters; }
92  private:
93 
96  float m_energy;
97  float m_eop;
98  float m_e9e25;
99  int m_nCrystals;
100  int m_nClusters;
101  float m_lat;
102  float m_dist;
103  float m_trkDepth;
104  float m_shDepth;
106  // 3: Added DeltaL track match variable (GDN, increment by TF)
108  };
110 }
111 
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::ECLPidLikelihood::setVariables
void setVariables(float energy, float eop, float e9e25, float lat, float dist, float trkDepth, float shDepth, int ncrystals, int nclusters)
Set cluster features upon which the likelihood might depend.
Definition: ECLPidLikelihood.h:84
Belle2::ECLPidLikelihood::getLogLikelihood
float getLogLikelihood(const Const::ChargedStable &type) const
returns log-likelihood value for a particle hypothesis.
Definition: ECLPidLikelihood.h:66
Belle2::ECLPidLikelihood::m_nClusters
int m_nClusters
Number of clusters per candidate.
Definition: ECLPidLikelihood.h:109
Belle2::ECLPidLikelihood::m_dist
float m_dist
Cluster-Shower distance.
Definition: ECLPidLikelihood.h:111
Belle2::ECLPidLikelihood::m_nCrystals
int m_nCrystals
Number of crystals per candidate.
Definition: ECLPidLikelihood.h:108
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLPidLikelihood
Container for likelihoods with ECL PID (ECLChargedPIDModule)
Definition: ECLPidLikelihood.h:34
Belle2::ECLPidLikelihood::m_lat
float m_lat
Cluster LAT.
Definition: ECLPidLikelihood.h:110
Belle2::ECLPidLikelihood::setLogLikelihood
void setLogLikelihood(const Const::ChargedStable &type, float logl)
corresponding setter for m_logl.
Definition: ECLPidLikelihood.h:78
Belle2::ECLPidLikelihood::ECLPidLikelihood
ECLPidLikelihood()
default constructor
Definition: ECLPidLikelihood.h:37
Belle2::ECLPidLikelihood::m_e9e25
float m_e9e25
Ratio of energy in 3x3 matrix over energy in 5x5 matrix (should now be called E9oE21) for cluster.
Definition: ECLPidLikelihood.h:107
Belle2::ECLPidLikelihood::m_eop
float m_eop
E/p ratio for cluster.
Definition: ECLPidLikelihood.h:106
Belle2::ECLPidLikelihood::m_energy
float m_energy
Cluster Energy.
Definition: ECLPidLikelihood.h:105
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::ECLPidLikelihood::m_trkDepth
float m_trkDepth
Track Depth.
Definition: ECLPidLikelihood.h:112
Belle2::Const::ChargedStable
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:465
Belle2::ECLPidLikelihood::m_logl
float m_logl[Const::ChargedStable::c_SetSize]
log likelihood for each particle, not including momentum prior
Definition: ECLPidLikelihood.h:103
Belle2::ECLPidLikelihood::m_shDepth
float m_shDepth
Cluster Depth.
Definition: ECLPidLikelihood.h:113
Belle2::RelationsInterface
Defines interface for accessing relations of objects in StoreArray.
Definition: RelationsObject.h:102
Belle2::ECLPidLikelihood::ClassDef
ClassDef(ECLPidLikelihood, 3)
Build ROOT dictionary.
Belle2::ECLPidLikelihood::getLikelihood
double getLikelihood(const Const::ChargedStable &type) const
returns exp(getLogLikelihood(type)) with sufficient precision.
Definition: ECLPidLikelihood.h:72