Belle II Software development
CDCDedxCosineEdge Class Reference

dE/dx special large cosine calibration to fix bending shoulder at large costh More...

#include <CDCDedxCosineEdge.h>

Inheritance diagram for CDCDedxCosineEdge:

Public Member Functions

 CDCDedxCosineEdge ()
 Default constructor.
 
 CDCDedxCosineEdge (const std::vector< std::vector< double > > &largecosth)
 Constructor.
 
 ~CDCDedxCosineEdge ()
 Destructor.
 
int getSize (const int side) const
 Get the number of bins of requested side.
 
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
 
double getCosEdgePar (int side, unsigned int ibin) const
 return specific large cosine constants on give side
 
void printCosEdgePars (int side)
 print large cosine constants array on requested side
 
void setCosthEdgePar (int side, unsigned int ibin, double value)
 set specific hadron parameter
 

Private Member Functions

 ClassDef (CDCDedxCosineEdge, 1)
 ClassDef.
 

Private Attributes

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

Detailed Description

dE/dx special large cosine calibration to fix bending shoulder at large costh

Definition at line 27 of file CDCDedxCosineEdge.h.

Constructor & Destructor Documentation

◆ CDCDedxCosineEdge() [1/2]

CDCDedxCosineEdge ( )
inline

Default constructor.

Definition at line 33 of file CDCDedxCosineEdge.h.

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

◆ CDCDedxCosineEdge() [2/2]

CDCDedxCosineEdge ( const std::vector< std::vector< double > > &  largecosth)
inlineexplicit

Constructor.

Definition at line 38 of file CDCDedxCosineEdge.h.

38: m_largeCos(largecosth) {};

◆ ~CDCDedxCosineEdge()

~CDCDedxCosineEdge ( )
inline

Destructor.

Definition at line 43 of file CDCDedxCosineEdge.h.

43{};

Member Function Documentation

◆ getCosEdgePar()

double getCosEdgePar ( int  side,
unsigned int  ibin 
) const
inline

return specific large cosine constants on give side

Parameters
side<0 for backward and >0 for forward
ibinis bin number for given costh

Definition at line 145 of file CDCDedxCosineEdge.h.

