]> git.uio.no Git - u/mrichter/AliRoot.git/blob - DPMJET/AliDpmJetRndm.cxx
bugfix
[u/mrichter/AliRoot.git] / DPMJET / AliDpmJetRndm.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: AliDpmJetRndm
20 //   Random Number Interface to Fortran 
21 //   Since AliGenDpmJet belongs to another module (TDPMjet) one cannot
22 //   pass the ponter to the generator via static variable
23 //-----------------------------------------------------------------------------
24
25 #include <TError.h>
26
27 #include "AliDpmJetRndm.h"
28
29 TRandom * AliDpmJetRndm::fgDpmJetRandom=0;
30
31 ClassImp(AliDpmJetRndm)
32
33 //_______________________________________________________________________
34 AliDpmJetRndm::AliDpmJetRndm()
35 {
36   // 
37   // Default ctor
38   //
39 }
40
41 //_______________________________________________________________________
42 AliDpmJetRndm::AliDpmJetRndm(const AliDpmJetRndm& rn)
43 {
44   //
45   // Copy constructor
46   //
47   rn.Copy(*this);
48 }
49
50 //_______________________________________________________________________
51 AliDpmJetRndm::~AliDpmJetRndm() {
52   //
53   // Destructor
54   //
55   fgDpmJetRandom=0;
56 }
57
58 //_______________________________________________________________________
59 void AliDpmJetRndm::Copy(AliDpmJetRndm&) const
60 {
61   //
62   // No copy is allowed
63   //
64   ::Fatal("Copy","Not implemented\n");
65 }
66
67 //_______________________________________________________________________
68 void AliDpmJetRndm::SetDpmJetRandom(TRandom *ran) {
69   //
70   // Sets the pointer to an existing random numbers generator
71   //
72   if(ran) fgDpmJetRandom=ran;
73   else fgDpmJetRandom=gRandom;
74 }
75
76 //_______________________________________________________________________
77 TRandom * AliDpmJetRndm::GetDpmJetRandom() {
78   //
79   // Retrieves the pointer to the random numbers generator
80   //
81   return fgDpmJetRandom;
82 }
83
84 #ifndef WIN32
85 # define dt_rndm_dpmjet   dt_rndm_dpmjet_
86 # define dt_rndmst_dpmjet dt_rndmst_dpmjet_
87 # define dt_rndmin_dpmjet dt_rndmin_dpmjet_
88 # define dt_rndmou_dpmjet dt_rndmou_dpmjet_
89 # define type_of_call
90 #else
91 # define dt_rndm_dpmjet   DT_RNDM_DPMJET_
92 # define dt_rndmst_dpmjet DT_RNDMST_DPMJET
93 # define dt_rndmin_dpmjet DT_RNDMIN_DPMJET
94 # define dt_rndmou_dpmjet DT_RNDMOU_DPMJET
95 # define type_of_call _stdcall
96 #endif
97
98
99 extern "C" {
100   void type_of_call dt_rndmst_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &)
101   {printf("Dummy version of dt_rndmst reached\n");}
102
103   void type_of_call dt_rndmin_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &)
104   {printf("Dummy version of dt_rndmin reached\n");}
105
106   void type_of_call dt_rndmou_dpmjet(Int_t &, Int_t &, Int_t &, Int_t &, Int_t &, Int_t &)
107   {printf("Dummy version of dt_rndmou reached\n");}
108
109   Double_t type_of_call dt_rndm_dpmjet(Int_t &) 
110   {
111       Float_t r;
112       do r = AliDpmJetRndm::GetDpmJetRandom()->Rndm();
113       while(0 >= r || r >= 1);
114       return r;
115   }
116 }
117
118