Belle II Software development
CDCDedxMomentumCor.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 {
26 class CDCDedxMomentumCor: public TObject {
27
28 public:
29
34
38 explicit CDCDedxMomentumCor(const std::vector<double>& momcor): m_momcor(momcor) {};
39
44
49 {
50 if (m_momcor.size() != rhs.getSize()) {
51 B2WARNING("Momentum correction parameters do not match, cannot merge!");
52 return *this;
53 }
54 std::vector<double> rhsgains = rhs.getMomCor();
55 for (unsigned int bin = 0; bin < m_momcor.size(); ++bin) {
56 m_momcor[bin] *= rhsgains[bin];
57 }
58 return *this;
59 }
60
63 unsigned int getSize() const { return m_momcor.size(); };
64
67 std::vector<double> getMomCor() const {return m_momcor; };
68
72 double getMean(unsigned int bin) const
73 {
74 if (bin > m_momcor.size()) return 1.0;
75 else return m_momcor[bin];
76 }
77
81 double getMean(double mom) const
82 {
83 if (std::abs(mom) > 10.0) return 0;
84
85 // gains are stored at the center of the bins
86 // find the bin center immediately preceding this value of mom
87 double binsize = 10.0 / m_momcor.size();
88 int bin = std::floor(mom / binsize);
89
90 return m_momcor[bin];
91 };
92
93 private:
94
95 std::vector<double> m_momcor;
98 };
100} // end namespace Belle2
dE/dx wire gain calibration constants
CDCDedxMomentumCor & operator*=(CDCDedxMomentumCor const &rhs)
Combine payloads.
ClassDef(CDCDedxMomentumCor, 5)
ClassDef.
CDCDedxMomentumCor()
Default constructor.
double getMean(double mom) const
Return dE/dx mean value for given cos(theta)
CDCDedxMomentumCor(const std::vector< double > &momcor)
Constructor.
std::vector< double > m_momcor
dE/dx gains in momentum bins
double getMean(unsigned int bin) const
Return dE/dx mean value for given bin.
std::vector< double > getMomCor() const
Get the momentum correction.
unsigned int getSize() const
Get the number of bins for the momentum correction.
Abstract base class for different kinds of events.