00001 // This is "translation" of "subroutine calg" from sub.f file to C++ 00002 // 00003 // The function gausin(x) from CERNLIB replaced with 00004 // M_SQRT2*TMath::ErfInverse(2*x-1) from ROOT 00005 // (see http://en.wikipedia.org/wiki/Probit_function) 00006 00007 /* 00008 subroutine calg(Px,e2) 00009 c real*8 Px,chi 00010 c Px=0.5 00011 c external sub 00012 real*8 e2 00013 external sub 00014 c chi = 0.0 00015 REAL Px 00016 c print*, "the value of Px is ",Px 00017 e2=gausin(Px) 00018 c print*, "the value of chi is ",e2 00019 c calg=chi 00020 c Px=0.1 00021 c print*, "the value of chi is ",e2 00022 c RETURN 00023 end 00024 */ 00025 00026 #include <iostream> 00027 #include <TMath.h> 00028 00029 using namespace std; 00030 00031 void CALG(double Px, double& e2) 00032 { 00033 // cout << "the value of Px is " << Px << endl; 00034 e2 = M_SQRT2*TMath::ErfInverse(2*Px-1); 00035 // cout << "the value of chi is " << e2 << endl; 00036 }