laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauAbsModIndPartWave.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 "LauConstants.hh"
19 #include "LauKinematics.hh"
20 #include "LauAbsModIndPartWave.hh"
21 #include "LauResonanceInfo.hh"
22 
24 
25 
26 LauAbsModIndPartWave::LauAbsModIndPartWave(LauResonanceInfo* resInfo, Int_t resPairAmpInt, const LauDaughters* daughters) :
27  LauAbsResonance(resInfo, resPairAmpInt, daughters),
28  nKnots_(0),
29  spline1_(0),
30  spline2_(0),
31  type1_(Lau1DCubicSpline::StandardSpline),
32  type2_(Lau1DCubicSpline::StandardSpline),
33  leftBound1_(Lau1DCubicSpline::NotAKnot),
34  rightBound1_(Lau1DCubicSpline::NotAKnot),
35  leftBound2_(Lau1DCubicSpline::NotAKnot),
36  rightBound2_(Lau1DCubicSpline::NotAKnot),
37  leftGrad1_(0.),
38  rightGrad1_(0.),
39  leftGrad2_(0.),
40  rightGrad2_(0.),
41  secondStage_(kFALSE)
42 {
43 }
44 
46 {
47  delete spline1_;
48  delete spline2_;
49 }
50 
52 {
54 
55  // if the parameters have not yet been created we can now just return
56  if ( amp1Pars_.size() != nKnots_ ) {
57  return;
58  }
59 
60  // otherwise we need to toggle their second-stage parameter
61  for ( UInt_t i(0); i < nKnots_; ++i ) {
62  amp1Pars_[i]->secondStage(secondStage_);
63  amp2Pars_[i]->secondStage(secondStage_);
64  }
65 }
66 
67 std::set<Double_t> LauAbsModIndPartWave::checkKnots(const std::set<Double_t>& masses)
68 {
69  std::set<Double_t> knots = masses;
70 
71  const std::set<Double_t>::const_iterator first = knots.begin();
72  const std::set<Double_t>::const_reverse_iterator last = knots.rbegin();
73 
74  const Double_t lower_limit = this->getMassDaug1() + this->getMassDaug2();
75  const Double_t upper_limit = this->getMassParent() - this->getMassBachelor();
76 
77  // check whether we have been given knots at unphysical masses
78  if ( *first < lower_limit ) {
79  std::cerr << "WARNING in LauAbsModIndPartWave::checkKnots : Knot found at mass " << *first << " is below the lower kinematic limit." << std::endl;
80  std::cerr << " : Lower kinematic limit is at mass " << lower_limit << std::endl;
81  std::cerr << " : Aborting definition of knot positions." << std::endl;
82  knots.clear();
83  return knots;
84  }
85  if ( *last > upper_limit ) {
86  std::cerr << "WARNING in LauAbsModIndPartWave::checkKnots : Knot found at mass " << *last << " is above the upper kinematic limit." << std::endl;
87  std::cerr << " : Upper kinematic limit is at mass " << upper_limit << std::endl;
88  std::cerr << " : Aborting definition of knot positions." << std::endl;
89  knots.clear();
90  return knots;
91  }
92 
93  // check if we have knots at each extreme - if not, add them in
94  if ( (*first) != lower_limit ) {
95  knots.insert( lower_limit );
96  }
97  if ( (*last) != upper_limit ) {
98  knots.insert( upper_limit );
99  }
100 
101  return knots;
102 }
103 
104 void LauAbsModIndPartWave::defineKnots(const std::set<Double_t>& masses)
105 {
106  if ( ! masses_.empty() ) {
107  std::cerr << "WARNING in LauAbsModIndPartWave::defineKnots : Knot positions have already been defined, not making any changes." << std::endl;
108  return;
109  }
110 
111  const std::set<Double_t> knots = this->checkKnots( masses );
112 
113  nKnots_ = knots.size();
114  if ( nKnots_ == 0 ) {
115  return;
116  }
117 
118  masses_.reserve(nKnots_);
119  amp1Vals_.reserve(nKnots_);
120  amp2Vals_.reserve(nKnots_);
121  amp1Pars_.reserve(nKnots_);
122  amp2Pars_.reserve(nKnots_);
123 
124  UInt_t counter(0);
125  for ( std::set<Double_t>::const_iterator iter = knots.begin(); iter != knots.end(); ++iter ) {
126  masses_.push_back( *iter );
127  amp1Vals_.push_back(1.0);
128  amp2Vals_.push_back(1.0);
129  this->createAmpParameters(counter);
130  ++counter;
131  }
132 
133  for ( std::vector<Double_t>::const_iterator iter = masses_.begin(); iter != masses_.end(); ++iter ) {
134  std::cout << "INFO in LauAbsModIndPartWave::defineKnots : Knot added to resonance " << this->getResonanceName() << " at mass " << *iter << std::endl;
135  }
136 }
137 
139 {
140  if ( spline1_ != 0 ) {
141  delete spline1_;
142  spline1_ = 0;
143  }
144  if ( spline2_ != 0 ) {
145  delete spline2_;
146  spline2_ = 0;
147  }
148 
149  for ( UInt_t i(0); i < nKnots_; ++i ) {
150  amp1Vals_[i] = amp1Pars_[i]->unblindValue();
151  amp2Vals_[i] = amp2Pars_[i]->unblindValue();
152  }
153 
156 }
157 
158 LauComplex LauAbsModIndPartWave::resAmp(Double_t mass, Double_t spinTerm)
159 {
160  amp_.zero();
161 
162  Bool_t paramChanged1(kFALSE), paramChanged2(kFALSE);
163 
164  for ( UInt_t i(0); i < nKnots_; ++i ) {
165  if ( !amp1Pars_[i]->fixed() && amp1Pars_[i]->unblindValue() != amp1Vals_[i] ) {
166  paramChanged1 = kTRUE;
167  amp1Vals_[i] = amp1Pars_[i]->unblindValue();
168  }
169  if ( !amp2Pars_[i]->fixed() && amp2Pars_[i]->unblindValue() != amp2Vals_[i] ) {
170  paramChanged2 = kTRUE;
171  amp2Vals_[i] = amp2Pars_[i]->unblindValue();
172  }
173  }
174 
175  if ( spline1_ == 0 || spline2_ == 0) {
176  std::cerr << "ERROR in LauAbsModIndPartWave::resAmp : One of the splines is null" << std::endl;
177  return amp_;
178  }
179 
180  if ( paramChanged1 ) {
182  }
183 
184  if ( paramChanged2 ) {
186  }
187 
188  this->evaluateAmplitude( mass );
189 
190  amp_.rescale( spinTerm );
191 
192  return amp_;
193 }
194 
196 {
197  type1_ = type1;
198  type2_ = type2;
199 }
200 
205  Double_t leftGrad1,
206  Double_t rightGrad1,
207  Double_t leftGrad2,
208  Double_t rightGrad2)
209 {
210  leftBound1_ = leftBound1;
211  rightBound1_ = rightBound1;
212  leftBound2_ = leftBound2;
213  rightBound2_ = rightBound2;
214  leftGrad1_ = leftGrad1;
215  rightGrad1_ = rightGrad1;
216  leftGrad2_ = leftGrad2;
217  rightGrad2_ = rightGrad2;
218 }
219 
220 const std::vector<LauParameter*>& LauAbsModIndPartWave::getFloatingParameters()
221 {
222  this->clearFloatingParameters();
223 
224  for ( UInt_t i(0); i < nKnots_; ++i ) {
225  if ( !amp1Pars_[i]->fixed() ) {
226  this->addFloatingParameter( amp1Pars_[i] );
227  }
228  if ( !amp2Pars_[i]->fixed() ) {
229  this->addFloatingParameter( amp2Pars_[i] );
230  }
231  }
232 
233  return this->getParameters();
234 }
235 
Bool_t fixed() const
Check whether the parameter is fixed or floated.
virtual std::set< Double_t > checkKnots(const std::set< Double_t > &masses)
Method to check that the supplied knot positions are valid.
Double_t getMassBachelor() const
Get the mass of the bachelor daughter.
const TString & getResonanceName() const
Get the name of the resonance.
virtual void initialise()
Initialise the model.
LauComplex amp_
The current value of the amplitude.
Abstract base class for defining a model independent partial wave component.
LauSplineBoundaryType
Define the allowed boundary condition types.
File containing declaration of LauResonanceInfo class.
ClassImp(LauAbsCoeffSet)
Double_t rightGrad1_
The gradient at the right boundary for the first spline if clamped.
Double_t getMassParent() const
Get the parent particle mass.
Class for defining the properties of a resonant particle.
Class that defines the particular 3-body decay under study.
Definition: LauDaughters.hh:33
Lau1DCubicSpline::LauSplineType type1_
The type of interpolation used for the first spline.
std::vector< LauParameter * > amp2Pars_
The parameters for the second real value at the knots.
Lau1DCubicSpline::LauSplineBoundaryType rightBound2_
The upper boundary condition type for the second spline.
virtual void createAmpParameters(const UInt_t iKnot)=0
Method to create the parameter objects for the given knot.
Double_t getMassDaug1() const
Get the mass of daughter 1.
virtual const std::vector< LauParameter * > & getFloatingParameters()
Retrieve the resonance parameters, e.g. so that they can be loaded into a fit.
virtual LauComplex resAmp(Double_t mass, Double_t spinTerm)
Complex resonant amplitude.
File containing declaration of LauKinematics class.
Double_t getMassDaug2() const
Get the mass of daughter 2.
void addFloatingParameter(LauParameter *param)
Add parameter to the list of floating parameters.
Lau1DCubicSpline::LauSplineBoundaryType rightBound1_
The upper boundary condition type for the first spline.
std::vector< Double_t > amp2Vals_
The values of the second real parameter at each knot.
virtual ~LauAbsModIndPartWave()
Destructor.
Double_t leftGrad2_
The gradient at the left boundary for the second spline if clamped.
Class for defining a 1D cubic spline based on a set of knots.
Bool_t secondStage() const
Check whether the parameter should be floated only in the second stage of a two stage fit...
std::vector< LauParameter * > & getParameters()
Access the list of floating parameters.
virtual void evaluateAmplitude(const Double_t mass)=0
Evaluate the amplitude at the given point from the splines.
std::vector< LauParameter * > amp1Pars_
The parameters for the first real value at the knots.
Bool_t secondStage_
Flag to determine if the parameters should be floated only in the second stage of the fit...
void updateYValues(const std::vector< Double_t > &ys)
Update the y-values of the knots.
std::vector< Double_t > masses_
The masses at which knots are defined in the magnitude and phase splines.
Double_t leftGrad1_
The gradient at the left boundary for the first spline if clamped.
Abstract class for defining type for resonance amplitude models (Breit-Wigner, Flatte etc...
void rescale(Double_t scaleVal)
Scale this by a factor.
Definition: LauComplex.hh:285
Lau1DCubicSpline * spline1_
The spline used to interpolate the values of the first real parameter.
void zero()
Set both real and imaginary part to zero.
Definition: LauComplex.hh:321
Lau1DCubicSpline::LauSplineBoundaryType leftBound1_
The lower boundary condition type for the first spline.
File containing LauConstants namespace.
Bool_t secondStage_
Flag whether it is floated only in the second stage of the fit.
Double_t unblindValue() const
The unblinded value of the parameter.
void defineKnots(const std::set< Double_t > &masses)
Define the knot positions.
Class for defining a complex number.
Definition: LauComplex.hh:47
Double_t rightGrad2_
The gradient at the right boundary for the second spline if clamped.
std::vector< Double_t > amp1Vals_
The values of the first real parameter at each knot.
UInt_t nKnots_
The number of knots.
Bool_t floatKnotsSecondStage() const
Retrieve the value of the second stage flag.
Lau1DCubicSpline * spline2_
The spline used to interpolate the values of the second real parameter.
void setSplineBoundaryConditions(Lau1DCubicSpline::LauSplineBoundaryType leftBound1, Lau1DCubicSpline::LauSplineBoundaryType rightBound1, Lau1DCubicSpline::LauSplineBoundaryType leftBound2, Lau1DCubicSpline::LauSplineBoundaryType rightBound2, Double_t leftGrad1=0.0, Double_t rightGrad1=0.0, Double_t leftGrad2=0.0, Double_t rightGrad2=0.0)
Method to set the boundary conditions of the splines.
Lau1DCubicSpline::LauSplineBoundaryType leftBound2_
The lower boundary condition type for the second spline.
LauSplineType
Define the allowed interpolation types.
void setSplineType(Lau1DCubicSpline::LauSplineType type1, Lau1DCubicSpline::LauSplineType type2)
Method to set the type of interpolation used for the splines.
Lau1DCubicSpline::LauSplineType type2_
The type of interpolation used for the second spline.
void clearFloatingParameters()
Clear list of floating parameters.
File containing declaration of LauAbsModIndPartWave class.