AmpTools
MinuitParameterManager.h
Go to the documentation of this file.
1 #if !defined(MINUITINTERFACE_MINUITPARAMETERMANAGER_H)
2 #define MINUITINTERFACE_MINUITPARAMETERMANAGER_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 
39 #include <iostream>
40 
41 #include <list>
42 #include <string>
43 #include <vector>
44 
46 
47 // forward declarations
48 class MinuitParameter;
50 
51 using namespace std;
52 
53 class MinuitParameterManager : public std::list<MinuitParameter*>
54 {
55  friend class MinuitParameter;
57 
58 public:
59 
60  // con/destructors
63 
64  // update parameter-related values
65  void update(); // central values only
66  void updateErrors(); // will only update if a fit is not in progress
67 
68  // synchronize minuit to current parameter states (fixed, floating, etc.)
69  void synchronizeMinuit();
70 
71  // to be implemented
72  // vector<ValuePair> scanParameter(int numberPointsInScan);
73  // vector<ParameterPair> scanParameterPair( int numberPointsInScan,
74  // double deltaFunction=1 );
75 
76  // could use some external matrix class... this works for now
77  vector< vector< double > > covarianceMatrix();
78  vector< vector< double > > correlationMatrix();
79 
80  // dump the list of parameters to an ostream. It will generally be more
81  // convenient to use the << operator defined as an inline below
82  std::ostream& dump( std::ostream& s ) const;
83 
84  int numFloatingPars() const { return m_numFloatingPars; }
85 
86  // ------------ static member functions ---------------------
87 
88 protected:
89  // allow a MinuitParameter to register itself
90  bool registerParameter( MinuitParameter* newParameter );
91 
92  // allow a MinuitParameter to remove itself from management
93  void removeParameter( MinuitParameter* aParameter );
94 
95  // to maintain efficiency, MinuitMinimizationManager can inform when a fit is in progress
96  void fitInProgress() { m_fitInProgress = true;}
97  void noFitInProgress() { m_fitInProgress = false;}
98 
99 private:
100  // make default constructor private: must pass in a MinuitMinimizationManager object
102 
103  // no defaulted copy constructor or assignment operators
105 
106  // ----------------------- member items --------------------------
107 
108  MinuitMinimizationManager& m_minimizationManager; // the controlling minimization manager
109  bool m_fitInProgress;
110 
111  int m_numFloatingPars;
112 
113  // ------------ static data members -------------------------
114 };
115 
116 inline std::ostream& operator<<( std::ostream& aStream,
117  const MinuitParameterManager& aManager )
118 {
119  return aManager.dump( aStream );
120 }
121 #endif
std::ostream & dump(std::ostream &s) const
std::ostream & operator<<(std::ostream &aStream, const MinuitParameterManager &aManager)