MINT2
Neg2LLConstraint.h
Go to the documentation of this file.
1 #ifndef NEG_TWO_LL_Constraint_HH
2 #define NEG_TWO_LL_Constraint_HH
3 // author: Philippe d'Argent (p.dargent@cern.ch)
4 
5 #include "TMath.h"
6 #include "Mint/Minimisable.h"
8 
9 #include <vector>
10 
11 namespace MINT{
12 
14  protected:
16  double _mean;
17  double _sigma;
18 
19  public:
20  Neg2LLConstraint(IMinuitParameter* mp, double mean, double sigma, MinuitParameterSet* mps=0)
21  : Minimisable(mps), _mp(mp), _mean(mean), _sigma(sigma) {};
22 
23  virtual void beginFit(){};
24  virtual void parametersChanged(){};
25  virtual void endFit(){};
26 
27  virtual double getVal(){
28  if(0 == _sigma) return 0;
29  double d=((double) *(_mp) -_mean)/_sigma;
30  return d*d;
31  //return -2.* log(gauss((double) *(_mp)) );
32  }
33 
34  virtual double getNewVal(){
36  return getVal();
37  }
38 
39  inline double gauss(double x){
40  if(0 == _sigma) return 0;
41  double d=(x-_mean)/_sigma;
42  double n=1./(sqrt(2.0*TMath::Pi())*_sigma);
43  return n * exp(-0.5*d*d);
44  }
45 
46  virtual ~Neg2LLConstraint(){}
47 
48 };
49 
50 }// namespace MINT
51 #endif
52 //
IMinuitParameter * _mp
Neg2LLConstraint(IMinuitParameter *mp, double mean, double sigma, MinuitParameterSet *mps=0)
virtual double getNewVal()
virtual double getVal()
virtual void parametersChanged()
double gauss(double x)