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