Belle II Software development
CDCDedx1DCell.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/logging/Logger.h>
12
13#include <TObject.h>
14#include <cmath>
15
16namespace Belle2 {
21
25
26 class CDCDedx1DCell: public TObject {
27
28 public:
29
34
36 CDCDedx1DCell(short version,
37 const std::vector<std::vector<double>>& groupGains,
38 const std::vector<unsigned int>& layerToGroup);
39
44
49
53 short getVersion() const { return m_version; };
54
56 unsigned int getNGroups() const {return m_onedgains.size();};
57
59 unsigned int getNLayers() const
60 {
61 if (!m_layerToGroup.empty()) return m_layerToGroup.size();
62
63 if (m_onedgains.size() == 2) return 56;
64
65 return 0;
66 };
67
69 unsigned int getGroup(unsigned int layer) const
70 {
71 if (layer >= getNLayers()) {
72 B2ERROR("Layer out of range");
73 return std::numeric_limits<unsigned int>::max();
74 }
75
76 if (!m_layerToGroup.empty()) {
77 return m_layerToGroup[layer];
78 }
79
80 if (m_onedgains.size() == 2) {
81 return (layer < 8) ? 0 : 1;
82 }
83
84 B2ERROR("Invalid 1DCell payload state");
85 return std::numeric_limits<unsigned int>::max();
86 };
87
90 unsigned int getNBins(unsigned int layer) const
91 {
92 const unsigned int group = getGroup(layer);
93
94 if (group >= m_onedgains.size()) return 0;
95
96 return m_onedgains[group].size();
97 };
98
103 const std::vector<std::vector<double>>& getOneDCell() const
104 {
105 return m_onedgains;
106 }
107
112
113 const std::vector<unsigned int>& getLayerMap() const
114 {
115 return m_layerToGroup;
116 }
117
122 double getMean(unsigned int layer, unsigned int bin) const;
123
124
130 void setMean(unsigned int layer, unsigned int bin, double value);
131
132
137 double getMean(unsigned int layer, double enta) const;
138
139
140 private:
141
143 bool isValidGroupedPayload() const;
144
148 short m_version;
149 std::vector<std::vector<double>> m_onedgains;
150 std::vector<unsigned int> m_layerToGroup;
151
153 };
154
155} // end namespace Belle2
dE/dx 1D cell correction calibration constants
unsigned int getNGroups() const
Number of groups.
std::vector< unsigned int > m_layerToGroup
layer to group map
short m_version
dE/dx cleanup correction versus entrance angle may be different for different layers,...
ClassDef(CDCDedx1DCell, 6)
ClassDef.
double getMean(unsigned int layer, unsigned int bin) const
Return dE/dx mean value for the given bin.
CDCDedx1DCell & operator*=(CDCDedx1DCell const &rhs)
Combine payloads.
~CDCDedx1DCell()
Destructor.
const std::vector< std::vector< double > > & getOneDCell() const
Get the grouped calibration constants.
std::vector< std::vector< double > > m_onedgains
dE/dx means in entrance angle bins
void setMean(unsigned int layer, unsigned int bin, double value)
Reset dE/dx mean value for the given bin.
bool isValidGroupedPayload() const
Payload validation.
const std::vector< unsigned int > & getLayerMap() const
Get the Layer-to-group map.
unsigned int getNLayers() const
Number of layers.
CDCDedx1DCell()
Default constructor.
unsigned int getGroup(unsigned int layer) const
Get group index for layer.
unsigned int getNBins(unsigned int layer) const
Get the number of bins for the entrance angle correction.
short getVersion() const
Get the version for the 1D cleanup.
Abstract base class for different kinds of events.