New quenching algorithm.
[u/mrichter/AliRoot.git] / PYTHIA6 / AliPythiaRndm.cxx
CommitLineData
7cdba479 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18//-----------------------------------------------------------------------------
19// Class: AliPythiaRndm
cef490e6 20// Responsibilities: Interface to Root random number generator
21// from Fortran (re-implements FINCTION PYR from PYTHIA)
22// Very similar to AliHijingRndm
23// Collaborators: AliPythia and AliGenPythia classes
24// Example:
25//
26// root> AliPythia::Instance();
27// root> AliPythiaRndm::SetPythiaRandom(new TRandom3());
28// root> AliPythiaRndm::GetPythiaRandom()->SetSeed(0);
29// root> cout<<"Seed "<< AliPythiaRndm::GetPythiaRandom()->GetSeed() <<endl;
30//
7cdba479 31//-----------------------------------------------------------------------------
32
cef490e6 33#include <TRandom.h>
7cdba479 34
35#include "AliPythiaRndm.h"
36
37TRandom * AliPythiaRndm::fgPythiaRandom=0;
38
39ClassImp(AliPythiaRndm)
40
7cdba479 41
42//_______________________________________________________________________
43void AliPythiaRndm::SetPythiaRandom(TRandom *ran) {
44 //
45 // Sets the pointer to an existing random numbers generator
46 //
47 if(ran) fgPythiaRandom=ran;
48 else fgPythiaRandom=gRandom;
49}
50
51//_______________________________________________________________________
52TRandom * AliPythiaRndm::GetPythiaRandom() {
53 //
54 // Retrieves the pointer to the random numbers generator
55 //
56 return fgPythiaRandom;
57}
58
59//_______________________________________________________________________
60#define pyr pyr_
88cb7938 61#define pyrset pyrset_
62#define pyrget pyrget_
7cdba479 63
64extern "C" {
65 Double_t pyr(Int_t*)
66 {
67 // Wrapper to FINCTION PYR from PYTHIA
68 // Uses static method to retrieve the pointer to the (C++) generator
69 Double_t r;
70 do r=AliPythiaRndm::GetPythiaRandom()->Rndm();
71 while(0 >= r || r >= 1);
72 return r;
73 }
88cb7938 74 void pyrset(Int_t*,Int_t*) {}
75 void pyrget(Int_t*,Int_t*) {}
7cdba479 76}