31 Bool_t useInterpolation, Bool_t fluctuateBins,
32 Double_t avEff, Double_t avEffError, Bool_t useUpperHalfOnly, Bool_t squareDP) :
34 hist_(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0),
35 errorHi_(0), errorLo_(0),
36 minX_(0.0), maxX_(0.0),
37 minY_(0.0), maxY_(0.0),
38 rangeX_(0.0), rangeY_(0.0),
39 binXWidth_(0.0), binYWidth_(0.0),
40 nBinsX_(0), nBinsY_(0),
41 useInterpolation_(useInterpolation)
44 std::cerr <<
"ERROR in Lau2DHistDP constructor : the histogram pointer is null." << std::endl;
45 gSystem->Exit(EXIT_FAILURE);
50 TAxis* xAxis = hist_->GetXaxis();
51 minX_ =
static_cast<Double_t
>(xAxis->GetXmin());
52 maxX_ =
static_cast<Double_t
>(xAxis->GetXmax());
53 rangeX_ = maxX_ - minX_;
55 TAxis* yAxis = hist_->GetYaxis();
56 minY_ =
static_cast<Double_t
>(yAxis->GetXmin());
57 maxY_ =
static_cast<Double_t
>(yAxis->GetXmax());
58 rangeY_ = maxY_ - minY_;
60 nBinsX_ =
static_cast<Int_t
>(hist_->GetNbinsX());
61 nBinsY_ =
static_cast<Int_t
>(hist_->GetNbinsY());
63 binXWidth_ =
static_cast<Double_t
>(TMath::Abs(rangeX_)/(nBinsX_*1.0));
64 binYWidth_ =
static_cast<Double_t
>(TMath::Abs(rangeY_)/(nBinsY_*1.0));
67 this->doBinFluctuation(hist_);
69 if (avEff > 0.0 && avEffError > 0.0) {
70 this->raiseOrLowerBins(hist_,avEff,avEffError);
75 Bool_t useInterpolation, Bool_t fluctuateBins,
76 Double_t avEff, Double_t avEffError, Bool_t useUpperHalfOnly, Bool_t squareDP) :
78 hist_(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0),
79 errorHi_(errorHi ? dynamic_cast<TH2*>(errorHi->Clone()) : 0),
80 errorLo_(errorLo ? dynamic_cast<TH2*>(errorLo->Clone()) : 0),
81 minX_(0.0), maxX_(0.0),
82 minY_(0.0), maxY_(0.0),
83 rangeX_(0.0), rangeY_(0.0),
84 binXWidth_(0.0), binYWidth_(0.0),
85 nBinsX_(0), nBinsY_(0),
86 useInterpolation_(useInterpolation)
89 std::cerr <<
"ERROR in Lau2DHistDP constructor : the histogram pointer is null." << std::endl;
90 gSystem->Exit(EXIT_FAILURE);
93 std::cerr <<
"ERROR in Lau2DHistDP constructor : the upper error histogram pointer is null." << std::endl;
94 gSystem->Exit(EXIT_FAILURE);
97 std::cerr <<
"ERROR in Lau2DHistDP constructor : the lower error histogram pointer is null." << std::endl;
98 gSystem->Exit(EXIT_FAILURE);
103 TAxis* xAxis =
hist_->GetXaxis();
104 minX_ =
static_cast<Double_t
>(xAxis->GetXmin());
105 maxX_ =
static_cast<Double_t
>(xAxis->GetXmax());
108 TAxis* yAxis =
hist_->GetYaxis();
109 minY_ =
static_cast<Double_t
>(yAxis->GetXmin());
110 maxY_ =
static_cast<Double_t
>(yAxis->GetXmax());
121 std::cerr <<
"ERROR in Lau2DHistDP constructor : the lower error histogram has a different number of bins to the main histogram." << std::endl;
122 gSystem->Exit(EXIT_FAILURE);
127 std::cerr <<
"ERROR in Lau2DHistDP constructor : the upper error histogram has a different number of bins to the main histogram." << std::endl;
128 gSystem->Exit(EXIT_FAILURE);
134 if(static_cast<Double_t>(xAxis->GetXmin()) != minX_ ||
135 static_cast<Double_t>(xAxis->GetXmax()) !=
maxX_) {
136 std::cerr <<
"ERROR in Lau2DHistDP constructor : the lower error histogram has a different x range to the main histogram." << std::endl;
137 gSystem->Exit(EXIT_FAILURE);
140 if(static_cast<Double_t>(yAxis->GetXmin()) != minY_ ||
141 static_cast<Double_t>(yAxis->GetXmax()) !=
maxY_) {
142 std::cerr <<
"ERROR in Lau2DHistDP constructor : the lower error histogram has a different y range to the main histogram." << std::endl;
143 gSystem->Exit(EXIT_FAILURE);
149 if(static_cast<Double_t>(xAxis->GetXmin()) != minX_ ||
150 static_cast<Double_t>(xAxis->GetXmax()) !=
maxX_) {
151 std::cerr <<
"ERROR in Lau2DHistDP constructor : the upper error histogram has a different x range to the main histogram." << std::endl;
152 gSystem->Exit(EXIT_FAILURE);
155 if(static_cast<Double_t>(yAxis->GetXmin()) != minY_ ||
156 static_cast<Double_t>(yAxis->GetXmax()) !=
maxY_) {
157 std::cerr <<
"ERROR in Lau2DHistDP constructor : the upper error histogram has a different y range to the main histogram." << std::endl;
158 gSystem->Exit(EXIT_FAILURE);
164 if (avEff > 0.0 && avEffError > 0.0) {
187 }
else if (xBinNo >=
nBinsX_) {
193 }
else if (yBinNo >=
nBinsY_) {
197 Double_t
value =
hist_->GetBinContent(xBinNo+1, yBinNo+1);
215 std::cerr <<
"WARNING in Lau2DHistDP::interpolateXY : Given position is outside the DP boundary, returning 0.0." << std::endl;
238 Double_t deltax = x - cbinx;
239 Double_t deltay = y - cbiny;
241 Int_t i_adj(0), j_adj(0);
253 Bool_t isXBoundary(kFALSE), isYBoundary(kFALSE);
257 if (i_adj >=
nBinsX_ || i_adj < 0) {isYBoundary = kTRUE;}
258 if (j_adj >=
nBinsY_ || j_adj < 0) {isXBoundary = kTRUE;}
261 if (isXBoundary == kTRUE && isYBoundary == kTRUE) {
265 }
else if (isXBoundary == kTRUE && isYBoundary == kFALSE) {
277 Double_t dx0 = TMath::Abs(x - cbinx);
278 Double_t dx1 = TMath::Abs(cbinx_adj - x);
279 Double_t inter_denom = dx0 + dx1;
284 value = (value1*dx1 + value2*dx0)/inter_denom;
288 }
else if (isYBoundary == kTRUE && isXBoundary == kFALSE) {
300 Double_t dy0 = TMath::Abs(y - cbiny);
301 Double_t dy1 = TMath::Abs(cbiny_adj - y);
302 Double_t inter_denom = dy0 + dy1;
307 value = (value1*dy1 + value2*dy0)/inter_denom;
325 Double_t dx0 = TMath::Abs(x - cbinx);
326 Double_t dx1 = TMath::Abs(cbinx_adj - x);
327 Double_t dy0 = TMath::Abs(y - cbiny);
328 Double_t dy1 = TMath::Abs(cbiny_adj - y);
330 Double_t inter_denom = (dx0 + dx1)*(dy0 + dy1);
337 value = value1*dx1*dy1 + value2*dx0*dy1 + value3*dx1*dy0 + value4*dx0*dy0;
338 value /= inter_denom;
Double_t minY_
The histogram y-axis minimum.
void raiseOrLowerBins(TH2 *hist, const Double_t avEff, const Double_t avEffError)
Rescale the histogram bin contents based on the desired average efficiency and its uncertainty...
void doBinFluctuation(TH2 *hist)
Fluctuate the contents of each histogram bin independently, in accordance with their errors...
Class that defines the particular 3-body decay under study.
Int_t nBinsY_
The number of bins on the y-axis of the histogram.
Double_t binYWidth_
The histogram y-axis bin width.
File containing declaration of LauDaughters class.
Double_t getBinHistValue(Int_t xBinNo, Int_t yBinNo) const
Get the raw bin content from the histogram.
File containing declaration of LauKinematics class.
Double_t minX_
The histogram x-axis minimum.
Double_t binXWidth_
The histogram x-axis bin width.
Abstract base class for defining a variation across a 2D DP based on a histogram. ...
Lau2DHistDP(const TH2 *hist, const LauDaughters *daughters, Bool_t useInterpolation=kTRUE, Bool_t fluctuateBins=kFALSE, Double_t avEff=-1.0, Double_t avEffError=-1.0, Bool_t useUpperHalfOnly=kFALSE, Bool_t squareDP=kFALSE)
Constructor.
Bool_t withinDPBoundaries(Double_t x, Double_t y) const
Check whether the given co-ordinates are within the kinematic boundary.
File containing declaration of Lau2DHistDP class.
Double_t interpolateXY(Double_t x, Double_t y) const
Perform the interpolation.
File containing LauRandom namespace.
Bool_t useInterpolation_
Control boolean for using the linear interpolation.
Double_t maxX_
The histogram x-axis maximum.
Double_t maxY_
The histogram y-axis maximum.
Class for defining a 2D DP histogram.
virtual ~Lau2DHistDP()
Destructor.
TH2 * errorLo_
The histogram containing the lower errors.
void getUpperHalf(Double_t &x, Double_t &y) const
If only using the upper half of the (symmetric) DP then transform into the correct half...
Double_t value() const
The value of the parameter.
Int_t nBinsX_
The number of bins on the x-axis of the histogram.
TH2 * errorHi_
The histogram containing the upper errors.
TH2 * hist_
The underlying histogram.
Double_t rangeX_
The histogram x-axis range.
Double_t rangeY_
The histogram y-axis range.