Belle II Software development
CDCDedx2DCell Class Reference

dE/dx wire gain calibration constants More...

#include <CDCDedx2DCell.h>

Inheritance diagram for CDCDedx2DCell:

Public Member Functions

 CDCDedx2DCell ()
 Default constructor.
 
 CDCDedx2DCell (short version, const std::vector< TH2F > &twodgains)
 Constructor.
 
 ~CDCDedx2DCell ()
 Destructor.
 
CDCDedx2DCelloperator*= (CDCDedx2DCell const &rhs)
 Combine payloads.
 
short getVersion () const
 Get the version for the 2D correction.
 
unsigned int getSize () const
 Get the number of histograms for the 2D correction.
 
const TH2F * getHist (unsigned int layer) const
 Get the 2D histogram for the correction for this layer.
 
double getMean (unsigned int layer, int dbin, int ebin) const
 Return dE/dx mean value for the given bin.
 
double getMean (unsigned int layer, double doca, double enta) const
 Return dE/dx mean value for given DOCA and entrance angle.
 

Private Member Functions

 ClassDef (CDCDedx2DCell, 5)
 ClassDef.
 

Private Attributes

short m_version
 dE/dx gains versus DOCA and entrance angle may be different for different layers, so store as a vector keep a version number to identify which layers are valid
 
std::vector< TH2F > m_twodgains
 2D histograms of doca/enta gains, layer dependent
 

Detailed Description

dE/dx wire gain calibration constants

Definition at line 26 of file CDCDedx2DCell.h.

Constructor & Destructor Documentation

◆ CDCDedx2DCell() [1/2]

CDCDedx2DCell ( )
inline

Default constructor.

Definition at line 33 of file CDCDedx2DCell.h.

33: m_version(), m_twodgains() {};
short m_version
dE/dx gains versus DOCA and entrance angle may be different for different layers, so store as a vecto...
std::vector< TH2F > m_twodgains
2D histograms of doca/enta gains, layer dependent

◆ CDCDedx2DCell() [2/2]

CDCDedx2DCell ( short  version,
const std::vector< TH2F > &  twodgains 
)
inline

Constructor.

Definition at line 38 of file CDCDedx2DCell.h.

38: m_version(version), m_twodgains(twodgains) {};

◆ ~CDCDedx2DCell()

~CDCDedx2DCell ( )
inline

Destructor.

Definition at line 43 of file CDCDedx2DCell.h.

43{};

Member Function Documentation

◆ getHist()

const TH2F * getHist ( unsigned int  layer) const
inline

Get the 2D histogram for the correction for this layer.

Definition at line 72 of file CDCDedx2DCell.h.

73 {
74 if (m_twodgains.size() == 0) {
75 B2ERROR("CDCDedx2DCell: vector too short");
76 return nullptr;
77 }
78
79 if (m_twodgains.size() == 2) {
80 if (layer == 0) return &m_twodgains[0];
81 else if (layer == 1) return &m_twodgains[1];
82 else {
83 B2ERROR("CDCDedx2DCell: const histograms NOT found");
84 return nullptr;
85 }
86 } else if (m_twodgains.size() == 56) {
87 if (layer < m_twodgains.size()) return &m_twodgains[layer];
88 } else {
89 B2ERROR("CDCDedx2DCell: Something is wrong # of const histograms");
90 return nullptr;
91 }
92 B2ERROR("CDCDedx2DCell: wrong layer number");
93 return nullptr;
94 }

◆ getMean() [1/2]

double getMean ( unsigned int  layer,
double  doca,
double  enta 
) const
inline

Return dE/dx mean value for given DOCA and entrance angle.

Parameters
layercontinuous layer number
docadistance of closest approach
entaentrance angle

Definition at line 118 of file CDCDedx2DCell.h.

