laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauModIndPartWaveMagPhase.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 LauModIndPartWaveMagPhase::LauModIndPartWaveMagPhase(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*>& magnitudePars = this->getAmp1Pars();
42  std::vector<LauParameter*>& phasePars = this->getAmp2Pars();
43 
44  TString magName(parNameBase);
45  magName += "_A";
46  magName += iKnot;
47 
48  magnitudePars.push_back(this->getResInfo()->getExtraParameter( magName ));
49  if( magnitudePars[iKnot] == 0) {
50  magnitudePars[iKnot] = new LauParameter( magName, 1.0, 0.0, 10.0, kFALSE);
51  magnitudePars[iKnot]->secondStage(secondStage);
52  this->getResInfo()->addExtraParameter(magnitudePars[iKnot]);
53  }
54 
55  TString phaseName(parNameBase);
56  phaseName += "_d";
57  phaseName += iKnot;
58 
59  phasePars.push_back(this->getResInfo()->getExtraParameter( phaseName ));
60  if( phasePars[iKnot] == 0) {
61  phasePars[iKnot] = new LauParameter( phaseName, 1.0, -6.0*LauConstants::pi, 6.0*LauConstants::pi, kFALSE);
62  phasePars[iKnot]->secondStage(secondStage);
63  this->getResInfo()->addExtraParameter(phasePars[iKnot]);
64  }
65 }
66 
67 void LauModIndPartWaveMagPhase::setKnotAmp(const UInt_t knot, const Double_t magVal, const Double_t phaseVal, const Bool_t fixMagnitude, const Bool_t fixPhase)
68 {
69  const UInt_t nknots = this->nKnots();
70 
71  if ( knot >= nknots ) {
72  std::cerr << "WARNING in LauModIndPartWaveMagPhase::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>& magnitudes = this->getAmp1Vals();
80  std::vector<Double_t>& phases = this->getAmp2Vals();
81 
82  std::vector<LauParameter*>& magnitudePars = this->getAmp1Pars();
83  std::vector<LauParameter*>& phasePars = this->getAmp2Pars();
84 
85  magnitudes[knot] = magVal;
86  magnitudePars[knot]->value(magVal);
87  magnitudePars[knot]->genValue(magVal);
88  magnitudePars[knot]->initValue(magVal);
89  magnitudePars[knot]->fixed(fixMagnitude);
90  phases[knot] = phaseVal;
91  phasePars[knot]->value(phaseVal);
92  phasePars[knot]->genValue(phaseVal);
93  phasePars[knot]->initValue(phaseVal);
94  phasePars[knot]->fixed(fixPhase);
95 
96  if ( knot == 0 ) {
97  std::cout << "INFO in LauModIndPartWaveMagPhase::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 LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at upper kinematic limit (" << masses[knot] << ")" << std::endl;
100  } else {
101  std::cout << "INFO in LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
102  }
103 
104  if ( fixMagnitude ) {
105  std::cout << " : Magnitude fixed to " << magVal << std::endl;
106  } else {
107  std::cout << " : Magnitude set to " << magVal << std::endl;
108  }
109 
110  if ( fixPhase ) {
111  std::cout << " : Phase fixed to " << phaseVal << std::endl;
112  } else {
113  std::cout << " : Phase set to " << phaseVal << std::endl;
114  }
115 }
116 
118 {
119  const Lau1DCubicSpline* splineMag = this->getSpline1();
120  const Lau1DCubicSpline* splinePhase = this->getSpline2();
121 
122  const Double_t mag = splineMag->evaluate(mass);
123  const Double_t phase = splinePhase->evaluate(mass);
124 
125  this->setAmp(mag*TMath::Cos(phase), mag*TMath::Sin(phase));
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.
const TString & getSanitisedName() const
Get the name of the resonance.
File containing declaration of LauModIndPartWaveMagPhase class.
virtual ~LauModIndPartWaveMagPhase()
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.
virtual void setKnotAmp(const UInt_t knot, const Double_t magVal, const Double_t phaseVal, const Bool_t fixMagnitude, const Bool_t fixPhase)
Set the values of the two real parameters that define the amplitude at a given knot.
Class for defining a model independent partial wave component where the amplitudes are parameterised ...
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...
const Double_t pi
Pi.
Definition: LauConstants.hh:89
const std::vector< Double_t > & getMasses()
Helper function to access the masses.
LauResonanceInfo * getResInfo() const
Access the resonance info object.
File containing LauConstants namespace.
virtual void createAmpParameters(const UInt_t iKnot)
Method to create the parameter objects for the given knot.
virtual void evaluateAmplitude(const Double_t mass)
Evaluate the amplitude at the given point from the splines.
Bool_t floatKnotsSecondStage() const
Retrieve the value of the second stage flag.
std::vector< Double_t > & getAmp2Vals()
Helper function to access the 2nd parameter set.
void addExtraParameter(LauParameter *param, const Bool_t independentPar=kFALSE)
Add an extra parameter of the resonance.