laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
Lau2DAbsHistDPPdf.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2014 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
29 #include <iostream>
30 
31 #include "TAxis.h"
32 #include "TH2.h"
33 #include "TRandom.h"
34 
35 #include "Lau2DAbsHistDPPdf.hh"
36 #include "LauKinematics.hh"
37 #include "LauRandom.hh"
38 #include "LauVetoes.hh"
39 
41 
42 
44  Bool_t useUpperHalfOnly, Bool_t squareDP) :
45  kinematics_(kinematics),
46  vetoes_(vetoes),
47  upperHalf_(useUpperHalfOnly),
48  squareDP_(squareDP)
49 {
50  if ( squareDP && ! kinematics->squareDP() ) {
51  // The histogram provided is defined in the square DP but the
52  // kinematics object has calculation of the square DP
53  // co-ordinates disabled, so need to enable it,
54  std::cerr << "WARNING in Lau2DAbsHistDPPdf constructor : forcing kinematics to calculate the required square DP co-ordinates" << std::endl;
55  kinematics->squareDP(kTRUE);
56  }
57 }
58 
60 {
61 }
62 
64 {
65  // Get the maximum height of the 2D histogram
66  maxHeight_ = 1.0;
67  if ( hist ) {
68  Int_t maxBin = hist->GetMaximumBin();
69  maxHeight_ = hist->GetBinContent(maxBin);
70  }
71 
72  std::cout << "INFO in Lau2DAbsHistDPPdf::calcMaxHeight : Max height = " << maxHeight_ << std::endl;
73 }
74 
76 {
77  if ( !hist ) {
78  return;
79  }
80 
81  TRandom* random = LauRandom::randomFun();
82 
83  Int_t nBinsX = static_cast<Int_t>(hist->GetNbinsX());
84  Int_t nBinsY = static_cast<Int_t>(hist->GetNbinsY());
85 
86  for (Int_t i(0); i<nBinsX; i++) {
87  for (Int_t j(0); j<nBinsY; j++) {
88  Double_t currentContent = hist->GetBinContent(i+1,j+1);
89  Double_t currentError = hist->GetBinError(i+1,j+1);
90  Double_t newContent = random->Gaus(currentContent,currentError);
91  if (newContent<0.0) {
92  hist->SetBinContent(i+1,j+1,0.0);
93  } else {
94  hist->SetBinContent(i+1,j+1,newContent);
95  }
96  }
97  }
98 }
99 
100 Bool_t Lau2DAbsHistDPPdf::withinDPBoundaries(Double_t x, Double_t y) const
101 {
103 }
104 
105 void Lau2DAbsHistDPPdf::getUpperHalf(Double_t& x, Double_t& y) const
106 {
107  if ( upperHalf_ == kTRUE ) {
108  if ( squareDP_ == kFALSE && x > y ) {
109  Double_t temp = y;
110  y = x;
111  x = temp;
112  } else if ( squareDP_ == kTRUE && y > 0.5 ) {
113  y = 1.0 - y;
114  }
115  }
116 }
117 
118 void Lau2DAbsHistDPPdf::updateKinematics(Double_t x, Double_t y) const {
119  if (squareDP_ == kTRUE) {
121  } else {
123  }
124 }
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:34
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:50
LauKinematics * kinematics_
DP kinematics.