30 Bool_t useInterpolation, Bool_t fluctuateBins, Bool_t useUpperHalfOnly, Bool_t squareDP) :
31 hist_(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0),
32 kinematics_(kinematics),
34 minX_(0.0), maxX_(0.0), minY_(0.0), maxY_(0.0), rangeX_(0.0), rangeY_(0.0),
35 binXWidth_(0.0), binYWidth_(0.0),
36 invBinXWidth_(0.0), invBinYWidth_(0.0),
38 nBinsX_(0), nBinsY_(0),
40 useInterpolation_(useInterpolation),
41 upperHalf_(useUpperHalfOnly),
52 TAxis* xAxis = hist_->GetXaxis();
53 minX_ = xAxis->GetXmin();
54 maxX_ = xAxis->GetXmax();
56 TAxis* yAxis = hist_->GetYaxis();
57 minY_ = yAxis->GetXmin();
58 maxY_ = yAxis->GetXmax();
60 nBinsX_ = hist_->GetNbinsX();
61 nBinsY_ = hist_->GetNbinsY();
63 minX_ = kinematics_->getm13SqMin();
64 maxX_ = kinematics_->getm13SqMax();
66 minY_ = kinematics_->getm23SqMin();
67 maxY_ = kinematics_->getm23SqMax();
73 rangeX_ = maxX_ - minX_;
74 rangeY_ = maxY_ - minY_;
75 if (nBinsX_ > 0) { binXWidth_ = TMath::Abs(rangeX_)/(nBinsX_*1.0); }
76 if (nBinsY_ > 0) { binYWidth_ = TMath::Abs(rangeY_)/(nBinsY_*1.0); }
77 if (binXWidth_ > 1e-10) { invBinXWidth_ = 1.0/binXWidth_; }
78 if (binYWidth_ > 1e-10) { invBinYWidth_ = 1.0/binYWidth_; }
83 this->doBinFluctuation();
90 this->checkNormalisation();
93 this->calcMaxHeight();
107 Int_t maxBin =
hist_->GetMaximumBin();
111 std::cout <<
"INFO in Lau2DHistDPPdf::calcMaxHeight : Max height = " <<
maxHeight_ << std::endl;
123 const Double_t axisMin = TMath::Min(
minX_,
minY_ );
124 const Double_t axisMax = TMath::Max(
maxX_,
maxY_ );
125 const Double_t axisRange = axisMax - axisMin;
127 const Double_t dx(1e-3 * axisRange);
128 const Double_t dy(dx);
132 Double_t x(axisMin + dx/2.0);
133 while (x < axisMax) {
134 Double_t y(axisMin + dy/2.0);
135 while (y < axisMax) {
151 }
else if (xBinNo >=
nBinsX_) {
157 }
else if (yBinNo >=
nBinsY_) {
161 Double_t
value =
hist_->GetBinContent(xBinNo+1, yBinNo+1);
188 }
else if (
squareDP_ == kTRUE && y > 0.5 ) {
194 Bool_t withinDP(kFALSE);
200 if (withinDP == kFALSE) {
return 0.0;}
210 Bool_t vetoOK(kTRUE);
214 if (vetoOK == kFALSE) {
return 0.0;}
239 if (withinDP == kFALSE) {
244 Double_t deltax = x - cbinx;
245 Double_t deltay = y - cbiny;
247 Int_t i_adj(0), j_adj(0);
259 Bool_t isXBoundary(kFALSE), isYBoundary(kFALSE);
263 if (i_adj >=
nBinsX_ || i_adj < 0) {isYBoundary = kTRUE;}
264 if (j_adj >=
nBinsY_ || j_adj < 0) {isXBoundary = kTRUE;}
267 if (isXBoundary == kTRUE && isYBoundary == kTRUE) {
271 }
else if (isXBoundary == kTRUE && isYBoundary == kFALSE) {
282 if (withinDP == kFALSE) {
289 Double_t dx0 = TMath::Abs(x - cbinx);
290 Double_t dx1 = TMath::Abs(cbinx_adj - x);
291 Double_t inter_denom = dx0 + dx1;
296 value = (value1*dx1 + value2*dx0)/inter_denom;
300 }
else if (isYBoundary == kTRUE && isXBoundary == kFALSE) {
311 if (withinDP == kFALSE) {
318 Double_t dy0 = TMath::Abs(y - cbiny);
319 Double_t dy1 = TMath::Abs(cbiny_adj - y);
320 Double_t inter_denom = dy0 + dy1;
325 value = (value1*dy1 + value2*dy0)/inter_denom;
342 if (withinDP == kFALSE) {
349 Double_t dx0 = TMath::Abs(x - cbinx);
350 Double_t dx1 = TMath::Abs(cbinx_adj - x);
351 Double_t dy0 = TMath::Abs(y - cbiny);
352 Double_t dy1 = TMath::Abs(cbiny_adj - y);
354 Double_t inter_denom = (dx0 + dx1)*(dy0 + dy1);
361 value = value1*dx1*dy1 + value2*dx0*dy1 + value3*dx1*dy0 + value4*dx0*dy0;
362 value /= inter_denom;
377 const Double_t axisMin = TMath::Min(
minX_,
minY_ );
378 const Double_t axisMax = TMath::Max(
maxX_,
maxY_ );
379 const Double_t axisRange = axisMax - axisMin;
381 const Double_t dx(1e-3 * axisRange);
382 const Double_t dy(dx);
385 Double_t areaNoNorm(0.0);
390 Double_t x(axisMin + dx/2.0);
391 while (x < axisMax) {
392 Double_t y(axisMin + dy/2.0);
393 while (y < axisMax) {
402 Double_t norm = area*dx*dy;
406 std::cout <<
"INFO in Lau2DHistDPPdf::checkNormalisation : Area = " << area <<
", dx = " << dx <<
", dy = " << dy <<
", dx*dy = " << dx*dy << std::endl;
407 std::cout <<
" : Area with no norm = " << areaNoNorm <<
"*dx*dy = " << areaNoNorm*dx*dy << std::endl;
408 std::cout <<
" : The total area of the normalised histogram PDF is " << norm << std::endl;
418 for (Int_t i(0); i<
nBinsX_; i++) {
419 for (Int_t j(0); j<
nBinsY_; j++) {
420 Double_t currentContent =
hist_->GetBinContent(i+1,j+1);
421 Double_t currentError =
hist_->GetBinError(i+1,j+1);
422 Double_t newContent = random->Gaus(currentContent,currentError);
423 if (newContent<0.0) {
424 hist_->SetBinContent(i+1,j+1,0.0);
426 hist_->SetBinContent(i+1,j+1,newContent);
Double_t minY_
The histogram y-axis minimum.
Double_t maxHeight_
The maximum height of 2D histogram.
TRandom * zeroSeedRandom()
Access the singleton random number generator with seed set from machine clock time (within +-1 sec)...
const LauVetoes * vetoes_
Vetos within DP.
Double_t norm_
The histogram normalisation.
void updateSqDPKinematics(Double_t mPrime, Double_t thetaPrime)
Update all kinematic quantities based on the square DP co-ordinates m' and theta'.
Double_t invBinYWidth_
The histogram y-axis inverse bin width.
Bool_t upperHalf_
Boolean for using the upper half of DP.
Double_t maxX_
The histogram x-axis maximum.
Double_t interpolateXYNorm(Double_t x, Double_t y) const
Perform the interpolation and divide by the normalisation.
Class for defining a 2D DP histogram PDF.
Int_t nBinsX_
The number of bins on the x-axis of the histogram.
File containing declaration of Lau2DHistDPPdf class.
Double_t binXWidth_
The histogram x-axis bin width.
File containing declaration of LauKinematics class.
TH2 * hist_
The underlying histogram.
void updateKinematics(Double_t m13Sq, Double_t m23Sq)
Update all kinematic quantities based on the DP co-ordinates m13Sq and m23Sq.
void checkNormalisation()
Check the normalisation calculation.
Double_t minX_
The histogram x-axis minimum.
Bool_t withinSqDPLimits(Double_t mPrime, Double_t thetaPrime) const
Check whether a given (m',theta') point is within the kinematic limits of the Dalitz plot...
Bool_t withinDPLimits(Double_t m13Sq, Double_t m23Sq) const
Check whether a given (m13Sq,m23Sq) point is within the kinematic limits of the Dalitz plot...
virtual ~Lau2DHistDPPdf()
Destructor.
Bool_t useInterpolation_
Control boolean for using the linear interpolation.
File containing LauRandom namespace.
Double_t invBinXWidth_
The histogram x-axis inverse bin width.
Bool_t passVeto(Double_t &m12Sq, Double_t &m23Sq, Double_t &m13Sq) const
Check whether the specified Dalitz plot point passes the vetoes.
void doBinFluctuation()
Fluctuate the histogram bin contents in accordance with their errors.
Double_t getBinHistValue(Int_t xBinNo, Int_t yBinNo) const
Get the bin content from the histogram.
Class for calculating 3-body kinematic quantities.
Double_t value() const
The value of the parameter.
File containing declaration of LauVetoes class.
Bool_t squareDP_
Boolean for using square DP variables.
Double_t maxY_
The histogram y-axis maximum.
void calcHistNorm()
Calculate the PDF normalisation.
Double_t binYWidth_
The histogram y-axis bin width.
Int_t nBinsY_
The number of bins on the y-axis of the histogram.
Double_t interpolateXY(Double_t x, Double_t y) const
Perform the interpolation (unnormalised)
Class for defining vetoes within the Dalitz plot.
LauKinematics * kinematics_
DP kinematics.
void calcMaxHeight()
Calculate maximum height.