26operator()(
unsigned int px,
unsigned int py,
unsigned int npoints)
const
40 unsigned int nfcn = 0;
43 print.
Debug(
"MnContours: finding ",npoints,
" contours points for ",px,py,
" at level ",
fFCN.
Up(),
" from value ",
fMinimum.
Fval());
45 std::vector<std::pair<double, double>>
result;
47 std::vector<MnUserParameterState> states;
64 print.
Debug(
"Run Minos to find first 4 contour points. Current minimum is : ",valx,valy);
69 print.
Error(
"unable to find first two points");
72 std::pair<double, double>
ex = mnex();
74 print.
Debug(
"Minos error for p0: ",
ex.first,
ex.second);
79 print.
Error(
"unable to find second two points");
82 std::pair<double, double>
ey = mney();
84 print.
Debug(
"Minos error for p0: ",
ey.first,
ey.second);
94 nfcn += exy_lo.
NFcn();
96 print.
Error(
"unable to find Lower y Value for x Parameter", px);
104 nfcn += exy_up.
NFcn();
106 print.
Error(
"unable to find Upper y Value for x Parameter", px);
116 nfcn += eyx_up.
NFcn();
118 print.
Error(
"unable to find Upper x Value for y Parameter", py);
125 nfcn += eyx_lo.
NFcn();
127 print.
Error(
"unable to find Lower x Value for y Parameter", py);
134 double scalx = 1. / (
ex.second -
ex.first);
135 double scaly = 1. / (
ey.second -
ey.first);
144 print.
Debug(
"List of first 4 found contour points",
'\n',
" Parameter x is", upar.
Name(px),
'\n',
" Parameter y is", upar.
Name(py),
150 std::vector<unsigned int> par(2);
156 for (
unsigned int i = 4; i < npoints; i++) {
159 auto idist1 =
result.end() - 1;
160 auto idist2 =
result.begin();
161 double dx = idist1->first - (idist2)->first;
162 double dy = idist1->second - (idist2)->second;
163 double bigdis = scalx * scalx * dx * dx + scaly * scaly * dy * dy;
165 for (
auto ipair =
result.begin(); ipair !=
result.end() - 1; ++ipair) {
166 double distx = ipair->first - (ipair + 1)->first;
167 double disty = ipair->second - (ipair + 1)->second;
168 double dist = scalx * scalx * distx * distx + scaly * scaly * disty * disty;
182 if (nfcn > maxcalls) {
183 print.
Error(
"maximum number of function calls exhausted");
187 print.
Debug(
"Find new contour point between points with max sep: (",idist1->first,
", ",idist1->second,
") and (",
188 idist2->first,
", ",idist2->second,
") with weights ",a1,a2);
192 double xmidcr = a1 * idist1->first + a2 * (idist2)->first;
193 double ymidcr = a1 * idist1->second + a2 * (idist2)->second;
195 double xdir = (idist2)->second - idist1->second;
196 double ydir = idist1->first - (idist2)->first;
197 double scalfac = sca * std::max(std::fabs(xdir * scalx), std::fabs(ydir * scaly));
198 double xdircr = xdir / scalfac;
199 double ydircr = ydir / scalfac;
200 std::vector<double> pmid(2);
203 std::vector<double> pdir(2);
207 MnCross opt = cross(par, pmid, pdir, toler, maxcalls);
214 print.
Error(
"unable to find point on Contour", i + 1,
'\n',
"found only", i,
"points");
219 print.
Debug(
"Unable to find point, try closer to p1 with weight values",a1,a2);
224 double aopt = opt.
Value();
226 if (idist2 ==
result.begin()) {
227 result.emplace_back(xmidcr + (aopt)*xdircr, ymidcr + (aopt)*ydircr);
231 auto itr =
result.insert(idist2, {xmidcr + (aopt)*xdircr, ymidcr + (aopt)*ydircr});
232 pos = std::distance(
result.begin(),itr);
234 print.
Info(
"Found new contour point - pos: ",pos,
result[pos]);
237 print.
Info(
"Number of contour points =",
result.size());
238 print.
Debug(
"List of contour points");
239 for (
size_t i = 0; i <
result.size(); i++)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
virtual double Up() const =0
Error definition of the function.
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
const MnUserParameterState & UserState() const
Class holding the result of Minos (lower and upper values) for a specific parameter.
unsigned int NFcn() const
double Value(unsigned int) const
void SetValue(unsigned int, double)
std::vector< std::pair< double, double > > operator()(unsigned int, unsigned int, unsigned int npoints=20) const
ask for one Contour (points only) from number of points (>=4) and parameter indices
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...
const FunctionMinimum & fMinimum
unsigned int NFcn() const
API class for minimization using Variable Metric technology ("MIGRAD"); allows for user interaction: ...
API class for Minos Error analysis (asymmetric errors); minimization has to be done before and Minimu...
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 Debug(const Ts &... args)
void Error(const Ts &... args)
void Info(const Ts &... args)
API class for defining four levels of strategies: low (0), medium (1), high (2), very high (>=3); act...
unsigned int Strategy() const
class which holds the external user and/or internal Minuit representation of the parameters and error...
double Value(unsigned int) const
unsigned int VariableParameters() const
const char * Name(unsigned int) const
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...