]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HERWIG/AliHerwigRndm.cxx
following coverity, fix for case of invalid DET string passed to GetNalignable
[u/mrichter/AliRoot.git] / HERWIG / AliHerwigRndm.cxx
... / ...
CommitLineData
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: AliHerwigRndm
20// Responsibilities: Interface to Root random number generator
21// from Fortran (re-implements FINCTION RLU_HERWIG
22// from HERWIG)
23// Note: Since AliGenHerwig belongs to another module (THerwig) one cannot
24// pass the ponter to the generator via static variable
25// Collaborators: AliGenHerwig class
26// Example:
27//
28// root> AliGenHerwig *gener = new AliGenHerwig(-1);
29// root> AliHerwigRndm::SetHerwigRandom(new TRandom3());
30// root> AliHerwigRndm::GetHerwigRandom()->SetSeed(0);
31// root> cout<<"Seed "<< AliHerwigRndm::GetHerwigRandom()->GetSeed() <<endl;
32//-----------------------------------------------------------------------------
33
34#include <TRandom.h>
35
36#include "AliHerwigRndm.h"
37
38TRandom * AliHerwigRndm::fgHerwigRandom=0;
39
40ClassImp(AliHerwigRndm)
41
42//_______________________________________________________________________
43void AliHerwigRndm::SetHerwigRandom(TRandom *ran) {
44 //
45 // Sets the pointer to an existing random numbers generator
46 //
47 if(ran) fgHerwigRandom=ran;
48 else fgHerwigRandom=gRandom;
49}
50
51//_______________________________________________________________________
52TRandom * AliHerwigRndm::GetHerwigRandom() {
53 //
54 // Retrieves the pointer to the random numbers generator
55 //
56 return fgHerwigRandom;
57}
58
59//_______________________________________________________________________
60# define hwrgen hwrgen_
61
62extern "C" {
63Double_t hwrgen(Int_t /*dummy*/)
64 {
65 // Wrapper to FUNCTION HWR from HERWIG
66 // Uses static method to retrieve the pointer to the (C++) generator
67 Double_t r;
68 do r=AliHerwigRndm::GetHerwigRandom()->Rndm();
69 while(0 >= r || r >= 1);
70 return r;
71 }
72}