Belle II Software development
CDCDedxCosineCor Class Reference

dE/dx wire gain calibration constants More...

#include <CDCDedxCosineCor.h>

Inheritance diagram for CDCDedxCosineCor:

Public Member Functions

 CDCDedxCosineCor ()
 Default constructor.
 
 CDCDedxCosineCor (const std::vector< double > &cosgains)
 Constructor.
 
 ~CDCDedxCosineCor ()
 Destructor.
 
CDCDedxCosineCoroperator*= (CDCDedxCosineCor const &rhs)
 Combine payloads.
 
unsigned int getSize () const
 Get the number of bins for the cosine correction.
 
const std::vector< double > & getCosCor () const
 Get the calibration constants.
 
void setCosCor (unsigned int bin, double value)
 Set the cosine correction.
 
double getMean (unsigned int bin) const
 Return dE/dx mean value for the given bin.
 
double getMean (double costh) const
 Return dE/dx mean value for given cos(theta)
 

Private Member Functions

 ClassDef (CDCDedxCosineCor, 8)
 ClassDef.
 

Private Attributes

std::vector< double > m_cosgains
 dE/dx gains in cos(theta) bins
 

Detailed Description

dE/dx wire gain calibration constants

Definition at line 26 of file CDCDedxCosineCor.h.

Constructor & Destructor Documentation

◆ CDCDedxCosineCor() [1/2]

CDCDedxCosineCor ( )
inline

Default constructor.

Definition at line 33 of file CDCDedxCosineCor.h.

33: m_cosgains() {};
std::vector< double > m_cosgains
dE/dx gains in cos(theta) bins

◆ CDCDedxCosineCor() [2/2]

CDCDedxCosineCor ( const std::vector< double > &  cosgains)
inlineexplicit

Constructor.

Parameters
cosgainsvector of calibration constants

Definition at line 39 of file CDCDedxCosineCor.h.

39: m_cosgains(cosgains) {};

◆ ~CDCDedxCosineCor()

~CDCDedxCosineCor ( )
inline

Destructor.

Definition at line 44 of file CDCDedxCosineCor.h.

44{};

Member Function Documentation

◆ getCosCor()

const std::vector< double > & getCosCor ( ) const
inline

Get the calibration constants.

Returns
calibration constants

Definition at line 73 of file CDCDedxCosineCor.h.

73{return m_cosgains; };

◆ getMean() [1/2]

double getMean ( double  costh) const
inline

Return dE/dx mean value for given cos(theta)

Parameters
costhfor const with costh theta value
Returns
mean value

Definition at line 102 of file CDCDedxCosineCor.h.

103 {
104 if (std::abs(costh) > 1) return 0;
105
106 // gains are stored at the center of the bins
107 // find the bin center immediately preceding this value of costh
108 double binsize = 2.0 / m_cosgains.size();
109 int bin = std::floor((costh - 0.5 * binsize + 1.0) / binsize);
110
111 // extrapolation
112 // extrapolate backward for lowest half-bin and center positive half-bin
113 // extrapolate forward for highest half-bin and center negative half-bin
114 int thisbin = bin, nextbin = bin + 1;
115 if ((costh + 1) < (binsize / 2) || (costh > 0 && std::fabs(costh) < (binsize / 2))) {
116 thisbin = bin + 1; nextbin = bin + 2;
117 } else {
118 if ((costh - 1) > -1.0 * (binsize / 2) || (costh < 0 && std::fabs(costh) < (binsize / 2))) {
119 thisbin = bin - 1; nextbin = bin;
120 }
121 }
122 double frac = ((costh - 0.5 * binsize + 1.0) / binsize) - thisbin;
123
124 if (thisbin < 0 || (unsigned)nextbin >= m_cosgains.size()) {
125 B2WARNING("Problem with extrapolation of CDC dE/dx cosine correction");
126 return 1.0;
127 }
128 return ((m_cosgains[nextbin] - m_cosgains[thisbin]) * frac + m_cosgains[thisbin]);
129 };

◆ getMean() [2/2]

double getMean ( unsigned int  bin) const
inline

Return dE/dx mean value for the given bin.

Parameters
binfor const with cosine bin
Returns
mean value

Definition at line 91 of file CDCDedxCosineCor.h.

92 {
93 if (bin < m_cosgains.size()) return m_cosgains[bin];
94 return 1.0;
95 }

◆ getSize()

unsigned int getSize ( ) const
inline

Get the number of bins for the cosine correction.

Returns
number of bins

Definition at line 67 of file CDCDedxCosineCor.h.

67{ return m_cosgains.size(); };

◆ operator*=()

CDCDedxCosineCor & operator*= ( CDCDedxCosineCor const &  rhs)
inline

Combine payloads.

Definition at line 49 of file CDCDedxCosineCor.h.

50 {
51 if (m_cosgains.size() % rhs.getSize() != 0) {
52 B2WARNING("Cosine gain parameters do not match, cannot merge!");
53 return *this;
54 }
55 std::vector<double> rhsgains = rhs.getCosCor();
56 int scale = std::floor(m_cosgains.size() / rhs.getSize() + 0.001);
57 for (unsigned int bin = 0; bin < m_cosgains.size(); ++bin) {
58 m_cosgains[bin] *= rhsgains[std::floor(bin / scale + 0.001)];
59 }
60 return *this;
61 }

◆ setCosCor()

void setCosCor ( unsigned int  bin,
double  value 
)
inline

Set the cosine correction.

Parameters
binbin number
valuevalue to be set

Definition at line 80 of file CDCDedxCosineCor.h.

81 {
82 if (bin < m_cosgains.size()) m_cosgains[bin] = value;
83 else B2ERROR("CDCDedxCosineCor: invalid bin number, value not set");
84 }

Member Data Documentation

◆ m_cosgains

std::vector<double> m_cosgains
private

dE/dx gains in cos(theta) bins

Definition at line 132 of file CDCDedxCosineCor.h.


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