Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MnParameterTransformation.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
11
13
14#include <cmath>
15
16namespace ROOT {
17
18namespace Minuit2 {
19
20long double SinParameterTransformation::Int2ext(long double Value, long double Upper, long double Lower) const
21{
22 // transformation from to internal (unlimited) to external values (limited by Lower/Upper )
23 return Lower + 0.5 * (Upper - Lower) * (std::sin(Value) + 1.);
24}
25
26long double SinParameterTransformation::Ext2int(long double Value, long double Upper, long double Lower,
27 const MnMachinePrecision &prec) const
28{
29 // transformation from external (limited by Lower/Upper ) to internal (unlimited) values given the lower/upper
30 // limits
31
32 long double piby2 = 2. * std::atan(1.);
33 long double distnn = 8. * std::sqrt(prec.Eps2());
34 long double vlimhi = piby2 - distnn;
35 long double vlimlo = -piby2 + distnn;
36
37 long double yy = 2. * (Value - Lower) / (Upper - Lower) - 1.;
38 long double yy2 = yy * yy;
39 if (yy2 > (1. - prec.Eps2())) {
40 if (yy < 0.) {
41 // Lower limit
42 // std::cout<<"SinParameterTransformation warning: is at its Lower allowed limit. "<<Value<<std::endl;
43 return vlimlo;
44 } else {
45 // Upper limit
46 // std::cout<<"SinParameterTransformation warning: is at its Upper allowed limit."<<std::endl;
47 return vlimhi;
48 }
49 } else {
50 return std::asin(yy);
51 }
52}
53
54long double SinParameterTransformation::DInt2Ext(long double Value, long double Upper, long 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
60long double SinParameterTransformation::D2Int2Ext(long double Value, long double Upper, long double Lower) const
61{
62 // return the second derivative of the transformation d^2 Ext/ d Int^2
63 return -0.5 * ((Upper - Lower) * std::sin(Value));
64}
65
66long double SinParameterTransformation::DExt2Int(long double Value, long double Upper, long double Lower) const
67{
68 // return the derivative of the transformation d Int/ d Ext
69 return 1. / std::sqrt((Value - Lower) * (Upper - Value));
70}
71
72long double SqrtLowParameterTransformation::Int2ext(long double value, long double lower) const
73{
74 /// internal to external transformation
75 long double val = lower - 1. + std::sqrt(value * value + 1.);
76 return val;
77}
78
79long double
81{
82 // external to internal transformation
83 long double yy = value - lower + 1.;
84 long double yy2 = yy * yy;
85 if (yy2 < 1.)
86 return 0;
87 else
88 return std::sqrt(yy2 - 1);
89}
90
91long double SqrtLowParameterTransformation::DInt2Ext(long double value, long double) const
92{
93 // derivative of internal to external transformation : d (Int2Ext) / d Int
94 long double val = value / (std::sqrt(value * value + 1.));
95 return val;
96}
97
98long double SqrtLowParameterTransformation::D2Int2Ext(long double value, long double) const
99{
100 // second derivative of internal to external transformation : d^2 (Int2Ext) / d Int^2
101 long double val = std::pow(value * value + 1., -1.5);
102 return val;
103}
104
105long double SqrtLowParameterTransformation::DExt2Int(long double value, long double lower) const
106{
107 // derivative of internal to external transformation : d (Ext2Int) / d Ext
108 long double val = (value - lower + 1) / (std::sqrt((value - lower + 1) * (value - lower + 1) - 1.));
109 return val;
110}
111
112long double SqrtUpParameterTransformation::Int2ext(long double value, long double upper) const
113{
114 // internal to external transformation
115 long double val = upper + 1. - std::sqrt(value * value + 1.);
116 return val;
117}
118
119long double
121{
122 // external to internal transformation
123 long double yy = upper - value + 1.;
124 long double yy2 = yy * yy;
125 if (yy2 < 1.)
126 return 0;
127 else
128 return std::sqrt(yy2 - 1);
129}
130
131long double SqrtUpParameterTransformation::DInt2Ext(long double value, long double) const
132{
133 // derivative of internal to external transformation : d (Int2Ext ) / d Int
134 long double val = -value / (std::sqrt(value * value + 1.));
135 return val;
136}
137
138long double SqrtUpParameterTransformation::D2Int2Ext(long double value, long double) const
139{
140 // second derivative of internal to external transformation : d^2 (Int2Ext) / d Int^2
141 long double val = -std::pow(value * value + 1., -1.5);
142 return val;
143}
144
145long double SqrtUpParameterTransformation::DExt2Int(long double value, long double upper) const
146{
147 // derivative of internal to external transformation : d (Ext2Int ) / d Ext
148 long double val = -(upper - value + 1) / (std::sqrt((upper - value + 1) * (upper - value + 1) - 1.));
149 return val;
150}
151
152} // namespace Minuit2
153
154} // namespace ROOT
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Sets the relative floating point (double) arithmetic precision.
long double DInt2Ext(long double Value, long double Upper, long double Lower) const
long double DExt2Int(long double Value, long double Upper, long double Lower) const
long double D2Int2Ext(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
long double DExt2Int(long double Value, long double Lower) const
long double D2Int2Ext(long double Value, long double Lower) const
long double Ext2int(long double Value, long double Lower, const MnMachinePrecision &) const
long double DInt2Ext(long double Value, long double Lower) const
long double Int2ext(long double Value, long double Lower) const
long double D2Int2Ext(long double Value, long double Upper) const
long double DExt2Int(long double Value, long double Upper) const
long double Int2ext(long double Value, long double Upper) const
long double DInt2Ext(long double Value, long double Upper) const
long double Ext2int(long double Value, long double Upper, const MnMachinePrecision &) const