laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
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 "LauAbsRValue.hh"
40 #include "LauBlind.hh"
41 
42 #include "TObject.h"
43 #include "TString.h"
44 
45 #include <iosfwd>
46 #include <map>
47 #include <vector>
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,
128  Double_t parValue,
129  Double_t parError,
130  Double_t min,
131  Double_t max );
132 
133  // Destructor
134  virtual ~LauParameter();
135 
137 
140  LauParameter( const LauParameter& rhs );
141 
143 
146  LauParameter& operator=( const LauParameter& rhs );
147 
148  // the simple accessor functions
149 
151 
154  inline const TString& name() const { return name_; }
155 
157 
160  inline Bool_t blind() const { return ( blinder_ != 0 ); }
161 
163 
166  inline const LauBlind* blinder() const { return blinder_; }
167 
169 
172  inline Double_t value() const { return value_; }
173 
175 
178  inline Double_t unblindValue() const
179  {
180  return ( blinder_ == 0 ) ? value_ : blinder_->unblind( value_ );
181  }
182 
184 
187  inline Double_t error() const { return error_; }
188 
190 
193  inline Double_t negError() const { return negError_; }
194 
196 
199  inline Double_t posError() const { return posError_; }
200 
202 
205  inline Double_t genValue() const { return genValue_; }
206 
208 
211  inline Double_t initValue() const { return initValue_; }
212 
214 
217  inline Double_t minValue() const { return minValue_; }
218 
220 
223  inline Double_t maxValue() const { return maxValue_; }
224 
226 
229  inline Double_t range() const { return this->maxValue() - this->minValue(); }
230 
232 
235  inline Bool_t fixed() const { return fixed_; }
236 
238 
241  inline Bool_t secondStage() const { return secondStage_; }
242 
244 
247  inline Bool_t gaussConstraint() const { return gaussConstraint_; }
248 
250 
253  Double_t constraintPenalty() const;
254 
256 
259  inline Double_t globalCorrelationCoeff() const { return gcc_; }
260 
262 
265  inline Double_t bias() const { return bias_; }
266 
268 
271  inline Double_t pull() const { return pull_; }
272 
274 
277  inline Bool_t isLValue() const { return kTRUE; }
278 
280 
283  std::vector<LauParameter*> getPars();
284 
285  // the simple "setter" functions
286 
288 
291  void name( const TString& newName );
292 
294 
297  void value( Double_t newValue );
298 
300 
303  void error( Double_t newError );
304 
306 
309  void negError( Double_t newNegError );
310 
312 
315  void posError( Double_t newPosError );
316 
318 
323  void errors( Double_t newError, Double_t newNegError, Double_t newPosError );
324 
326 
332  void valueAndErrors( Double_t newValue,
333  Double_t newError,
334  Double_t newNegError = 0.0,
335  Double_t newPosError = 0.0 );
336 
338 
341  void globalCorrelationCoeff( Double_t newGCCValue );
342 
344 
347  void genValue( Double_t newGenValue );
348 
350 
353  void initValue( Double_t newInitValue );
354 
356 
359  void minValue( Double_t newMinValue );
360 
362 
365  void maxValue( Double_t newMaxValue );
366 
368 
372  void range( Double_t newMinValue, Double_t newMaxValue );
373 
375 
380  void valueAndRange( Double_t newValue, Double_t newMinValue, Double_t newMaxValue );
381 
383 
386  void fixed( Bool_t parFixed );
387 
389 
392  void secondStage( Bool_t secondStagePar );
393 
395 
399  void addGaussianConstraint( Double_t newGaussMean, Double_t newGaussWidth );
400 
403 
405  void generateConstraintMean();
406 
408 
414  void blindParameter( const TString& blindingString, const Double_t width );
415 
416  // functions for the cloning mechanism
417 
419 
422  inline Bool_t clone() const { return clone_; }
423 
425 
429  LauParameter* createClone( Double_t constFactor = 1.0 );
430 
432 
437  LauParameter* createClone( const TString& newName, Double_t constFactor = 1.0 );
438 
440 
443  inline LauParameter* parent() const { return parent_; }
444 
446  void updatePull();
447 
449 
452  void randomiseValue();
453 
455 
463  void randomiseValue( Double_t minVal, Double_t maxVal );
464 
465  protected:
467 
472  void checkRange( Double_t val, Double_t minVal, Double_t maxVal );
473 
475  inline void checkRange()
476  {
477  this->checkRange( this->value(), this->minValue(), this->maxValue() );
478  }
479 
481 
484  inline void clone( LauParameter* theparent )
485  {
486  parent_ = theparent;
487  clone_ = ( parent_ == 0 ) ? kFALSE : kTRUE;
488  }
489 
491  inline void wipeClones() { clones_.clear(); }
492 
494 
497  void updateClones( Bool_t justValue );
498 
499  private:
501  friend class LauFitNtuple;
502 
504  friend class LauFitObject;
505 
507  TString name_;
508 
510  Double_t value_;
511 
513  Double_t error_;
515  Double_t negError_;
517  Double_t posError_;
518 
520  Double_t genValue_;
521 
523  Double_t initValue_;
525  Double_t minValue_;
527  Double_t maxValue_;
528 
530  Bool_t fixed_;
532  Bool_t secondStage_;
533 
539  Double_t constraintMean_;
542 
544  Double_t gcc_;
545 
547  Double_t bias_;
549  Double_t pull_;
550 
552  Bool_t clone_;
553 
556 
558  std::map<LauParameter*, Double_t> clones_;
559 
562 
563  ClassDef( LauParameter, 4 )
564 };
565 
567 std::ostream& operator<<( std::ostream& stream, const LauParameter& par );
568 
570 typedef std::vector<std::vector<LauParameter>> LauParArray;
571 
572 #endif
Double_t globalCorrelationCoeff() const
The parameter global correlation coefficient.
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.
LauBlind * blinder_
The blinding engine.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:49
void removeGaussianConstraint()
Remove the Gaussian constraint.
Double_t unblindValue() const
The unblinded value of the parameter.
Double_t unblind(const Double_t val) const
Obtain the unblinded value.
Definition: LauBlind.hh:70
Double_t value() const
The value of the parameter.
Double_t posError_
The upper error on the parameter.
const LauBlind * blinder() const
Access the blinder object.
void clone(LauParameter *theparent)
Mark this as a clone of the given parent.
Bool_t clone_
Flag whether the parameter is a clone.
void generateConstraintMean()
Generate per-experiment constraint mean.
Double_t minValue_
Minimum value for the parameter.
Double_t minValue() const
The minimum value allowed for the parameter.
void randomiseValue()
Randomise the value of the parameter (if it is floating).
Double_t initValue_
Initial fit value.
File containing declaration of LauAbsRValue class.
Bool_t secondStage() const
Check whether the parameter should be floated only in the second stage of a two stage fit.
LauParameter * parent() const
The parent parameter.
Bool_t blind() const
The blinding state.
void wipeClones()
Method to clear the clone parameters.
Class for blinding and unblinding a number based on a blinding string.
Definition: LauBlind.hh:42
std::ostream & operator<<(std::ostream &stream, const LauParameter &par)
Output stream operator.
Bool_t clone() const
Check whether is a clone or not.
LauParameter & operator=(const LauParameter &rhs)
Copy assignment operator.
Class to store the results from the fit into an ntuple.
Definition: LauFitNtuple.hh:58
LauParameter * createClone(Double_t constFactor=1.0)
Method to create a clone from the parent parameter using the copy constructor.
Double_t maxValue() const
The maximum value allowed for the parameter.
void blindParameter(const TString &blindingString, const Double_t width)
Blind the parameter.
Double_t constraintMean_
Mean value of the Gaussian constraint.
std::vector< std::vector< LauParameter > > LauParArray
Type to define an array of parameters.
Double_t posError() const
The upper error on the parameter.
Bool_t fixed() const
Check whether the parameter is fixed or floated.
LauParameter()
Default constructor.
Definition: LauParameter.cc:40
Double_t constraintWidth_
Width of the Gaussian constraint.
void addGaussianConstraint(Double_t newGaussMean, Double_t newGaussWidth)
Add a Gaussian constraint (or modify an existing one)
Pure abstract base class for defining a parameter containing an R value.
Definition: LauAbsRValue.hh:45
Double_t maxValue_
Maximum value for the parameter.
const TString & name() const
The parameter name.
Double_t pull() const
The pull value for the parameter.
LauParameter * parent_
The parent parameter.
Double_t error() const
The error on the parameter.
Bool_t gaussConstraint() const
Check whether a Gaussian constraints is applied.
Double_t bias() const
The bias in the parameter.
Bool_t fixed_
Fix/float option for parameter.
Bool_t isLValue() const
Boolean to say it is an L value.
void errors(Double_t newError, Double_t newNegError, Double_t newPosError)
Set the error values on the parameter.
Double_t range() const
The range allowed for the parameter.
File containing declaration of LauBlind class.
void updatePull()
Call to update the bias and pull values.
void updateClones(Bool_t justValue)
Method to update clone values.
TString name_
The parameter name.
The abstract interface for the objects that control the calculation of the likelihood.
Definition: LauFitObject.hh:47
Double_t genValue_
Toy generation value.
Double_t value_
The parameter value.
Double_t genValue() const
The value generated for the parameter.
Double_t negError() const
The lower error on the parameter.
Double_t constraintTrueMean_
True mean of the Gaussian constraint.
Double_t negError_
The lower error on the parameter.
std::vector< LauParameter * > getPars()
Get the LauParameter itself.
Bool_t secondStage_
Flag whether it is floated only in the second stage of the fit.
Double_t bias_
Parameter bias.
void valueAndRange(Double_t newValue, Double_t newMinValue, Double_t newMaxValue)
Set the value and range for the parameter.
Double_t pull_
Parameter pull.
Double_t gcc_
Global correlation coefficient.
Bool_t gaussConstraint_
Choice to use Gaussian constraint.
Double_t initValue() const
The initial value of the parameter.
std::map< LauParameter *, Double_t > clones_
The clones of this parameter.
Double_t error_
The error on the parameter.
Double_t constraintPenalty() const
The penalty term from the Gaussian constraint.
void checkRange()
Method to check whether value provided is whithin the range and that the minimum and maximum limits m...