laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauModIndPartWaveRealImag.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 #include <iostream>
31 
32 #include "Lau1DCubicSpline.hh"
33 #include "LauConstants.hh"
34 #include "LauKinematics.hh"
36 #include "LauResonanceInfo.hh"
37 
39 
40 
41 LauModIndPartWaveRealImag::LauModIndPartWaveRealImag(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters) :
42  LauAbsModIndPartWave(resInfo, resPairAmpInt, daughters)
43 {
44 }
45 
47 {
48 }
49 
51 {
52  const TString& parNameBase = this->getSanitisedName();
53  const Bool_t secondStage = this->floatKnotsSecondStage();
54 
55  std::vector<LauParameter*>& rePars = this->getAmp1Pars();
56  std::vector<LauParameter*>& imPars = this->getAmp2Pars();
57 
58  TString reName(parNameBase);
59  reName += "_Re";
60  reName += iKnot;
61 
62  rePars.push_back(this->getResInfo()->getExtraParameter( reName ));
63  if( rePars[iKnot] == 0) {
64  rePars[iKnot] = new LauParameter( reName, 1.0, -10.0, 10.0, kFALSE);
65  rePars[iKnot]->secondStage(secondStage);
66  this->getResInfo()->addExtraParameter(rePars[iKnot]);
67  }
68 
69  TString imName(parNameBase);
70  imName += "_Im";
71  imName += iKnot;
72 
73  imPars.push_back(this->getResInfo()->getExtraParameter( imName ));
74  if( imPars[iKnot] == 0) {
75  imPars[iKnot] = new LauParameter( imName, 1.0, -10.0, 10.0, kFALSE);
76  imPars[iKnot]->secondStage(secondStage);
77  this->getResInfo()->addExtraParameter(imPars[iKnot]);
78  }
79 }
80 
81 void LauModIndPartWaveRealImag::setKnotAmp(const UInt_t knot, const Double_t realVal, const Double_t imagVal, const Bool_t fixRealPart, const Bool_t fixImagPart)
82 {
83  const UInt_t nknots = this->nKnots();
84 
85  if ( knot >= nknots ) {
86  std::cerr << "WARNING in LauModIndPartWaveRealImag::setKnotAmp : Index " << knot << " does not correspond to an existing knot in resonance " << this->getResonanceName() << std::endl;
87  std::cerr << " : Index must be in range 0 to " << nknots-1 << std::endl;
88  return;
89  }
90 
91  const std::vector<Double_t>& masses = this->getMasses();
92 
93  std::vector<Double_t>& realVals = this->getAmp1Vals();
94  std::vector<Double_t>& imagVals = this->getAmp2Vals();
95 
96  std::vector<LauParameter*>& realPars = this->getAmp1Pars();
97  std::vector<LauParameter*>& imagPars = this->getAmp2Pars();
98 
99  realVals[knot] = realVal;
100  realPars[knot]->value(realVal);
101  realPars[knot]->genValue(realVal);
102  realPars[knot]->initValue(realVal);
103  realPars[knot]->fixed(fixRealPart);
104  imagVals[knot] = imagVal;
105  imagPars[knot]->value(imagVal);
106  imagPars[knot]->genValue(imagVal);
107  imagPars[knot]->initValue(imagVal);
108  imagPars[knot]->fixed(fixImagPart);
109 
110  if ( knot == 0 ) {
111  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at lower kinematic limit (" << masses[knot] << ")" << std::endl;
112  } else if ( knot == nknots-1 ) {
113  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at upper kinematic limit (" << masses[knot] << ")" << std::endl;
114  } else {
115  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
116  }
117 
118  if ( fixRealPart ) {
119  std::cout << " : Real part fixed to " << realVal << std::endl;
120  } else {
121  std::cout << " : Real part set to " << realVal << std::endl;
122  }
123 
124  if ( fixImagPart ) {
125  std::cout << " : Imaginary part fixed to " << imagVal << std::endl;
126  } else {
127  std::cout << " : Imaginary part set to " << imagVal << std::endl;
128  }
129 }
130 
132 {
133  const Lau1DCubicSpline* splineReal = this->getSpline1();
134  const Lau1DCubicSpline* splineImag = this->getSpline2();
135 
136  const Double_t re = splineReal->evaluate(mass);
137  const Double_t im = splineImag->evaluate(mass);
138 
139  this->setAmp(re, im);
140 }
141 
std::vector< LauParameter * > & getAmp2Pars()
Helper function to access the 2nd parameter set.
const Lau1DCubicSpline * getSpline2() const
Helper function to access the 1st spline.
std::vector< LauParameter * > & getAmp1Pars()
Helper function to access the 1st parameter set.
const TString & getResonanceName() const
Get the name of the resonance.
Abstract base class for defining a model independent partial wave component.
File containing declaration of LauResonanceInfo class.
ClassImp(LauAbsCoeffSet)
std::vector< Double_t > & getAmp1Vals()
Helper function to access the 1st parameter set.
LauParameter()
Default constructor.
Definition: LauParameter.cc:44
Class for defining the properties of a resonant particle.
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.
File containing declaration of LauModIndPartWaveRealImag class.
const TString & getSanitisedName() const
Get the name of the resonance.
virtual ~LauModIndPartWaveRealImag()
Destructor.
const Lau1DCubicSpline * getSpline1() const
Helper function to access the 1st spline.
void setAmp(const Double_t realPart, const Double_t imagPart)
Helper function to set the current amplitude value.
File containing declaration of LauKinematics class.
File containing declaration of Lau1DCubicSpline class.
Class for defining a 1D cubic spline based on a set of knots.
UInt_t nKnots() const
Return the number of knots that have been defined (including those at the upper and lower kinematic l...
Bool_t secondStage() const
Check whether the parameter should be floated only in the second stage of a two stage fit...
virtual void createAmpParameters(const UInt_t iKnot)
Method to create the parameter objects for the given knot.
virtual void setKnotAmp(const UInt_t knot, const Double_t realVal, const Double_t imagVal, const Bool_t fixRealPart, const Bool_t fixImagPart)
Set the values of the two real parameters that define the amplitude at a given knot.
const std::vector< Double_t > & getMasses()
Helper function to access the masses.
LauResonanceInfo * getResInfo() const
Access the resonance info object.
File containing LauConstants namespace.
Bool_t floatKnotsSecondStage() const
Retrieve the value of the second stage flag.
Class for defining a model independent partial wave component where the amplitudes are parameterised ...
std::vector< Double_t > & getAmp2Vals()
Helper function to access the 2nd parameter set.
virtual void evaluateAmplitude(const Double_t mass)
Evaluate the amplitude at the given point from the splines.
void addExtraParameter(LauParameter *param, const Bool_t independentPar=kFALSE)
Add an extra parameter of the resonance.