laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauModIndPartWaveMagPhase.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 LauModIndPartWaveMagPhase::LauModIndPartWaveMagPhase(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*>& magnitudePars = this->getAmp1Pars();
56  std::vector<LauParameter*>& phasePars = this->getAmp2Pars();
57 
58  TString magName(parNameBase);
59  magName += "_A";
60  magName += iKnot;
61 
62  magnitudePars.push_back(this->getResInfo()->getExtraParameter( magName ));
63  if( magnitudePars[iKnot] == 0) {
64  magnitudePars[iKnot] = new LauParameter( magName, 1.0, 0.0, 10.0, kFALSE);
65  magnitudePars[iKnot]->secondStage(secondStage);
66  this->getResInfo()->addExtraParameter(magnitudePars[iKnot]);
67  }
68 
69  TString phaseName(parNameBase);
70  phaseName += "_d";
71  phaseName += iKnot;
72 
73  phasePars.push_back(this->getResInfo()->getExtraParameter( phaseName ));
74  if( phasePars[iKnot] == 0) {
75  phasePars[iKnot] = new LauParameter( phaseName, 1.0, -6.0*LauConstants::pi, 6.0*LauConstants::pi, kFALSE);
76  phasePars[iKnot]->secondStage(secondStage);
77  this->getResInfo()->addExtraParameter(phasePars[iKnot]);
78  }
79 }
80 
81 void LauModIndPartWaveMagPhase::setKnotAmp(const UInt_t knot, const Double_t magVal, const Double_t phaseVal, const Bool_t fixMagnitude, const Bool_t fixPhase)
82 {
83  const UInt_t nknots = this->nKnots();
84 
85  if ( knot >= nknots ) {
86  std::cerr << "WARNING in LauModIndPartWaveMagPhase::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>& magnitudes = this->getAmp1Vals();
94  std::vector<Double_t>& phases = this->getAmp2Vals();
95 
96  std::vector<LauParameter*>& magnitudePars = this->getAmp1Pars();
97  std::vector<LauParameter*>& phasePars = this->getAmp2Pars();
98 
99  magnitudes[knot] = magVal;
100  magnitudePars[knot]->value(magVal);
101  magnitudePars[knot]->genValue(magVal);
102  magnitudePars[knot]->initValue(magVal);
103  magnitudePars[knot]->fixed(fixMagnitude);
104  phases[knot] = phaseVal;
105  phasePars[knot]->value(phaseVal);
106  phasePars[knot]->genValue(phaseVal);
107  phasePars[knot]->initValue(phaseVal);
108  phasePars[knot]->fixed(fixPhase);
109 
110  if ( knot == 0 ) {
111  std::cout << "INFO in LauModIndPartWaveMagPhase::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 LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at upper kinematic limit (" << masses[knot] << ")" << std::endl;
114  } else {
115  std::cout << "INFO in LauModIndPartWaveMagPhase::setKnotAmp : Knot updated in resonance " << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
116  }
117 
118  if ( fixMagnitude ) {
119  std::cout << " : Magnitude fixed to " << magVal << std::endl;
120  } else {
121  std::cout << " : Magnitude set to " << magVal << std::endl;
122  }
123 
124  if ( fixPhase ) {
125  std::cout << " : Phase fixed to " << phaseVal << std::endl;
126  } else {
127  std::cout << " : Phase set to " << phaseVal << std::endl;
128  }
129 }
130 
132 {
133  const Lau1DCubicSpline* splineMag = this->getSpline1();
134  const Lau1DCubicSpline* splinePhase = this->getSpline2();
135 
136  const Double_t mag = splineMag->evaluate(mass);
137  const Double_t phase = splinePhase->evaluate(mass);
138 
139  this->setAmp(mag*TMath::Cos(phase), mag*TMath::Sin(phase));
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.
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.
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.