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::DExt2Int(long double Value, long double Upper, long double Lower) const
61{
62 // return the derivative of the transformation d Int/ d Ext
63 return 1. / std::sqrt((Value - Lower) * (Upper - Value));
64}
65
66long double SqrtLowParameterTransformation::Int2ext(long double value, long double lower) const
67{
68 /// internal to external transformation
69 long double val = lower - 1. + std::sqrt(value * value + 1.);
70 return val;
71}
72
73long double
75{
76 // external to internal transformation
77 long double yy = value - lower + 1.;
78 long double yy2 = yy * yy;
79 if (yy2 < 1.)
80 return 0;
81 else
82 return std::sqrt(yy2 - 1);
83}
84
85long double SqrtLowParameterTransformation::DInt2Ext(long double value, long double) const
86{
87 // derivative of internal to external transformation : d (Int2Ext) / d Int
88 long double val = value / (std::sqrt(value * value + 1.));
89 return val;
90}
91
92long double SqrtLowParameterTransformation::DExt2Int(long double value, long double lower) const
93{
94 // derivative of internal to external transformation : d (Ext2Int) / d Ext
95 long double val = (value - lower + 1) / (std::sqrt((value - lower + 1) * (value - lower + 1) - 1.));
96 return val;
97}
98
99long double SqrtUpParameterTransformation::Int2ext(long double value, long double upper) const
100{
101 // internal to external transformation
102 long double val = upper + 1. - std::sqrt(value * value + 1.);
103 return val;
104}
105
106long double
108{
109 // external to internal transformation
110 long double yy = upper - value + 1.;
111 long double yy2 = yy * yy;
112 if (yy2 < 1.)
113 return 0;
114 else
115 return std::sqrt(yy2 - 1);
116}
117
118long double SqrtUpParameterTransformation::DInt2Ext(long double value, long double) const
119{
120 // derivative of internal to external transformation : d (Int2Ext ) / d Int
121 long double val = -value / (std::sqrt(value * value + 1.));
122 return val;
123}
124
125long double SqrtUpParameterTransformation::DExt2Int(long double value, long double upper) const
126{
127 // derivative of internal to external transformation : d (Ext2Int ) / d Ext
128 long double val = -(upper - value + 1) / (std::sqrt((upper - value + 1) * (upper - value + 1) - 1.));
129 return val;
130}
131
132} // namespace Minuit2
133
134} // 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 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 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 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
Namespace for new ROOT classes and functions.