laura is hosted by Hepforge, IPPP Durham
Laura++  v3r3
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  fluctuateEffHisto_( kFALSE ),
33  lowBinWarningIssued_( kFALSE ),
34  highBinWarningIssued_( kFALSE )
35 {
36  if ( daughters_ == 0 ) {
37  std::cerr << "ERROR in LauWeightedSumEffModel Constructor : invalid pointer to daughters object supplied." << std::endl;
38  gSystem->Exit(EXIT_FAILURE);
39  }
40 }
41 
42 void LauWeightedSumEffModel::addEffModel(const LauAbsEffModel* effModel, Double_t coeff)
43 {
44  const LauDaughters* otherDaughters = effModel->getDaughters();
45  if( otherDaughters->getTypeDaug1()!=daughters_->getTypeDaug1() ||
46  otherDaughters->getTypeDaug2()!=daughters_->getTypeDaug2() ||
47  otherDaughters->getTypeDaug3()!=daughters_->getTypeDaug3() ||
48  otherDaughters->getTypeParent()!=daughters_->getTypeParent() ) {
49  std::cerr << "ERROR in LauWeightedSumEffModel::addEffModel : daughters of provided efficiency model do not match those expected." << std::endl;
50  gSystem->Exit(EXIT_FAILURE);
51  }
52 
53  effModel_.push_back(effModel);
54  coeff_.push_back(coeff);
55 
56  if ( effModel->fluctuateEffHisto() ) {
57  fluctuateEffHisto_ = kTRUE;
58  }
59 }
60 
61 Double_t LauWeightedSumEffModel::calcEfficiency( const LauKinematics* kinematics ) const
62 {
63  // Routine to calculate the efficiency for the given event/point in
64  // the Dalitz plot. This routine uses the models set by the
65  // addEffModel() function.
66  Double_t eff(0.0);
67 
68  std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
69  std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
70 
71  std::vector<Double_t>::const_iterator coeffIt = coeff_.begin();
72 
73  for( ; it!=end; ++it) {
74  eff += (*coeffIt)*(*it)->calcEfficiency( kinematics );
75  ++coeffIt;
76  }
77 
78  // Check that the efficiency is in the allowed range (0-1)
79  // Out of range efficiencies could be caused by incorrect coefficients.
80  if ( eff < 0.0 ) {
82  std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff << " is less than 0 - setting to 0. You may want to check your coefficients!" << std::endl
83  << " : Further warnings will be suppressed." << std::endl;
85  }
86  eff = 0.0;
87  } else if ( eff > 1.0 ) {
89  std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff << " is greater than 1 - setting to 1. You may want to check your coefficients!" << std::endl
90  << " : Further warnings will be suppressed." << std::endl;
92  }
93  eff = 1.0;
94  }
95 
96  return eff;
97 }
98 
99 Bool_t LauWeightedSumEffModel::passVeto( const LauKinematics* kinematics ) const
100 {
101  std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
102  std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
103 
104  for( ; it!=end; ++it) {
105  if(!(*it)->passVeto( kinematics )) return kFALSE;
106  }
107  return kTRUE;
108 }
109 
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.
Int_t getTypeDaug2() const
Get PDG code of the second daughter particle.
File containing declaration of LauWeightedSumEffModel class.
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.