]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HIJING/AliHijingRndm.cxx
Changes related to the initialization of random numbers generators. Now one can use...
[u/mrichter/AliRoot.git] / HIJING / AliHijingRndm.cxx
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
20 //   Random Number Interface to Fortran (FINCTION RLU_HIJING from HIJING)
21 //   Since AliGenHijing belongs to another module (THijing) one cannot
22 //   pass the ponter to the generator via static variable
23 //   Author:
24 //-----------------------------------------------------------------------------
25
26 #include <TError.h>
27
28 #include "AliHijingRndm.h"
29
30 TRandom * AliHijingRndm::fgHijingRandom=0;
31
32 ClassImp(AliHijingRndm)
33
34 //_______________________________________________________________________
35 AliHijingRndm::AliHijingRndm()
36 {
37   // 
38   // Default ctor
39   //
40 }
41
42 //_______________________________________________________________________
43 AliHijingRndm::AliHijingRndm(const AliHijingRndm& rn)
44 {
45   //
46   // Copy constructor
47   //
48   rn.Copy(*this);
49 }
50
51 //_______________________________________________________________________
52 AliHijingRndm::~AliHijingRndm() {
53   //
54   // Destructor
55   //
56   fgHijingRandom=0;
57 }
58
59 //_______________________________________________________________________
60 void AliHijingRndm::Copy(AliHijingRndm&) const
61 {
62   //
63   // No copy is allowed
64   //
65   ::Fatal("Copy","Not implemented\n");
66 }
67
68 //_______________________________________________________________________
69 void AliHijingRndm::SetHijingRandom(TRandom *ran) {
70   //
71   // Sets the pointer to an existing random numbers generator
72   //
73   if(ran) fgHijingRandom=ran;
74   else fgHijingRandom=gRandom;
75 }
76
77 //_______________________________________________________________________
78 TRandom * AliHijingRndm::GetHijingRandom() {
79   //
80   // Retrieves the pointer to the random numbers generator
81   //
82   return fgHijingRandom;
83 }
84
85 //_______________________________________________________________________
86 # define rluget_hijing rluget_hijing_
87 # define rluset_hijing rluset_hijing_
88 # define rlu_hijing    rlu_hijing_
89
90 extern "C" {
91   void rluget_hijing(Int_t & /*lfn*/, Int_t & /*move*/)
92   {printf("Dummy version of rluget_hijing reached\n");}
93
94   void rluset_hijing(Int_t & /*lfn*/, Int_t & /*move*/)
95   {printf("Dummy version of rluset_hijing reached\n");}
96
97   Double_t rlu_hijing(Int_t & /*idum*/) 
98   {
99     // Wrapper to FINCTION RLU_HIJING from HIJING
100     // Uses static method to retrieve the pointer to the (C++) generator
101       Double_t r;
102       do r=AliHijingRndm::GetHijingRandom()->Rndm(); 
103       while(0 >= r || r >= 1);
104       return r;
105   }
106 }