MINT2
FitParDependent.cpp
Go to the documentation of this file.
1 
2 #include "Mint/FitParDependent.h"
3 #include "Mint/FitParRef.h"
4 #include <iostream>
5 
6 using namespace MINT;
7 using namespace std;
8 
9 /*
10 bool FitParDependent::changedSinceLastCall() const{
11  // return true; // for debugging only (effectively switches off caching)
12  for(unsigned int i=0; i < this->size(); i++){
13  if( ((*this)[i]).changedSinceLastCall() ) return true;
14  }
15  // cout << "no change since last call " << endl;
16  return false;
17 }
18 void FitParDependent::rememberFitParValues() const{
19  for(unsigned int i=0; i < this->size(); i++){
20  ((*this)[i]).rememberFitParValues();
21  }
22 }
23 
24 
25 const FitParRef& FitParDependent::operator[](unsigned int i) const{
26  return ((static_cast<const vector<FitParRef>& >(*this))[i]);
27 }
28 
29 */
30 
32  return (0 != fpr.theFitParameter().iFixInit())
33  || (0 == fpr.theFitParameter().stepInit());
34 }
35 
37  for(unsigned int i=0; i < fpd.size(); i++){
38  registerFitParDependence(fpd[i]);
39  }
40  return true;
41 }
43  if(ignoreFitParRef(fpr)) return false;
44 
45  this->push_back(fpr);
46  if(0 != _daddy) _daddy->registerFitParDependence(fpr);
47  return true;
48 }
49 
50 
52 // if(0 != daddy) daddy->registerFitParDependence(*this);
53 // the new scheme is saver as it ensures that everyone has their own
54 // copy of the FitParRefs, with independent instances of _lastValue.
55 
56 
58  : MINT::PolymorphVector<FitParRef>(other), _daddy(other._daddy){
59  if(0 != newDaddy) _daddy = newDaddy;
60 }
61 
63  for(unsigned int i=0; i < this->size(); i++){
64  const FitParameter& fp = ((*this)[i]).theFitParameter();
65  double prev = ((*this)[i]).lastValue();
66  bool ch = (((double) fp) != prev);
67  os << fp << ", prev: " << prev << (ch ? " changed" : "") << ", "
68  << ((*this)[i]).changedSinceLastCall()<< ", "
69  << changedSinceLastCall() << endl;
70  }
71 }
72 
73 //
FitParDependent(IFitParRegister *daddy=0)
virtual bool changedSinceLastCall() const
virtual unsigned int size() const =0
int iFixInit() const
bool ignoreFitParRef(const FitParRef &fpr) const
virtual bool registerFitParDependence(const IFitParDependent &fpd)
virtual unsigned int size() const
IFitParRegister * _daddy
double stepInit() const
void push_back(T &t, const typename T::value_type &a, const typename T::value_type &b, const typename T::value_type &c, const typename T::value_type &d)
const FitParameter & theFitParameter() const
Definition: FitParRef.h:45
void listFitParDependencies(std::ostream &os=std::cout) const