00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "Minuit2/SinParameterTransformation.h"
00011 #include "Minuit2/MnMachinePrecision.h"
00012
00013 #include <math.h>
00014
00015 namespace ROOT {
00016
00017 namespace Minuit2 {
00018
00019
00020
00021 double SinParameterTransformation::Int2ext(double Value, double Upper, double Lower) const {
00022
00023 return Lower + 0.5*(Upper - Lower)*(sin(Value) + 1.);
00024 }
00025
00026 double SinParameterTransformation::Ext2int(double Value, double Upper, double Lower, const MnMachinePrecision& prec) const {
00027
00028
00029 double piby2 = 2.*atan(1.);
00030 double distnn = 8.*sqrt(prec.Eps2());
00031 double vlimhi = piby2 - distnn;
00032 double vlimlo = -piby2 + distnn;
00033
00034 double yy = 2.*(Value - Lower)/(Upper - Lower) - 1.;
00035 double yy2 = yy*yy;
00036 if(yy2 > (1. - prec.Eps2())) {
00037 if(yy < 0.) {
00038
00039
00040 return vlimlo;
00041 } else {
00042
00043
00044 return vlimhi;
00045 }
00046
00047 } else {
00048 return asin(yy);
00049 }
00050 }
00051
00052 double SinParameterTransformation::DInt2Ext(double Value, double Upper, double Lower) const {
00053
00054 return 0.5*((Upper - Lower)*cos(Value));
00055 }
00056
00057 }
00058
00059 }