119 {
120 if (layer > 56) {
121 B2ERROR("Asking for a CDC layer beyond 56!");
122 return 0;
123 }
124
125 unsigned int mylayer = 0;
126 if (layer >= 8 && m_twodgains.size() == 2) mylayer = 1;
127 else if (m_twodgains.size() == 56) mylayer = layer;
128
129 if (mylayer >= m_twodgains.size()) {
130 B2ERROR("CDCDedx2DCell: wrong layer number, returning 1");
131 return 1.0;
132 }
133
134 // assume rotational symmetry
135 if (enta < -3.1416 / 2.0) enta += 3.1416 / 2.0;
136 if (enta > 3.1416 / 2.0) enta -= 3.1416 / 2.0;
137
138 // iterate bin number by one since TH2F bins start at 1 not 0
139 double dbinsize = m_twodgains[mylayer].GetXaxis()->GetBinCenter(2) - m_twodgains[mylayer].GetXaxis()->GetBinCenter(1);
140 int dbin = std::floor((doca - m_twodgains[mylayer].GetXaxis()->GetBinLowEdge(1)) / dbinsize) + 1;
141
142 double ebinsize = m_twodgains[mylayer].GetYaxis()->GetBinCenter(2) - m_twodgains[mylayer].GetYaxis()->GetBinCenter(1);
143 // int ebin = std::floor((std::sin(enta) - m_twodgains[mylayer].GetYaxis()->GetBinLowEdge(1)) / ebinsize) + 1;
144 int ebin = std::floor((enta - m_twodgains[mylayer].GetYaxis()->GetBinLowEdge(1)) / ebinsize) + 1;
145
146 double mean = 1.0;
147 if (dbin > 0 && dbin <= m_twodgains[mylayer].GetNbinsX() && ebin > 0 && ebin <= m_twodgains[mylayer].GetNbinsY())
148 mean = m_twodgains[mylayer].GetBinContent(dbin, ebin);
149 else if (dbin > m_twodgains[mylayer].GetNbinsX() && ebin > 0 && ebin <= m_twodgains[mylayer].GetNbinsY())
150 mean = m_twodgains[mylayer].GetBinContent(m_twodgains[mylayer].GetNbinsX(), ebin);
151 else
152 // B2WARNING("Problem with 2D CDC dE/dx calibration! " << doca << "\t" << dbin << "\t" << std::sin(enta) << "\t" << ebin);
153 B2WARNING("Problem with 2D CDC dE/dx calibration! " << doca << "\t" << dbin << "\t" << enta << "\t" << ebin);
154
155 return mean;
156 };

◆ getMean() [2/2]

double getMean ( unsigned int  layer,
int  dbin,
int  ebin 
) const
inline

Return dE/dx mean value for the given bin.

Parameters
layerlayer number
dbindoca bin number
ebinenta bin number

Definition at line 101 of file CDCDedx2DCell.h.

102 {
103 unsigned int mylayer = 0;
104 if (layer >= 8 && m_twodgains.size() == 2) mylayer = 1;
105 else if (m_twodgains.size() == 56) mylayer = layer;
106
107 if (mylayer < m_twodgains.size()) return m_twodgains[mylayer].GetBinContent(dbin, ebin);
108
109 B2ERROR("CDCDedx2DCell: wrong layer number, returning 1");
110 return 1.0;
111 }

◆ getSize()

unsigned int getSize ( ) const
inline

Get the number of histograms for the 2D correction.

Definition at line 68 of file CDCDedx2DCell.h.

68{ return m_twodgains.size(); };

◆ getVersion()

short getVersion ( ) const
inline

Get the version for the 2D correction.

Definition at line 64 of file CDCDedx2DCell.h.

64{return m_version; };

◆ operator*=()

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

Combine payloads.

Definition at line 48 of file CDCDedx2DCell.h.

49 {
50 if (m_version != rhs.getVersion()) {
51 B2WARNING("2D cell gain parameters do not match, cannot merge!");
52 return *this;
53 }
54 for (unsigned int layer = 0; layer < getSize(); ++layer) {
55 const TH2F* newhist = rhs.getHist(layer);
56 if (newhist->GetEntries() > 0)m_twodgains[layer].Multiply(newhist);
57 else B2ERROR("ERROR! constant histograms is empty");
58 }
59 return *this;
60 }
unsigned int getSize() const
Get the number of histograms for the 2D correction.
Definition: CDCDedx2DCell.h:68

Member Data Documentation

◆ m_twodgains

std::vector<TH2F> m_twodgains
private

2D histograms of doca/enta gains, layer dependent

Definition at line 163 of file CDCDedx2DCell.h.

◆ m_version

short m_version
private

dE/dx gains versus DOCA and entrance angle may be different for different layers, so store as a vector keep a version number to identify which layers are valid

version number for 2D correction

Definition at line 162 of file CDCDedx2DCell.h.


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