Belle II Software development
CDCDedxADCNonLinearity Class Reference

dE/dx electronic ADC non-linearity correction for highly ionising particles (used in offline hadron saturation calibration) parameters are for X vs Y relation and sep for inner and outer layer vector array 0,1 for inner and 2,3 for outer layers More...

#include <CDCDedxADCNonLinearity.h>

Inheritance diagram for CDCDedxADCNonLinearity:

Public Member Functions

 CDCDedxADCNonLinearity ()
 Default constructor.
 
 CDCDedxADCNonLinearity (const std::vector< std::vector< double > > &nonlinearity)
 Constructor.
 
 ~CDCDedxADCNonLinearity ()
 Destructor.
 
unsigned int getSize (int layer, int axis) const
 Get the number of bins for the non-linearity angle correction.
 
double getCorrectedADC (const double &ADC, const int layer) const
 Return corrected ADC with given parameters.
 
double getNonLinearityPar (int layer, int axis, unsigned int par) const
 return specific hadron parameter
 
void printNonLinearityPars (int layer, int axis) const
 print requested hadron parameter array
 
void setNonLinearityPar (unsigned int layer, unsigned int axis, unsigned int par, double value)
 set specific hadron parameter
 

Private Member Functions

 ClassDef (CDCDedxADCNonLinearity, 1)
 ClassDef.
 

Private Attributes

std::vector< std::vector< double > > m_nonlADC
 ADC vs corrected ADC mapping.
 

Detailed Description

dE/dx electronic ADC non-linearity correction for highly ionising particles (used in offline hadron saturation calibration) parameters are for X vs Y relation and sep for inner and outer layer vector array 0,1 for inner and 2,3 for outer layers

Definition at line 29 of file CDCDedxADCNonLinearity.h.

Constructor & Destructor Documentation

◆ CDCDedxADCNonLinearity() [1/2]

Default constructor.

Definition at line 35 of file CDCDedxADCNonLinearity.h.

35: m_nonlADC() {};
std::vector< std::vector< double > > m_nonlADC
ADC vs corrected ADC mapping.

◆ CDCDedxADCNonLinearity() [2/2]

CDCDedxADCNonLinearity ( const std::vector< std::vector< double > > &  nonlinearity)
inlineexplicit

Constructor.

Definition at line 40 of file CDCDedxADCNonLinearity.h.

40: m_nonlADC(nonlinearity) {};

◆ ~CDCDedxADCNonLinearity()

Destructor.

Definition at line 45 of file CDCDedxADCNonLinearity.h.

45{};

Member Function Documentation

◆ getCorrectedADC()

double getCorrectedADC ( const double &  ADC,
const int  layer 
) const
inline

Return corrected ADC with given parameters.

Parameters
ADCuncorrected version
layerouter vs inner 0 to 56 indexing

Definition at line 78 of file CDCDedxADCNonLinearity.h.

79 {
80
81 int mylayer = 0;
82 if (layer < 0 || layer > 55) {
83 B2WARNING("CDCDedxADCNonLinearity:returning uncorrected ADC as input layer is out of range: must be 0-55");
84 return ADC;
85 } else {
86 if (layer >= 8) mylayer = 2;
87 }
88
89 std::vector<double> tempX = m_nonlADC[mylayer];//inner or outer X array
90 std::vector<double> tempY = m_nonlADC[mylayer + 1];//inner or outer Y array
91
92 if (tempX.size() != tempY.size()) {
93 B2WARNING("CDCDedxADCNonLinearity:returning uncorrected ADC as parameters range don't match: X=Y in bins");
94 return ADC;
95 }
96
97 //Find bin for ADC correction
98 unsigned int ibin = TMath::BinarySearch(tempY.size(), tempY.data(), double(ADC));
99
100 if (ibin >= tempY.size() - 1)ibin = tempY.size() - 2; //overflow to last bin
101 if (ibin >= tempY.size() - 1) {
102 B2WARNING("CDCDedxADCNonLinearity:returning uncorrected ADC as bins are not in range");
103 return ADC;
104 }
105
106 double slope = (tempY[ibin + 1] - tempY[ibin]) / (tempX[ibin + 1] - tempX[ibin]);
107 return std::round(tempX[ibin] + (ADC - tempY[ibin]) / slope);
108 }

