laura is hosted by Hepforge, IPPP Durham
Laura++  v2r0
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 
31 
32 class LauParameter : public TObject {
33 
34  public:
36  LauParameter();
37 
39 
42  LauParameter(const TString& parName);
43 
45 
48  LauParameter(Double_t parValue);
49 
51 
56  LauParameter(Double_t parValue, Double_t min, Double_t max);
57 
59 
65  LauParameter(Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
66 
68 
74  LauParameter(Double_t parValue, Double_t parError, Double_t min, Double_t max);
75 
77 
81  LauParameter(const TString& parName, Double_t parValue);
82 
84 
90  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max);
91 
93 
100  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
101 
103 
110  LauParameter(const TString& parName, Double_t parValue, Double_t parError, Double_t min, Double_t max);
111 
112  // Destructor
113  virtual ~LauParameter(){}
114 
116 
119  LauParameter(const LauParameter& rhs);
120 
122 
125  LauParameter& operator=(const LauParameter& rhs);
126 
127  // the simple accessor functions
128 
130 
133  inline const TString& name() const {return name_;}
134 
136 
139  inline Double_t value() const {return value_;}
140 
142 
145  inline Double_t error() const {return error_;}
146 
148 
151  inline Double_t negError() const {return negError_;}
152 
154 
157  inline Double_t posError() const {return posError_;}
158 
160 
163  inline Double_t genValue() const {return genValue_;}
164 
166 
169  inline Double_t initValue() const {return initValue_;}
170 
172 
175  inline Double_t minValue() const {return minValue_;}
176 
178 
181  inline Double_t maxValue() const {return maxValue_;}
182 
184 
187  inline Double_t range() const {return this->maxValue() - this->minValue();}
188 
190 
193  inline Bool_t fixed() const {return fixed_;}
194 
196 
199  inline Bool_t firstStage() const {return firstStage_;}
200 
202 
205  inline Bool_t secondStage() const {return secondStage_;}
206 
208 
211  inline Bool_t gaussConstraint() const {return gaussConstraint_;}
212 
214 
217  inline Double_t constraintMean() const {return constraintMean_;}
218 
220 
223  inline Double_t constraintWidth() const {return constraintWidth_;}
224 
226 
229  inline Double_t globalCorrelationCoeff() const {return gcc_;}
230 
232 
235  inline Double_t bias() const {return bias_;}
236 
238 
241  inline Double_t pull() const {return pull_;}
242 
243  // the simple "setter" functions
244 
246 
249  void name(const TString& newName);
250 
252 
255  void value(Double_t newValue);
256 
258 
261  void error(Double_t newError);
262 
264 
267  void negError(Double_t newNegError);
268 
270 
273  void posError(Double_t newPosError);
274 
276 
281  void errors(Double_t newError, Double_t newNegError, Double_t newPosError);
282 
284 
290  void valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError = 0.0, Double_t newPosError = 0.0);
291 
293 
296  void globalCorrelationCoeff(Double_t newGCCValue);
297 
299 
302  void genValue(Double_t newGenValue);
303 
305 
308  void initValue(Double_t newInitValue);
309 
311 
314  void minValue(Double_t newMinValue);
315 
317 
320  void maxValue(Double_t newMaxValue);
321 
323 
327  void range(Double_t newMinValue, Double_t newMaxValue);
328 
330 
335  void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue);
336 
338 
341  void fixed(Bool_t parFixed);
342 
344 
347  void firstStage(Bool_t firstStagePar);
348 
350 
353  void secondStage(Bool_t secondStagePar);
354 
356 
360  void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth);
361 
364 
365  // operators
366 
368 
371  LauParameter& operator = (Double_t val);
372 
374 
377  LauParameter& operator += (Double_t val);
378 
380 
383  LauParameter& operator -= (Double_t val);
384 
386 
389  LauParameter& operator *= (Double_t val);
390 
392 
395  LauParameter& operator /= (Double_t val);
396 
397  // functions for the cloning mechanism
398 
400 
403  inline Bool_t clone() const {return clone_;}
404 
406 
410  LauParameter* createClone(Double_t constFactor = 1.0);
411 
413 
418  LauParameter* createClone(const TString& newName, Double_t constFactor = 1.0);
419 
421  void updatePull();
422 
424 
427  void randomiseValue();
428 
430 
438  void randomiseValue(Double_t minVal, Double_t maxVal);
439 
440  protected:
442 
447  void checkRange(Double_t val, Double_t minVal, Double_t maxVal);
448 
450  inline void checkRange()
451  {
452  this->checkRange(this->value(),this->minValue(),this->maxValue());
453  }
454 
456 
459  inline void clone(LauParameter* theparent) {
460  parent_ = theparent;
461  clone_ = (parent_==0) ? kFALSE : kTRUE;
462  }
463 
465 
468  inline LauParameter* parent() const {return parent_;}
469 
471  inline void wipeClones() {clones_.clear();}
472 
474 
477  void updateClones(Bool_t justValue = kFALSE);
478 
479  private:
481  friend class LauFitNtuple;
482 
484  TString name_;
485 
487  Double_t value_;
488 
490  Double_t error_;
492  Double_t negError_;
494  Double_t posError_;
495 
497  Double_t genValue_;
498 
500  Double_t initValue_;
502  Double_t minValue_;
504  Double_t maxValue_;
505 
507  Bool_t fixed_;
509  Bool_t firstStage_;
511  Bool_t secondStage_;
512 
516  Double_t constraintMean_;
519 
521  Double_t gcc_;
522 
524  Double_t bias_;
526  Double_t pull_;
527 
529  Bool_t clone_;
532 
534  std::map<LauParameter*, Double_t> clones_;
535 
536  ClassDef(LauParameter, 1)
537 
538 };
539 
540 // operators to allow mathematical operations with double precision numbers
541 Double_t operator + (const LauParameter& lhs, Double_t rhs);
542 Double_t operator + (Double_t lhs, const LauParameter& rhs);
543 Double_t operator + (const LauParameter& lhs, const LauParameter& rhs);
544 Double_t operator - (const LauParameter& lhs, Double_t rhs);
545 Double_t operator - (Double_t lhs, const LauParameter& rhs);
546 Double_t operator - (const LauParameter& lhs, const LauParameter& rhs);
547 Double_t operator * (const LauParameter& lhs, Double_t rhs);
548 Double_t operator * (Double_t lhs, const LauParameter& rhs);
549 Double_t operator * (const LauParameter& lhs, const LauParameter& rhs);
550 Double_t operator / (const LauParameter& lhs, Double_t rhs);
551 Double_t operator / (Double_t lhs, const LauParameter& rhs);
552 Double_t operator / (const LauParameter& lhs, const LauParameter& rhs);
553 Double_t operator += (Double_t& lhs, const LauParameter& rhs);
554 Double_t operator -= (Double_t& lhs, const LauParameter& rhs);
555 Double_t operator *= (Double_t& lhs, const LauParameter& rhs);
556 Double_t operator /= (Double_t& lhs, const LauParameter& rhs);
557 
559 ostream& operator << (ostream& stream, const LauParameter& par);
560 
562 typedef std::vector< std::vector<LauParameter> > LauParArray;
563 
564 #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.
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.
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...
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:32
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.
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.