laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauWeightedSumEffModel.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 <cstdlib>
30 #include <iostream>
31 
32 #include "TSystem.h"
33 #include "Lau2DHistDP.hh"
34 #include "Lau2DSplineDP.hh"
35 #include "LauDaughters.hh"
37 #include "LauKinematics.hh"
38 #include "LauVetoes.hh"
39 
41 
42 
44  daughters_( daughters ),
45  effModel_( 0 ),
46  fluctuateEffHisto_( kFALSE ),
47  lowBinWarningIssued_( kFALSE ),
48  highBinWarningIssued_( kFALSE )
49 {
50  if ( daughters_ == 0 ) {
51  std::cerr << "ERROR in LauWeightedSumEffModel Constructor : invalid pointer to daughters object supplied." << std::endl;
52  gSystem->Exit(EXIT_FAILURE);
53  }
54 }
55 
56 void LauWeightedSumEffModel::addEffModel(const LauAbsEffModel* effModel, Double_t coeff)
57 {
58  const LauDaughters* otherDaughters = effModel->getDaughters();
59  if( otherDaughters->getTypeDaug1()!=daughters_->getTypeDaug1() ||
60  otherDaughters->getTypeDaug2()!=daughters_->getTypeDaug2() ||
61  otherDaughters->getTypeDaug3()!=daughters_->getTypeDaug3() ||
62  otherDaughters->getTypeParent()!=daughters_->getTypeParent() ) {
63  std::cerr << "ERROR in LauWeightedSumEffModel::addEffModel : daughters of provided efficiency model do not match those expected." << std::endl;
64  gSystem->Exit(EXIT_FAILURE);
65  }
66 
67  effModel_.push_back(effModel);
68  coeff_.push_back(coeff);
69 
70  if ( effModel->fluctuateEffHisto() ) {
71  fluctuateEffHisto_ = kTRUE;
72  }
73 }
74 
75 Double_t LauWeightedSumEffModel::calcEfficiency( const LauKinematics* kinematics ) const
76 {
77  // Routine to calculate the efficiency for the given event/point in
78  // the Dalitz plot. This routine uses the models set by the
79  // addEffModel() function.
80  Double_t eff(0.0);
81 
82  std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
83  std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
84 
85  std::vector<Double_t>::const_iterator coeffIt = coeff_.begin();
86 
87  for( ; it!=end; ++it) {
88  eff += (*coeffIt)*(*it)->calcEfficiency( kinematics );
89  ++coeffIt;
90  }
91 
92  // Check that the efficiency is in the allowed range (0-1)
93  // Out of range efficiencies could be caused by incorrect coefficients.
94  if ( eff < 0.0 ) {
96  std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff << " is less than 0 - setting to 0. You may want to check your coefficients!" << std::endl
97  << " : Further warnings will be suppressed." << std::endl;
99  }
100  eff = 0.0;
101  } else if ( eff > 1.0 ) {
102  if(!highBinWarningIssued_) {
103  std::cerr << "WARNING in LauWeightedSumEffModel::calcEfficiency : Efficiency " << eff << " is greater than 1 - setting to 1. You may want to check your coefficients!" << std::endl
104  << " : Further warnings will be suppressed." << std::endl;
105  highBinWarningIssued_=kTRUE;
106  }
107  eff = 1.0;
108  }
109 
110  return eff;
111 }
112 
113 Bool_t LauWeightedSumEffModel::passVeto( const LauKinematics* kinematics ) const
114 {
115  std::vector<const LauAbsEffModel*>::const_iterator it = effModel_.begin();
116  std::vector<const LauAbsEffModel*>::const_iterator end = effModel_.end();
117 
118  for( ; it!=end; ++it) {
119  if(!(*it)->passVeto( kinematics )) return kFALSE;
120  }
121  return kTRUE;
122 }
123 
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:47
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.