laura is hosted by Hepforge, IPPP Durham
Laura++  v2r2p1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauAbsDPDynamics.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2005 - 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 <iostream>
16 using std::cout;
17 using std::cerr;
18 using std::endl;
19 
20 #include "TSystem.h"
21 
22 #include "LauAbsDPDynamics.hh"
23 #include "LauCacheData.hh"
24 #include "LauComplex.hh"
25 #include "LauDaughters.hh"
26 #include "LauAbsEffModel.hh"
27 #include "LauKinematics.hh"
28 #include "LauResonanceMaker.hh"
29 
31 
32 
33 LauAbsDPDynamics::LauAbsDPDynamics(LauDaughters* daughters, LauAbsEffModel* effModel, LauAbsEffModel* scfFractionModel) :
34  daughters_(daughters),
35  resonanceMaker_(new LauResonanceMaker(daughters)),
36  kinematics_(daughters_ ? daughters_->getKinematics() : 0),
37  effModel_(effModel),
38  nAmp_(0),
39  nResDefMax_(resonanceMaker_ ? resonanceMaker_->getNResDefMax() : 0),
40  DPNorm_(0.0),
41  DPRate_("DPRate", 0.0, 0.0, 1000.0),
42  meanDPEff_("meanDPEff", 0.0, 0.0, 1.0),
43  currentEvent_(0)
44 {
45  if (scfFractionModel != 0) {
46  scfFractionModel_[0] = scfFractionModel;
47  }
48  extraParameters_.clear();
49 }
50 
52  daughters_(daughters),
53  resonanceMaker_(new LauResonanceMaker(daughters)),
54  kinematics_(daughters_ ? daughters_->getKinematics() : 0),
55  effModel_(effModel),
56  scfFractionModel_(scfFractionModel),
57  nAmp_(0),
58  nResDefMax_(resonanceMaker_ ? resonanceMaker_->getNResDefMax() : 0),
59  DPNorm_(0.0),
60  DPRate_("DPRate", 0.0, 0.0, 1000.0),
61  meanDPEff_("meanDPEff", 0.0, 0.0, 1.0),
62  currentEvent_(0)
63 {
64  extraParameters_.clear();
65 }
66 
68 {
69  if (resonanceMaker_ != 0) {
70  delete resonanceMaker_; resonanceMaker_ = 0;
71  }
72  extraParameters_.clear();
73 
74  for ( std::vector<LauCacheData*>::iterator iter = data_.begin(); iter != data_.end(); ++iter ) {
75  delete (*iter);
76  }
77 }
78 
80 {
81  // Retrieve the data for event iEvt
82  if (data_.size() > iEvt) {
83  currentEvent_ = data_[iEvt];
84  } else {
85  cerr<<"ERROR in LauAbsDPDynamics::setDataEventNo : Event index too large: "<<iEvt<<" >= "<<data_.size()<<"."<<endl;
86  }
87 }
88 
89 void LauAbsDPDynamics::updateCoeffs(const std::vector<LauComplex>& coeffs)
90 {
91  // Check that the number of coeffs is correct
92  if (coeffs.size() != this->getnAmp()) {
93  cerr << "ERROR in LauAbsDPDynamics::updateCoeffs : Expected " << this->getnAmp() << " but got " << coeffs.size() << endl;
94  gSystem->Exit(EXIT_FAILURE);
95  }
96 
97  // Now check if the coeffs have changed
98  Bool_t changed = (Amp_ != coeffs);
99  if (changed) {
100  // Copy the coeffs
101  Amp_ = coeffs;
102 
103  // Update the total normalisation for the signal likelihood
104  this->calcSigDPNorm();
105  }
106 }
107 
108 Bool_t LauAbsDPDynamics::hasResonance(const TString& resName) const
109 {
110  const LauAbsResonance* theRes = this->findResonance(resName);
111  if (theRes != 0) {
112  return kTRUE;
113  } else {
114  return kFALSE;
115  }
116 }
117 
118 TString LauAbsDPDynamics::getConjResName(const TString& resName) const
119 {
120  // Get the name of the charge conjugate resonance
121  TString conjName(resName);
122 
123  Ssiz_t index1 = resName.Index("+");
124  Ssiz_t index2 = resName.Index("-");
125  if (index1 != -1) {
126  conjName.Replace(index1, 1, "-");
127  } else if (index2 != -1) {
128  conjName.Replace(index2, 1, "+");
129  }
130 
131  return conjName;
132 
133 }
134 
136 {
137  Double_t eff(1.0);
138  if (effModel_ != 0) {
140  }
141  return eff;
142 }
143 
145 {
146  Double_t scfFraction(0.0);
147 
148  // scf model and eff model are exactly the same, functionally
149  // so we use an instance of LauAbsEffModel, and the method
150  // calcEfficiency actually calculates the scf fraction
151  if (tagCat == -1) {
152  if (!scfFractionModel_.empty()) {
153  scfFraction = scfFractionModel_[0]->calcEfficiency(kinematics_);
154  }
155  } else {
156  scfFraction = scfFractionModel_[tagCat]->calcEfficiency(kinematics_);
157  }
158  return scfFraction;
159 }
160 
Class for defining the abstract interface for signal Dalitz plot dynamics.
virtual LauAbsResonance * findResonance(const TString &name)=0
Retrieve the named resonance.
File containing declaration of LauAbsEffModel class.
ClassImp(LauAbsCoeffSet)
Class that defines the particular 3-body decay under study.
Definition: LauDaughters.hh:33
File containing declaration of LauDaughters class.
virtual Double_t retrieveEfficiency()
Obtain the efficiency of the current event from the model.
Pure abstract base class for defining the efficiency description across the signal Dalitz plot...
virtual Bool_t hasResonance(const TString &resName) const
Check whether this model includes a named resonance.
std::vector< LauComplex > Amp_
The complex coefficients for the amplitude components.
File containing declaration of LauKinematics class.
virtual Double_t calcSigDPNorm()=0
Calculate the normalisation factor for the log-likelihood function.
std::vector< LauCacheData * > data_
The cached data for all events.
Class for creating resonances.
LauAbsEffModel * effModel_
The efficiency model across the Dalitz plot.
std::map< Int_t, LauAbsEffModel * > LauTagCatScfFractionModelMap
The type used for containing multiple self cross feed fraction models for different categories (e...
std::vector< LauParameter > extraParameters_
any extra parameters/quantities (e.g. K-matrix total fit fractions)
File containing declaration of LauResonanceMaker class.
File containing declaration of LauCacheData class.
File containing declaration of LauComplex class.
virtual TString getConjResName(const TString &resName) const
Retrieve the name of the charge conjugate of a named resonance.
virtual Double_t retrieveScfFraction(Int_t tagCat)
Obtain the self cross feed fraction of the current event from the model.
virtual Double_t calcEfficiency(const LauKinematics *kinematics) const =0
Determine the efficiency for a given point in the Dalitz plot.
UInt_t getnAmp() const
Retrieve the number of amplitude components.
File containing declaration of LauAbsDPDynamics class.
Abstract class for defining type for resonance amplitude models (Breit-Wigner, Flatte etc...
virtual void updateCoeffs(const std::vector< LauComplex > &coeffs)
Update the complex coefficients for the resonances.
virtual void setDataEventNo(UInt_t iEvt)
Load the data for a given event.
LauAbsDPDynamics(LauDaughters *daughters, LauAbsEffModel *effModel, LauAbsEffModel *scfFractionModel=0)
Constructor.
LauResonanceMaker * resonanceMaker_
Object to create resonances.
LauKinematics * kinematics_
The kinematics of the decay.
LauCacheData * currentEvent_
The cached data for the current event.
virtual ~LauAbsDPDynamics()
Destructor.
LauTagCatScfFractionModelMap scfFractionModel_
The self cross feed fraction models across the Dalitz plot.