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 |
20 | // Random Number Interface to Fortran (FINCTION PYR from PYTHIA) |
21 | // Very similar to AliHijingRndm |
22 | // Author: |
23 | //----------------------------------------------------------------------------- |
24 | |
25 | #include <TError.h> |
26 | |
27 | #include "AliPythiaRndm.h" |
28 | |
29 | TRandom * AliPythiaRndm::fgPythiaRandom=0; |
30 | |
31 | ClassImp(AliPythiaRndm) |
32 | |
33 | //_______________________________________________________________________ |
34 | AliPythiaRndm::AliPythiaRndm() |
35 | { |
36 | // |
37 | // Default ctor |
38 | // |
39 | } |
40 | |
41 | //_______________________________________________________________________ |
42 | AliPythiaRndm::AliPythiaRndm(const AliPythiaRndm& rn) |
43 | { |
44 | // |
45 | // Copy constructor |
46 | // |
47 | rn.Copy(*this); |
48 | } |
49 | |
50 | //_______________________________________________________________________ |
51 | AliPythiaRndm::~AliPythiaRndm() { |
52 | // |
53 | // Destructor |
54 | // |
55 | fgPythiaRandom=0; |
56 | } |
57 | |
58 | //_______________________________________________________________________ |
59 | void AliPythiaRndm::Copy(AliPythiaRndm&) const |
60 | { |
61 | // |
62 | // No copy is allowed for the object |
63 | // |
64 | ::Fatal("Copy","Not implemented\n"); |
65 | } |
66 | |
67 | //_______________________________________________________________________ |
68 | void AliPythiaRndm::SetPythiaRandom(TRandom *ran) { |
69 | // |
70 | // Sets the pointer to an existing random numbers generator |
71 | // |
72 | if(ran) fgPythiaRandom=ran; |
73 | else fgPythiaRandom=gRandom; |
74 | } |
75 | |
76 | //_______________________________________________________________________ |
77 | TRandom * AliPythiaRndm::GetPythiaRandom() { |
78 | // |
79 | // Retrieves the pointer to the random numbers generator |
80 | // |
81 | return fgPythiaRandom; |
82 | } |
83 | |
84 | //_______________________________________________________________________ |
85 | #define pyr pyr_ |
88cb7938 |
86 | #define pyrset pyrset_ |
87 | #define pyrget pyrget_ |
7cdba479 |
88 | |
89 | extern "C" { |
90 | Double_t pyr(Int_t*) |
91 | { |
92 | // Wrapper to FINCTION PYR from PYTHIA |
93 | // Uses static method to retrieve the pointer to the (C++) generator |
94 | Double_t r; |
95 | do r=AliPythiaRndm::GetPythiaRandom()->Rndm(); |
96 | while(0 >= r || r >= 1); |
97 | return r; |
98 | } |
88cb7938 |
99 | void pyrset(Int_t*,Int_t*) {} |
100 | void pyrget(Int_t*,Int_t*) {} |
7cdba479 |
101 | } |