11#include <framework/logging/Logger.h>
51 B2WARNING(
"2D cell gain parameters do not match, cannot merge!");
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");
72 const TH2F*
getHist(
unsigned int layer)
const
75 B2ERROR(
"CDCDedx2DCell: vector too short");
83 B2ERROR(
"CDCDedx2DCell: const histograms NOT found");
89 B2ERROR(
"CDCDedx2DCell: Something is wrong # of const histograms");
92 B2ERROR(
"CDCDedx2DCell: wrong layer number");
101 double getMean(
unsigned int layer,
int dbin,
int ebin)
const
103 unsigned int mylayer = 0;
104 if (layer >= 8 &&
m_twodgains.size() == 2) mylayer = 1;
105 else if (
m_twodgains.size() == 56) mylayer = layer;
109 B2ERROR(
"CDCDedx2DCell: wrong layer number, returning 1");
118 double getMean(
unsigned int layer,
double doca,
double enta)
const
121 B2ERROR(
"Asking for a CDC layer beyond 56!");
125 unsigned int mylayer = 0;
126 if (layer >= 8 &&
m_twodgains.size() == 2) mylayer = 1;
127 else if (
m_twodgains.size() == 56) mylayer = layer;
130 B2ERROR(
"CDCDedx2DCell: wrong layer number, returning 1");
135 if (enta < -3.1416 / 2.0) enta += 3.1416 / 2.0;
136 if (enta > 3.1416 / 2.0) enta -= 3.1416 / 2.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;
142 double ebinsize =
m_twodgains[mylayer].GetYaxis()->GetBinCenter(2) -
m_twodgains[mylayer].GetYaxis()->GetBinCenter(1);
144 int ebin = std::floor((enta -
m_twodgains[mylayer].GetYaxis()->GetBinLowEdge(1)) / ebinsize) + 1;
147 if (dbin > 0 && dbin <=
m_twodgains[mylayer].GetNbinsX() && ebin > 0 && ebin <=
m_twodgains[mylayer].GetNbinsY())
148 mean =
m_twodgains[mylayer].GetBinContent(dbin, ebin);
153 B2WARNING(
"Problem with 2D CDC dE/dx calibration! " << doca <<
"\t" << dbin <<
"\t" << enta <<
"\t" << ebin);
dE/dx wire gain calibration constants
const TH2F * getHist(unsigned int layer) const
Get the 2D histogram for the correction for this layer.
short m_version
dE/dx gains versus DOCA and entrance angle may be different for different layers, so store as a vecto...
double getMean(unsigned int layer, double doca, double enta) const
Return dE/dx mean value for given DOCA and entrance angle.
ClassDef(CDCDedx2DCell, 5)
ClassDef.
CDCDedx2DCell()
Default constructor.
~CDCDedx2DCell()
Destructor.
CDCDedx2DCell & operator*=(CDCDedx2DCell const &rhs)
Combine payloads.
std::vector< TH2F > m_twodgains
2D histograms of doca/enta gains, layer dependent
CDCDedx2DCell(short version, const std::vector< TH2F > &twodgains)
Constructor.
double getMean(unsigned int layer, int dbin, int ebin) const
Return dE/dx mean value for the given bin.
short getVersion() const
Get the version for the 2D correction.
unsigned int getSize() const
Get the number of histograms for the 2D correction.
Abstract base class for different kinds of events.