MINT2
FitParRef.cpp
Go to the documentation of this file.
1 #include "Mint/FitParRef.h"
3 
4 using namespace MINT;
5 using namespace std;
6 
8  : _lastValue( (-9999. != ((double) fipa) ? -9999.0 : -9998.0 ))
9  , _fp(&fipa){
10  /*
11  cout << "hello from FitParRef::FitParRef with..." << endl;
12  cout << "_lastValue = " << _lastValue << endl;
13  cout << "_fp " << _fp << endl;
14  cout << "daddyPtr = " << daddyPtr << endl;
15  */
16  if(0 != daddyPtr) daddyPtr->registerFitParDependence(*this);
17 }
18 
19 FitParRef::FitParRef(const FitParRef& other, IFitParRegister* newDaddyPtr)
20  : _lastValue( (-9999. != ((double) other) ? -9999.0 : -9998.0 ))
21 // : _lastValue(other._lastValue)
22  , _fp(other._fp){
23  /*
24  cout << "hello from FitParRef::FitParRef with..." << endl;
25  cout << "_lastValue = " << _lastValue << endl;
26  cout << "_fp " << _fp << endl;
27  cout << "daddyPtr = " << daddyPtr << endl;
28  */
29  //cout << "FitParRef copy constructor called" << endl;
30  if(0 != newDaddyPtr) newDaddyPtr->registerFitParDependence(*this);
31 }
32 
33 
35  // we seem to need the assignment operator for
36  // compatibility with some implementations of
37  // std::vector. Annoying. Forces us to use ptr
38  // instead of refererence for FitParameter.
39  _fp = rhs._fp;
40  _lastValue = -9999;
41  if( -9999 == (double) fp()) _lastValue=-9998;
42  return *this;
43 }
44 
45 
46 //bool FitParRef::changedSinceLastCall() const{
47  /*
48  bool changed = ((double) _fp) != _lastValue;
49  if(changed) cout << "canged because " << _fp << " != " << _lastValue << endl;
50  else cout << "not changed" << endl;
51  return changed;
52  */
53 // return ( ((double) _fp) != _lastValue);
54 //}
55 
56 void FitParRef::listFitParDependencies(ostream& os) const{
57  bool ch = changedSinceLastCall();
58  os << fp() << ", prev: " << _lastValue << (ch ? "changed" : "") << endl;
59 }
60 
61 //
virtual bool changedSinceLastCall() const
Definition: FitParRef.h:29
FitParRef & operator=(const FitParRef &rhs)
Definition: FitParRef.cpp:34
const FitParameter * _fp
Definition: FitParRef.h:16
double _lastValue
Definition: FitParRef.h:14
virtual void listFitParDependencies(std::ostream &os=std::cout) const
Definition: FitParRef.cpp:56
virtual bool registerFitParDependence(const IFitParDependent &fpd)=0
FitParRef(const FitParameter &fipa, IFitParRegister *daddyPtr=0)
Definition: FitParRef.cpp:7
const FitParameter & fp() const
Definition: FitParRef.h:17