13#include <framework/logging/Logger.h>
52 unsigned int getSize(
int layer,
int axis)
const
56 if (layer < 0 || layer > 55) {
57 B2ERROR(
"CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
60 if (layer >= 8) mylayer = 2;
63 if (axis < 0 || axis > 1) {
64 B2ERROR(
"CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
67 mylayer = mylayer + axis;
82 if (layer < 0 || layer > 55) {
83 B2WARNING(
"CDCDedxADCNonLinearity:returning uncorrected ADC as input layer is out of range: must be 0-55");
86 if (layer >= 8) mylayer = 2;
89 std::vector<double> tempX =
m_nonlADC[mylayer];
90 std::vector<double> tempY =
m_nonlADC[mylayer + 1];
92 if (tempX.size() != tempY.size()) {
93 B2WARNING(
"CDCDedxADCNonLinearity:returning uncorrected ADC as parameters range don't match: X=Y in bins");
98 unsigned int ibin = TMath::BinarySearch(tempY.size(), tempY.data(),
double(ADC));
100 if (ibin >= tempY.size() - 1)ibin = tempY.size() - 2;
101 if (ibin >= tempY.size() - 1) {
102 B2WARNING(
"CDCDedxADCNonLinearity:returning uncorrected ADC as bins are not in range");
106 double slope = (tempY[ibin + 1] - tempY[ibin]) / (tempX[ibin + 1] - tempX[ibin]);
107 return std::round(tempX[ibin] + (ADC - tempY[ibin]) / slope);
119 if (layer < 0 || layer > 55) {
120 B2ERROR(
"CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
123 if (layer >= 8) mylayer = 2;
126 if (axis < 0 || axis > 1) {
127 B2ERROR(
"CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
130 mylayer = mylayer + axis;
134 B2ERROR(
"CDCDedxADCNonLinearity:Problem with par index: choose 0 and " <<
m_nonlADC[mylayer].size());
149 if (layer < 0 || layer > 55) {
150 B2ERROR(
"CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
153 if (layer >= 8) mylayer = 2;
156 if (axis < 0 || axis > 1) {
157 B2ERROR(
"CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
160 mylayer = mylayer + axis;
163 B2INFO(
"Printing parameters for layer: " << layer <<
", axis: " << axis <<
", nPars:" <<
m_nonlADC[mylayer].size());
164 for (
unsigned int iPar = 0; iPar <
m_nonlADC[mylayer].size(); iPar++)
165 std::cout <<
"Par # " << iPar <<
": " <<
m_nonlADC[mylayer][iPar] << std::endl;
179 B2ERROR(
"CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
182 if (layer >= 8) mylayer = 2;
186 B2ERROR(
"CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
189 mylayer = mylayer + axis;
193 B2ERROR(
"CDCDedxADCNonLinearity:Problem with par index: choose 0 and " <<
m_nonlADC[mylayer].size());
dE/dx electronic ADC non-linearity correction for highly ionising particles (used in offline hadron s...
double getCorrectedADC(const double &ADC, const int layer) const
Return corrected ADC with given parameters.
ClassDef(CDCDedxADCNonLinearity, 1)
ClassDef.
CDCDedxADCNonLinearity(const std::vector< std::vector< double > > &nonlinearity)
Constructor.
~CDCDedxADCNonLinearity()
Destructor.
std::vector< std::vector< double > > m_nonlADC
ADC vs corrected ADC mapping.
double getNonLinearityPar(int layer, int axis, unsigned int par) const
return specific hadron parameter
void setNonLinearityPar(unsigned int layer, unsigned int axis, unsigned int par, double value)
set specific hadron parameter
void printNonLinearityPars(int layer, int axis) const
print requested hadron parameter array
CDCDedxADCNonLinearity()
Default constructor.
unsigned int getSize(int layer, int axis) const
Get the number of bins for the non-linearity angle correction.
Abstract base class for different kinds of events.