laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauEFKLLMRes.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2015 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 
31 #include "Lau1DCubicSpline.hh"
32 #include "LauKinematics.hh"
33 #include "LauEFKLLMRes.hh"
34 #include "LauResonanceInfo.hh"
35 #include "LauTextFileParser.hh"
36 
37 
39 
40 
43 
44 
45 LauEFKLLMRes::LauEFKLLMRes(LauResonanceInfo* resInfo, const Int_t resPairAmpInt, const LauDaughters* daughters) :
46  LauAbsResonance(resInfo, resPairAmpInt, daughters),
47  massFactor_(0)
48 {
49  const Double_t massFactorVal = 0.;
50 
51  const TString& parNameBase = this->getSanitisedName();
52 
53  TString massFactorName(parNameBase);
54  massFactorName += "_massFactor";
55  massFactor_ = resInfo->getExtraParameter( massFactorName );
56  if ( massFactor_ == 0 ) {
57  massFactor_ = new LauParameter( massFactorName, massFactorVal, -10.0, 10.0, kTRUE );
58  massFactor_->secondStage(kTRUE);
59  resInfo->addExtraParameter( massFactor_ );
60  }
61 }
62 
64 {
65 }
66 
68 {
69 }
70 
71 void LauEFKLLMRes::setResonanceParameter(const TString& name, const Double_t value)
72 {
73  if(name=="massFactor") {
74  this->setMassFactor(value);
75  std::cout << "INFO in LauEFKLLMRes::setResonanceParameter: Mass factor set to " << value << std::endl;
76  } else {
77  std::cerr << "WARNING in LauEFKLLMRes::setResonanceParameter: Parameter name not reconised." << std::endl;
78  }
79 }
80 
82 {
83  if(name=="massFactor") {
84  if ( massFactor_->fixed() ) {
85  massFactor_->fixed( kFALSE );
87  } else {
88  std::cerr << "WARNING in LauEFKLLMRes::floatResonanceParameter: Parameter already floating. No parameter changes made." << std::endl;
89  }
90  } else {
91  std::cerr << "WARNING in LauEFKLLMRes::floatResonanceParameter: Parameter name not reconised." << std::endl;
92  }
93 }
94 
96 {
97  if(name=="massFactor") {
98  return massFactor_;
99  } else {
100  std::cerr << "WARNING in LauEFKLLMRes::getResonanceParameter: Parameter name not reconised." << std::endl;
101  return 0;
102  }
103 }
104 
105 const std::vector<LauParameter*>& LauEFKLLMRes::getFloatingParameters()
106 {
107  this->clearFloatingParameters();
108 
109  if ( ! this->fixMassFactor() ) {
111  }
112 
113  return this->getParameters();
114 }
115 
116 LauComplex LauEFKLLMRes::resAmp(Double_t mass, Double_t /*spinTerm*/)
117 {
118  LauComplex amp(0.0, 0.0);
119 
120  if (magSpline_ == 0 || phaseSpline_ == 0) {
121  std::cerr << "ERROR in LauEFKLLMRes::resAmp : One of the splines is null." << std::endl;
122  return amp;
123  }
124 
125  const Double_t massSq = mass*mass;
126  const Double_t mag = magSpline_->evaluate(massSq);
127  const Double_t phase = TMath::DegToRad()*phaseSpline_->evaluate(massSq);
128  LauComplex ff(mag*TMath::Cos(phase), mag*TMath::Sin(phase));
129 
130  amp = ff.scale(TMath::Power(mass,this->getMassFactor()));
131 
132  return amp;
133 }
134 
135 void LauEFKLLMRes::setupFormFactor(const TString& inputFile)
136 {
137  LauTextFileParser readFile(inputFile);
138  readFile.processFile();
139 
140  std::vector<Double_t> mSqVals;
141  std::vector<Double_t> magVals;
142  std::vector<Double_t> phaseVals;
143 
144  std::vector<std::string> line;
145 
146  line=readFile.getNextLine();
147  while(!line.empty()) {
148  UInt_t length = line.size();
149  if(length!=3) {
150  std::cerr << "ERROR in LauEFKLLMRes::setupFormFactor : Unexpected number of fields in text file, aborting reading of form-factor information." << std::endl;
151  return;
152  }
153  mSqVals.push_back( atof(line[0].c_str()));
154  magVals.push_back( atof(line[1].c_str()));
155  phaseVals.push_back(atof(line[2].c_str()));
156  line=readFile.getNextLine();
157  }
158 
159  // Destroy any splines we already had defined but issue a warning just in case
160  if ( magSpline_ != 0 || phaseSpline_ != 0 ) {
161  std::cerr << "WARNING in LauEFKLLMRes::setupFormFactor : Overwriting previous form-factor splines with newly read values." << std::endl;
162  delete magSpline_;
163  delete phaseSpline_;
164  }
167 }
168 
169 void LauEFKLLMRes::setMassFactor(const Double_t massFactor)
170 {
171  massFactor_->value( massFactor );
172  massFactor_->genValue( massFactor );
173  massFactor_->initValue( massFactor );
174 }
175 
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:45
virtual LauParameter * getResonanceParameter(const TString &name)
Access the given resonance parameter.
Definition: LauEFKLLMRes.cc:95
virtual void initialise()
Initialise the model.
Definition: LauEFKLLMRes.cc:67
File containing declaration of LauResonanceInfo class.
ClassImp(LauAbsCoeffSet)
LauParameter()
Default constructor.
Definition: LauParameter.cc:44
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:47
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:50
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.
virtual void setResonanceParameter(const TString &name, const Double_t value)
Set value of a resonance parameter.
Definition: LauEFKLLMRes.cc:71
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:49
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:63
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:61
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:290
virtual void floatResonanceParameter(const TString &name)
Allow the various parameters to float in the fit.
Definition: LauEFKLLMRes.cc:81
void clearFloatingParameters()
Clear list of floating parameters.