Belle II Software  release-06-00-14
TOPPDFCollection.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  struct Gaussian {
40  float mean = 0;
41  float width = 0;
42  float area = 0;
46  Gaussian(float m, float w, float a): mean(m), width(w), area(a)
47  {}
48  };
49 
50  typedef std::vector<Gaussian> channelPDF_t;
51  typedef std::array<channelPDF_t, 512> modulePDF_t;
57 
61  bool addHypothesisPDF(const modulePDF_t& pdf, const int hypothesis)
62  {
63  auto result = m_data.insert(std::make_pair(hypothesis, pdf));
64  if (not result.second) {
65  B2WARNING("PDF exists already for this track");
66  }
67  return result.second;
68  }
69 
73  const modulePDF_t& getHypothesisPDF(const int hypothesis) const
74  {
75  return m_data.at(hypothesis);
76  }
77 
81  void setLocalPositionMomentum(const TVector3& pos, const TVector3& mom, int moduleID)
82  {
83  m_localHitPosition.SetXYZ(pos.X(), pos.Y(), pos.Z());
84  m_localHitMomentum.SetXYZ(mom.X(), mom.Y(), mom.Z());
85  m_moduleID = moduleID;
86  }
87 
91  const TVector3& getAssociatedLocalHit() const
92  {
93  return m_localHitPosition;
94  }
95 
99  const TVector3& getAssociatedLocalMomentum() const
100  {
101  return m_localHitMomentum;
102  }
103 
107  int getModuleID() const {return m_moduleID;}
108 
109  private:
110  std::map<int, modulePDF_t> m_data;
111  // The following two members are useful for python modules (with no access
112  // to TOPGeometryPar)
115  int m_moduleID = 0;
117  };
119 } // end namespace Belle2
120 
Defines interface for accessing relations of objects in StoreArray.
Class to store analytical PDF relation from Tracks filled top/modules/TOPPDFDebugger/src/TOPPDFDebugg...
std::array< channelPDF_t, 512 > modulePDF_t
the PDF of the module is a list of 512 channel PDFs
const modulePDF_t & getHypothesisPDF(const int hypothesis) const
returns the pdf for the given hypothesis (PDG code)
std::vector< Gaussian > channelPDF_t
the PDF in a given channel is a list of Gaussians
void setLocalPositionMomentum(const TVector3 &pos, const TVector3 &mom, int moduleID)
sets the position and momentum of the exthit in local coordinates
TVector3 m_localHitMomentum
momentum of the exthit in local coordinates
TVector3 m_localHitPosition
position of the exthit in local coordinates
std::map< int, modulePDF_t > m_data
collection of samples of the pdf
int m_moduleID
slot ID of the exthit
ClassDef(TOPPDFCollection, 3)
ClassDef.
int getModuleID() const
returns slot ID of the associated exthit
const TVector3 & getAssociatedLocalHit() const
returns the local coordinates of the exthit associated with this PDF
bool addHypothesisPDF(const modulePDF_t &pdf, const int hypothesis)
adds the pdf for the given hypothesis (PDG code)
const TVector3 & getAssociatedLocalMomentum() const
returns the momentum of the associated exthit in local coordinates
TOPPDFCollection()
default constructor
Abstract base class for different kinds of events.
parameters to describe a Gaussian
Gaussian(float m, float w, float a)
useful constructor
float area
area (number of photons)