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, E.G.P. Bos 2003-2017
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
19long double SinParameterTransformation::Int2ext(long double Value, long double Upper, long 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
25long double
26SinParameterTransformation::Ext2int(long double Value, long double Upper, long 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 long double piby2 = 2. * std::atan(1.);
32 long double distnn = 8. * std::sqrt(prec.Eps2());
33 long double vlimhi = piby2 - distnn;
34 long double vlimlo = -piby2 + distnn;
35
36 long double yy = 2. * (Value - Lower) / (Upper - Lower) - 1.;
37 long 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 } else {
49 return std::asin(yy);
50 }
51}
52
53long double SinParameterTransformation::DInt2Ext(long double Value, long double Upper, long double Lower) const
54{
55 // return the derivative of the transformation d Ext/ d Int
56 return 0.5 * ((Upper - Lower) * std::cos(Value));
57}
58
59} // namespace Minuit2
60
61} // namespace ROOT
Sets the relative floating point (double) arithmetic precision.
double Eps2() const
eps2 returns 2*sqrt(eps)
long double DInt2Ext(long double Value, long double Upper, long double Lower) const
long double Int2ext(long double Value, long double Upper, long double Lower) const
long double Ext2int(long double Value, long double Upper, long double Lower, const MnMachinePrecision &) const
RVec< PromoteType< T > > cos(const RVec< T > &v)
Definition: RVec.hxx:1776
RVec< PromoteType< T > > asin(const RVec< T > &v)
Definition: RVec.hxx:1778
RVec< PromoteType< T > > atan(const RVec< T > &v)
Definition: RVec.hxx:1780
RVec< PromoteType< T > > sin(const RVec< T > &v)
Definition: RVec.hxx:1775
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.