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
 large cosine calibration constants
 

Detailed Description

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

Definition at line 30 of file CDCDedxCosineEdge.h.

Constructor & Destructor Documentation

◆ CDCDedxCosineEdge() [1/2]

CDCDedxCosineEdge ( )
inline

Default constructor.

Definition at line 36 of file CDCDedxCosineEdge.h.

36: m_largeCos() {};
std::vector< std::vector< double > > m_largeCos
large cosine calibration constants

◆ CDCDedxCosineEdge() [2/2]

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

Constructor.

Parameters
largecosthcalibration constants

Definition at line 42 of file CDCDedxCosineEdge.h.

42: m_largeCos(largecosth) {};

◆ ~CDCDedxCosineEdge()

~CDCDedxCosineEdge ( )
inline

Destructor.

Definition at line 47 of file CDCDedxCosineEdge.h.

47{};

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 146 of file CDCDedxCosineEdge.h.

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

◆ 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
Returns
calibration constant

Definition at line 91 of file CDCDedxCosineEdge.h.

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

Definition at line 72 of file CDCDedxCosineEdge.h.

73 {
74 if (m_largeCos.size() < 2) {
75 B2ERROR("CDCDedxCosineEdge: vector-of-vectors too short, returning 1");
76 return 1.0;
77 }
78
79 const std::vector<double>& temp = side < 0 ? m_largeCos[0] : m_largeCos[1];
80 if (ibin < temp.size()) return temp[ibin];
81
82 B2WARNING("CDCDedxCosineEdge: invalid bin number, returning 1");
83 return 1.0;
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
Returns
number of bins

Definition at line 54 of file CDCDedxCosineEdge.h.

55 {
56 if (side < 0) {
57 if (m_largeCos.empty()) return 0;
58 return m_largeCos[0].size();
59 } else {
60 if (m_largeCos.size() < 2) return 0;
61 return m_largeCos[1].size();
62 }
63 };

◆ 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 179 of file CDCDedxCosineEdge.h.

180 {
181 std::vector<double> temp;
182 double coslow = 0.0, coshigh = 0.0;
183 if (side < 0) {
184 if (m_largeCos.size() > 0) temp = m_largeCos[0];
185 coslow = -0.870; coshigh = -0.850;
186 } else if (side > 0) {
187 if (m_largeCos.size() > 1) temp = m_largeCos[1];
188 coslow = 0.950; coshigh = 0.960;
189 } else {
190 B2ERROR("CDCDedxCosineEdge:choose > 0 for forward and <0 for backward side");
191 return;
192 }
193
194 if (temp.size() == 0) return;
195 double bw = std::abs(coshigh - coslow) / temp.size();
196 B2INFO("Printing parameters (0=backward and 1=forward): " << side << ", nPars = " << temp.size());
197 for (unsigned int ibin = 0; ibin < temp.size(); ibin++) {
198 double bc = coslow + (0.5 + ibin) * bw; //bin centre
199 std::cout << "Par # " << ibin << ", costh bin centre = " << bc << ", const = " << temp[ibin] << std::endl;
200 }
201 };

◆ 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 210 of file CDCDedxCosineEdge.h.

211 {
212 if (m_largeCos.size() < 2) {
213 B2ERROR("CDCDedxCosineEdge: vector-of-vectors too short, value not set");
214 return;
215 }
216
217 int iside = side < 0 ? 0 : 1;
218 if (ibin >= m_largeCos[iside].size()) {
219 B2ERROR("CDCDedxCosineEdge: invalid bin number, value not set");
220 return;
221 }
222
223 m_largeCos[iside][ibin] = value;
224 B2DEBUG(20, "Par # " << ibin << ", const = " << m_largeCos[iside][ibin]);
225 };

Member Data Documentation

◆ m_largeCos

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

large cosine calibration constants

Definition at line 229 of file CDCDedxCosineEdge.h.


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