13#include <framework/logging/Logger.h>
52 unsigned int getSize(
int layer,
int axis)
const
55 unsigned int mylayer = 0;
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 unsigned int mylayer = 0;
83 if (layer < 0 || layer > 55) {
84 B2WARNING(
"CDCDedxADCNonLinearity:returning uncorrected ADC as input layer is out of range: must be 0-55");
87 if (layer >= 8) mylayer = 2;
90 if (mylayer + 1 >=
m_nonlADC.size())
return ADC;
92 const std::vector<double>& tempX =
m_nonlADC[mylayer];
93 const std::vector<double>& tempY =
m_nonlADC[mylayer + 1];
95 if (tempX.size() < 2 or tempX.size() != tempY.size()) {
96 B2WARNING(
"CDCDedxADCNonLinearity:returning uncorrected ADC as parameters range don't match: X=Y in bins");
101 unsigned int ibin = TMath::BinarySearch(tempY.size(), tempY.data(),
double(ADC));
103 if (ibin >= tempY.size() - 1) ibin = tempY.size() - 2;
104 if (ibin >= tempY.size() - 1) {
105 B2WARNING(
"CDCDedxADCNonLinearity:returning uncorrected ADC as bins are not in range");
109 double slope = (tempY[ibin + 1] - tempY[ibin]) / (tempX[ibin + 1] - tempX[ibin]);
110 return std::round(tempX[ibin] + (ADC - tempY[ibin]) / slope);
121 unsigned int mylayer = 0;
122 if (layer < 0 || layer > 55) {
123 B2ERROR(
"CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
126 if (layer >= 8) mylayer = 2;
129 if (axis < 0 || axis > 1) {
130 B2ERROR(
"CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
133 mylayer = mylayer + axis;
137 B2ERROR(
"CDCDedxADCNonLinearity: vector-of-vectors too short");
142 B2ERROR(
"CDCDedxADCNonLinearity:Problem with par index: choose 0 and " <<
m_nonlADC[mylayer].size());
156 unsigned int mylayer = 0;
157 if (layer < 0 || layer > 55) {
158 B2ERROR(
"CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
161 if (layer >= 8) mylayer = 2;
164 if (axis < 0 || axis > 1) {
165 B2ERROR(
"CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
168 mylayer = mylayer + axis;
172 B2ERROR(
"CDCDedxADCNonLinearity: vector-of-vectors too short");
176 B2INFO(
"Printing parameters for layer: " << layer <<
", axis: " << axis <<
", nPars:" <<
m_nonlADC[mylayer].size());
177 for (
unsigned int iPar = 0; iPar <
m_nonlADC[mylayer].size(); iPar++)
178 std::cout <<
"Par # " << iPar <<
": " <<
m_nonlADC[mylayer][iPar] << std::endl;
190 unsigned int mylayer = 0;
192 B2ERROR(
"CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
195 if (layer >= 8) mylayer = 2;
199 B2ERROR(
"CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
202 mylayer = mylayer + axis;
206 B2ERROR(
"CDCDedxADCNonLinearity: vector-of-vectors too short");
210 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...
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.
double getCorrectedADC(double ADC, int layer) const
Return corrected ADC with given parameters.
Abstract base class for different kinds of events.