laura is hosted by Hepforge, IPPP Durham
Laura++  v2r2p1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauWeightedSumEffModel.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 
18 #include "TSystem.h"
19 #include "Lau2DHistDP.hh"
20 #include "Lau2DSplineDP.hh"
21 #include "LauDaughters.hh"
23 #include "LauKinematics.hh"
24 #include "LauVetoes.hh"
25 
27 
28 
30  daughters_( daughters ),
31  effModel_( 0 ),
32  squareDP_( kFALSE ),
33  fluctuateEffHisto_( kFALSE ),
34  lowBinWarningIssued_( kFALSE ),
35  highBinWarningIssued_( kFALSE )
36 {
37  if ( daughters_ == 0 ) {
38  std::cerr << "ERROR in LauWeightedSumEffModel Constructor : invalid pointer to daughters object supplied." << std::endl;
39  gSystem->Exit(EXIT_FAILURE);
40  }
41 }
42 
43 void LauWeightedSumEffModel::addEffModel(const LauAbsEffModel* effModel, Double_t coeff)
44 {
45  const LauDaughters* otherDaughters = effModel->getDaughters();
46  if( otherDaughters->getTypeDaug1()!=daughters_->getTypeDaug1() ||
47  otherDaughters->getTypeDaug2()!=daughters_->getTypeDaug2() ||
48  otherDaughters->getTypeDaug3()!=daughters_->getTypeDaug3() ||
49  otherDaughters->getTypeParent()!=daughters_->getTypeParent() ) {
50  std::cerr << "ERROR in LauWeightedSumEffModel::addEffModel : daughters of provided efficiency model do not match those expected." << std::endl;
51  gSystem->Exit(EXIT_FAILURE);
52  }
53 
54  if( effModel_.empty() ) {
55  squareDP_=effModel->usingSquareDP();
56  } else if( effModel->usingSquareDP() != usingSquareDP() ) {
57  std::cerr << "ERROR in LauWeightedSumEffModel::addEffModel : either all efficiency models must use the normal DP or all efficiency models must use the square DP." << std::endl;
58  gSystem->Exit(EXIT_FAILURE);
59  }
60 
61  effModel_.push_back(effModel);
62  coeff_.push_back(coeff);
63  if(effModel->fluctuateEffHisto()) fluctuateEffHisto_=kTRUE;
64 }
65 
66 Double_t LauWeightedSumEffModel::calcEfficiency( const LauKinematics* kinematics ) const
67 {
68  // Routine to calculate the efficiency for the given event/point in
69  // the Dalitz plot. This routine uses the models set by the
70  // addEffModel() function.
71  Double_t eff(0.0);
72 
73  std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
74  std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
75 
76  std::vector<Double_t>::const_iterator coeffIt = coeff_.begin();
77 
78  for( ; it!=end; ++it) {
79  eff += (*coeffIt)*(*it)->calcEfficiency( kinematics );
80  ++coeffIt;
81  }
82 
83  // Check that the efficiency is in the allowed range (0-1)
84  // Out of range efficiencies could be caused by incorrect coefficients.
85  if ( eff < 0.0 ) {
87  std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff << " is less than 0 - setting to 0. You may want to check your coefficients!" << std::endl
88  << " : Further warnings will be suppressed." << std::endl;
90  }
91  eff = 0.0;
92  } else if ( eff > 1.0 ) {
94  std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff << " is greater than 1 - setting to 1. You may want to check your coefficients!" << std::endl
95  << " : Further warnings will be suppressed." << std::endl;
97  }
98  eff = 1.0;
99  }
100 
101  return eff;
102 }
103 
104 Bool_t LauWeightedSumEffModel::passVeto( const LauKinematics* kinematics ) const
105 {
106  std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
107  std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
108 
109  for( ; it!=end; ++it) {
110  if(!(*it)->passVeto( kinematics )) return kFALSE;
111  }
112  return kTRUE;
113 }
114 
Bool_t highBinWarningIssued_
Flag to track whether a warning has been issued for bin values greater than one.
File containing declaration of Lau2DSplineDP class.
Int_t getTypeDaug1() const
Get PDG code of the first daughter particle.
virtual Bool_t fluctuateEffHisto() const =0
Determine whether the efficiency histogram has had its bins fluctuated within their errors...
Bool_t lowBinWarningIssued_
Flag to track whether a warning has been issued for bin values less than zero.
ClassImp(LauAbsCoeffSet)
virtual const LauDaughters * getDaughters() const =0
Return the daughters object.
Class that defines the particular 3-body decay under study.
Definition: LauDaughters.hh:33
Int_t getTypeParent() const
Get PDG code of the parent particle.
const LauDaughters * daughters_
The daughters object.
File containing declaration of LauDaughters class.
void addEffModel(const LauAbsEffModel *effModel, Double_t coeff)
Add an efficiency variation across the phase space using a predetermined LauAbsEffModel object...
Pure abstract base class for defining the efficiency description across the signal Dalitz plot...
File containing declaration of LauKinematics class.
Class that implements the efficiency description across the signal Dalitz plot.
Double_t calcEfficiency(const LauKinematics *kinematics) const
Determine the efficiency for a given point in the Dalitz plot.
File containing declaration of Lau2DHistDP class.
std::vector< Double_t > coeff_
The efficiency model objects.
Int_t getTypeDaug3() const
Get PDG code of the third daughter particle.
Bool_t squareDP_
Use of the square Dalitz plot.
Bool_t usingSquareDP() const
Determine whether the efficiency histogram is in the square DP.
Int_t getTypeDaug2() const
Get PDG code of the second daughter particle.
File containing declaration of LauWeightedSumEffModel class.
virtual Bool_t usingSquareDP() const =0
Determine whether the efficiency histogram is in the square DP.
Class for calculating 3-body kinematic quantities.
File containing declaration of LauVetoes class.
Bool_t passVeto(const LauKinematics *kinematics) const
Determine whether the given DP position is outside the vetoes.
Bool_t fluctuateEffHisto_
Fluctuate histogram within the error.
std::vector< const LauAbsEffModel * > effModel_
The efficiency model objects.