Adding TAmpt (Constantin)
[u/mrichter/AliRoot.git] / TAmpt / AMPT / AliAmptRndm.cxx
CommitLineData
0119ef9a 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#include <TRandom.h>
19
20#include "AliAmptRndm.h"
21
22TRandom * AliAmptRndm::fgAmptRandom=0;
23
24ClassImp(AliAmptRndm)
25
26//_______________________________________________________________________
27void AliAmptRndm::SetAmptRandom(TRandom *ran) {
28 //
29 // Sets the pointer to an existing random numbers generator
30 //
31 if(ran) fgAmptRandom=ran;
32 else fgAmptRandom=gRandom;
33}
34
35//_______________________________________________________________________
36TRandom * AliAmptRndm::GetAmptRandom() {
37 //
38 // Retrieves the pointer to the random numbers generator
39 //
40 return fgAmptRandom;
41}
42
43//_______________________________________________________________________
44# define rluget_ampt rluget_ampt_
45# define rluset_ampt rluset_ampt_
46# define rlu_ampt rlu_ampt_
47# define ranart ranart_
48# define ran1 ran1_
49# define rlu rlu_
50
51extern "C" {
52 void rluget_ampt(Int_t & /*lfn*/, Int_t & /*move*/)
53 {printf("Dummy version of rluget_ampt reached\n");}
54
55 void rluset_ampt(Int_t & /*lfn*/, Int_t & /*move*/)
56 {printf("Dummy version of rluset_ampt reached\n");}
57
58 Float_t rlu_ampt(Int_t & /*idum*/)
59 {
60 // Wrapper to FINCTION RLU_AMPT from AMPT
61 // Uses static method to retrieve the pointer to the (C++) generator
62 Double_t r;
63 do r=AliAmptRndm::GetAmptRandom()->Rndm();
64 while(0 >= r || r >= 1);
65 return (Float_t)r;
66 }
67
68 Float_t ranart(Int_t &idum)
69 {
70 return rlu_ampt(idum);
71 }
72
73 Float_t ran1(Int_t &idum)
74 {
75 return rlu_ampt(idum);
76 }
77
78 Float_t rlu(Int_t &idum)
79 {
80 return rlu_ampt(idum);
81 }
82}