11#include <framework/logging/Logger.h>
52 B2WARNING(
"Cosine gain parameters do not match, cannot merge!");
55 std::vector<double> rhsgains = rhs.
getCosCor();
57 for (
unsigned int bin = 0; bin <
m_cosgains.size(); ++bin) {
58 m_cosgains[bin] *= rhsgains[std::floor(bin / scale + 0.001)];
83 else B2ERROR(
"CDCDedxCosineCor: invalid bin number, value not set");
104 if (std::abs(costh) > 1)
return 0;
109 int bin = std::floor((costh - 0.5 * binsize + 1.0) / binsize);
114 int thisbin = bin, nextbin = bin + 1;
115 if ((costh + 1) < (binsize / 2) || (costh > 0 && std::fabs(costh) < (binsize / 2))) {
116 thisbin = bin + 1; nextbin = bin + 2;
118 if ((costh - 1) > -1.0 * (binsize / 2) || (costh < 0 && std::fabs(costh) < (binsize / 2))) {
119 thisbin = bin - 1; nextbin = bin;
122 double frac = ((costh - 0.5 * binsize + 1.0) / binsize) - thisbin;
124 if (thisbin < 0 || (
unsigned)nextbin >=
m_cosgains.size()) {
125 B2WARNING(
"Problem with extrapolation of CDC dE/dx cosine correction");
dE/dx wire gain calibration constants
CDCDedxCosineCor()
Default constructor.
~CDCDedxCosineCor()
Destructor.
void setCosCor(unsigned int bin, double value)
Set the cosine correction.
double getMean(double costh) const
Return dE/dx mean value for given cos(theta)
CDCDedxCosineCor(const std::vector< double > &cosgains)
Constructor.
CDCDedxCosineCor & operator*=(CDCDedxCosineCor const &rhs)
Combine payloads.
std::vector< double > m_cosgains
dE/dx gains in cos(theta) bins
const std::vector< double > & getCosCor() const
Get the calibration constants.
ClassDef(CDCDedxCosineCor, 8)
ClassDef.
double getMean(unsigned int bin) const
Return dE/dx mean value for the given bin.
unsigned int getSize() const
Get the number of bins for the cosine correction.
Abstract base class for different kinds of events.