laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauParameter.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2006 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
36 #ifndef LAU_PARAMETER
37 #define LAU_PARAMETER
38 
39 #include <iosfwd>
40 #include <map>
41 #include <vector>
42 
43 #include "TObject.h"
44 #include "TString.h"
45 #include "LauAbsRValue.hh"
46 #include "LauBlind.hh"
47 
48 
49 class LauParameter : public TObject, public LauAbsRValue {
50 
51  public:
53  LauParameter();
54 
56 
59  explicit LauParameter(const TString& parName);
60 
62 
65  explicit LauParameter(Double_t parValue);
66 
68 
73  LauParameter(Double_t parValue, Double_t min, Double_t max);
74 
76 
82  LauParameter(Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
83 
85 
91  LauParameter(Double_t parValue, Double_t parError, Double_t min, Double_t max);
92 
94 
98  LauParameter(const TString& parName, Double_t parValue);
99 
101 
107  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max);
108 
110 
117  LauParameter(const TString& parName, Double_t parValue, Double_t min, Double_t max, Bool_t parFixed);
118 
120 
127  LauParameter(const TString& parName, Double_t parValue, Double_t parError, Double_t min, Double_t max);
128 
129  // Destructor
130  virtual ~LauParameter();
131 
133 
136  LauParameter(const LauParameter& rhs);
137 
139 
142  LauParameter& operator=(const LauParameter& rhs);
143 
144  // the simple accessor functions
145 
147 
150  inline const TString& name() const {return name_;}
151 
153 
156  inline Bool_t blind() const {return (blinder_ != 0);}
157 
159 
162  inline const LauBlind* blinder() const {return blinder_;}
163 
165 
168  inline Double_t value() const {return value_;}
169 
171 
174  inline Double_t unblindValue() const {return (blinder_==0) ? value_ : blinder_->unblind(value_);}
175 
177 
180  inline Double_t error() const {return error_;}
181 
183 
186  inline Double_t negError() const {return negError_;}
187 
189 
192  inline Double_t posError() const {return posError_;}
193 
195 
198  inline Double_t genValue() const {return genValue_;}
199 
201 
204  inline Double_t initValue() const {return initValue_;}
205 
207 
210  inline Double_t minValue() const {return minValue_;}
211 
213 
216  inline Double_t maxValue() const {return maxValue_;}
217 
219 
222  inline Double_t range() const {return this->maxValue() - this->minValue();}
223 
225 
228  inline Bool_t fixed() const {return fixed_;}
229 
231 
234  inline Bool_t secondStage() const {return secondStage_;}
235 
237 
240  inline Bool_t gaussConstraint() const {return gaussConstraint_;}
241 
243 
246  inline Double_t constraintMean() const {return constraintMean_;}
247 
249 
252  inline Double_t constraintWidth() const {return constraintWidth_;}
253 
255 
258  inline Double_t globalCorrelationCoeff() const {return gcc_;}
259 
261 
264  inline Double_t bias() const {return bias_;}
265 
267 
270  inline Double_t pull() const {return pull_;}
271 
273 
276  inline Bool_t isLValue() const {return kTRUE;}
277 
279 
282  std::vector<LauParameter*> getPars();
283 
284  // the simple "setter" functions
285 
287 
290  void name(const TString& newName);
291 
293 
296  void value(Double_t newValue);
297 
299 
302  void error(Double_t newError);
303 
305 
308  void negError(Double_t newNegError);
309 
311 
314  void posError(Double_t newPosError);
315 
317 
322  void errors(Double_t newError, Double_t newNegError, Double_t newPosError);
323 
325 
331  void valueAndErrors(Double_t newValue, Double_t newError, Double_t newNegError = 0.0, Double_t newPosError = 0.0);
332 
334 
337  void globalCorrelationCoeff(Double_t newGCCValue);
338 
340 
343  void genValue(Double_t newGenValue);
344 
346 
349  void initValue(Double_t newInitValue);
350 
352 
355  void minValue(Double_t newMinValue);
356 
358 
361  void maxValue(Double_t newMaxValue);
362 
364 
368  void range(Double_t newMinValue, Double_t newMaxValue);
369 
371 
376  void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue);
377 
379 
382  void fixed(Bool_t parFixed);
383 
385 
388  void secondStage(Bool_t secondStagePar);
389 
391 
395  void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth);
396 
399 
401 
407  void blindParameter(const TString& blindingString, const Double_t width);
408 
409  // functions for the cloning mechanism
410 
412 
415  inline Bool_t clone() const {return clone_;}
416 
418 
422  LauParameter* createClone(Double_t constFactor = 1.0);
423 
425 
430  LauParameter* createClone(const TString& newName, Double_t constFactor = 1.0);
431 
433 
436  inline LauParameter* parent() const {return parent_;}
437 
439  void updatePull();
440 
442 
445  void randomiseValue();
446 
448 
456  void randomiseValue(Double_t minVal, Double_t maxVal);
457 
458  protected:
460 
465  void checkRange(Double_t val, Double_t minVal, Double_t maxVal);
466 
468  inline void checkRange()
469  {
470  this->checkRange(this->value(),this->minValue(),this->maxValue());
471  }
472 
474 
477  inline void clone(LauParameter* theparent) {
478  parent_ = theparent;
479  clone_ = (parent_==0) ? kFALSE : kTRUE;
480  }
481 
483  inline void wipeClones() {clones_.clear();}
484 
486 
489  void updateClones(Bool_t justValue);
490 
491  private:
493  friend class LauFitNtuple;
494 
496  TString name_;
497 
499  Double_t value_;
500 
502  Double_t error_;
504  Double_t negError_;
506  Double_t posError_;
507 
509  Double_t genValue_;
510 
512  Double_t initValue_;
514  Double_t minValue_;
516  Double_t maxValue_;
517 
519  Bool_t fixed_;
521  Bool_t secondStage_;
522 
526  Double_t constraintMean_;
529 
531  Double_t gcc_;
532 
534  Double_t bias_;
536  Double_t pull_;
537 
539  Bool_t clone_;
540 
543 
545  std::map<LauParameter*, Double_t> clones_;
546 
549 
550  ClassDef(LauParameter, 3)
551 
552 };
553 
555 std::ostream& operator << (std::ostream& stream, const LauParameter& par);
556 
558 typedef std::vector< std::vector<LauParameter> > LauParArray;
559 
560 #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:44
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:57
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:49
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:70
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:58
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:42
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:43
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.