11#include <framework/logging/Logger.h>
72 double getMean(
int side,
unsigned int ibin)
const
75 B2ERROR(
"CDCDedxCosineEdge: vector-of-vectors too short, returning 1");
80 if (ibin < temp.size())
return temp[ibin];
82 B2WARNING(
"CDCDedxCosineEdge: invalid bin number, returning 1");
94 B2ERROR(
"CDCDedxCosineEdge: vector-of-vectors too short, returning 1");
99 if (temp.size() < 2) {
100 B2ERROR(
"CDCDedxCosineEdge: vector too short, returning 1");
104 double coslow = 0.0, coshigh = 0.0;
106 coslow = -0.870; coshigh = -0.850;
108 coslow = 0.950; coshigh = 0.960;
112 if (costh < coslow or costh > coshigh) {
116 if (costh <= -0.866 or costh >= 0.9575)
return 1.0;
120 int nbins = int(temp.size());
121 double binsize = (coshigh - coslow) / nbins;
122 int bin = std::floor((costh - 0.5 * binsize - coslow) / binsize);
123 if (bin < 0) bin = 0;
124 else if (bin > nbins - 2) bin = nbins - 2;
129 if (temp[bin + 1] - temp[bin] < -0.6) bin++;
130 else if (temp[bin + 1] - temp[bin] > 0.6) bin--;
132 if (bin < 0 or bin + 1 >= nbins) {
133 B2WARNING(
"CDCDedxCosineEdge:no constants for costh: " << costh <<
" as it is not in range");
137 double frac = ((costh - 0.5 * binsize - coslow) / binsize) - bin;
138 return ((temp[bin + 1] - temp[bin]) * frac + temp[bin]);
149 std::vector<double> temp;
150 double coslow = 0.0, coshigh = 0.0;
153 coslow = -0.870; coshigh = -0.850;
154 }
else if (side > 0) {
156 coslow = 0.950; coshigh = 0.960;
158 B2ERROR(
"CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
162 if (ibin >= temp.size()) {
163 B2ERROR(
"CDCDedxCosineEdge:Problem with bin index: choose 0 and " << temp.size() - 1);
167 if (temp.size() == 0)
return -99.0;
168 double bw = std::abs(coshigh - coslow) / temp.size();
169 double bc = coslow + (0.5 + ibin) * bw;
170 std::cout <<
"Par # " << ibin <<
", costh bin centre = " << bc <<
", const =" << temp[ibin] << std::endl;
181 std::vector<double> temp;
182 double coslow = 0.0, coshigh = 0.0;
185 coslow = -0.870; coshigh = -0.850;
186 }
else if (side > 0) {
188 coslow = 0.950; coshigh = 0.960;
190 B2ERROR(
"CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
194 if (temp.size() == 0)
return;
195 double bw = std::abs(coshigh - coslow) / temp.size();
196 B2INFO(
"Printing parameters (0=backward and 1=forward): " << side <<
", nPars = " << temp.size());
197 for (
unsigned int ibin = 0; ibin < temp.size(); ibin++) {
198 double bc = coslow + (0.5 + ibin) * bw;
199 std::cout <<
"Par # " << ibin <<
", costh bin centre = " << bc <<
", const = " << temp[ibin] << std::endl;
213 B2ERROR(
"CDCDedxCosineEdge: vector-of-vectors too short, value not set");
217 int iside = side < 0 ? 0 : 1;
219 B2ERROR(
"CDCDedxCosineEdge: invalid bin number, value not set");
224 B2DEBUG(20,
"Par # " << ibin <<
", const = " <<
m_largeCos[iside][ibin]);
dE/dx special large cosine calibration to fix bending shoulder at large costh
CDCDedxCosineEdge()
Default constructor.
ClassDef(CDCDedxCosineEdge, 1)
ClassDef.
~CDCDedxCosineEdge()
Destructor.
double getCosEdgePar(int side, unsigned int ibin) const
Return specific large cosine constants on give side.
void setCosthEdgePar(int side, unsigned int ibin, double value)
Set specific hadron parameter.
double getMean(int side, unsigned int ibin) const
Return calibration constant for given side and bin #.
double getMean(double costh) const
Return calibration constant for cosine value.
void printCosEdgePars(int side)
Print large cosine constants array on requested side.
std::vector< std::vector< double > > m_largeCos
large cosine calibration constants
CDCDedxCosineEdge(const std::vector< std::vector< double > > &largecosth)
Constructor.
int getSize(const int side) const
Get the number of bins of requested side.
Abstract base class for different kinds of events.