146 {
147
148 std::vector<double> temp;
149 double coslow = 0.0, coshigh = 0.0;
150 if (side < 0) {
151 temp = m_largeCos[0];
152 coslow = -0.870; coshigh = -0.850;
153 } else if (side > 0) {
154 temp = m_largeCos[1];
155 coslow = 0.950; coshigh = 0.960;
156 } else {
157 B2ERROR("CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
158 return -99.0;
159 }
160
161 if (ibin >= temp.size()) {
162 B2ERROR("CDCDedxCosineEdge:Problem with bin index: choose 0 and " << temp.size() - 1); //
163 return -99.0;
164 }
165
166 if (temp.size() == 0)return -99.0;
167 double bw = abs(coshigh - coslow) / temp.size();
168 double bc = coslow + (0.5 + ibin) * bw; //bin centre
169 std::cout << "Par # " << ibin << ", costh bin centre = " << bc << ", const =" << temp[ibin] << std::endl;
170 return temp[ibin];
171 };

◆ getMean() [1/2]

double getMean ( double  costh) const
inline

return calibration constant for cosine value

Parameters
costhis a signed cosine theta value so by definition it recog it's side

Definition at line 89 of file CDCDedxCosineEdge.h.

90 {
91
92 double coslow = 0.0, coshigh = 0.0;
93 std::vector<double> temp;
94
95 if (costh < 0) {
96 temp = m_largeCos[0];
97 coslow = -0.870; coshigh = -0.850; //this is hardcoded and fixed
98 } else if (costh > 0) {
99 temp = m_largeCos[1];
100 coslow = 0.950; coshigh = 0.960; //this is hardcoded and fixed
101 } else {
102 B2ERROR("CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
103 return 1.0;
104 }
105
106 //don't do anything for other cosine range
107 if (costh < coslow || costh > coshigh) {
108 B2WARNING("CDCDedxCosineEdge:outside range (" << costh << ")choose in between " << coslow << " and " << coshigh);
109 return 1.0;
110 }
111
112 if (costh <= -0.866 || costh >= 0.9575) return 1.0;
113
114 // gains are stored at the center of the bins
115 // find the bin center immediately preceding this value of costh
116 double binsize = (coshigh - coslow) / temp.size();
117 int bin = std::floor((costh - 0.5 * binsize - coslow) / binsize);
118
119 // extrapolate backward for lowest half-bin and center positive half-bin
120 // extrapolate forward for highest half-bin and center negative half-bin
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;
125 } else {
126 if (bin >= nbin - 1 || (temp[nextbin] - temp[thisbin] > 0.6 && bin < nbin - 1)) {
127 thisbin = bin - 1; nextbin = bin;
128 }
129 }
130
131 double frac = ((costh - 0.5 * binsize - coslow) / binsize) - thisbin;
132
133 if (thisbin < 0 || (unsigned)nextbin >= temp.size()) {
134 B2WARNING("CDCDedxCosineEdge:no constants for costh: " << costh << " as it is not in range");
135 return 1.0;
136 }
137
138 return ((temp[nextbin] - temp[thisbin]) * frac + temp[thisbin]);
139 }

◆ getMean() [2/2]

double getMean ( int  side,
unsigned int  ibin 
) const
inline

return calibration constant for given side and bin #

Parameters
side<0 for backward and >0 for forward
ibinis bin number for given costh

Definition at line 66 of file CDCDedxCosineEdge.h.

67 {
68
69 std::vector<double> temp;
70 if (side < 0) {
71 temp = m_largeCos[0];
72 } else if (side > 0) {
73 temp = m_largeCos[1];
74 } else {
75 B2ERROR("CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
76 return 1.0;
77 }
78
79 if (ibin >= temp.size()) { //index starts from zero
80 B2WARNING("CDCDedxADCNonLinearity:returning (1.0) uncorrected ADC as bin: " << ibin << " is not in range");
81 return 1.0;
82 }
83 return temp[ibin];
84 };

◆ getSize()

int getSize ( const int  side) const
inline

Get the number of bins of requested side.

Parameters
side<0 for backward and >0 for forward

Definition at line 49 of file CDCDedxCosineEdge.h.

50 {
51 if (side < 0) {
52 return m_largeCos[0].size();
53 } else if (side > 0) {
54 return m_largeCos[1].size();
55 } else {
56 B2ERROR("CDCDedxCosineEdge:choose >0 for forward and <0 for backward side");
57 return 0;
58 }
59 };

◆ printCosEdgePars()

void printCosEdgePars ( int  side)
inline

print large cosine constants array on requested side

Parameters
side<0 for backward and >0 for forward constants

Definition at line 177 of file CDCDedxCosineEdge.h.

178 {
179 std::vector<double> temp;
180 double coslow = 0.0, coshigh = 0.0;
181 if (side < 0) {
182 temp = m_largeCos[0];
183 coslow = -0.870; coshigh = -0.850;
184 } else if (side > 0) {
185 temp = m_largeCos[1];
186 coslow = 0.950; coshigh = 0.960;
187 } else {
188 B2ERROR("CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
189 return;
190 }
191
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; //bin centre
197 std::cout << "Par # " << ibin << ", costh bin centre = " << bc << ", const = " << temp[ibin] << std::endl;
198 }
199 temp.clear();
200 };

◆ setCosthEdgePar()

void setCosthEdgePar ( int  side,
unsigned int  ibin,
double  value 
)
inline

set specific hadron parameter

Parameters
side0 for backward and 1 for forward
ibinnumber starts from 0
valueof parameter to set

Definition at line 208 of file CDCDedxCosineEdge.h.

209 {
210 int iside = -99.0;
211 if (side < 0) {
212 iside = 0;
213 } else if (side > 0) {
214 iside = 1;
215 } else {
216 B2ERROR("CDCDedxCosineEdge:choose >0 for forward and <0 for backward side");
217 return;
218 }
219
220 if (ibin >= m_largeCos[iside].size()) {
221 B2ERROR("CDCDedxCosineEdge:Problem with bin index: choose 0 and " << m_largeCos[iside].size() - 1); //
222 return;
223 }
224
225 m_largeCos[iside][ibin] = value;
226 std::cout << "Par # " << ibin << ", const = " << m_largeCos[iside][ibin] << std::endl;
227 };

Member Data Documentation

◆ m_largeCos

std::vector<std::vector<double> > m_largeCos
private

ADC vs corrected ADC mapping.

Definition at line 231 of file CDCDedxCosineEdge.h.


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