13#include <framework/logging/Logger.h>
53 }
else if (side > 0) {
56 B2ERROR(
"CDCDedxCosineEdge:choose >0 for forward and <0 for backward side");
66 double getMean(
int side,
unsigned int ibin)
const
69 std::vector<double> temp;
72 }
else if (side > 0) {
75 B2ERROR(
"CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
79 if (ibin >= temp.size()) {
80 B2WARNING(
"CDCDedxADCNonLinearity:returning (1.0) uncorrected ADC as bin: " << ibin <<
" is not in range");
92 double coslow = 0.0, coshigh = 0.0;
93 std::vector<double> temp;
97 coslow = -0.870; coshigh = -0.850;
98 }
else if (costh > 0) {
100 coslow = 0.950; coshigh = 0.960;
102 B2ERROR(
"CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
107 if (costh < coslow || costh > coshigh) {
108 B2WARNING(
"CDCDedxCosineEdge:outside range (" << costh <<
")choose in between " << coslow <<
" and " << coshigh);
112 if (costh <= -0.866 || costh >= 0.9575)
return 1.0;
116 double binsize = (coshigh - coslow) / temp.size();
117 int bin = std::floor((costh - 0.5 * binsize - coslow) / binsize);
121 int thisbin = bin, nextbin = bin + 1;
122 int nbin = int(temp.size());
123 if (bin < 0 || (temp[nextbin] - temp[thisbin] < -0.6 && bin < nbin - 1)) {
124 thisbin = bin + 1; nextbin = bin + 2;
126 if (bin >= nbin - 1 || (temp[nextbin] - temp[thisbin] > 0.6 && bin < nbin - 1)) {
127 thisbin = bin - 1; nextbin = bin;
131 double frac = ((costh - 0.5 * binsize - coslow) / binsize) - thisbin;
133 if (thisbin < 0 || (
unsigned)nextbin >= temp.size()) {
134 B2WARNING(
"CDCDedxCosineEdge:no constants for costh: " << costh <<
" as it is not in range");
138 return ((temp[nextbin] - temp[thisbin]) * frac + temp[thisbin]);
148 std::vector<double> temp;
149 double coslow = 0.0, coshigh = 0.0;
152 coslow = -0.870; coshigh = -0.850;
153 }
else if (side > 0) {
155 coslow = 0.950; coshigh = 0.960;
157 B2ERROR(
"CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
161 if (ibin >= temp.size()) {
162 B2ERROR(
"CDCDedxCosineEdge:Problem with bin index: choose 0 and " << temp.size() - 1);
166 if (temp.size() == 0)
return -99.0;
167 double bw = abs(coshigh - coslow) / temp.size();
168 double bc = coslow + (0.5 + ibin) * bw;
169 std::cout <<
"Par # " << ibin <<
", costh bin centre = " << bc <<
", const =" << temp[ibin] << std::endl;
179 std::vector<double> temp;
180 double coslow = 0.0, coshigh = 0.0;
183 coslow = -0.870; coshigh = -0.850;
184 }
else if (side > 0) {
186 coslow = 0.950; coshigh = 0.960;
188 B2ERROR(
"CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
192 if (temp.size() == 0)
return;
193 double bw = abs(coshigh - coslow) / temp.size();
194 B2INFO(
"Printing parameters (0=backward and 1=forward): " << side <<
", nPars = " << temp.size());
195 for (
unsigned int ibin = 0; ibin < temp.size(); ibin++) {
196 double bc = coslow + (0.5 + ibin) * bw;
197 std::cout <<
"Par # " << ibin <<
", costh bin centre = " << bc <<
", const = " << temp[ibin] << std::endl;
213 }
else if (side > 0) {
216 B2ERROR(
"CDCDedxCosineEdge:choose >0 for forward and <0 for backward side");
221 B2ERROR(
"CDCDedxCosineEdge:Problem with bin index: choose 0 and " <<
m_largeCos[iside].size() - 1);
226 std::cout <<
"Par # " << ibin <<
", const = " <<
m_largeCos[iside][ibin] << std::endl;
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
ADC vs corrected ADC mapping.
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.