laura is hosted by Hepforge, IPPP Durham
Laura++  v2r1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauParameter.hh
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2006 - 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 
22 #ifndef LAU_PARAMETER
23 #define LAU_PARAMETER
24 
25 #include <map>
26 #include <vector>
27 
28 #include "TObject.h"
29 #include "TString.h"
30 #include "LauAbsRValue.hh"
31 
32 
33 class LauParameter : public TObject, public LauAbsRValue {
34 
35  public:
37  LauParameter();
38 
40 
43  LauParameter(const TString& parName);
44 
46 
49  LauParameter(Double_t parValue);
50 
52 
57  LauParameter(Double_t parValue, Double_t min, Double_t max);
58 
60 
66  LauParameter(Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
67 
69 
75  LauParameter(Double_t parValue, Double_t parError, Double_t min, Double_t max);
76 
78 
82  LauParameter(const TString& parName, Double_t parValue);
83 
85 
91  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max);
92 
94 
101  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
102 
104 
111  LauParameter(const TString& parName, Double_t parValue, Double_t parError, Double_t min, Double_t max);
112 
113  // Destructor
114  virtual ~LauParameter(){}
115 
117 
120  LauParameter(const LauParameter& rhs);
121 
123 
126  LauParameter& operator=(const LauParameter& rhs);
127 
128  // the simple accessor functions
129 
131 
134  inline const TString& name() const {return name_;}
135 
137 
140  inline Double_t value() const {return value_;}
141 
143 
146  inline Double_t error() const {return error_;}
147 
149 
152  inline Double_t negError() const {return negError_;}
153 
155 
158  inline Double_t posError() const {return posError_;}
159 
161 
164  inline Double_t genValue() const {return genValue_;}
165 
167 
170  inline Double_t initValue() const {return initValue_;}
171 
173 
176  inline Double_t minValue() const {return minValue_;}
177 
179 
182  inline Double_t maxValue() const {return maxValue_;}
183 
185 
188  inline Double_t range() const {return this->maxValue() - this->minValue();}
189 
191 
194  inline Bool_t fixed() const {return fixed_;}
195 
197 
200  inline Bool_t firstStage() const {return firstStage_;}
201 
203 
206  inline Bool_t secondStage() const {return secondStage_;}
207 
209 
212  inline Bool_t gaussConstraint() const {return gaussConstraint_;}
213 
215 
218  inline Double_t constraintMean() const {return constraintMean_;}
219 
221 
224  inline Double_t constraintWidth() const {return constraintWidth_;}
225 
227 
230  inline Double_t globalCorrelationCoeff() const {return gcc_;}
231 
233 
236  inline Double_t bias() const {return bias_;}
237 
239 
242  inline Double_t pull() const {return pull_;}
243 
245 
248  inline Bool_t isLValue() const {return kTRUE;}
249 
251 
254  std::vector<LauParameter*> getPars();
255 
256  // the simple "setter" functions
257 
259 
262  void name(const TString& newName);
263 
265 
268  void value(Double_t newValue);
269 
271 
274  void error(Double_t newError);
275 
277 
280  void negError(Double_t newNegError);
281 
283 
286  void posError(Double_t newPosError);
287 
289 
294  void errors(Double_t newError, Double_t newNegError, Double_t newPosError);
295 
297 
303  void valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError = 0.0, Double_t newPosError = 0.0);
304 
306 
309  void globalCorrelationCoeff(Double_t newGCCValue);
310 
312 
315  void genValue(Double_t newGenValue);
316 
318 
321  void initValue(Double_t newInitValue);
322 
324 
327  void minValue(Double_t newMinValue);
328 
330 
333  void maxValue(Double_t newMaxValue);
334 
336 
340  void range(Double_t newMinValue, Double_t newMaxValue);
341 
343 
348  void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue);
349 
351 
354  void fixed(Bool_t parFixed);
355 
357 
360  void firstStage(Bool_t firstStagePar);
361 
363 
366  void secondStage(Bool_t secondStagePar);
367 
369 
373  void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth);
374 
377 
378  // operators
379 
381 
384  LauParameter& operator = (Double_t val);
385 
387 
390  LauParameter& operator += (Double_t val);
391 
393 
396  LauParameter& operator -= (Double_t val);
397 
399 
402  LauParameter& operator *= (Double_t val);
403 
405 
408  LauParameter& operator /= (Double_t val);
409 
410  // functions for the cloning mechanism
411 
413 
416  inline Bool_t clone() const {return clone_;}
417 
419 
423  LauParameter* createClone(Double_t constFactor = 1.0);
424 
426 
431  LauParameter* createClone(const TString& newName, Double_t constFactor = 1.0);
432 
434  void updatePull();
435 
437 
440  void randomiseValue();
441 
443 
451  void randomiseValue(Double_t minVal, Double_t maxVal);
452 
453  protected:
455 
460  void checkRange(Double_t val, Double_t minVal, Double_t maxVal);
461 
463  inline void checkRange()
464  {
465  this->checkRange(this->value(),this->minValue(),this->maxValue());
466  }
467 
469 
472  inline void clone(LauParameter* theparent) {
473  parent_ = theparent;
474  clone_ = (parent_==0) ? kFALSE : kTRUE;
475  }
476 
478 
481  inline LauParameter* parent() const {return parent_;}
482 
484  inline void wipeClones() {clones_.clear();}
485 
487 
490  void updateClones(Bool_t justValue = kFALSE);
491 
492  private:
494  friend class LauFitNtuple;
495 
497  TString name_;
498 
500  Double_t value_;
501 
503  Double_t error_;
505  Double_t negError_;
507  Double_t posError_;
508 
510  Double_t genValue_;
511 
513  Double_t initValue_;
515  Double_t minValue_;
517  Double_t maxValue_;
518 
520  Bool_t fixed_;
522  Bool_t firstStage_;
524  Bool_t secondStage_;
525 
529  Double_t constraintMean_;
532 
534  Double_t gcc_;
535 
537  Double_t bias_;
539  Double_t pull_;
540 
542  Bool_t clone_;
545 
547  std::map<LauParameter*, Double_t> clones_;
548 
549  ClassDef(LauParameter, 1)
550 
551 };
552 
553 // operators to allow mathematical operations with double precision numbers
554 Double_t operator + (const LauParameter& lhs, Double_t rhs);
555 Double_t operator + (Double_t lhs, const LauParameter& rhs);
556 Double_t operator + (const LauParameter& lhs, const LauParameter& rhs);
557 Double_t operator - (const LauParameter& lhs, Double_t rhs);
558 Double_t operator - (Double_t lhs, const LauParameter& rhs);
559 Double_t operator - (const LauParameter& lhs, const LauParameter& rhs);
560 Double_t operator * (const LauParameter& lhs, Double_t rhs);
561 Double_t operator * (Double_t lhs, const LauParameter& rhs);
562 Double_t operator * (const LauParameter& lhs, const LauParameter& rhs);
563 Double_t operator / (const LauParameter& lhs, Double_t rhs);
564 Double_t operator / (Double_t lhs, const LauParameter& rhs);
565 Double_t operator / (const LauParameter& lhs, const LauParameter& rhs);
566 Double_t operator += (Double_t& lhs, const LauParameter& rhs);
567 Double_t operator -= (Double_t& lhs, const LauParameter& rhs);
568 Double_t operator *= (Double_t& lhs, const LauParameter& rhs);
569 Double_t operator /= (Double_t& lhs, const LauParameter& rhs);
570 
572 ostream& operator << (ostream& stream, const LauParameter& par);
573 
575 typedef std::vector< std::vector<LauParameter> > LauParArray;
576 
577 #endif
Double_t range() const
The range allowed for the parameter.
Double_t genValue_
Toy generation value.
Bool_t fixed() const
Check whether the parameter is fixed or floated.
Double_t operator+=(Double_t &lhs, const LauParameter &rhs)
std::map< LauParameter *, Double_t > clones_
The clones of this parameter.
Double_t operator*=(Double_t &lhs, const LauParameter &rhs)
Double_t constraintMean_
Mean value of the Gaussian constraint.
Double_t maxValue() const
The maximum value allowed for the parameter.
LauParameter()
Default constructor.
Definition: LauParameter.cc:30
const TString & name() const
The parameter name.
Double_t operator/(const LauParameter &lhs, Double_t rhs)
Double_t constraintWidth() const
The width of the Gaussian constraint.
Double_t bias() const
The bias in the parameter.
LauParameter * parent_
The parent parameter.
Bool_t gaussConstraint_
Choice to use Gaussian constraint.
Double_t negError() const
The lower error on the parameter.
Double_t minValue() const
The minimum value allowed for the parameter.
Double_t maxValue_
Maximum value for the parameter.
std::vector< std::vector< LauParameter > > LauParArray
Type to define an array of parameters.
Bool_t isLValue() const
Boolean to say it is an L value.
LauParameter & operator*=(Double_t val)
Multiplication assignment operator.
Bool_t firstStage_
Flag whether it is floated only in the first stage of the fit.
Double_t operator-=(Double_t &lhs, const LauParameter &rhs)
void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue)
Set the value and range for the parameter.
void updateClones(Bool_t justValue=kFALSE)
Method to update clone values.
Double_t operator/=(Double_t &lhs, const LauParameter &rhs)
Double_t bias_
Parameter bias.
Double_t operator*(const LauParameter &lhs, Double_t rhs)
Double_t posError() const
The upper error on the parameter.
Double_t error_
The error on the parameter.
Bool_t clone() const
Check whether is a clone or not.
void checkRange()
Method to check whether value provided is whithin the range and that the minimum and maximum limits m...
Double_t pull() const
The pull value for the parameter.
File containing declaration of LauAbsRValue class.
Bool_t firstStage() const
Check whether the parameter should be floated only in the first stage of a two stage fit...
std::ostream & operator<<(std::ostream &os, const LauComplex &z)
Definition: LauComplex.cc:43
Double_t minValue_
Minimum value for the parameter.
Double_t pull_
Parameter pull.
Double_t constraintMean() const
The mean of the Gaussian constraint.
Double_t negError_
The lower error on the parameter.
Bool_t gaussConstraint() const
Check whether a Gaussian constraints is applied.
Double_t gcc_
Global correlation coefficient.
Bool_t secondStage() const
Check whether the parameter should be floated only in the second stage of a two stage fit...
std::vector< LauParameter * > getPars()
Get the LauParameter itself.
Double_t error() const
The error on the parameter.
LauParameter & operator/=(Double_t val)
Division assignment operator.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:33
void randomiseValue()
Randomise the value of the parameter (if it is floating).
void valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError=0.0, Double_t newPosError=0.0)
Set the value and errors on the parameter.
Double_t posError_
The upper error on the parameter.
Double_t operator+(const LauParameter &lhs, Double_t rhs)
LauParameter * parent() const
The parent parameter.
virtual ~LauParameter()
void clone(LauParameter *theparent)
Mark this as a clone of the given parent.
TString name_
The parameter name.
LauParameter & operator-=(Double_t val)
Subtraction assignment operator.
Double_t initValue() const
The initial value of the parameter.
Bool_t secondStage_
Flag whether it is floated only in the second stage of the fit.
Class to store the results from the fit into an ntuple.
Definition: LauFitNtuple.hh:42
Double_t value_
The parameter value.
Bool_t clone_
Flag whether the parameter is a clone.
void updatePull()
Call to update the bias and pull values.
LauParameter * createClone(Double_t constFactor=1.0)
Method to create a clone from the parent parameter using the copy constructor.
void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth)
Add a Gaussian constraint (or modify an existing one)
Bool_t fixed_
Fix/float option for parameter.
Double_t value() const
The value of the parameter.
void wipeClones()
Method to clear the clone parameters.
Double_t operator-(const LauParameter &lhs, Double_t rhs)
Double_t globalCorrelationCoeff() const
The parameter global correlation coefficient.
Double_t constraintWidth_
Width of the Gaussian constraint.
Pure abstract base class for defining a parameter containing an R value.
Definition: LauAbsRValue.hh:29
Double_t genValue() const
The value generated for the parameter.
void removeGaussianConstraint()
Remove the Gaussian constraint.
void errors(Double_t newError, Double_t newNegError, Double_t newPosError)
Set the error values on the parameter.
Double_t initValue_
Initial fit value.
LauParameter & operator=(const LauParameter &rhs)
Copy assignment operator.
LauParameter & operator+=(Double_t val)
Addition assignment operator.