Changeset 19639 for trunk/Mars/mbase
- Timestamp:
- 09/15/19 14:23:22 (5 years ago)
- Location:
- trunk/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mbase/MMath.cc
r17161 r19639 901 901 } 902 902 903 // -------------------------------------------------------------------------- 904 // 905 // Returns an exponential distribution 906 // 907 // -tau*log(x) with x=[0;1[ and y=[0;1[ 908 // 903 909 Double_t MMath::RndmExp(Double_t tau) 904 910 { 905 // returns an exponential deviate.906 //907 // exp( -t/tau )908 909 911 const Double_t x = gRandom->Rndm(); // uniform on ] 0, 1 ] 910 912 911 913 return -tau * TMath::Log(x); // convert to exponential distribution 912 914 } 915 916 // -------------------------------------------------------------------------- 917 // 918 // Returns a distribution according to 919 // 920 // atanh((y+1)/x*sigma) with x and y [-1;1] and x^2+y^2=1 921 // 922 Double_t MMath::RndmPSF(Double_t sigma) 923 { 924 double x, y; 925 gRandom->Circle(x, y, 1); 926 return TMath::ATanH((y+1)/x*sigma); 927 } -
trunk/Mars/mbase/MMath.h
r17161 r19639 91 91 92 92 Double_t RndmExp(Double_t tau); 93 Double_t RndmPSF(Double_t sigma=1); 93 94 } 94 95
Note:
See TracChangeset
for help on using the changeset viewer.