laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
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 
30 
31 #include "Lau1DCubicSpline.hh"
32 #include "LauConstants.hh"
33 #include "LauKinematics.hh"
34 #include "LauResonanceInfo.hh"
35 
36 #include <cstdlib>
37 #include <iostream>
38 
40  Int_t resPairAmpInt,
41  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,
82  const Double_t realVal,
83  const Double_t imagVal,
84  const Bool_t fixRealPart,
85  const Bool_t fixImagPart )
86 {
87  const UInt_t nknots = this->nKnots();
88 
89  if ( knot >= nknots ) {
90  std::cerr << "WARNING in LauModIndPartWaveRealImag::setKnotAmp : Index " << knot
91  << " does not correspond to an existing knot in resonance "
92  << this->getResonanceName() << std::endl;
93  std::cerr << " : Index must be in range 0 to "
94  << nknots - 1 << std::endl;
95  return;
96  }
97 
98  const std::vector<Double_t>& masses = this->getMasses();
99 
100  std::vector<Double_t>& realVals = this->getAmp1Vals();
101  std::vector<Double_t>& imagVals = this->getAmp2Vals();
102 
103  std::vector<LauParameter*>& realPars = this->getAmp1Pars();
104  std::vector<LauParameter*>& imagPars = this->getAmp2Pars();
105 
106  realVals[knot] = realVal;
107  realPars[knot]->value( realVal );
108  realPars[knot]->genValue( realVal );
109  realPars[knot]->initValue( realVal );
110  realPars[knot]->fixed( fixRealPart );
111  imagVals[knot] = imagVal;
112  imagPars[knot]->value( imagVal );
113  imagPars[knot]->genValue( imagVal );
114  imagPars[knot]->initValue( imagVal );
115  imagPars[knot]->fixed( fixImagPart );
116 
117  if ( knot == 0 ) {
118  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance "
119  << this->getResonanceName() << " at lower kinematic limit (" << masses[knot]
120  << ")" << std::endl;
121  } else if ( knot == nknots - 1 ) {
122  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance "
123  << this->getResonanceName() << " at upper kinematic limit (" << masses[knot]
124  << ")" << std::endl;
125  } else {
126  std::cout << "INFO in LauModIndPartWaveRealImag::setKnotAmp : Knot updated in resonance "
127  << this->getResonanceName() << " at mass " << masses[knot] << std::endl;
128  }
129 
130  if ( fixRealPart ) {
131  std::cout << " : Real part fixed to "
132  << realVal << std::endl;
133  } else {
134  std::cout << " : Real part set to " << realVal
135  << std::endl;
136  }
137 
138  if ( fixImagPart ) {
139  std::cout << " : Imaginary part fixed to "
140  << imagVal << std::endl;
141  } else {
142  std::cout << " : Imaginary part set to "
143  << imagVal << std::endl;
144  }
145 }
146 
148 {
149  const Lau1DCubicSpline* splineReal = this->getSpline1();
150  const Lau1DCubicSpline* splineImag = this->getSpline2();
151 
152  const Double_t re = splineReal->evaluate( mass );
153  const Double_t im = splineImag->evaluate( mass );
154 
155  this->setAmp( re, im );
156 }
File containing declaration of LauResonanceInfo class.
const TString & getSanitisedName() const
Get the name of the resonance.
const TString & getResonanceName() const
Get the name of the resonance.
const std::vector< Double_t > & getMasses()
Helper function to access the masses.
std::vector< Double_t > & getAmp1Vals()
Helper function to access the 1st parameter set.
std::vector< LauParameter * > & getAmp2Pars()
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.
Bool_t secondStage() const
Check whether the parameter should be floated only in the second stage of a two stage fit.
File containing declaration of LauModIndPartWaveRealImag class.
Class for defining a 1D cubic spline based on a set of knots.
std::vector< LauParameter * > & getAmp1Pars()
Helper function to access the 1st parameter set.
LauModIndPartWaveRealImag(LauResonanceInfo *resInfo, Int_t resPairAmpInt, const LauDaughters *daughters)
Constructor.
File containing declaration of Lau1DCubicSpline class.
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.
void setAmp(const Double_t realPart, const Double_t imagPart)
Helper function to set the current amplitude value.
void addExtraParameter(LauParameter *param, const Bool_t independentPar=kFALSE)
Add an extra parameter of the resonance.
LauParameter()
Default constructor.
Definition: LauParameter.cc:40
virtual ~LauModIndPartWaveRealImag()
Destructor.
Class for defining the properties of a resonant particle.
File containing LauConstants namespace.
virtual void createAmpParameters(const UInt_t iKnot)
Method to create the parameter objects for the given knot.
UInt_t nKnots() const
Return the number of knots that have been defined (including those at the upper and lower kinematic l...
const Lau1DCubicSpline * getSpline2() const
Helper function to access the 1st spline.
Double_t evaluate(Double_t x) const
Evaluate the function at given point.
Class that defines the particular 3-body decay under study.
Definition: LauDaughters.hh:47
const Lau1DCubicSpline * getSpline1() const
Helper function to access the 1st spline.
LauResonanceInfo * getResInfo() const
Access the resonance info object.
Bool_t floatKnotsSecondStage() const
Retrieve the value of the second stage flag.
Abstract base class for defining a model independent partial wave component.
std::vector< Double_t > & getAmp2Vals()
Helper function to access the 2nd parameter set.
File containing declaration of LauKinematics class.