24 using namespace ROOT::Minuit2;
31 std::vector<double> pos = gdg.
Positions();
33 std::vector<double> var = gdg.
Variances();
42 double dx = pos[1]-pos[0];
44 for(
unsigned int i = 0; i < meas.size(); i++) {
46 x += (meas[i]*pos[i]);
47 x2 += (meas[i]*pos[i]*pos[i]);
51 double rms2 = x2/norm - mean*mean;
52 double rms = rms2 > 0. ?
sqrt(rms2) : 1.;
59 std::vector<double> init_par;
60 init_par.push_back(mean);
61 init_par.push_back(rms);
62 init_par.push_back(area);
65 std::vector<double> init_err;
66 init_err.push_back(0.1);
67 init_err.push_back(0.1);
68 init_err.push_back(0.1);
77 std::cout<<
"minimum: "<<min<<std::endl;
84 upar.
Add(
"mean", mean, 0.1);
85 upar.
Add(
"sigma", rms, 0.1);
86 upar.
Add(
"area", area, 0.1);
95 std::cout<<
"minimum: "<<min<<std::endl;
104 upar.
Add(
"mean", mean, 0.1);
105 upar.
Add(
"sigma", rms, 0.1);
106 upar.
Add(
"area", area, 0.1);
109 upar.
SetLimits(
"mean", mean-0.01, mean+0.01);
124 std::cout<<
"minimum: "<<min<<std::endl;
136 std::cout<<
"minimum1: "<<min1<<std::endl;
145 std::cout<<
"minimum2: "<<min2<<std::endl;
155 std::cout<<
"minimum3: "<<min3<<std::endl;
161 upar.
Add(
"mean", mean, 0.1);
162 upar.
Add(
"sigma", rms-1., 0.1);
163 upar.
Add(
"area", area, 0.1);
176 std::cout<<
"test Lower limit minimim= "<<min<<std::endl;
184 upar.
Add(
"mean", mean, 0.1);
185 upar.
Add(
"sigma", rms, 0.1);
186 upar.
Add(
"area", area, 0.1);
199 std::pair<double,double> e0 =
Minos(0);
200 std::pair<double,double> e1 =
Minos(1);
201 std::pair<double,double> e2 =
Minos(2);
204 std::cout<<
"1-sigma Minos errors: "<<std::endl;
205 std::cout<<
"par0: "<<min.
UserState().
Value(
"mean")<<
" "<<e0.first<<
" "<<e0.second<<std::endl;
206 std::cout<<
"par1: "<<min.
UserState().
Value(1)<<
" "<<e1.first<<
" "<<e1.second<<std::endl;
207 std::cout<<
"par2: "<<min.
UserState().
Value(
"area")<<
" "<<e2.first<<
" "<<e2.second<<std::endl;
218 std::cout<<
"2-sigma Minos errors: "<<std::endl;
219 std::cout<<e0<<std::endl;
220 std::cout<<e1<<std::endl;
221 std::cout<<e2<<std::endl;
230 upar.
Add(
"mean", mean, 0.1);
231 upar.
Add(
"sigma", rms, 0.1);
232 upar.
Add(
"area", area, 0.1);
234 double meanLow = -50.03;
236 std::cout <<
"sigma Limit: " << rmsUp <<
"\tmean limit: " << meanLow << std::endl;
254 std::pair<double,double> e0 =
Minos(0);
255 std::pair<double,double> e1 =
Minos(1);
256 std::pair<double,double> e2 =
Minos(2);
260 std::cout<<
"3-sigma Minos errors with limits: "<<std::endl;
261 std::cout.precision(16);
262 std::cout<<
"par0: "<<min.
UserState().
Value(
"mean")<<
" "<<e0.first<<
" "<<e0.second<<std::endl;
263 std::cout<<
"par1: "<<min.
UserState().
Value(1)<<
" "<<e1.first<<
" "<<e1.second<<std::endl;
264 std::cout<<
"par2: "<<min.
UserState().
Value(
"area")<<
" "<<e2.first<<
" "<<e2.second<<std::endl;
276 upar.
Add(
"mean", mean, 0.1);
277 upar.
Add(
"sigma", rms, 0.1);
278 upar.
Add(
"area", area, 0.1);
292 std::vector<std::pair<double,double> > cont = contours(0, 1, 20);
301 cont.insert(cont.end(), cont4().begin(), cont4().end());
305 std::cout<<cont4<<std::endl;
API class for minimization using Variable Metric technology ("MIGRAD"); allows for user interaction: ...
void SetLowerLimit(unsigned int, double)
std::vector< double > Measurements() const
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
double Value(unsigned int) const
RooCmdArg Minos(Bool_t flag=kTRUE)
API class for Contours Error analysis (2-dim errors); minimization has to be done before and Minimum ...
MnPlot produces a text-screen graphical output of (x,y) points, e.g.
const MnUserParameterState & UserState() const
bool Add(const std::string &, double, double)
Add free Parameter Name, Value, Error.
void plot(TString fname="data.root", TString var0="var0", TString var1="var1")
static const double x2[5]
void SetLimits(unsigned int, double, double)
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
API class for Minos Error analysis (asymmetric errors); minimization has to be done before and Minimu...
virtual FunctionMinimum Minimize(const FCNBase &, const std::vector< double > &, const std::vector< double > &, unsigned int stra=1, unsigned int maxfcn=0, double toler=0.1) const
std::vector< double > Variances() const
Class holding the result of Minos (lower and upper values) for a specific parameter.
std::vector< double > Positions() const
Instantiates the SeedGenerator and MinimumBuilder for Variable Metric Minimization method...
MinosError Minos(unsigned int, unsigned int maxcalls=0, double toler=0.1) const
ask for MinosError (Lower + Upper) can be printed via std::cout
void RemoveLimits(unsigned int)
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
ContoursError Contour(unsigned int, unsigned int, unsigned int npoints=20) const
ask for one Contour ContoursError (MinosErrors + points) from number of points (>=4) and parameter in...
void SetErrorDef(double def)
add interface to set dynamically a new error definition Re-implement this function if needed...
void Release(unsigned int)
void SetUpperLimit(unsigned int, double)
double norm(double *x, double *p)