laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
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 #include "LauBlind.hh"
33 
34 
35 class LauParameter : public TObject, public LauAbsRValue {
36 
37  public:
39  LauParameter();
40 
42 
45  explicit LauParameter(const TString& parName);
46 
48 
51  explicit LauParameter(Double_t parValue);
52 
54 
59  LauParameter(Double_t parValue, Double_t min, Double_t max);
60 
62 
68  LauParameter(Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
69 
71 
77  LauParameter(Double_t parValue, Double_t parError, Double_t min, Double_t max);
78 
80 
84  LauParameter(const TString& parName, Double_t parValue);
85 
87 
93  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max);
94 
96 
103  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
104 
106 
113  LauParameter(const TString& parName, Double_t parValue, Double_t parError, Double_t min, Double_t max);
114 
115  // Destructor
116  virtual ~LauParameter();
117 
119 
122  LauParameter(const LauParameter& rhs);
123 
125 
128  LauParameter& operator=(const LauParameter& rhs);
129 
130  // the simple accessor functions
131 
133 
136  inline const TString& name() const {return name_;}
137 
139 
142  inline Bool_t blind() const {return (blinder_ != 0);}
143 
145 
148  inline const LauBlind* blinder() const {return blinder_;}
149 
151 
154  inline Double_t value() const {return value_;}
155 
157 
160  inline Double_t unblindValue() const {return (blinder_==0) ? value_ : blinder_->unblind(value_);}
161 
163 
166  inline Double_t error() const {return error_;}
167 
169 
172  inline Double_t negError() const {return negError_;}
173 
175 
178  inline Double_t posError() const {return posError_;}
179 
181 
184  inline Double_t genValue() const {return genValue_;}
185 
187 
190  inline Double_t initValue() const {return initValue_;}
191 
193 
196  inline Double_t minValue() const {return minValue_;}
197 
199 
202  inline Double_t maxValue() const {return maxValue_;}
203 
205 
208  inline Double_t range() const {return this->maxValue() - this->minValue();}
209 
211 
214  inline Bool_t fixed() const {return fixed_;}
215 
217 
220  inline Bool_t secondStage() const {return secondStage_;}
221 
223 
226  inline Bool_t gaussConstraint() const {return gaussConstraint_;}
227 
229 
232  inline Double_t constraintMean() const {return constraintMean_;}
233 
235 
238  inline Double_t constraintWidth() const {return constraintWidth_;}
239 
241 
244  inline Double_t globalCorrelationCoeff() const {return gcc_;}
245 
247 
250  inline Double_t bias() const {return bias_;}
251 
253 
256  inline Double_t pull() const {return pull_;}
257 
259 
262  inline Bool_t isLValue() const {return kTRUE;}
263 
265 
268  std::vector<LauParameter*> getPars();
269 
270  // the simple "setter" functions
271 
273 
276  void name(const TString& newName);
277 
279 
282  void value(Double_t newValue);
283 
285 
288  void error(Double_t newError);
289 
291 
294  void negError(Double_t newNegError);
295 
297 
300  void posError(Double_t newPosError);
301 
303 
308  void errors(Double_t newError, Double_t newNegError, Double_t newPosError);
309 
311 
317  void valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError = 0.0, Double_t newPosError = 0.0);
318 
320 
323  void globalCorrelationCoeff(Double_t newGCCValue);
324 
326 
329  void genValue(Double_t newGenValue);
330 
332 
335  void initValue(Double_t newInitValue);
336 
338 
341  void minValue(Double_t newMinValue);
342 
344 
347  void maxValue(Double_t newMaxValue);
348 
350 
354  void range(Double_t newMinValue, Double_t newMaxValue);
355 
357 
362  void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue);
363 
365 
368  void fixed(Bool_t parFixed);
369 
371 
374  void secondStage(Bool_t secondStagePar);
375 
377 
381  void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth);
382 
385 
387 
393  void blindParameter(const TString& blindingString, const Double_t width);
394 
395  // functions for the cloning mechanism
396 
398 
401  inline Bool_t clone() const {return clone_;}
402 
404 
408  LauParameter* createClone(Double_t constFactor = 1.0);
409 
411 
416  LauParameter* createClone(const TString& newName, Double_t constFactor = 1.0);
417 
419 
422  inline LauParameter* parent() const {return parent_;}
423 
425  void updatePull();
426 
428 
431  void randomiseValue();
432 
434 
442  void randomiseValue(Double_t minVal, Double_t maxVal);
443 
444  protected:
446 
451  void checkRange(Double_t val, Double_t minVal, Double_t maxVal);
452 
454  inline void checkRange()
455  {
456  this->checkRange(this->value(),this->minValue(),this->maxValue());
457  }
458 
460 
463  inline void clone(LauParameter* theparent) {
464  parent_ = theparent;
465  clone_ = (parent_==0) ? kFALSE : kTRUE;
466  }
467 
469  inline void wipeClones() {clones_.clear();}
470 
472 
475  void updateClones(Bool_t justValue);
476 
477  private:
479  friend class LauFitNtuple;
480 
482  TString name_;
483 
485  Double_t value_;
486 
488  Double_t error_;
490  Double_t negError_;
492  Double_t posError_;
493 
495  Double_t genValue_;
496 
498  Double_t initValue_;
500  Double_t minValue_;
502  Double_t maxValue_;
503 
505  Bool_t fixed_;
507  Bool_t secondStage_;
508 
512  Double_t constraintMean_;
515 
517  Double_t gcc_;
518 
520  Double_t bias_;
522  Double_t pull_;
523 
525  Bool_t clone_;
526 
529 
531  std::map<LauParameter*, Double_t> clones_;
532 
535 
536  ClassDef(LauParameter, 3)
537 
538 };
539 
541 std::ostream& operator << (std::ostream& stream, const LauParameter& par);
542 
544 typedef std::vector< std::vector<LauParameter> > LauParArray;
545 
546 #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.
std::map< LauParameter *, Double_t > clones_
The clones of this parameter.
Double_t constraintMean_
Mean value of the Gaussian constraint.
File containing declaration of LauBlind class.
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 constraintWidth() const
The width of the Gaussian constraint.
Double_t bias() const
The bias in the parameter.
LauParameter * parent_
The parent parameter.
virtual ~LauParameter()
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.
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 bias_
Parameter bias.
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 blind() const
The blinding state.
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.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:35
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.
LauParameter * parent() const
The parent parameter.
const LauBlind * blinder() const
Access the blinder object.
Double_t unblind(const Double_t val) const
Obtain the unblinded value.
Definition: LauBlind.hh:56
void clone(LauParameter *theparent)
Mark this as a clone of the given parent.
TString name_
The parameter name.
Double_t initValue() const
The initial value of the parameter.
void blindParameter(const TString &blindingString, const Double_t width)
Blind the parameter.
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.
Class to store the results from the fit into an ntuple.
Definition: LauFitNtuple.hh:44
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.
LauBlind * blinder_
The blinding engine.
Class for blinding and unblinding a number based on a blinding string.
Definition: LauBlind.hh:28
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.