laura is hosted by Hepforge, IPPP Durham
Laura++  v1r0
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 "TString.h"
29 
30 
31 class LauParameter {
32 
33  public:
35  LauParameter();
36 
38 
41  LauParameter(const TString& parName);
42 
44 
47  LauParameter(Double_t parValue);
48 
50 
55  LauParameter(Double_t parValue, Double_t min, Double_t max);
56 
58 
64  LauParameter(Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
65 
67 
73  LauParameter(Double_t parValue, Double_t parError, Double_t min, Double_t max);
74 
76 
80  LauParameter(const TString& parName, Double_t parValue);
81 
83 
89  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max);
90 
92 
99  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
100 
102 
109  LauParameter(const TString& parName, Double_t parValue, Double_t parError, Double_t min, Double_t max);
110 
111  // Destructor
112  virtual ~LauParameter(){}
113 
115 
118  LauParameter(const LauParameter& rhs);
119 
121 
124  LauParameter& operator=(const LauParameter& rhs);
125 
126  // the simple accessor functions
127 
129 
132  inline const TString& name() const {return name_;}
133 
135 
138  inline Double_t value() const {return value_;}
139 
141 
144  inline Double_t error() const {return error_;}
145 
147 
150  inline Double_t negError() const {return negError_;}
151 
153 
156  inline Double_t posError() const {return posError_;}
157 
159 
162  inline Double_t genValue() const {return genValue_;}
163 
165 
168  inline Double_t initValue() const {return initValue_;}
169 
171 
174  inline Double_t minValue() const {return minValue_;}
175 
177 
180  inline Double_t maxValue() const {return maxValue_;}
181 
183 
186  inline Double_t range() const {return this->maxValue() - this->minValue();}
187 
189 
192  inline Bool_t fixed() const {return fixed_;}
193 
195 
198  inline Bool_t firstStage() const {return firstStage_;}
199 
201 
204  inline Bool_t secondStage() const {return secondStage_;}
205 
207 
210  inline Double_t bias() const {return bias_;}
211 
213 
216  inline Double_t pull() const {return pull_;}
217 
218  // the simple "setter" functions
219 
221 
224  void name(const TString& newName);
225 
227 
230  void value(Double_t newValue);
231 
233 
236  void error(Double_t newError);
237 
239 
242  void negError(Double_t newNegError);
243 
245 
248  void posError(Double_t newPosError);
249 
251 
256  void errors(Double_t newError, Double_t newNegError, Double_t newPosError);
257 
259 
265  void valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError = 0.0, Double_t newPosError = 0.0);
266 
268 
271  void genValue(Double_t newGenValue);
272 
274 
277  void initValue(Double_t newInitValue);
278 
280 
283  void minValue(Double_t newMinValue);
284 
286 
289  void maxValue(Double_t newMaxValue);
290 
292 
296  void range(Double_t newMinValue, Double_t newMaxValue);
297 
299 
304  void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue);
305 
307 
310  void fixed(Bool_t parFixed);
311 
313 
316  void firstStage(Bool_t firstStagePar);
317 
319 
322  void secondStage(Bool_t secondStagePar);
323 
324  // operators
325 
327 
330  LauParameter& operator = (Double_t val);
331 
333 
336  LauParameter& operator += (Double_t val);
337 
339 
342  LauParameter& operator -= (Double_t val);
343 
345 
348  LauParameter& operator *= (Double_t val);
349 
351 
354  LauParameter& operator /= (Double_t val);
355 
356  // functions for the cloning mechanism
357 
359 
362  inline Bool_t clone() const {return clone_;}
363 
365 
369  LauParameter* createClone(Double_t constFactor = 1.0);
370 
372 
377  LauParameter* createClone(const TString& newName, Double_t constFactor = 1.0);
378 
380  void updatePull();
381 
383 
386  void randomiseValue();
387 
389 
397  void randomiseValue(Double_t minVal, Double_t maxVal);
398 
399  protected:
401 
406  void checkRange(Double_t val, Double_t minVal, Double_t maxVal);
407 
409  inline void checkRange()
410  {
411  this->checkRange(this->value(),this->minValue(),this->maxValue());
412  }
413 
415 
418  inline void clone(LauParameter* theparent) {
419  parent_ = theparent;
420  clone_ = (parent_==0) ? kFALSE : kTRUE;
421  }
422 
424 
427  inline LauParameter* parent() const {return parent_;}
428 
430  inline void wipeClones() {clones_.clear();}
431 
433 
436  void updateClones(Bool_t justValue = kFALSE);
437 
438  private:
440  friend class LauFitNtuple;
441 
443  TString name_;
444 
446  Double_t value_;
447 
449  Double_t error_;
451  Double_t negError_;
453  Double_t posError_;
454 
456  Double_t genValue_;
457 
459  Double_t initValue_;
461  Double_t minValue_;
463  Double_t maxValue_;
465  Bool_t fixed_;
467  Bool_t firstStage_;
469  Bool_t secondStage_;
470 
472  Double_t bias_;
474  Double_t pull_;
475 
477  Bool_t clone_;
480 
482  std::map<LauParameter*, Double_t> clones_;
483 
484  ClassDef(LauParameter, 0)
485 
486 };
487 
488 // operators to allow mathematical operations with double precision numbers
489 Double_t operator + (const LauParameter& lhs, Double_t rhs);
490 Double_t operator + (Double_t lhs, const LauParameter& rhs);
491 Double_t operator + (const LauParameter& lhs, const LauParameter& rhs);
492 Double_t operator - (const LauParameter& lhs, Double_t rhs);
493 Double_t operator - (Double_t lhs, const LauParameter& rhs);
494 Double_t operator - (const LauParameter& lhs, const LauParameter& rhs);
495 Double_t operator * (const LauParameter& lhs, Double_t rhs);
496 Double_t operator * (Double_t lhs, const LauParameter& rhs);
497 Double_t operator * (const LauParameter& lhs, const LauParameter& rhs);
498 Double_t operator / (const LauParameter& lhs, Double_t rhs);
499 Double_t operator / (Double_t lhs, const LauParameter& rhs);
500 Double_t operator / (const LauParameter& lhs, const LauParameter& rhs);
501 Double_t operator += (Double_t& lhs, const LauParameter& rhs);
502 Double_t operator -= (Double_t& lhs, const LauParameter& rhs);
503 Double_t operator *= (Double_t& lhs, const LauParameter& rhs);
504 Double_t operator /= (Double_t& lhs, const LauParameter& rhs);
505 
507 ostream& operator << (ostream& stream, const LauParameter& par);
508 
510 typedef std::vector< std::vector<LauParameter> > LauParArray;
511 
512 #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 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 bias() const
The bias in the parameter.
LauParameter * parent_
The parent parameter.
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 negError_
The lower error on the parameter.
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:31
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:41
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.
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 genValue() const
The value generated for the parameter.
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.