Logo ROOT   6.10/09
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 <math.h>
14 
15 namespace ROOT {
16 
17  namespace Minuit2 {
18 
19 
20 
21 double SinParameterTransformation::Int2ext(double Value, double Upper, double Lower) const {
22  // transformation from to internal (unlimited) to external values (limited by Lower/Upper )
23  return Lower + 0.5*(Upper - Lower)*(sin(Value) + 1.);
24 }
25 
26 double SinParameterTransformation::Ext2int(double Value, double Upper, double Lower, const MnMachinePrecision& prec) const {
27  // transformation from external (limited by Lower/Upper ) to internal (unlimited) values given the lower/upper limits
28 
29  double piby2 = 2.*atan(1.);
30  double distnn = 8.*sqrt(prec.Eps2());
31  double vlimhi = piby2 - distnn;
32  double vlimlo = -piby2 + distnn;
33 
34  double yy = 2.*(Value - Lower)/(Upper - Lower) - 1.;
35  double yy2 = yy*yy;
36  if(yy2 > (1. - prec.Eps2())) {
37  if(yy < 0.) {
38  // Lower limit
39  // std::cout<<"SinParameterTransformation warning: is at its Lower allowed limit. "<<Value<<std::endl;
40  return vlimlo;
41  } else {
42  // Upper limit
43  // std::cout<<"SinParameterTransformation warning: is at its Upper allowed limit."<<std::endl;
44  return vlimhi;
45  }
46 
47  } else {
48  return asin(yy);
49  }
50 }
51 
52 double SinParameterTransformation::DInt2Ext(double Value, double Upper, double Lower) const {
53  // return the derivative of the transformation d Ext/ d Int
54  return 0.5*((Upper - Lower)*cos(Value));
55 }
56 
57  } // namespace Minuit2
58 
59 } // namespace ROOT
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
determines the relative floating point arithmetic precision.
double cos(double)
double sqrt(double)
double DInt2Ext(double Value, double Upper, double Lower) const
double sin(double)
double asin(double)
double Eps2() const
eps2 returns 2*sqrt(eps)
double atan(double)
double Ext2int(double Value, double Upper, double Lower, const MnMachinePrecision &) const
double Int2ext(double Value, double Upper, double Lower) const
const char * Value
Definition: TXMLSetup.cxx:73