Belle II Software  release-08-01-10
TOPPixelLikelihood.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 #include <framework/logging/Logger.h>
14 
15 #include <map>
16 #include <vector>
17 #include <tuple>
18 #include <utility>
19 
20 namespace Belle2 {
33 
34  public:
35 
39  typedef std::array<float, 512> PixelArray_t;
40 
45 
51  bool addHypothesisLikelihoods(const PixelArray_t& plkhs, const int hypothesis)
52  {
53  auto result = m_logls.insert(std::make_pair(hypothesis, plkhs));
54  if (not result.second) {
55  B2WARNING("Likelihoods already exist for this track");
56  }
57  return result.second;
58  }
59 
65  bool addHypothesisSignalPhotons(const PixelArray_t& sfots, const int hypothesis)
66  {
67  auto result = m_sfots.insert(std::make_pair(hypothesis, sfots));
68  if (not result.second) {
69  B2WARNING("Signal photons already exist for this track");
70  }
71  return result.second;
72  }
73 
79  const PixelArray_t& getHypothesisLikelihoods(const int hypothesis) const
80  {
81  return m_logls.at(hypothesis);
82  }
83 
89  const PixelArray_t& getHypothesisSignalPhotons(const int hypothesis) const
90  {
91  return m_sfots.at(hypothesis);
92  }
93 
98  const PixelArray_t& getPixelLogL_e() const { return m_logls.at(11); }
99 
104  const PixelArray_t& getPixelLogL_mu() const { return m_logls.at(13); }
105 
110  const PixelArray_t& getPixelLogL_pi() const { return m_logls.at(211); }
111 
116  const PixelArray_t& getPixelLogL_K() const { return m_logls.at(321); }
117 
122  const PixelArray_t& getPixelLogL_p() const { return m_logls.at(2212); }
123 
128  const PixelArray_t& getPixelSigPhot_e() const { return m_sfots.at(11); }
129 
134  const PixelArray_t& getPixelSigPhot_mu() const { return m_sfots.at(13); }
135 
140  const PixelArray_t& getPixelSigPhot_pi() const { return m_sfots.at(211); }
141 
146  const PixelArray_t& getPixelSigPhot_K() const { return m_sfots.at(321); }
147 
152  const PixelArray_t& getPixelSigPhot_p() const { return m_sfots.at(2212); }
153 
158  void setModuleID(int moduleID)
159  {
160  m_moduleID = moduleID;
161  }
162 
166  int getModuleID() const { return m_moduleID; }
167 
168  private:
169  std::map<int, PixelArray_t> m_logls;
170  std::map<int, PixelArray_t> m_sfots;
171  int m_moduleID = 0;
173  };
175 } // end namespace Belle2
176 
Defines interface for accessing relations of objects in StoreArray.
Class to store pixel-by-pixel likelihoods for a track relation from Tracks filled in top/modules/TOPP...
const PixelArray_t & getPixelSigPhot_p() const
Returns the pixel signal photons for the proton hypothesis.
std::array< float, 512 > PixelArray_t
Array of length 512 to hold per-pixel information.
const PixelArray_t & getPixelLogL_mu() const
Returns the pixel likelihoods for the muon hypothesis.
std::map< int, PixelArray_t > m_logls
pixel likelihoods for different hypotheses
void setModuleID(int moduleID)
Sets module ID of the associated exthit.
const PixelArray_t & getPixelLogL_e() const
Returns the pixel likelihoods for the electron hypothesis.
std::map< int, PixelArray_t > m_sfots
pixel sigphot counts for different hypotheses
int m_moduleID
slot ID of the exthit
const PixelArray_t & getPixelSigPhot_pi() const
Returns the pixel signal photons for the pion hypothesis.
const PixelArray_t & getPixelSigPhot_e() const
Returns the pixel signal photons for the electron hypothesis.
int getModuleID() const
Returns module ID of the associated exthit.
const PixelArray_t & getPixelLogL_pi() const
Returns the pixel likelihoods for the pion hypothesis.
const PixelArray_t & getPixelLogL_K() const
Returns the pixel likelihoods for the kaon hypothesis.
const PixelArray_t & getPixelSigPhot_mu() const
Returns the pixel signal photons for the muon hypothesis.
const PixelArray_t & getHypothesisSignalPhotons(const int hypothesis) const
Returns the pixel signal photons for the given hypothesis (PDG code)
const PixelArray_t & getPixelSigPhot_K() const
Returns the pixel signal photons for the kaon hypothesis.
bool addHypothesisSignalPhotons(const PixelArray_t &sfots, const int hypothesis)
Adds the signal photon array for the given hypothesis (PDG code)
bool addHypothesisLikelihoods(const PixelArray_t &plkhs, const int hypothesis)
Adds the likelihood array for the given hypothesis (PDG code)
ClassDef(TOPPixelLikelihood, 3)
ClassDef.
TOPPixelLikelihood()
Default constructor.
const PixelArray_t & getHypothesisLikelihoods(const int hypothesis) const
Returns the pixel likelihoods for the given hypothesis (PDG code)
const PixelArray_t & getPixelLogL_p() const
Returns the pixel likelihoods for the proton hypothesis.
Abstract base class for different kinds of events.