]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PYTHIA6/AliPythiaRndm.cxx
Debug message removed.
[u/mrichter/AliRoot.git] / PYTHIA6 / AliPythiaRndm.cxx
index c0368062bf7cbd302c91ee0f6e5fdd4f1a57ca49..7efc265efa2facea624eec050fabdf2cedbf4ae6 100644 (file)
@@ -57,20 +57,36 @@ TRandom * AliPythiaRndm::GetPythiaRandom() {
 }
 
 //_______________________________________________________________________
-#define pyr    pyr_
-#define pyrset pyrset_
-#define pyrget pyrget_
+#define pyr        pyr_
+#define pygauss    pygauss_
+#define pyrset     pyrset_
+#define pyrget     pyrget_
 
 extern "C" {
-  Double_t pyr(Int_t*) 
-  {
-    // Wrapper to FINCTION PYR from PYTHIA
-    // Uses static method to retrieve the pointer to the (C++) generator
-    Double_t r;
-    do r=AliPythiaRndm::GetPythiaRandom()->Rndm();
-    while(0 >= r || r >= 1);
-    return r;
-  }
-  void pyrset(Int_t*,Int_t*) {}
-  void pyrget(Int_t*,Int_t*) {}
+    Double_t pyr(Int_t*) 
+    {
+       // Wrapper to FINCTION PYR from PYTHIA
+       // Uses static method to retrieve the pointer to the (C++) generator
+       Double_t r;
+       do r=AliPythiaRndm::GetPythiaRandom()->Rndm();
+       while(0 >= r || r >= 1);
+       return r;
+    }
+    
+    Double_t pygauss(Double_t x0, Double_t sig)
+    {
+       Double_t s = 2.;
+       Double_t v1 = 0.;
+       Double_t v2 = 0.;
+       
+       while (s > 1.) {
+           v1 = 2. * pyr(0) - 1.;
+           v2 = 2. * pyr(0) - 1.;
+           s = v1 * v1 + v2 * v2;
+       }
+       return v1 * TMath::Sqrt(-2. * TMath::Log(s) / s) * sig + x0;
+    }
+
+    void pyrset(Int_t*,Int_t*) {}
+    void pyrget(Int_t*,Int_t*) {}
 }