From 7cdba479ac84d9e3621351018a6917570b21b797 Mon Sep 17 00:00:00 2001 From: hristov Date: Wed, 30 Apr 2003 14:48:21 +0000 Subject: [PATCH] Changes related to the initialization of random numbers generators. Now one can use its own randoms for each module, particle generator, and/or tracking package. The interface with Fortran is simplified and some inter-library dependencies are avoided. Future improvements are welcome... --- EVGEN/AliGenMC.cxx | 5 +- EVGEN/AliGenParam.cxx | 9 +- HIJING/AliHijingRndm.cxx | 106 +++++++++++++++++ HIJING/AliHijingRndm.h | 30 +++++ HIJING/hijingLinkDef.h | 8 ++ HIJING/libhijing.pkg | 8 ++ PYTHIA6/AliGenPythia.cxx | 219 +---------------------------------- PYTHIA6/AliPythia.cxx | 128 +------------------- PYTHIA6/AliPythiaRndm.cxx | 103 ++++++++++++++++ PYTHIA6/AliPythiaRndm.h | 30 +++++ PYTHIA6/libpythia6.pkg | 8 ++ PYTHIA6/pythia6LinkDef.h | 8 ++ STEER/AliRndm.cxx | 5 +- STEER/AliRndm.h | 8 +- THbtp/AliGenHBTprocessor.cxx | 2 +- THerwig/AliGenHerwig.cxx | 26 +---- THijing/AliGenHijing.cxx | 206 +------------------------------- TIsajet/TIsajet.cxx | 2 + TMEVSIM/AliGenMevSim.cxx | 15 +-- 19 files changed, 339 insertions(+), 587 deletions(-) create mode 100644 HIJING/AliHijingRndm.cxx create mode 100644 HIJING/AliHijingRndm.h create mode 100644 HIJING/hijingLinkDef.h create mode 100644 PYTHIA6/AliPythiaRndm.cxx create mode 100644 PYTHIA6/AliPythiaRndm.h create mode 100644 PYTHIA6/pythia6LinkDef.h diff --git a/EVGEN/AliGenMC.cxx b/EVGEN/AliGenMC.cxx index 2b87c64c7e8..69c583e07d2 100644 --- a/EVGEN/AliGenMC.cxx +++ b/EVGEN/AliGenMC.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.16 2003/04/08 10:22:05 morsch +Rapidity shift calculated in Init(). + Revision 1.15 2003/04/04 08:13:26 morsch Boost method added. @@ -360,7 +363,7 @@ void AliGenMC::Boost() Double_t gamma = 1./TMath::Sqrt(1.-beta*beta); Double_t gb = gamma * beta; - printf("\n Boosting particles to lab frame %f %f %f", fDyBoost, beta, gamma); + // printf("\n Boosting particles to lab frame %f %f %f", fDyBoost, beta, gamma); Int_t i; Int_t np = fParticles->GetEntriesFast(); diff --git a/EVGEN/AliGenParam.cxx b/EVGEN/AliGenParam.cxx index e73e1fa8687..61f8f44a090 100644 --- a/EVGEN/AliGenParam.cxx +++ b/EVGEN/AliGenParam.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.42 2003/03/15 19:48:01 morsch +AliDecayerPythia replaced by AliDecayer + Revision 1.41 2003/01/09 17:38:47 morsch Draw() method added. @@ -167,9 +170,6 @@ AliGenParam::AliGenParam() fParam = 0; fAnalog = kAnalog; SetDeltaPt(); -// -// Set random number generator - sRandom = fRandom; fDecayer = 0; @@ -191,9 +191,6 @@ AliGenParam::AliGenParam(Int_t npart, AliGenLib * Library, Int_t param, char* t fAnalog = kAnalog; SetForceDecay(); SetDeltaPt(); -// -// Set random number generator - sRandom = fRandom; } //____________________________________________________________ diff --git a/HIJING/AliHijingRndm.cxx b/HIJING/AliHijingRndm.cxx new file mode 100644 index 00000000000..d17334b1b5b --- /dev/null +++ b/HIJING/AliHijingRndm.cxx @@ -0,0 +1,106 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//----------------------------------------------------------------------------- +// Class: AliHijingRndm +// Random Number Interface to Fortran (FINCTION RLU_HIJING from HIJING) +// Since AliGenHijing belongs to another module (THijing) one cannot +// pass the ponter to the generator via static variable +// Author: +//----------------------------------------------------------------------------- + +#include + +#include "AliHijingRndm.h" + +TRandom * AliHijingRndm::fgHijingRandom=0; + +ClassImp(AliHijingRndm) + +//_______________________________________________________________________ +AliHijingRndm::AliHijingRndm() +{ + // + // Default ctor + // +} + +//_______________________________________________________________________ +AliHijingRndm::AliHijingRndm(const AliHijingRndm& rn) +{ + // + // Copy constructor + // + rn.Copy(*this); +} + +//_______________________________________________________________________ +AliHijingRndm::~AliHijingRndm() { + // + // Destructor + // + fgHijingRandom=0; +} + +//_______________________________________________________________________ +void AliHijingRndm::Copy(AliHijingRndm&) const +{ + // + // No copy is allowed + // + ::Fatal("Copy","Not implemented\n"); +} + +//_______________________________________________________________________ +void AliHijingRndm::SetHijingRandom(TRandom *ran) { + // + // Sets the pointer to an existing random numbers generator + // + if(ran) fgHijingRandom=ran; + else fgHijingRandom=gRandom; +} + +//_______________________________________________________________________ +TRandom * AliHijingRndm::GetHijingRandom() { + // + // Retrieves the pointer to the random numbers generator + // + return fgHijingRandom; +} + +//_______________________________________________________________________ +# define rluget_hijing rluget_hijing_ +# define rluset_hijing rluset_hijing_ +# define rlu_hijing rlu_hijing_ + +extern "C" { + void rluget_hijing(Int_t & /*lfn*/, Int_t & /*move*/) + {printf("Dummy version of rluget_hijing reached\n");} + + void rluset_hijing(Int_t & /*lfn*/, Int_t & /*move*/) + {printf("Dummy version of rluset_hijing reached\n");} + + Double_t rlu_hijing(Int_t & /*idum*/) + { + // Wrapper to FINCTION RLU_HIJING from HIJING + // Uses static method to retrieve the pointer to the (C++) generator + Double_t r; + do r=AliHijingRndm::GetHijingRandom()->Rndm(); + while(0 >= r || r >= 1); + return r; + } +} diff --git a/HIJING/AliHijingRndm.h b/HIJING/AliHijingRndm.h new file mode 100644 index 00000000000..a8d7b74b187 --- /dev/null +++ b/HIJING/AliHijingRndm.h @@ -0,0 +1,30 @@ +#ifndef ALIHIJINGRNDM_H +#define ALIHIJINGRNDM_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include "TRandom.h" + +class AliHijingRndm { + public: + AliHijingRndm(); + AliHijingRndm(const AliHijingRndm &rnd); + virtual ~AliHijingRndm(); + AliHijingRndm & operator=(const AliHijingRndm& rn) + {rn.Copy(*this); return (*this);} + + static void SetHijingRandom(TRandom *ran=0); + static TRandom * GetHijingRandom(); + +private: + void Copy(AliHijingRndm &rn) const; + + static TRandom * fgHijingRandom; //! pointer to the random number generator + + ClassDef(AliHijingRndm,0) //Random Number generator wrapper (non persistent) +}; + +#endif + diff --git a/HIJING/hijingLinkDef.h b/HIJING/hijingLinkDef.h new file mode 100644 index 00000000000..a51c41a6c3b --- /dev/null +++ b/HIJING/hijingLinkDef.h @@ -0,0 +1,8 @@ +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliHijingRndm+; +#endif diff --git a/HIJING/libhijing.pkg b/HIJING/libhijing.pkg index 130f4b24995..aa9db09bafd 100644 --- a/HIJING/libhijing.pkg +++ b/HIJING/libhijing.pkg @@ -1,3 +1,11 @@ +SRCS:=AliHijingRndm.cxx + +HDRS= $(SRCS:.cxx=.h) + +DHDR:=hijingLinkDef.h + +EXPORT:=AliHijingRndm.h + FSRCS:= \ hijing1_36/ar3jet.F \ hijing1_36/aran9.F \ diff --git a/PYTHIA6/AliGenPythia.cxx b/PYTHIA6/AliGenPythia.cxx index 8743ba83b7c..3ddb173b969 100644 --- a/PYTHIA6/AliGenPythia.cxx +++ b/PYTHIA6/AliGenPythia.cxx @@ -13,218 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.5 2003/04/04 08:12:56 morsch -Boost for assymmetric systems added. - -Revision 1.4 2003/04/01 20:39:00 morsch -Pycell configurable. - -Revision 1.3 2003/03/31 15:47:16 morsch -Unhandled cases added. - -Revision 1.2 2003/03/27 09:28:38 morsch -Charm production process configuration for pPb and pp added -(A. Dainese, N. Carrer) - -Revision 1.1 2003/03/15 15:00:48 morsch -Classed imported from EVGEN. - -Revision 1.69 2003/01/14 10:50:19 alibrary -Cleanup of STEER coding conventions - -Revision 1.68 2002/12/11 09:16:16 morsch -Use GetJets to fill header. - -Revision 1.67 2002/12/09 15:24:09 morsch -Same trigger routine can use Pycell or Pyclus. - -Revision 1.66 2002/12/09 08:22:56 morsch -UA1 jet finder (Pycell) for software triggering added. - -Revision 1.65 2002/11/19 08:57:10 morsch -Configuration of pt-kick added. - -Revision 1.64 2002/11/15 00:43:06 morsch -Changes for kPyJets -- initial and final state g-radiation + pt-kick default -- trigger based on parton clusters (using pyclus) -- trigger jets are stored in header. - -Revision 1.63 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.52.4.4 2002/10/10 16:40:08 hristov -Updating VirtualMC to v3-09-02 - -Revision 1.62 2002/09/24 10:00:01 morsch -CheckTrigger() corrected. - -Revision 1.61 2002/07/30 09:52:38 morsch -Call SetGammaPhiRange() and SetGammaEtaRange() in the constructor. - -Revision 1.60 2002/07/19 14:49:03 morsch -Typo corrected. - -Revision 1.59 2002/07/19 14:35:36 morsch -Count total number of trials. Print mean Q, x1, x2. - -Revision 1.58 2002/07/17 10:04:09 morsch -SetYHard method added. - -Revision 1.57 2002/05/22 13:22:53 morsch -Process kPyMbNonDiffr added. - -Revision 1.56 2002/04/26 10:30:01 morsch -Option kPyBeautyPbMNR added. (N. Carrer). - -Revision 1.55 2002/04/17 10:23:56 morsch -Coding Rule violations corrected. - -Revision 1.54 2002/03/28 11:49:10 morsch -Pass status code in SetTrack. - -Revision 1.53 2002/03/25 14:51:13 morsch -New stack-fill and count options introduced (N. Carrer). - -Revision 1.51 2002/03/06 08:46:57 morsch -- Loop until np-1 -- delete dyn. alloc. arrays (N. Carrer) - -Revision 1.50 2002/03/03 13:48:50 morsch -Option kPyCharmPbMNR added. Produce charm pairs in agreement with MNR -NLO calculations (Nicola Carrer). - -Revision 1.49 2002/02/08 16:50:50 morsch -Add name and title in constructor. - -Revision 1.48 2001/12/20 11:44:28 morsch -Add kinematic bias for direct gamma production. - -Revision 1.47 2001/12/19 14:45:00 morsch -Store number of trials in header. - -Revision 1.46 2001/12/19 10:36:19 morsch -Add possibility if jet kinematic biasing. - -Revision 1.45 2001/11/28 08:06:52 morsch -Use fMaxLifeTime parameter. - -Revision 1.44 2001/11/27 13:13:07 morsch -Maximum lifetime for long-lived particles to be put on the stack is parameter. -It can be set via SetMaximumLifetime(..). - -Revision 1.43 2001/10/21 18:35:56 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.42 2001/10/15 08:21:55 morsch -Vertex truncation settings moved to AliGenMC. - -Revision 1.41 2001/10/08 08:45:42 morsch -Possibility of vertex cut added. - -Revision 1.40 2001/09/25 11:30:23 morsch -Pass event vertex to header. - -Revision 1.39 2001/07/27 17:09:36 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.38 2001/07/13 10:58:54 morsch -- Some coded moved to AliGenMC -- Improved handling of secondary vertices. - -Revision 1.37 2001/06/28 11:17:28 morsch -SetEventListRange setter added. Events in specified range are listed for -debugging. (Yuri Kharlov) - -Revision 1.36 2001/03/30 07:05:49 morsch -Final print-out in finish run. -Write parton system for jet-production (preliminary solution). - -Revision 1.35 2001/03/09 13:03:40 morsch -Process_t and Struc_Func_t moved to AliPythia.h - -Revision 1.34 2001/02/14 15:50:40 hristov -The last particle in event marked using SetHighWaterMark - -Revision 1.33 2001/01/30 09:23:12 hristov -Streamers removed (R.Brun) - -Revision 1.32 2001/01/26 19:55:51 hristov -Major upgrade of AliRoot code - -Revision 1.31 2001/01/17 10:54:31 hristov -Better protection against FPE - -Revision 1.30 2000/12/18 08:55:35 morsch -Make AliPythia dependent generartors work with new scheme of random number generation - -Revision 1.29 2000/12/04 11:22:03 morsch -Init of sRandom as in 1.15 - -Revision 1.28 2000/12/02 11:41:39 morsch -Use SetRandom() to initialize random number generator in constructor. - -Revision 1.27 2000/11/30 20:29:02 morsch -Initialise static variable sRandom in constructor: sRandom = fRandom; - -Revision 1.26 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.25 2000/10/18 19:11:27 hristov -Division by zero fixed - -Revision 1.24 2000/09/18 10:41:35 morsch -Add possibility to use nuclear structure functions from PDF library V8. - -Revision 1.23 2000/09/14 14:05:40 morsch -dito - -Revision 1.22 2000/09/14 14:02:22 morsch -- Correct conversion from mm to cm when passing particle vertex to MC. -- Correct handling of fForceDecay == all. - -Revision 1.21 2000/09/12 14:14:55 morsch -Call fDecayer->ForceDecay() at the beginning of Generate(). - -Revision 1.20 2000/09/06 14:29:33 morsch -Use AliPythia for event generation an AliDecayPythia for decays. -Correct handling of "nodecay" option - -Revision 1.19 2000/07/11 18:24:56 fca -Coding convention corrections + few minor bug fixes - -Revision 1.18 2000/06/30 12:40:34 morsch -Pythia takes care of vertex smearing. Correct conversion from Pythia units (mm) to -Geant units (cm). - -Revision 1.17 2000/06/09 20:34:07 morsch -All coding rule violations except RS3 corrected - -Revision 1.16 2000/05/15 15:04:20 morsch -The full event is written for fNtrack = -1 -Coding rule violations corrected. - -Revision 1.15 2000/04/26 10:14:24 morsch -Particles array has one entry more than pythia particle list. Upper bound of -particle loop changed to np-1 (R. Guernane, AM) - -Revision 1.14 2000/04/05 08:36:13 morsch -Check status code of particles in Pythia event -to avoid double counting as partonic state and final state particle. - -Revision 1.13 1999/11/09 07:38:48 fca -Changes for compatibility with version 2.23 of ROOT - -Revision 1.12 1999/11/03 17:43:20 fca -New version from G.Martinez & A.Morsch - -Revision 1.11 1999/09/29 09:24:14 fca -Introduction of the Copyright and cvs Log -*/ +/* $Id$ */ // // Generator using the TPythia interface (via AliPythia) @@ -247,6 +36,7 @@ Introduction of the Copyright and cvs Log #include "AliGenPythia.h" #include "AliGenPythiaEventHeader.h" #include "AliPythia.h" +#include "AliPythiaRndm.h" #include "AliRun.h" ClassImp(AliGenPythia) @@ -266,6 +56,8 @@ AliGenPythia::AliGenPythia() SetGammaEtaRange(); SetPtKick(); fSetNuclei = kFALSE; + if (!AliPythiaRndm::GetPythiaRandom()) + AliPythiaRndm::SetPythiaRandom(GetRandom()); } AliGenPythia::AliGenPythia(Int_t npart) @@ -286,7 +78,8 @@ AliGenPythia::AliGenPythia(Int_t npart) SetEnergyCMS(); fDecayer = new AliDecayerPythia(); // Set random number generator - sRandom=fRandom; + if (!AliPythiaRndm::GetPythiaRandom()) + AliPythiaRndm::SetPythiaRandom(GetRandom()); fFlavorSelect = 0; // Produced particles fParticles = new TClonesArray("TParticle",1000); diff --git a/PYTHIA6/AliPythia.cxx b/PYTHIA6/AliPythia.cxx index f4747604bcc..a380e9c5414 100644 --- a/PYTHIA6/AliPythia.cxx +++ b/PYTHIA6/AliPythia.cxx @@ -13,99 +13,10 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2003/03/15 15:00:48 morsch -Classed imported from EVGEN. - -Revision 1.28 2002/12/09 08:22:56 morsch -UA1 jet finder (Pycell) for software triggering added. - -Revision 1.27 2002/11/15 00:39:37 morsch -- Correct initialisation of sRandom. -- QCD Jets with initial and final state gluon radiation is default -- pt kick for jets default -- Interface to Pyclus added. - -Revision 1.26 2002/11/14 00:37:32 morsch -Warning message for kPyJets added. - -Revision 1.25 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.20.6.1 2002/06/10 14:57:41 hristov -Merged with v3-08-02 - -Revision 1.24 2002/05/22 13:22:53 morsch -Process kPyMbNonDiffr added. - -Revision 1.23 2002/05/06 07:17:29 morsch -Pyr gives random number r in interval 0 < r < 1. - -Revision 1.22 2002/04/26 10:28:48 morsch -Option kPyBeautyPbMNR added (N. Carrer). - -Revision 1.21 2002/03/25 14:46:16 morsch -Case kPyD0PbMNR added (N. Carrer). - -Revision 1.20 2002/03/03 13:48:50 morsch -Option kPyCharmPbMNR added. Produce charm pairs in agreement with MNR -NLO calculations (Nicola Carrer). - -Revision 1.19 2002/02/20 08:52:20 morsch -Correct documentation of SetNuclei method. - -Revision 1.18 2002/02/07 10:43:06 morsch -Tuned pp-min.bias settings (M.Monteno, R.Ugoccioni and N.Carrer) - -Revision 1.17 2001/12/19 15:40:43 morsch -For kPyJets enforce simple jet topology, i.e no initial or final state -gluon radiation and no primordial pT. - -Revision 1.16 2001/10/12 11:13:59 morsch -Missing break statements added (thanks to Nicola Carrer) - -Revision 1.15 2001/03/27 10:54:50 morsch -Add ResetDecayTable() and SsetDecayTable() methods. - -Revision 1.14 2001/03/09 13:03:40 morsch -Process_t and Struc_Func_t moved to AliPythia.h - -Revision 1.13 2000/12/18 08:55:35 morsch -Make AliPythia dependent generartors work with new scheme of random number generation - -Revision 1.12 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.11 2000/10/20 06:30:06 fca -Use version 0 to avoid streamer generation - -Revision 1.10 2000/10/06 14:18:44 morsch -Upper cut of prim. pT distribution set to 5. GeV - -Revision 1.9 2000/09/18 10:41:35 morsch -Add possibility to use nuclear structure functions from PDF library V8. - -Revision 1.8 2000/09/06 14:26:24 morsch -Decayer functionality of AliPythia has been moved to AliDecayerPythia. -Class is now a singleton. - -Revision 1.7 2000/06/09 20:34:50 morsch -All coding rule violations except RS3 corrected - -Revision 1.6 1999/11/09 07:38:48 fca -Changes for compatibility with version 2.23 of ROOT - -Revision 1.5 1999/11/03 17:43:20 fca -New version from G.Martinez & A.Morsch - -Revision 1.4 1999/09/29 09:24:14 fca -Introduction of the Copyright and cvs Log - -*/ - +/* $Id$ */ #include "AliPythia.h" +#include "AliPythiaRndm.h" ClassImp(AliPythia) @@ -131,14 +42,16 @@ AliPythia::AliPythia() // Default Constructor // // Set random number - if (!sRandom) sRandom=fRandom; + if (!AliPythiaRndm::GetPythiaRandom()) + AliPythiaRndm::SetPythiaRandom(GetRandom()); } void AliPythia::ProcInit(Process_t process, Float_t energy, StrucFunc_t strucfunc) { // Initialise the process to generate - if (!sRandom) sRandom = gRandom; + if (!AliPythiaRndm::GetPythiaRandom()) + AliPythiaRndm::SetPythiaRandom(GetRandom()); fProcess = process; fEcms = energy; @@ -588,32 +501,3 @@ void AliPythia::Pycell(Int_t& njet) -#ifndef WIN32 -#define pyr pyr_ -#define pyrset pyrset_ -#define pyrget pyrget_ -#define pyclus pyclus_ -#define pycell pycell_ -#else -#define pyr PYR -#define pyrset PYRSET -#define pyrget PYRGET -#define pyclus PYCLUS -#define pycell PYCELL -#endif - -extern "C" { - Double_t pyr(Int_t*) -{ - Float_t r; - do r=sRandom->Rndm(); while(0 >= r || r >= 1); - return r; -} - void pyrset(Int_t*,Int_t*) {} - void pyrget(Int_t*,Int_t*) {} -} - - - - - diff --git a/PYTHIA6/AliPythiaRndm.cxx b/PYTHIA6/AliPythiaRndm.cxx new file mode 100644 index 00000000000..98de97d0e3b --- /dev/null +++ b/PYTHIA6/AliPythiaRndm.cxx @@ -0,0 +1,103 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//----------------------------------------------------------------------------- +// Class: AliPythiaRndm +// Random Number Interface to Fortran (FINCTION PYR from PYTHIA) +// Very similar to AliHijingRndm +// Author: +//----------------------------------------------------------------------------- + +#include + +#include "AliPythiaRndm.h" + +TRandom * AliPythiaRndm::fgPythiaRandom=0; + +ClassImp(AliPythiaRndm) + +//_______________________________________________________________________ +AliPythiaRndm::AliPythiaRndm() +{ + // + // Default ctor + // +} + +//_______________________________________________________________________ +AliPythiaRndm::AliPythiaRndm(const AliPythiaRndm& rn) +{ + // + // Copy constructor + // + rn.Copy(*this); +} + +//_______________________________________________________________________ +AliPythiaRndm::~AliPythiaRndm() { + // + // Destructor + // + fgPythiaRandom=0; +} + +//_______________________________________________________________________ +void AliPythiaRndm::Copy(AliPythiaRndm&) const +{ + // + // No copy is allowed for the object + // + ::Fatal("Copy","Not implemented\n"); +} + +//_______________________________________________________________________ +void AliPythiaRndm::SetPythiaRandom(TRandom *ran) { + // + // Sets the pointer to an existing random numbers generator + // + if(ran) fgPythiaRandom=ran; + else fgPythiaRandom=gRandom; +} + +//_______________________________________________________________________ +TRandom * AliPythiaRndm::GetPythiaRandom() { + // + // Retrieves the pointer to the random numbers generator + // + return fgPythiaRandom; +} + +//_______________________________________________________________________ +#define pyr pyr_ +// #define pyrset pyrset_ +// #define pyrget pyrget_ +// #define pyclus pyclus_ +// #define pycell pycell_ + +extern "C" { + Double_t pyr(Int_t*) + { + // Wrapper to FINCTION PYR from PYTHIA + // Uses static method to retrieve the pointer to the (C++) generator + Double_t r; + do r=AliPythiaRndm::GetPythiaRandom()->Rndm(); + while(0 >= r || r >= 1); + return r; + } +// void pyrset(Int_t*,Int_t*) {} +// void pyrget(Int_t*,Int_t*) {} +} diff --git a/PYTHIA6/AliPythiaRndm.h b/PYTHIA6/AliPythiaRndm.h new file mode 100644 index 00000000000..d7330e6ef94 --- /dev/null +++ b/PYTHIA6/AliPythiaRndm.h @@ -0,0 +1,30 @@ +#ifndef ALIPYTHIARNDM_H +#define ALIPYTHIARNDM_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include "TRandom.h" + +class AliPythiaRndm { + public: + AliPythiaRndm(); + AliPythiaRndm(const AliPythiaRndm &rnd); + virtual ~AliPythiaRndm(); + AliPythiaRndm & operator=(const AliPythiaRndm& rn) + {rn.Copy(*this); return (*this);} + + static void SetPythiaRandom(TRandom *ran=0); + static TRandom * GetPythiaRandom(); + +private: + void Copy(AliPythiaRndm &rn) const; + + static TRandom * fgPythiaRandom; //! pointer to the random number generator + + ClassDef(AliPythiaRndm,0) //Random Number generator wrapper (non persistent) +}; + +#endif + diff --git a/PYTHIA6/libpythia6.pkg b/PYTHIA6/libpythia6.pkg index 6516607c845..06ca55b2a7e 100644 --- a/PYTHIA6/libpythia6.pkg +++ b/PYTHIA6/libpythia6.pkg @@ -1,3 +1,11 @@ +SRCS:=AliPythiaRndm.cxx + +HDRS= $(SRCS:.cxx=.h) + +DHDR:=pythia6LinkDef.h + +EXPORT:= + CSRCS:= \ main.c pythia6_address.c diff --git a/PYTHIA6/pythia6LinkDef.h b/PYTHIA6/pythia6LinkDef.h new file mode 100644 index 00000000000..cf3e9758db5 --- /dev/null +++ b/PYTHIA6/pythia6LinkDef.h @@ -0,0 +1,8 @@ +#ifdef __CINT__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliPythiaRndm+; +#endif diff --git a/STEER/AliRndm.cxx b/STEER/AliRndm.cxx index dae14952a5e..8dc9dbd551d 100644 --- a/STEER/AliRndm.cxx +++ b/STEER/AliRndm.cxx @@ -32,17 +32,16 @@ ClassImp(AliRndm) //_______________________________________________________________________ AliRndm::AliRndm(): - fRandom(0) + fRandom(gRandom) { // // Default ctor // - SetRandom(); } //_______________________________________________________________________ AliRndm::AliRndm(const AliRndm& rn): - fRandom(0) + fRandom(gRandom) { // // Copy constructor diff --git a/STEER/AliRndm.h b/STEER/AliRndm.h index 04d98780568..f6ee3c840df 100644 --- a/STEER/AliRndm.h +++ b/STEER/AliRndm.h @@ -13,21 +13,19 @@ #include -static TRandom *sRandom; - class AliRndm { public: AliRndm(); AliRndm(const AliRndm &rnd); - virtual ~AliRndm() {fRandom=sRandom=0;} + virtual ~AliRndm() {fRandom=0;} AliRndm & operator=(const AliRndm& rn) {rn.Copy(*this); return (*this);} // Random number generator bit virtual void SetRandom(TRandom *ran=0) - {if(ran) fRandom=sRandom=ran; - else fRandom=sRandom=gRandom;} + {if(ran) fRandom=ran; + else fRandom=gRandom;} virtual TRandom* GetRandom() const {return fRandom;} virtual void Rndm(Float_t* array, const Int_t size) const; diff --git a/THbtp/AliGenHBTprocessor.cxx b/THbtp/AliGenHBTprocessor.cxx index b1920970d91..f6be9cd6942 100644 --- a/THbtp/AliGenHBTprocessor.cxx +++ b/THbtp/AliGenHBTprocessor.cxx @@ -69,7 +69,7 @@ ClassImp(AliGenHBTprocessor) - +static TRandom* sRandom; AliGenCocktailAfterBurner* GetGenerator(); /*******************************************************************/ diff --git a/THerwig/AliGenHerwig.cxx b/THerwig/AliGenHerwig.cxx index b0f294e00e6..3ace77fef90 100644 --- a/THerwig/AliGenHerwig.cxx +++ b/THerwig/AliGenHerwig.cxx @@ -13,29 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.2.2.3 2002/10/11 10:40:46 hristov -Default case added - -Revision 1.2.2.2 2002/07/26 18:34:02 alibrary -Updating VirtualMC - -Revision 1.3 2002/07/26 15:32:24 hristov -stream.h doesn't exest on Sun, removed from includes - -Revision 1.2 2002/07/19 11:43:10 morsch -- Write full stack. -- Use SetTrack passing energy. - -Revision 1.1 2002/07/16 11:33:26 morsch -First commit. - -*/ - +/* $Id$ */ // Generator using Herwig as an external generator @@ -52,6 +30,8 @@ First commit. ClassImp(AliGenHerwig) +static TRandom * sRandom; + AliGenHerwig::AliGenHerwig() { // Constructor diff --git a/THijing/AliGenHijing.cxx b/THijing/AliGenHijing.cxx index b8abe1aace8..c0e6c152273 100644 --- a/THijing/AliGenHijing.cxx +++ b/THijing/AliGenHijing.cxx @@ -13,177 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2003/04/08 10:23:03 morsch -Rapidity shift calculated in AliGenMC::Init() - -Revision 1.2 2003/04/04 08:14:02 morsch -Boost() moved to AliGenMC - -Revision 1.1 2003/03/15 14:45:57 morsch -Classes imported from EVGEN - -Revision 1.47 2003/01/14 10:50:18 alibrary -Cleanup of STEER coding conventions - -Revision 1.46 2003/01/07 14:12:33 morsch -Provides collision geometry. - -Revision 1.45 2002/12/16 09:44:49 morsch -Default for fRadiation is 3. - -Revision 1.44 2002/10/14 14:55:35 hristov -Merging the VirtualMC branch to the main development branch (HEAD) - -Revision 1.42.4.1 2002/08/28 15:06:50 alibrary -Updating to v3-09-01 - -Revision 1.43 2002/08/09 12:09:52 morsch -Direct gamma trigger correctly included. - -Revision 1.42 2002/03/12 11:07:08 morsch -Add status code of particle to SetTrack call. - -Revision 1.41 2002/03/05 11:25:33 morsch -- New quenching options -- Correction in CheckTrigger() - -Revision 1.40 2002/02/12 11:05:53 morsch -Get daughter indices right. - -Revision 1.39 2002/02/12 09:16:39 morsch -Correction in SelectFlavor() - -Revision 1.38 2002/02/12 08:53:21 morsch -SetNoGammas can be used to inhibit writing of gammas and pi0. - -Revision 1.37 2002/02/08 16:50:50 morsch -Add name and title in constructor. - -Revision 1.36 2002/01/31 20:17:55 morsch -Allow for triggered jets with simplified topology: Exact pT, back-to-back - -Revision 1.35 2001/12/13 07:56:25 hristov -Set pointers to zero in the default constructor - -Revision 1.34 2001/12/11 16:55:42 morsch -Correct initialization for jet phi-range. - -Revision 1.33 2001/12/05 10:18:51 morsch -Possibility of kinematic biasing of jet phi range. (J. Klay) - -Revision 1.32 2001/11/28 13:51:11 morsch -Introduce kinematic biasing (etamin, etamax) of jet trigger. Bookkeeping -(number of trials) done in AliGenHijingEventHeader. - -Revision 1.31 2001/11/06 12:30:34 morsch -Add Boost() method to boost all particles to LHC lab frame. Needed for asymmetric collision systems. - -Revision 1.30 2001/10/21 18:35:56 hristov -Several pointers were set to zero in the default constructors to avoid memory management problems - -Revision 1.29 2001/10/15 08:12:24 morsch -- Vertex smearing with truncated gaussian. -- Store triggered jet info before and after final state radiation into mc-heade - -Revision 1.28 2001/10/08 11:55:25 morsch -Store 4-momenta of trigegred jets in event header. -Possibility to switch of initial and final state radiation. - -Revision 1.27 2001/10/08 07:13:14 morsch -Add setter for minimum transverse momentum of triggered jet. - -Revision 1.26 2001/10/04 08:12:24 morsch -Redefinition of stable condition. - -Revision 1.25 2001/07/27 17:09:36 morsch -Use local SetTrack, KeepTrack and SetHighWaterMark methods -to delegate either to local stack or to stack owned by AliRun. -(Piotr Skowronski, A.M.) - -Revision 1.24 2001/07/20 09:34:56 morsch -Count the number of spectator neutrons and protons and add information -to the event header. (Chiara Oppedisano) - -Revision 1.23 2001/07/13 17:30:22 morsch -Derive from AliGenMC. - -Revision 1.22 2001/06/11 13:09:23 morsch -- Store cross-Section and number of binary collisions as a function of impact parameter -- Pass AliGenHijingEventHeader to gAlice. - -Revision 1.21 2001/02/28 17:35:24 morsch -Consider elastic interactions (ks = 1 and ks = 11) as spectator (Chiara Oppedisano) - -Revision 1.20 2001/02/14 15:50:40 hristov -The last particle in event marked using SetHighWaterMark - -Revision 1.19 2000/12/21 16:24:06 morsch -Coding convention clean-up - -Revision 1.18 2000/12/06 17:46:30 morsch -Avoid random numbers 1 and 0. - -Revision 1.17 2000/12/04 11:22:03 morsch -Init of sRandom as in 1.15 - -Revision 1.16 2000/12/02 11:41:39 morsch -Use SetRandom() to initialize random number generator in constructor. - -Revision 1.15 2000/11/30 20:29:02 morsch -Initialise static variable sRandom in constructor: sRandom = fRandom; - -Revision 1.14 2000/11/30 07:12:50 alibrary -Introducing new Rndm and QA classes - -Revision 1.13 2000/11/09 17:40:27 morsch -Possibility to select/unselect spectator protons and neutrons. -Method SetSpectators(Int_t spect) added. (FCA, Ch. Oppedisano) - -Revision 1.12 2000/10/20 13:38:38 morsch -Debug printouts commented. - -Revision 1.11 2000/10/20 13:22:26 morsch -- skip particle type 92 (string) -- Charmed and beauty baryions (5122, 4122) are considered as stable consistent with - mesons. - -Revision 1.10 2000/10/17 15:10:20 morsch -Write first all the parent particles to the stack and then the final state particles. - -Revision 1.9 2000/10/17 13:38:59 morsch -Protection against division by zero in EvaluateCrossSection() and KinematicSelection(..) (FCA) - -Revision 1.8 2000/10/17 12:46:31 morsch -Protect EvaluateCrossSections() against division by zero. - -Revision 1.7 2000/10/02 21:28:06 fca -Removal of useless dependecies via forward declarations - -Revision 1.6 2000/09/11 13:23:37 morsch -Write last seed to file (fortran lun 50) and reed back from same lun using calls to -luget_hijing and luset_hijing. - -Revision 1.5 2000/09/07 16:55:40 morsch -fHijing->Initialize(); after change of parameters. (Dmitri Yurevitch Peressounko) - -Revision 1.4 2000/07/11 18:24:56 fca -Coding convention corrections + few minor bug fixes - -Revision 1.3 2000/06/30 12:08:36 morsch -In member data: char* replaced by TString, Init takes care of resizing the strings to -8 characters required by Hijing. - -Revision 1.2 2000/06/15 14:15:05 morsch -Add possibility for heavy flavor selection: charm and beauty. - -Revision 1.1 2000/06/09 20:47:27 morsch -AliGenerator interface class to HIJING using THijing (test version) - -*/ - - +/* $Id$ */ // Generator using HIJING as an external generator // The main HIJING options are accessable for the user through this interface. @@ -201,9 +31,9 @@ AliGenerator interface class to HIJING using THijing (test version) #include "AliGenHijing.h" #include "AliGenHijingEventHeader.h" #include "AliRun.h" +#include "AliHijingRndm.h" - - ClassImp(AliGenHijing) +ClassImp(AliGenHijing) AliGenHijing::AliGenHijing() :AliGenMC() @@ -213,6 +43,7 @@ AliGenHijing::AliGenHijing() fHijing = 0; fDsigmaDb = 0; fDnDb = 0; + AliHijingRndm::SetHijingRandom(GetRandom()); } AliGenHijing::AliGenHijing(Int_t npart) @@ -250,7 +81,7 @@ AliGenHijing::AliGenHijing(Int_t npart) fParticles = new TClonesArray("TParticle",10000); // // Set random number generator - sRandom = fRandom; + AliHijingRndm::SetHijingRandom(GetRandom()); fHijing = 0; } @@ -770,30 +601,3 @@ AliGenHijing& AliGenHijing::operator=(const AliGenHijing& rhs) return *this; } -#ifndef WIN32 -# define rluget_hijing rluget_hijing_ -# define rluset_hijing rluset_hijing_ -# define rlu_hijing rlu_hijing_ -# define type_of_call -#else -# define rluget_hijing RLUGET_HIJING -# define rluset_hijing RLUSET_HIJING -# define rlu_hijing RLU_HIJING -# define type_of_call _stdcall -#endif - - -extern "C" { - void type_of_call rluget_hijing(Int_t & /*lfn*/, Int_t & /*move*/) - {printf("Dummy version of rluget_hijing reached\n");} - - void type_of_call rluset_hijing(Int_t & /*lfn*/, Int_t & /*move*/) - {printf("Dummy version of rluset_hijing reached\n");} - - Double_t type_of_call rlu_hijing(Int_t & /*idum*/) - { - Float_t r; - do r=sRandom->Rndm(); while(0 >= r || r >= 1); - return r; - } -} diff --git a/TIsajet/TIsajet.cxx b/TIsajet/TIsajet.cxx index 8e0f5c99c75..76ae0c5e878 100644 --- a/TIsajet/TIsajet.cxx +++ b/TIsajet/TIsajet.cxx @@ -9,6 +9,8 @@ ClassImp(TIsajet) +static TRandom * sRandom; + /**************************************************************************/ TIsajet::TIsajet() : TGenerator("Isajet", "Isajet") diff --git a/TMEVSIM/AliGenMevSim.cxx b/TMEVSIM/AliGenMevSim.cxx index 8f5fe4d6690..b8a822520fc 100644 --- a/TMEVSIM/AliGenMevSim.cxx +++ b/TMEVSIM/AliGenMevSim.cxx @@ -13,18 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.3 2001/07/27 17:24:28 morsch -Some bugs corrected. ( Piotr Skowronski) - -Revision 1.2 2001/03/28 07:31:48 hristov -Loop variables declared only once (HP,Sun) - -Revision 1.1 2001/03/24 10:04:44 morsch -MevSim interfaced through AliGenerator, first commit (Sylwester Radomski et al.) -//Piotr Skowronski Line 104: fThetaMin-->fThetaMax -*/ +/* $Id$ */ // // Wrapper for MEVSIM generator. @@ -45,6 +34,8 @@ MevSim interfaced through AliGenerator, first commit (Sylwester Radomski et al.) ClassImp(AliGenMevSim) +static TRandom * sRandom; + //____________________________________________________________________________ AliGenMevSim::AliGenMevSim() : AliGenerator(-1) { -- 2.43.0