laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
Lau2DAbsHistDPPdf.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2004 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
15 #include <iostream>
16 
17 #include "TAxis.h"
18 #include "TH2.h"
19 #include "TRandom.h"
20 
21 #include "Lau2DAbsHistDPPdf.hh"
22 #include "LauKinematics.hh"
23 #include "LauRandom.hh"
24 #include "LauVetoes.hh"
25 
27 
28 
30  Bool_t useUpperHalfOnly, Bool_t squareDP) :
31  kinematics_(kinematics),
32  vetoes_(vetoes),
33  upperHalf_(useUpperHalfOnly),
34  squareDP_(squareDP)
35 {
36  if ( squareDP && ! kinematics->squareDP() ) {
37  // The histogram provided is defined in the square DP but the
38  // kinematics object has calculation of the square DP
39  // co-ordinates disabled, so need to enable it,
40  std::cerr << "WARNING in Lau2DAbsHistDPPdf constructor : forcing kinematics to calculate the required square DP co-ordinates" << std::endl;
41  kinematics->squareDP(kTRUE);
42  }
43 }
44 
46 {
47 }
48 
50 {
51  // Get the maximum height of the 2D histogram
52  maxHeight_ = 1.0;
53  if ( hist ) {
54  Int_t maxBin = hist->GetMaximumBin();
55  maxHeight_ = hist->GetBinContent(maxBin);
56  }
57 
58  std::cout << "INFO in Lau2DAbsHistDPPdf::calcMaxHeight : Max height = " << maxHeight_ << std::endl;
59 }
60 
62 {
63  if ( !hist ) {
64  return;
65  }
66 
67  TRandom* random = LauRandom::randomFun();
68 
69  Int_t nBinsX = static_cast<Int_t>(hist->GetNbinsX());
70  Int_t nBinsY = static_cast<Int_t>(hist->GetNbinsY());
71 
72  for (Int_t i(0); i<nBinsX; i++) {
73  for (Int_t j(0); j<nBinsY; j++) {
74  Double_t currentContent = hist->GetBinContent(i+1,j+1);
75  Double_t currentError = hist->GetBinError(i+1,j+1);
76  Double_t newContent = random->Gaus(currentContent,currentError);
77  if (newContent<0.0) {
78  hist->SetBinContent(i+1,j+1,0.0);
79  } else {
80  hist->SetBinContent(i+1,j+1,newContent);
81  }
82  }
83  }
84 }
85 
86 Bool_t Lau2DAbsHistDPPdf::withinDPBoundaries(Double_t x, Double_t y) const
87 {
89 }
90 
91 void Lau2DAbsHistDPPdf::getUpperHalf(Double_t& x, Double_t& y) const
92 {
93  if ( upperHalf_ == kTRUE ) {
94  if ( squareDP_ == kFALSE && x > y ) {
95  Double_t temp = y;
96  y = x;
97  x = temp;
98  } else if ( squareDP_ == kTRUE && y > 0.5 ) {
99  y = 1.0 - y;
100  }
101  }
102 }
103 
104 void Lau2DAbsHistDPPdf::updateKinematics(Double_t x, Double_t y) const {
105  if (squareDP_ == kTRUE) {
107  } else {
109  }
110 }
Bool_t withinDPLimits(const Double_t m13Sq, const Double_t m23Sq) const
Check whether a given (m13Sq,m23Sq) point is within the kinematic limits of the Dalitz plot...
TRandom * randomFun()
Access the singleton random number generator with a particular seed.
Definition: LauRandom.cc:20
virtual ~Lau2DAbsHistDPPdf()
Destructor.
Double_t maxHeight_
The maximum height of 2D histogram.
ClassImp(LauAbsCoeffSet)
Abstract base class for defining a variation across a 2D DP based on a histogram. ...
Bool_t withinDPBoundaries(Double_t x, Double_t y) const
Check whether the given co-ordinates are within the kinematic boundary.
Bool_t squareDP_
Boolean for using square DP variables.
void updateSqDPKinematics(const Double_t mPrime, const Double_t thetaPrime)
Update all kinematic quantities based on the square DP co-ordinates m&#39; and theta&#39;.
void doBinFluctuation(TH2 *hist)
Fluctuate the histogram bin contents in accordance with their errors.
File containing declaration of LauKinematics class.
File containing declaration of Lau2DAbsHistDPPdf class.
Bool_t upperHalf_
Boolean for using the upper half of DP.
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...
void updateKinematics(const Double_t m13Sq, const Double_t m23Sq)
Update all kinematic quantities based on the DP co-ordinates m13Sq and m23Sq.
File containing LauRandom namespace.
void calcMaxHeight(TH2 *hist)
Calculate maximum height.
Class for calculating 3-body kinematic quantities.
void updateKinematics(Double_t x, Double_t y) const
Update the current co-ordinates in the kinematic space.
File containing declaration of LauVetoes class.
Bool_t withinSqDPLimits(const Double_t mPrime, const Double_t thetaPrime) const
Check whether a given (m&#39;,theta&#39;) point is within the kinematic limits of the Dalitz plot...
Class for defining vetoes within the Dalitz plot.
Definition: LauVetoes.hh:36
LauKinematics * kinematics_
DP kinematics.