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.
 
std::vector< double > getCosCor () const
 Get the cosine correction.
 
void setCosCor (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.

Definition at line 38 of file CDCDedxCosineCor.h.

38: m_cosgains(cosgains) {};

◆ ~CDCDedxCosineCor()

~CDCDedxCosineCor ( )
inline

Destructor.

Definition at line 43 of file CDCDedxCosineCor.h.

43{};

Member Function Documentation

◆ getCosCor()

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

Get the cosine correction.

Definition at line 68 of file CDCDedxCosineCor.h.

68{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

Definition at line 89 of file CDCDedxCosineCor.h.

90 {
91 if (std::abs(costh) > 1) return 0;
92
93 // gains are stored at the center of the bins
94 // find the bin center immediately preceding this value of costh
95 double binsize = 2.0 / m_cosgains.size();
96 int bin = std::floor((costh - 0.5 * binsize + 1.0) / binsize);
97
98 // extrapolation
99 // extrapolate backward for lowest half-bin and center positive half-bin
100 // extrapolate forward for highest half-bin and center negative half-bin
101 int thisbin = bin, nextbin = bin + 1;
102 if ((costh + 1) < (binsize / 2) || (costh > 0 && std::fabs(costh) < (binsize / 2))) {
103 thisbin = bin + 1; nextbin = bin + 2;
104 } else {
105 if ((costh - 1) > -1.0 * (binsize / 2) || (costh < 0 && std::fabs(costh) < (binsize / 2))) {
106 thisbin = bin - 1; nextbin = bin;
107 }
108 }
109 double frac = ((costh - 0.5 * binsize + 1.0) / binsize) - thisbin;
110
111 if (thisbin < 0 || (unsigned)nextbin >= m_cosgains.size()) {
112 B2WARNING("Problem with extrapolation of CDC dE/dx cosine correction");
113 return 1.0;
114 }
115 return ((m_cosgains[nextbin] - m_cosgains[thisbin]) * frac + m_cosgains[thisbin]);
116 };

◆ 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

Definition at line 80 of file CDCDedxCosineCor.h.

81 {
82 if (bin > m_cosgains.size()) return 1.0;
83 else return m_cosgains[bin];
84 }

◆ getSize()

unsigned int getSize ( ) const
inline

Get the number of bins for the cosine correction.

Definition at line 64 of file CDCDedxCosineCor.h.

64{ return m_cosgains.size(); };

◆ operator*=()

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

Combine payloads.

Definition at line 48 of file CDCDedxCosineCor.h.

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

◆ setCosCor()

void setCosCor ( int  bin,
double  value 
)
inline

Set the cosine correction.

Definition at line 72 of file CDCDedxCosineCor.h.

73 {
74 m_cosgains[bin] = value;
75 }

Member Data Documentation

◆ m_cosgains

std::vector<double> m_cosgains
private

dE/dx gains in cos(theta) bins

Definition at line 119 of file CDCDedxCosineCor.h.


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