laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauModIndPartWaveRealImag.cc
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2004 - 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 <cstdlib>
16 #include <iostream>
17 
18 #include "Lau1DCubicSpline.hh"
19 #include "LauConstants.hh"
20 #include "LauKinematics.hh"
22 #include "LauResonanceInfo.hh"
23 
25 
26 
27 LauModIndPartWaveRealImag::LauModIndPartWaveRealImag(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters) :
28  LauAbsModIndPartWave(resInfo, resPairAmpInt, daughters)
29 {
30 }
31 
33 {
34 }
35 
37 {
38  const TString& parNameBase = this->getSanitisedName();
39  const Bool_t secondStage = this->floatKnotsSecondStage();
40 
41  std::vector<LauParameter*>& rePars = this->getAmp1Pars();
42  std::vector<LauParameter*>& imPars = this->getAmp2Pars();
43 
44  TString reName(parNameBase);
45  reName += "_Re";
46  reName += iKnot;
47 
48  rePars.push_back(this->getResInfo()->getExtraParameter( reName ));
49  if( rePars[iKnot] == 0) {
50  rePars[iKnot] = new LauParameter( reName, 1.0, -10.0, 10.0, kFALSE);
51  rePars[iKnot]->secondStage(secondStage);
52  this->getResInfo()->addExtraParameter(rePars[iKnot]);
53  }
54 
55  TString imName(parNameBase);
56  imName += "_Im";
57  imName += iKnot;
58 
59  imPars.push_back(this->getResInfo()->getExtraParameter( imName ));
60  if( imPars[iKnot] == 0) {
61  imPars[iKnot] = new LauParameter( imName, 1.0, -10.0, 10.0, kFALSE);
62  imPars[iKnot]->secondStage(secondStage);
63  this->getResInfo()->addExtraParameter(imPars[iKnot]);
64  }
65 }
66 
67 void LauModIndPartWaveRealImag::setKnotAmp(const UInt_t knot, const Double_t realVal, const Double_t imagVal, const Bool_t fixRealPart, const Bool_t fixImagPart)
68 {
69  const UInt_t nknots = this->nKnots();
70 
71  if ( knot >= nknots ) {
72  std::cerr << "WARNING in LauModIndPartWaveRealImag::setKnotAmp : Index " << knot << " does not correspond to an existing knot in resonance " << this->getResonanceName() << std::endl;
73  std::cerr << " : Index must be in range 0 to " << nknots-1 << std::endl;
74  return;
75  }
76 
77  const std::vector<Double_t>& masses = this->getMasses();
78 
79  std::vector<Double_t>& realVals = this->getAmp1Vals();
80  std::vector<Double_t>& imagVals = this->getAmp2Vals();
81 
82  std::vector<LauParameter*>& realPars = this->getAmp1Pars();
83  std::vector<LauParameter*>& imagPars = this->getAmp2Pars();
84 
85  realVals[knot] = realVal;
86  realPars[knot]->value(realVal);
87  realPars[knot]->genValue(realVal);
88  realPars[knot]->initValue(realVal);
89  realPars[knot]->fixed(fixRealPart);
90  imagVals[knot] = imagVal;
91  imagPars[knot]->value(imagVal);
92  imagPars[knot]->genValue(imagVal);
93  imagPars[knot]->initValue(imagVal);
94  imagPars[knot]->fixed(fixImagPart);
95 
96  if ( knot == 0 ) {
97  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at lower kinematic limit (" << masses[knot] << ")" << std::endl;
98  } else if ( knot == nknots-1 ) {
99  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at upper kinematic limit (" << masses[knot] << ")" << std::endl;
100  } else {
101  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
102  }
103 
104  if ( fixRealPart ) {
105  std::cout << " : Real part fixed to " << realVal << std::endl;
106  } else {
107  std::cout << " : Real part set to " << realVal << std::endl;
108  }
109 
110  if ( fixImagPart ) {
111  std::cout << " : Imaginary part fixed to " << imagVal << std::endl;
112  } else {
113  std::cout << " : Imaginary part set to " << imagVal << std::endl;
114  }
115 }
116 
118 {
119  const Lau1DCubicSpline* splineReal = this->getSpline1();
120  const Lau1DCubicSpline* splineImag = this->getSpline2();
121 
122  const Double_t re = splineReal->evaluate(mass);
123  const Double_t im = splineImag->evaluate(mass);
124 
125  this->setAmp(re, im);
126 }
127 
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:30
Class for defining the properties of a resonant particle.
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.
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.