31 Bool_t useInterpolation, Bool_t fluctuateBins,
32 Double_t avEff, Double_t avEffError, Bool_t useUpperHalfOnly, Bool_t squareDP) :
33 hist_(hist ? dynamic_cast<TH2*>(hist->Clone()) : 0),
34 kinematics_( (daughters!=0) ? daughters->getKinematics() : 0 ),
35 minX_(0.0), maxX_(0.0),
36 minY_(0.0), maxY_(0.0),
37 rangeX_(0.0), rangeY_(0.0),
38 binXWidth_(0.0), binYWidth_(0.0),
39 nBinsX_(0), nBinsY_(0),
40 useInterpolation_(useInterpolation),
41 upperHalf_(useUpperHalfOnly),
45 std::cerr <<
"ERROR in Lau2DHistDP constructor : the histogram pointer is null." << std::endl;
46 gSystem->Exit(EXIT_FAILURE);
51 TAxis* xAxis = hist_->GetXaxis();
52 minX_ =
static_cast<Double_t
>(xAxis->GetXmin());
53 maxX_ =
static_cast<Double_t
>(xAxis->GetXmax());
54 rangeX_ = maxX_ - minX_;
56 TAxis* yAxis = hist_->GetYaxis();
57 minY_ =
static_cast<Double_t
>(yAxis->GetXmin());
58 maxY_ =
static_cast<Double_t
>(yAxis->GetXmax());
59 rangeY_ = maxY_ - minY_;
61 nBinsX_ =
static_cast<Int_t
>(hist_->GetNbinsX());
62 nBinsY_ =
static_cast<Int_t
>(hist_->GetNbinsY());
64 binXWidth_ =
static_cast<Double_t
>(TMath::Abs(rangeX_)/(nBinsX_*1.0));
65 binYWidth_ =
static_cast<Double_t
>(TMath::Abs(rangeY_)/(nBinsY_*1.0));
68 this->doBinFluctuation();
70 if (avEff > 0.0 && avEffError > 0.0) {
71 this->raiseOrLowerBins(avEff,avEffError);
76 hist_(rhs.hist_ ? dynamic_cast<TH2*>(rhs.hist_->Clone()) : 0),
77 kinematics_( rhs.kinematics_ ),
78 minX_(rhs.minX_), maxX_(rhs.maxX_),
79 minY_(rhs.minY_), maxY_(rhs.maxY_),
80 rangeX_(rhs.rangeX_), rangeY_(rhs.rangeY_),
81 binXWidth_(rhs.binXWidth_), binYWidth_(rhs.binYWidth_),
82 nBinsX_(rhs.nBinsX_), nBinsY_(rhs.nBinsY_),
83 useInterpolation_(rhs.useInterpolation_),
84 upperHalf_(rhs.upperHalf_),
85 squareDP_(rhs.squareDP_)
105 }
else if (yBinNo >=
nBinsY_) {
109 Double_t
value =
hist_->GetBinContent(xBinNo+1, yBinNo+1);
128 }
else if (
squareDP_ == kTRUE && y > 0.5 ) {
134 Bool_t withinDP(kFALSE);
140 if (withinDP == kFALSE) {
141 std::cerr <<
"WARNING in Lau2DHistDP::interpolateXY : Given position is outside the DP boundary, returning 0.0." << std::endl;
169 Double_t deltax = x - cbinx;
170 Double_t deltay = y - cbiny;
172 Int_t i_adj(0), j_adj(0);
184 Bool_t isXBoundary(kFALSE), isYBoundary(kFALSE);
188 if (i_adj >=
nBinsX_ || i_adj < 0) {isYBoundary = kTRUE;}
189 if (j_adj >=
nBinsY_ || j_adj < 0) {isXBoundary = kTRUE;}
192 if (isXBoundary == kTRUE && isYBoundary == kTRUE) {
196 }
else if (isXBoundary == kTRUE && isYBoundary == kFALSE) {
207 if (withinDP == kFALSE) {
214 Double_t dx0 = TMath::Abs(x - cbinx);
215 Double_t dx1 = TMath::Abs(cbinx_adj - x);
216 Double_t inter_denom = dx0 + dx1;
221 value = (value1*dx1 + value2*dx0)/inter_denom;
225 }
else if (isYBoundary == kTRUE && isXBoundary == kFALSE) {
236 if (withinDP == kFALSE) {
243 Double_t dy0 = TMath::Abs(y - cbiny);
244 Double_t dy1 = TMath::Abs(cbiny_adj - y);
245 Double_t inter_denom = dy0 + dy1;
250 value = (value1*dy1 + value2*dy0)/inter_denom;
267 if (withinDP == kFALSE) {
274 Double_t dx0 = TMath::Abs(x - cbinx);
275 Double_t dx1 = TMath::Abs(cbinx_adj - x);
276 Double_t dy0 = TMath::Abs(y - cbiny);
277 Double_t dy1 = TMath::Abs(cbiny_adj - y);
279 Double_t inter_denom = (dx0 + dx1)*(dy0 + dy1);
286 value = value1*dx1*dy1 + value2*dx0*dy1 + value3*dx1*dy0 + value4*dx0*dy0;
287 value /= inter_denom;
299 for (Int_t i(0); i<
nBinsX_; ++i) {
300 for (Int_t j(0); j<
nBinsY_; ++j) {
301 Double_t currentContent =
hist_->GetBinContent(i+1,j+1);
302 Double_t currentError =
hist_->GetBinError(i+1,j+1);
303 Double_t newContent = random->Gaus(currentContent,currentError);
304 if (newContent<0.0) {
305 hist_->SetBinContent(i+1,j+1,0.0);
307 hist_->SetBinContent(i+1,j+1,newContent);
318 Double_t newAvg = random->Gaus(avEff,avEffError);
320 hist_->Scale( newAvg / curAvg );
325 Double_t totalContent(0.0);
326 Int_t binsWithinDPBoundary(0);
330 for ( Int_t i(0); i<
nBinsX_; ++i ) {
331 Double_t binXCentre =
hist_->GetXaxis()->GetBinCenter(i+1);
332 Double_t binXLowerEdge =
hist_->GetXaxis()->GetBinLowEdge(i+1);
333 Double_t binXUpperEdge =
hist_->GetXaxis()->GetBinUpEdge(i+1);
335 for ( Int_t j(0); j<
nBinsX_; ++j ) {
336 Double_t binYCentre =
hist_->GetYaxis()->GetBinCenter(i+1);
337 Double_t binYLowerEdge =
hist_->GetYaxis()->GetBinLowEdge(i+1);
338 Double_t binYUpperEdge =
hist_->GetYaxis()->GetBinUpEdge(i+1);
348 ++binsWithinDPBoundary;
358 ++binsWithinDPBoundary;
364 return totalContent/binsWithinDPBoundary;
void raiseOrLowerBins(Double_t avEff, Double_t avEffError)
Rescale the histogram bin contents based on the desired average efficiency and its uncertainty...
Double_t minY_
The histogram y-axis minimum.
TRandom * zeroSeedRandom()
Access the singleton random number generator with seed set from machine clock time (within +-1 sec)...
const LauKinematics * kinematics_
Kinematics used to check events are within DP boundary.
Class that defines the particular 3-body decay under study.
Int_t nBinsY_
The number of bins on the y-axis of the histogram.
void doBinFluctuation()
Fluctuate the contents of each histogram bin independently, in accordance with their errors...
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 computeAverageContents() const
Compute the average bin content for bins within the kinematic boundary.
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 withinSqDPLimits(Double_t mPrime, Double_t thetaPrime) const
Check whether a given (m',theta') point is within the kinematic limits of the Dalitz plot...
File containing declaration of Lau2DHistDP class.
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...
Double_t interpolateXY(Double_t x, Double_t y) const
Perform the interpolation.
File containing LauRandom namespace.
Bool_t upperHalf_
Boolean for using the upper half of DP.
Bool_t useInterpolation_
Control boolean for using the linear interpolation.
Class for defining a 2D DP histogram.
virtual ~Lau2DHistDP()
Destructor.
Double_t value() const
The value of the parameter.
Bool_t squareDP_
Boolean for using square DP variables.
Int_t nBinsX_
The number of bins on the x-axis of the histogram.
TH2 * hist_
The underlying histogram.
Double_t rangeX_
The histogram x-axis range.
Double_t rangeY_
The histogram y-axis range.