Updating limits to cope both with p-A and A-p ZDC timing
[u/mrichter/AliRoot.git] / HIJING / AliHijingRndm.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: AliHijingRndm
3fe46493 20// Responsibilities: Interface to Root random number generator
21// from Fortran (re-implements FINCTION RLU_HIJING
22// from HIJING)
23// Note: Since AliGenHijing belongs to another module (THijing) one cannot
24// pass the ponter to the generator via static variable
25// Collaborators: AliGenHijing class
26// Example:
27//
28// root> AliGenHijing *gener = new AliGenHijing(-1);
29// root> AliHijingRndm::SetHijingRandom(new TRandom3());
30// root> AliHijingRndm::GetHijingRandom()->SetSeed(0);
31// root> cout<<"Seed "<< AliHijingRndm::GetHijingRandom()->GetSeed() <<endl;
7cdba479 32//-----------------------------------------------------------------------------
33
3fe46493 34#include <TRandom.h>
7cdba479 35
36#include "AliHijingRndm.h"
37
38TRandom * AliHijingRndm::fgHijingRandom=0;
39
40ClassImp(AliHijingRndm)
41
42//_______________________________________________________________________
7cdba479 43void AliHijingRndm::SetHijingRandom(TRandom *ran) {
44 //
45 // Sets the pointer to an existing random numbers generator
46 //
47 if(ran) fgHijingRandom=ran;
48 else fgHijingRandom=gRandom;
49}
50
51//_______________________________________________________________________
52TRandom * AliHijingRndm::GetHijingRandom() {
53 //
54 // Retrieves the pointer to the random numbers generator
55 //
56 return fgHijingRandom;
57}
58
59//_______________________________________________________________________
60# define rluget_hijing rluget_hijing_
61# define rluset_hijing rluset_hijing_
62# define rlu_hijing rlu_hijing_
63
64extern "C" {
65 void rluget_hijing(Int_t & /*lfn*/, Int_t & /*move*/)
66 {printf("Dummy version of rluget_hijing reached\n");}
67
68 void rluset_hijing(Int_t & /*lfn*/, Int_t & /*move*/)
69 {printf("Dummy version of rluset_hijing reached\n");}
70
0ce61fd0 71 Float_t rlu_hijing(Int_t & /*idum*/)
7cdba479 72 {
73 // Wrapper to FINCTION RLU_HIJING from HIJING
74 // Uses static method to retrieve the pointer to the (C++) generator
75 Double_t r;
76 do r=AliHijingRndm::GetHijingRandom()->Rndm();
77 while(0 >= r || r >= 1);
0ce61fd0 78 return (Float_t)r;
7cdba479 79 }
80}