Belle II Software  release-05-01-25
TOPPDFCollection.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Sam Cunliffe, Jan Strube, Marko Staric *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/datastore/RelationsObject.h>
14 #include <framework/gearbox/Const.h>
15 #include <framework/logging/Logger.h>
16 
17 #include <map>
18 #include <vector>
19 #include <tuple>
20 #include <utility>
21 
22 namespace Belle2 {
34  class TOPPDFCollection : public RelationsObject {
35 
36  public:
37 
41  struct Gaussian {
42  float mean = 0;
43  float width = 0;
44  float area = 0;
48  Gaussian(float m, float w, float a): mean(m), width(w), area(a)
49  {}
50  };
51 
52  typedef std::vector<Gaussian> channelPDF_t;
53  typedef std::array<channelPDF_t, 512> modulePDF_t;
58  TOPPDFCollection() { }
59 
63  bool addHypothesisPDF(const modulePDF_t& pdf, const int hypothesis)
64  {
65  auto result = m_data.insert(std::make_pair(hypothesis, pdf));
66  if (not result.second) {
67  B2WARNING("PDF exists already for this track");
68  }
69  return result.second;
70  }
71 
75  const modulePDF_t& getHypothesisPDF(const int hypothesis) const
76  {
77  return m_data.at(hypothesis);
78  }
79 
83  void setLocalPositionMomentum(const TVector3& pos, const TVector3& mom, int moduleID)
84  {
85  m_localHitPosition.SetXYZ(pos.X(), pos.Y(), pos.Z());
86  m_localHitMomentum.SetXYZ(mom.X(), mom.Y(), mom.Z());
87  m_moduleID = moduleID;
88  }
89 
93  const TVector3& getAssociatedLocalHit() const
94  {
95  return m_localHitPosition;
96  }
97 
101  const TVector3& getAssociatedLocalMomentum() const
102  {
103  return m_localHitMomentum;
104  }
105 
109  int getModuleID() const {return m_moduleID;}
110 
111  private:
112  std::map<int, modulePDF_t> m_data;
113  // The following two members are useful for python modules (with no access
114  // to TOPGeometryPar)
115  TVector3 m_localHitPosition;
116  TVector3 m_localHitMomentum;
117  int m_moduleID = 0;
119  };
121 } // end namespace Belle2
122 
Belle2::TOPPDFCollection::Gaussian::area
float area
area (number of photons)
Definition: TOPPDFCollection.h:52
Belle2::TOPPDFCollection::addHypothesisPDF
bool addHypothesisPDF(const modulePDF_t &pdf, const int hypothesis)
adds the pdf for the given hypothesis (PDG code)
Definition: TOPPDFCollection.h:71
Belle2::TOPPDFCollection::getAssociatedLocalHit
const TVector3 & getAssociatedLocalHit() const
returns the local coordinates of the exthit associated with this PDF
Definition: TOPPDFCollection.h:101
Belle2::TOPPDFCollection
Class to store analytical PDF relation from Tracks filled top/modules/TOPPDFDebugger/src/TOPPDFDebugg...
Definition: TOPPDFCollection.h:42
Belle2::TOPPDFCollection::Gaussian::mean
float mean
position
Definition: TOPPDFCollection.h:50
Belle2::TOPPDFCollection::getModuleID
int getModuleID() const
returns slot ID of the associated exthit
Definition: TOPPDFCollection.h:117
Belle2::TOPPDFCollection::Gaussian::Gaussian
Gaussian(float m, float w, float a)
useful constructor
Definition: TOPPDFCollection.h:56
Belle2::TOPPDFCollection::modulePDF_t
std::array< channelPDF_t, 512 > modulePDF_t
the PDF of the module is a list of 512 channel PDFs
Definition: TOPPDFCollection.h:61
Belle2::TOPPDFCollection::TOPPDFCollection
TOPPDFCollection()
default constructor
Definition: TOPPDFCollection.h:66
Belle2::TOPPDFCollection::m_data
std::map< int, modulePDF_t > m_data
collection of samples of the pdf
Definition: TOPPDFCollection.h:120
Belle2::TOPPDFCollection::m_localHitPosition
TVector3 m_localHitPosition
position of the exthit in local coordinates
Definition: TOPPDFCollection.h:123
Belle2::TOPPDFCollection::channelPDF_t
std::vector< Gaussian > channelPDF_t
the PDF in a given channel is a list of Gaussians
Definition: TOPPDFCollection.h:60
Belle2::TOPPDFCollection::m_moduleID
int m_moduleID
slot ID of the exthit
Definition: TOPPDFCollection.h:125
Belle2::TOPPDFCollection::ClassDef
ClassDef(TOPPDFCollection, 3)
ClassDef.
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TOPPDFCollection::setLocalPositionMomentum
void setLocalPositionMomentum(const TVector3 &pos, const TVector3 &mom, int moduleID)
sets the position and momentum of the exthit in local coordinates
Definition: TOPPDFCollection.h:91
Belle2::TOPPDFCollection::getHypothesisPDF
const modulePDF_t & getHypothesisPDF(const int hypothesis) const
returns the pdf for the given hypothesis (PDG code)
Definition: TOPPDFCollection.h:83
Belle2::TOPPDFCollection::Gaussian::width
float width
width (sigma)
Definition: TOPPDFCollection.h:51
Belle2::RelationsObject
RelationsInterface< TObject > RelationsObject
Provides interface for getting/adding relations to objects in StoreArrays.
Definition: RelationsObject.h:443
Belle2::TOPPDFCollection::m_localHitMomentum
TVector3 m_localHitMomentum
momentum of the exthit in local coordinates
Definition: TOPPDFCollection.h:124
Belle2::TOPPDFCollection::getAssociatedLocalMomentum
const TVector3 & getAssociatedLocalMomentum() const
returns the momentum of the associated exthit in local coordinates
Definition: TOPPDFCollection.h:109