laura is hosted by Hepforge, IPPP Durham
Laura++  v1r0
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauEffModel.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 <cstdlib>
16 #include <iostream>
17 using std::cout;
18 using std::cerr;
19 using std::endl;
20 
21 #include "TSystem.h"
22 #include "Lau2DHistDP.hh"
23 #include "LauDaughters.hh"
24 #include "LauEffModel.hh"
25 #include "LauKinematics.hh"
26 #include "LauVetoes.hh"
27 
28 ClassImp(LauEffModel)
29 
30 
31 LauEffModel::LauEffModel(const LauDaughters* daughters, const LauVetoes* vetoes) :
32  daughters_( daughters ),
33  vetoes_( vetoes ),
34  effHisto_( 0 ),
35  squareDP_( kFALSE ),
36  fluctuateEffHisto_( kFALSE )
37 {
38  if ( daughters_ == 0 ) {
39  cerr << "ERROR in LauEffModel Constructor : invalid pointer to daughters object supplied." << endl;
40  gSystem->Exit(EXIT_FAILURE);
41  }
42 }
43 
45  daughters_( rhs.daughters_ ),
46  vetoes_( rhs.vetoes_ ),
47  effHisto_( rhs.effHisto_ ? new Lau2DHistDP( *rhs.effHisto_ ) : 0 ),
48  squareDP_( rhs.squareDP_ ),
49  fluctuateEffHisto_( rhs.fluctuateEffHisto_ )
50 {
51 }
52 
54 {
55  if (effHisto_ != 0) {
56  delete effHisto_; effHisto_ = 0;
57  }
58 }
59 
60 void LauEffModel::setEffHisto(const TH2* effHisto, Bool_t useInterpolation,
61  Bool_t fluctuateBins, Double_t avEff, Double_t absError,
62  Bool_t useUpperHalfOnly, Bool_t squareDP)
63 {
64  // Set the efficiency across the Dalitz plot using a predetermined 2D histogram
65  // with x = m_13^2, y = m_23^2.
66  Bool_t upperHalf( kFALSE );
67  if ( daughters_->gotSymmetricalDP() && useUpperHalfOnly == kTRUE) {upperHalf = kTRUE;}
68  cout<<"Efficiency histogram has upperHalf = "<<static_cast<Int_t>(upperHalf)<<endl;
69 
70  squareDP_ = squareDP;
71 
72  // Copy the histogram.
73  effHisto_ = new Lau2DHistDP(effHisto, daughters_,
74  useInterpolation, fluctuateBins,
75  avEff, absError, upperHalf, squareDP);
76  fluctuateEffHisto_ = fluctuateBins;
77 
78  if (avEff > 0.0 && absError > 0.0) {
79  fluctuateEffHisto_ = kTRUE;
80  }
81 }
82 
83 Double_t LauEffModel::getEffHistValue(Double_t xVal, Double_t yVal) const
84 {
85  // Get the efficiency from the 2D histo.
86  Double_t eff(1.0);
87 
88  if (effHisto_ != 0) {
89  eff = effHisto_->interpolateXY(xVal, yVal);
90  }
91 
92  return eff;
93 }
94 
95 Double_t LauEffModel::calcEfficiency( const LauKinematics* kinematics ) const
96 {
97  // Routine to calculate the efficiency for the given event/point in
98  // the Dalitz plot. This routine uses the 2D histogram set by the
99  // setEffHisto() funciton.
100  Double_t eff(1.0);
101 
102  // Check for vetoes
103  Bool_t vetoOK(kTRUE);
104  if ( vetoes_ != 0 ) {
105  vetoOK = vetoes_->passVeto(kinematics);
106  }
107 
108  if (vetoOK == kFALSE) {
109  // We failed the veto.
110  eff = 0.0;
111  } else {
112  // We are using a 2D histogram representation of the efficiency across the Dalitz plot.
113  // First find out which bin we are in given the x and y Dalitz plot mass values
114  // Here, x = m13^2, y = m23^2 or if using square DP x = m', y = theta'.
115  if (squareDP_ == kTRUE) {
116  eff = this->getEffHistValue(kinematics->getmPrime(), kinematics->getThetaPrime());
117  } else {
118  eff = this->getEffHistValue(kinematics->getm13Sq(), kinematics->getm23Sq());
119  }
120  }
121 
122  // Check that the efficiency is in the allowed range (0-1)
123  if ( eff < 0.0 ) {
124  std::cerr << "WARNING in LauEffModel::calcEfficiency : Efficiency is less than 0 - setting to 0. You may want to check your histogram!" << std::endl;
125  eff = 0.0;
126  } else if ( eff > 1.0 ) {
127  std::cerr << "WARNING in LauEffModel::calcEfficiency : Efficiency is greater than 1 - setting to 1. You may want to check your histogram!" << std::endl;
128  eff = 1.0;
129  }
130 
131  return eff;
132 }
133 
134 Bool_t LauEffModel::passVeto( const LauKinematics* kinematics ) const
135 {
136  Bool_t pass = kTRUE;
137  if ( vetoes_ != 0 ) {
138  pass = vetoes_->passVeto( kinematics );
139  }
140  return pass;
141 }
142 
LauEffModel(const LauDaughters *daughters, const LauVetoes *vetoes)
Constructor.
Definition: LauEffModel.cc:31
void setEffHisto(const TH2 *effHisto, Bool_t useInterpolation=kTRUE, Bool_t fluctuateBins=kFALSE, Double_t avEff=-1.0, Double_t absError=-1.0, Bool_t useUpperHalfOnly=kFALSE, Bool_t squareDP=kFALSE)
Set the efficiency variation across the phase space using a predetermined 2D histogram.
Definition: LauEffModel.cc:60
const LauDaughters * daughters_
The daughters object.
Definition: LauEffModel.hh:101
Double_t getmPrime() const
Get m&#39; value.
Class that defines the particular 3-body decay under study.
Definition: LauDaughters.hh:33
File containing declaration of LauDaughters class.
Double_t getm23Sq() const
Get the m23 invariant mass square.
Double_t getEffHistValue(Double_t xVal, Double_t yVal) const
Get the efficiency from a two-dimensional histogram by interpolating in x and y.
Definition: LauEffModel.cc:83
File containing declaration of LauKinematics class.
Bool_t gotSymmetricalDP() const
Is Dalitz plot symmetric.
Definition: LauDaughters.hh:66
Bool_t passVeto(const LauKinematics *kinematics) const
Determine whether the given DP position is outside the vetoes.
Definition: LauEffModel.cc:134
Double_t calcEfficiency(const LauKinematics *kinematics) const
Determine the efficiency for a given point in the Dalitz plot.
Definition: LauEffModel.cc:95
const LauVetoes * vetoes_
The vetoes object.
Definition: LauEffModel.hh:104
File containing declaration of Lau2DHistDP class.
Double_t interpolateXY(Double_t x, Double_t y) const
Perform the interpolation.
Definition: Lau2DHistDP.cc:113
File containing declaration of LauEffModel class.
Class that implements the efficiency description across the signal Dalitz plot.
Definition: LauEffModel.hh:37
Bool_t squareDP_
Use of the square Dalitz plot.
Definition: LauEffModel.hh:110
Double_t getm13Sq() const
Get the m13 invariant mass square.
Bool_t passVeto(Double_t &m12Sq, Double_t &m23Sq, Double_t &m13Sq) const
Check whether the specified Dalitz plot point passes the vetoes.
Definition: LauVetoes.cc:109
Lau2DHistDP * effHisto_
The efficiency histogram object.
Definition: LauEffModel.hh:107
Class for defining a 2D DP histogram.
Definition: Lau2DHistDP.hh:34
Double_t getThetaPrime() const
Get theta&#39; value.
Class for calculating 3-body kinematic quantities.
File containing declaration of LauVetoes class.
Bool_t fluctuateEffHisto_
Fluctuate histogram within the error.
Definition: LauEffModel.hh:112
Class for defining vetoes within the Dalitz plot.
Definition: LauVetoes.hh:33
virtual ~LauEffModel()
Destructor.
Definition: LauEffModel.cc:53