Belle II Software development
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#include <Math/Vector3D.h>
20#include <Math/Point3D.h>
21
22namespace Belle2 {
35
36 public:
37
41 struct Gaussian {
42 float mean = 0;
43 float width = 0;
44 float area = 0;
51 Gaussian(float m, float w, float a): mean(m), width(w), area(a)
52 {}
53 };
54
55 typedef std::vector<Gaussian> channelPDF_t;
56 typedef std::array<channelPDF_t, 512> modulePDF_t;
62
69 bool addHypothesisPDF(const modulePDF_t& pdf, const int hypothesis)
70 {
71 auto result = m_data.insert(std::make_pair(hypothesis, pdf));
72 if (not result.second) {
73 B2WARNING("PDF exists already for this track");
74 }
75 return result.second;
76 }
77
83 const modulePDF_t& getHypothesisPDF(const int hypothesis) const
84 {
85 return m_data.at(hypothesis);
86 }
87
94 void setLocalPositionMomentum(const ROOT::Math::XYZPoint& pos, const ROOT::Math::XYZVector& mom, int moduleID)
95 {
98 m_moduleID = moduleID;
99 }
100
105 const ROOT::Math::XYZPoint& getAssociatedLocalHit() const
106 {
107 return m_localHitPosition;
108 }
109
114 const ROOT::Math::XYZVector& getAssociatedLocalMomentum() const
115 {
116 return m_localHitMomentum;
117 }
118
123 int getModuleID() const {return m_moduleID;}
124
125 private:
126 std::map<int, modulePDF_t> m_data;
127 // The following two members are useful for python modules (with no access
128 // to TOPGeometryPar)
129 ROOT::Math::XYZPoint m_localHitPosition;
130 ROOT::Math::XYZVector m_localHitMomentum;
131 int m_moduleID = 0;
133 };
135} // end namespace Belle2
136
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
void setLocalPositionMomentum(const ROOT::Math::XYZPoint &pos, const ROOT::Math::XYZVector &mom, int moduleID)
Sets the position and momentum of the exthit in local coordinates.
std::vector< Gaussian > channelPDF_t
the PDF in a given channel is a list of Gaussians
ROOT::Math::XYZPoint m_localHitPosition
position of the exthit in local coordinates
ROOT::Math::XYZVector m_localHitMomentum
momentum of the exthit in local coordinates
std::map< int, modulePDF_t > m_data
collection of samples of the pdf
const ROOT::Math::XYZPoint & getAssociatedLocalHit() const
Returns the local coordinates of the exthit associated with this PDF.
int m_moduleID
slot ID of the exthit
int getModuleID() const
Returns slot ID of the associated exthit.
bool addHypothesisPDF(const modulePDF_t &pdf, const int hypothesis)
Adds the pdf for the given hypothesis (PDG code)
const ROOT::Math::XYZVector & getAssociatedLocalMomentum() const
Returns the momentum of the associated exthit in local coordinates.
const modulePDF_t & getHypothesisPDF(const int hypothesis) const
Returns the pdf for the given hypothesis (PDG code)
ClassDef(TOPPDFCollection, 4)
ClassDef.
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)