ROOT   Reference Guide
Searching...
No Matches
SinParameterTransformation.cxx
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
12
13#include <cmath>
14
15namespace ROOT {
16
17namespace Minuit2 {
18
19double SinParameterTransformation::Int2ext(double Value, double Upper, double Lower) const
20{
21 // transformation from to internal (unlimited) to external values (limited by Lower/Upper )
22 return Lower + 0.5 * (Upper - Lower) * (std::sin(Value) + 1.);
23}
24
25double
26SinParameterTransformation::Ext2int(double Value, double Upper, double Lower, const MnMachinePrecision &prec) const
27{
28 // transformation from external (limited by Lower/Upper ) to internal (unlimited) values given the lower/upper
29 // limits
30
31 double piby2 = 2. * std::atan(1.);
32 double distnn = 8. * std::sqrt(prec.Eps2());
33 double vlimhi = piby2 - distnn;
34 double vlimlo = -piby2 + distnn;
35
36 double yy = 2. * (Value - Lower) / (Upper - Lower) - 1.;
37 double yy2 = yy * yy;
38 if (yy2 > (1. - prec.Eps2())) {
39 if (yy < 0.) {
40 // Lower limit
41 // std::cout<<"SinParameterTransformation warning: is at its Lower allowed limit. "<<Value<<std::endl;
42 return vlimlo;
43 } else {
44 // Upper limit
45 // std::cout<<"SinParameterTransformation warning: is at its Upper allowed limit."<<std::endl;
46 return vlimhi;
47 }
48
49 } else {
50 return std::asin(yy);
51 }
52}
53
54double SinParameterTransformation::DInt2Ext(double Value, double Upper, double Lower) const
55{
56 // return the derivative of the transformation d Ext/ d Int
57 return 0.5 * ((Upper - Lower) * std::cos(Value));
58}
59
60} // namespace Minuit2
61
62} // namespace ROOT
Sets the relative floating point (double) arithmetic precision.
double Eps2() const
eps2 returns 2*sqrt(eps)
double DInt2Ext(double Value, double Upper, double Lower) const
double Int2ext(double Value, double Upper, double Lower) const
double Ext2int(double Value, double Upper, double Lower, const MnMachinePrecision &) const
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...