AmpTools
MinuitParameter.h
Go to the documentation of this file.
1 #if !defined(MINUITINTERFACE_MINUITPARAMETER_H)
2 #define MINUITINTERFACE_MINUITPARAMETER_H
3 
4 // This file is a part of MinuitInterface - a front end for the Minuit minimization
5 // package (Minuit itself was authored by Fred James, of CERN)
6 //
7 //
8 // Copyright Cornell University 1993, 1996, All Rights Reserved.
9 //
10 // This software written by Lawrence Gibbons, Cornell University.
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions
14 // are met:
15 // 1. Redistributions of source code must retain the above copyright
16 // notice and author attribution, this list of conditions and the
17 // following disclaimer.
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice and author attribution, this list of conditions and the
20 // following disclaimer in the documentation and/or other materials
21 // provided with the distribution.
22 // 3. Neither the name of the University nor the names of its contributors
23 // may be used to endorse or promote products derived from this software
24 // without specific prior written permission.
25 //
26 // Creation of derivative forms of this software for commercial
27 // utilization may be subject to restriction; written permission may be
28 // obtained from Cornell University.
29 //
30 // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way
31 // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR
32 // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
33 // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS,
34 // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be
35 // held liable for any liability with respect to any claim by the user or any
36 // other party arising from use of the program.
37 //
38 
41 
43 
44 class MinuitParameter : public Parameter {
45 
46  friend class MinuitParameterManager;
47  enum { kUnknownMinuitId = 0 };
48 
49 public:
50  MinuitParameter( const std::string& name,
51  MinuitParameterManager& aManager,
52  double initialValue = 0,
53  bool bounded = false,
54  double lowerBound = 0,
55  double upperBound = 0 );
56 
57  virtual ~MinuitParameter();
58 
59  // user allowed changes in the status of the parameter:
60  void fix(); // keep parameter constant during minimization
61  void free(); // allow parameter to float during minimization
62  void bound( double lowerBound, double upperBound ); // limit parameter range in minimization
63  void unbound();
64 
65  unsigned int minuitId() const;
66  bool floating() const;
67 
68  double error() const; // symmetric (parabolic) error
69  const AsymmetricError& asymmetricErrors() const;
70  double globalCorrelationCoefficient() const;
71 
72  bool bounded() const;
73  double lowerBound() const;
74  double upperBound() const;
75 
76  void registerWithManager();
77  void unregister();
78 
79  std::ostream& dump( std::ostream& aStream ) const;
80 
81 protected:
82  // status changes managed by MinuitParameterManager
83  void invalidateErrors();
84  void validateErrors();
85  void setParabolicError( double newParabolicError );
86  void setAsymmetricErrors( const std::pair<double,double>& newAsymmetricErrors );
88  void setMinuitId( unsigned int minuitId );
89 
90 private:
91  MinuitParameter(); // stop default
92  MinuitParameter( const MinuitParameter& ); // stop default
93  const MinuitParameter& operator=( const MinuitParameter& rhs ); // stop default
94 
95  // --------- member data ----------
96 
97  unsigned int m_minuitId;
98  bool m_floating;
99 
100  double m_lowerBound;
101  double m_upperBound;
102  bool m_bounded;
103 
104  bool m_validErrors;
105  double m_parabolicError;
106  AsymmetricError m_asymmetricErrors;
107 
108  double m_globalCorrelationCoefficient;
109 
110  MinuitParameterManager& m_parameterManager;
111 };
112 inline std::ostream& operator<<( std::ostream& aStream,
113  const MinuitParameter& aParameter ) {
114  return aParameter.dump( aStream );
115 }
116 #endif
double lowerBound() const
std::ostream & operator<<(std::ostream &aStream, const MinuitParameter &aParameter)
bool floating() const
void setParabolicError(double newParabolicError)
std::ostream & dump(std::ostream &aStream) const
bool bounded() const
void registerWithManager()
void setGlobalCorrelation(double globalCorrelationCoefficient)
void bound(double lowerBound, double upperBound)
void setAsymmetricErrors(const std::pair< double, double > &newAsymmetricErrors)
double error() const
void setMinuitId(unsigned int minuitId)
double upperBound() const
double globalCorrelationCoefficient() const
const std::string & name() const
Definition: Parameter.cc:80
unsigned int minuitId() const
const AsymmetricError & asymmetricErrors() const
virtual ~MinuitParameter()