laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauEFKLLMRes.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2004 - 2015.
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 
17 #include "Lau1DCubicSpline.hh"
18 #include "LauKinematics.hh"
19 #include "LauEFKLLMRes.hh"
20 #include "LauResonanceInfo.hh"
21 #include "LauTextFileParser.hh"
22 
23 
25 
26 
29 
30 
31 LauEFKLLMRes::LauEFKLLMRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
32  LauAbsResonance(resInfo, resPairAmpInt, daughters),
33  massFactor_(0)
34 {
35  const Double_t massFactorVal = 0.;
36 
37  const TString& parNameBase = this->getSanitisedName();
38 
39  TString massFactorName(parNameBase);
40  massFactorName += "_massFactor";
41  massFactor_ = resInfo->getExtraParameter( massFactorName );
42  if ( massFactor_ == 0 ) {
43  massFactor_ = new LauParameter( massFactorName, massFactorVal, -10.0, 10.0, kTRUE );
44  massFactor_->secondStage(kTRUE);
45  resInfo->addExtraParameter( massFactor_ );
46  }
47 }
48 
50 {
51 }
52 
54 {
55 }
56 
57 void LauEFKLLMRes::setResonanceParameter(const TString& name, const Double_t value)
58 {
59  if(name=="massFactor") {
60  this->setMassFactor(value);
61  std::cout << "INFO in LauEFKLLMRes::setResonanceParameter: Mass factor set to " << value << std::endl;
62  } else {
63  std::cerr << "WARNING in LauEFKLLMRes::setResonanceParameter: Parameter name not reconised." << std::endl;
64  }
65 }
66 
68 {
69  if(name=="massFactor") {
70  if ( massFactor_->fixed() ) {
71  massFactor_->fixed( kFALSE );
73  } else {
74  std::cerr << "WARNING in LauEFKLLMRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
75  }
76  } else {
77  std::cerr << "WARNING in LauEFKLLMRes::floatResonanceParameter: Parameter name not reconised." << std::endl;
78  }
79 }
80 
82 {
83  if(name=="massFactor") {
84  return massFactor_;
85  } else {
86  std::cerr << "WARNING in LauEFKLLMRes::getResonanceParameter: Parameter name not reconised." << std::endl;
87  return 0;
88  }
89 }
90 
91 const std::vector<LauParameter*>& LauEFKLLMRes::getFloatingParameters()
92 {
94 
95  if ( ! this->fixMassFactor() ) {
97  }
98 
99  return this->getParameters();
100 }
101 
102 LauComplex LauEFKLLMRes::resAmp(Double_t mass, Double_t /*spinTerm*/)
103 {
104  LauComplex amp(0.0, 0.0);
105 
106  if (magSpline_ == 0 || phaseSpline_ == 0) {
107  std::cerr << "ERROR in LauEFKLLMRes::resAmp : One of the splines is null." << std::endl;
108  return amp;
109  }
110 
111  const Double_t massSq = mass*mass;
112  const Double_t mag = magSpline_->evaluate(massSq);
113  const Double_t phase = TMath::DegToRad()*phaseSpline_->evaluate(massSq);
114  LauComplex ff(mag*TMath::Cos(phase), mag*TMath::Sin(phase));
115 
116  amp = ff.scale(TMath::Power(mass,this->getMassFactor()));
117 
118  return amp;
119 }
120 
121 void LauEFKLLMRes::setupFormFactor(const TString& inputFile)
122 {
123  LauTextFileParser readFile(inputFile);
124  readFile.processFile();
125 
126  std::vector<Double_t> mSqVals;
127  std::vector<Double_t> magVals;
128  std::vector<Double_t> phaseVals;
129 
130  std::vector<std::string> line;
131 
132  line=readFile.getNextLine();
133  while(!line.empty()) {
134  UInt_t length = line.size();
135  if(length!=3) {
136  std::cerr << "ERROR in LauEFKLLMRes::setupFormFactor : Unexpected number of fields in text file, aborting reading of form-factor information." << std::endl;
137  return;
138  }
139  mSqVals.push_back( atof(line[0].c_str()));
140  magVals.push_back( atof(line[1].c_str()));
141  phaseVals.push_back(atof(line[2].c_str()));
142  line=readFile.getNextLine();
143  }
144 
145  // Destroy any splines we already had defined but issue a warning just in case
146  if ( magSpline_ != 0 || phaseSpline_ != 0 ) {
147  std::cerr << "WARNING in LauEFKLLMRes::setupFormFactor : Overwriting previous form-factor splines with newly read values." << std::endl;
148  delete magSpline_;
149  delete phaseSpline_;
150  }
153 }
154 
155 void LauEFKLLMRes::setMassFactor(const Double_t massFactor)
156 {
157  massFactor_->value( massFactor );
158  massFactor_->genValue( massFactor );
159  massFactor_->initValue( massFactor );
160 }
161 
File containing declaration of LauTextFileParser class.
Class for parsing text files.
Bool_t fixed() const
Check whether the parameter is fixed or floated.
LauEFKLLMRes(LauResonanceInfo *resInfo, const Int_t resPairAmpInt, const LauDaughters *daughters)
Constructor.
Definition: LauEFKLLMRes.cc:31
virtual LauParameter * getResonanceParameter(const TString &name)
Access the given resonance parameter.
Definition: LauEFKLLMRes.cc:81
virtual void initialise()
Initialise the model.
Definition: LauEFKLLMRes.cc:53
File containing declaration of LauResonanceInfo class.
ClassImp(LauAbsCoeffSet)
LauParameter()
Default constructor.
Definition: LauParameter.cc:30
Class for defining the properties of a resonant particle.
const TString & name() const
The parameter name.
Class that defines the particular 3-body decay under study.
Definition: LauDaughters.hh:33
Double_t evaluate(Double_t x) const
Evaluate the function at given point.
std::vector< std::string > getNextLine()
Retrieve the next line.
const TString & getSanitisedName() const
Get the name of the resonance.
LauParameter * massFactor_
The power of the mass dependence.
static void setupFormFactor(const TString &inputFile)
Read the form factor information from text file.
void setMassFactor(const Double_t massFactor)
Set the power of the mass dependence.
File containing declaration of LauKinematics class.
Class for defining the EFKLLM K-pi S-wave model.
Definition: LauEFKLLMRes.hh:36
File containing declaration of LauEFKLLMRes class.
void addFloatingParameter(LauParameter *param)
Add parameter to the list of floating parameters.
static Lau1DCubicSpline * phaseSpline_
Spline describing the phase variation of the form-factor.
Double_t getMassFactor() const
Get the power of the mass dependence.
virtual const std::vector< LauParameter * > & getFloatingParameters()
Retrieve the resonance parameters, e.g. so that they can be loaded into a fit.
Definition: LauEFKLLMRes.cc:91
virtual void setResonanceParameter(const TString &name, const Double_t value)
Set value of a resonance parameter.
Definition: LauEFKLLMRes.cc:57
File containing declaration of Lau1DCubicSpline class.
Class for defining a 1D cubic spline based on a set of knots.
Bool_t secondStage() const
Check whether the parameter should be floated only in the second stage of a two stage fit...
std::vector< LauParameter * > & getParameters()
Access the list of floating parameters.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:35
virtual LauComplex resAmp(Double_t mass, Double_t spinTerm)
Complex resonant amplitude.
LauParameter * getExtraParameter(const TString &parName)
Retrieve an extra parameter of the resonance.
virtual ~LauEFKLLMRes()
Destructor.
Definition: LauEFKLLMRes.cc:49
Bool_t fixMassFactor() const
See if the mass factor parameter is fixed or floating.
Abstract class for defining type for resonance amplitude models (Breit-Wigner, Flatte etc...
Double_t initValue() const
The initial value of the parameter.
Class for defining a complex number.
Definition: LauComplex.hh:47
Double_t value() const
The value of the parameter.
void processFile()
Parse the file.
Double_t genValue() const
The value generated for the parameter.
static Lau1DCubicSpline * magSpline_
Spline describing the magnitude variation of the form-factor.
void addExtraParameter(LauParameter *param, const Bool_t independentPar=kFALSE)
Add an extra parameter of the resonance.
LauComplex scale(Double_t scaleVal) const
Obtain the complex number scaled by some factor.
Definition: LauComplex.hh:276
virtual void floatResonanceParameter(const TString &name)
Allow the various parameters to float in the fit.
Definition: LauEFKLLMRes.cc:67
void clearFloatingParameters()
Clear list of floating parameters.