Logo ROOT  
Reference Guide
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 
15 namespace ROOT {
16 
17 namespace Minuit2 {
18 
19 double 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 
25 double
26 SinParameterTransformation::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 
54 double 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
ROOT::Minuit2::MnMachinePrecision::Eps2
double Eps2() const
eps2 returns 2*sqrt(eps)
Definition: MnMachinePrecision.h:41
SinParameterTransformation.h
MnMachinePrecision.h
sin
double sin(double)
cos
double cos(double)
ROOT::Minuit2::SinParameterTransformation::DInt2Ext
double DInt2Ext(double Value, double Upper, double Lower) const
Definition: SinParameterTransformation.cxx:54
ROOT::Minuit2::SinParameterTransformation::Ext2int
double Ext2int(double Value, double Upper, double Lower, const MnMachinePrecision &) const
Definition: SinParameterTransformation.cxx:26
Value
Definition: functioncalls.h:15
ROOT::Minuit2::MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
Definition: MnMachinePrecision.h:32
sqrt
double sqrt(double)
ROOT::Minuit2::SinParameterTransformation::Int2ext
double Int2ext(double Value, double Upper, double Lower) const
Definition: SinParameterTransformation.cxx:19
atan
double atan(double)
asin
double asin(double)
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4