◆ getNonLinearityPar()

double getNonLinearityPar ( int  layer,
int  axis,
unsigned int  par 
) const
inline

return specific hadron parameter

Parameters
layerouter(8-55) vs inner(0-7)
axis0 for X and 1 for Y
parnumber starts from 0

Definition at line 115 of file CDCDedxADCNonLinearity.h.

116 {
117
118 int mylayer = 0;
119 if (layer < 0 || layer > 55) {
120 B2ERROR("CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
121 return -99.0;
122 } else {
123 if (layer >= 8) mylayer = 2;
124 }
125
126 if (axis < 0 || axis > 1) {
127 B2ERROR("CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
128 return -99.0;
129 } else {
130 mylayer = mylayer + axis;
131 }
132
133 if (par >= m_nonlADC[mylayer].size()) {
134 B2ERROR("CDCDedxADCNonLinearity:Problem with par index: choose 0 and " << m_nonlADC[mylayer].size()); //
135 return -99.0;
136 }
137
138 return m_nonlADC[mylayer][par];
139 };

◆ getSize()

unsigned int getSize ( int  layer,
int  axis 
) const
inline

Get the number of bins for the non-linearity angle correction.

Parameters
layerouter vs inner 0 to 56 indexing
axis0 for X and 1 for Y

Definition at line 52 of file CDCDedxADCNonLinearity.h.

53 {
54
55 int mylayer = 0;
56 if (layer < 0 || layer > 55) {
57 B2ERROR("CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
58 return 0;
59 } else {
60 if (layer >= 8) mylayer = 2;
61 }
62
63 if (axis < 0 || axis > 1) {
64 B2ERROR("CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
65 return 0;
66 } else {
67 mylayer = mylayer + axis;
68 }
69
70 return m_nonlADC[mylayer].size();
71 };

◆ printNonLinearityPars()

void printNonLinearityPars ( int  layer,
int  axis 
) const
inline

print requested hadron parameter array

Parameters
layerouter vs inner
axis0 for X and 1 for Y

Definition at line 145 of file CDCDedxADCNonLinearity.h.

146 {
147
148 int mylayer = 0;
149 if (layer < 0 || layer > 55) {
150 B2ERROR("CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
151 return;
152 } else {
153 if (layer >= 8) mylayer = 2;
154 }
155
156 if (axis < 0 || axis > 1) {
157 B2ERROR("CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
158 return;
159 } else {
160 mylayer = mylayer + axis;
161 }
162
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;
166
167 };

◆ setNonLinearityPar()

void setNonLinearityPar ( unsigned int  layer,
unsigned int  axis,
unsigned int  par,
double  value 
)
inline

set specific hadron parameter

Parameters
layerouter(8-55) vs inner(0-7)
axis0 for X and 1 for Y
parnumber starts from 0
valueof parameter to set

Definition at line 175 of file CDCDedxADCNonLinearity.h.

176 {
177 int mylayer = 0;
178 if (layer > 55) {
179 B2ERROR("CDCDedxADCNonLinearity:CDC layer out of range, choose between 0-55");
180 return;
181 } else {
182 if (layer >= 8) mylayer = 2;
183 }
184
185 if (axis > 1) {
186 B2ERROR("CDCDedxADCNonLinearity:Problem with X/Y axis: choose 0/1 for X/Y");
187 return;
188 } else {
189 mylayer = mylayer + axis;
190 }
191
192 if (par >= m_nonlADC[mylayer].size()) {
193 B2ERROR("CDCDedxADCNonLinearity:Problem with par index: choose 0 and " << m_nonlADC[mylayer].size()); //
194 }
195
196 //here set parameter to requested value
197 m_nonlADC[mylayer][par] = value;
198
199 };

Member Data Documentation

◆ m_nonlADC

std::vector<std::vector<double> > m_nonlADC
private

ADC vs corrected ADC mapping.

Definition at line 203 of file CDCDedxADCNonLinearity.h.


The documentation for this class was generated from the following file: