laura is hosted by Hepforge, IPPP Durham
Laura++  v3r0
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 <iosfwd>
26 #include <map>
27 #include <vector>
28 
29 #include "TObject.h"
30 #include "TString.h"
31 #include "LauAbsRValue.hh"
32 
33 
34 class LauParameter : public TObject, public LauAbsRValue {
35 
36  public:
38  LauParameter();
39 
41 
44  LauParameter(const TString& parName);
45 
47 
50  LauParameter(Double_t parValue);
51 
53 
58  LauParameter(Double_t parValue, Double_t min, Double_t max);
59 
61 
67  LauParameter(Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
68 
70 
76  LauParameter(Double_t parValue, Double_t parError, Double_t min, Double_t max);
77 
79 
83  LauParameter(const TString& parName, Double_t parValue);
84 
86 
92  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max);
93 
95 
102  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
103 
105 
112  LauParameter(const TString& parName, Double_t parValue, Double_t parError, Double_t min, Double_t max);
113 
114  // Destructor
115  virtual ~LauParameter(){}
116 
118 
121  LauParameter(const LauParameter& rhs);
122 
124 
127  LauParameter& operator=(const LauParameter& rhs);
128 
129  // the simple accessor functions
130 
132 
135  inline const TString& name() const {return name_;}
136 
138 
141  inline Double_t value() const {return value_;}
142 
144 
147  inline Double_t error() const {return error_;}
148 
150 
153  inline Double_t negError() const {return negError_;}
154 
156 
159  inline Double_t posError() const {return posError_;}
160 
162 
165  inline Double_t genValue() const {return genValue_;}
166 
168 
171  inline Double_t initValue() const {return initValue_;}
172 
174 
177  inline Double_t minValue() const {return minValue_;}
178 
180 
183  inline Double_t maxValue() const {return maxValue_;}
184 
186 
189  inline Double_t range() const {return this->maxValue() - this->minValue();}
190 
192 
195  inline Bool_t fixed() const {return fixed_;}
196 
198 
201  inline Bool_t firstStage() const {return firstStage_;}
202 
204 
207  inline Bool_t secondStage() const {return secondStage_;}
208 
210 
213  inline Bool_t gaussConstraint() const {return gaussConstraint_;}
214 
216 
219  inline Double_t constraintMean() const {return constraintMean_;}
220 
222 
225  inline Double_t constraintWidth() const {return constraintWidth_;}
226 
228 
231  inline Double_t globalCorrelationCoeff() const {return gcc_;}
232 
234 
237  inline Double_t bias() const {return bias_;}
238 
240 
243  inline Double_t pull() const {return pull_;}
244 
246 
249  inline Bool_t isLValue() const {return kTRUE;}
250 
252 
255  std::vector<LauParameter*> getPars();
256 
257  // the simple "setter" functions
258 
260 
263  void name(const TString& newName);
264 
266 
269  void value(Double_t newValue);
270 
272 
275  void error(Double_t newError);
276 
278 
281  void negError(Double_t newNegError);
282 
284 
287  void posError(Double_t newPosError);
288 
290 
295  void errors(Double_t newError, Double_t newNegError, Double_t newPosError);
296 
298 
304  void valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError = 0.0, Double_t newPosError = 0.0);
305 
307 
310  void globalCorrelationCoeff(Double_t newGCCValue);
311 
313 
316  void genValue(Double_t newGenValue);
317 
319 
322  void initValue(Double_t newInitValue);
323 
325 
328  void minValue(Double_t newMinValue);
329 
331 
334  void maxValue(Double_t newMaxValue);
335 
337 
341  void range(Double_t newMinValue, Double_t newMaxValue);
342 
344 
349  void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue);
350 
352 
355  void fixed(Bool_t parFixed);
356 
358 
361  void firstStage(Bool_t firstStagePar);
362 
364 
367  void secondStage(Bool_t secondStagePar);
368 
370 
374  void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth);
375 
378 
379  // operators
380 
382 
385  LauParameter& operator = (Double_t val);
386 
388 
391  LauParameter& operator += (Double_t val);
392 
394 
397  LauParameter& operator -= (Double_t val);
398 
400 
403  LauParameter& operator *= (Double_t val);
404 
406 
409  LauParameter& operator /= (Double_t val);
410 
411  // functions for the cloning mechanism
412 
414 
417  inline Bool_t clone() const {return clone_;}
418 
420 
424  LauParameter* createClone(Double_t constFactor = 1.0);
425 
427 
432  LauParameter* createClone(const TString& newName, Double_t constFactor = 1.0);
433 
435 
438  inline LauParameter* parent() const {return parent_;}
439 
441  void updatePull();
442 
444 
447  void randomiseValue();
448 
450 
458  void randomiseValue(Double_t minVal, Double_t maxVal);
459 
460  protected:
462 
467  void checkRange(Double_t val, Double_t minVal, Double_t maxVal);
468 
470  inline void checkRange()
471  {
472  this->checkRange(this->value(),this->minValue(),this->maxValue());
473  }
474 
476 
479  inline void clone(LauParameter* theparent) {
480  parent_ = theparent;
481  clone_ = (parent_==0) ? kFALSE : kTRUE;
482  }
483 
485  inline void wipeClones() {clones_.clear();}
486 
488 
491  void updateClones(Bool_t justValue);
492 
493  private:
495  friend class LauFitNtuple;
496 
498  TString name_;
499 
501  Double_t value_;
502 
504  Double_t error_;
506  Double_t negError_;
508  Double_t posError_;
509 
511  Double_t genValue_;
512 
514  Double_t initValue_;
516  Double_t minValue_;
518  Double_t maxValue_;
519 
521  Bool_t fixed_;
523  Bool_t firstStage_;
525  Bool_t secondStage_;
526 
530  Double_t constraintMean_;
533 
535  Double_t gcc_;
536 
538  Double_t bias_;
540  Double_t pull_;
541 
543  Bool_t clone_;
546 
548  std::map<LauParameter*, Double_t> clones_;
549 
550  ClassDef(LauParameter, 1)
551 
552 };
553 
554 // operators to allow mathematical operations with double precision numbers
555 Double_t operator + (const LauParameter& lhs, Double_t rhs);
556 Double_t operator + (Double_t lhs, const LauParameter& rhs);
557 Double_t operator + (const LauParameter& lhs, const LauParameter& rhs);
558 Double_t operator - (const LauParameter& lhs, Double_t rhs);
559 Double_t operator - (Double_t lhs, const LauParameter& rhs);
560 Double_t operator - (const LauParameter& lhs, const LauParameter& rhs);
561 Double_t operator * (const LauParameter& lhs, Double_t rhs);
562 Double_t operator * (Double_t lhs, const LauParameter& rhs);
563 Double_t operator * (const LauParameter& lhs, const LauParameter& rhs);
564 Double_t operator / (const LauParameter& lhs, Double_t rhs);
565 Double_t operator / (Double_t lhs, const LauParameter& rhs);
566 Double_t operator / (const LauParameter& 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 Double_t operator /= (Double_t& lhs, const LauParameter& rhs);
571 
573 std::ostream& operator << (std::ostream& stream, const LauParameter& par);
574 
576 typedef std::vector< std::vector<LauParameter> > LauParArray;
577 
578 #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)
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:34
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.