X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EVGEN%2FAliGenPHOSlib.cxx;h=3d8e95749f378b3c568a759c8800e3ef9d7d2559;hb=65fb704d5a3c40dcad260b5c6ceb87aaa8697172;hp=6ce5c60195e7a6ab9889659371c4aa2086a9785b;hpb=5c3fd7ea762232b455d7b59c4a255ffd99cc9867;p=u%2Fmrichter%2FAliRoot.git diff --git a/EVGEN/AliGenPHOSlib.cxx b/EVGEN/AliGenPHOSlib.cxx index 6ce5c60195e..3d8e95749f3 100644 --- a/EVGEN/AliGenPHOSlib.cxx +++ b/EVGEN/AliGenPHOSlib.cxx @@ -15,6 +15,14 @@ /* $Log$ +Revision 1.5 2000/06/29 21:08:27 morsch +All paramatrisation libraries derive from the pure virtual base class AliGenLib. +This allows to pass a pointer to a library directly to AliGenParam and avoids the +use of function pointers in Config.C. + +Revision 1.4 2000/06/14 15:21:05 morsch +Include clean-up (IH) + Revision 1.3 2000/06/09 20:32:54 morsch All coding rule violations except RS3 corrected @@ -48,8 +56,10 @@ New version from G.Martinez & A.Morsch // martinez@subatech.in2p3.fr //====================================================================== +#include "TMath.h" +#include "TRandom.h" + #include "AliGenPHOSlib.h" -#include "AliMC.h" ClassImp(AliGenPHOSlib) @@ -102,21 +112,20 @@ ClassImp(AliGenPHOSlib) return ka*TMath::Exp(-ex); } - Int_t AliGenPHOSlib::IpPion() + Int_t AliGenPHOSlib::IpPion(TRandom *ran) { // particle composition pi+, pi0, pi- // - Float_t random[1]; - gMC->Rndm(random,1); + Float_t random = ran->Rndm(); - if ( (3.*random[0]) < 1. ) + if ( (3.*random) < 1. ) { return 211 ; } else { - if ( (3.*random[0]) >= 2.) + if ( (3.*random) >= 2.) { return -211 ; } @@ -182,17 +191,16 @@ ClassImp(AliGenPHOSlib) return ka*TMath::Exp(-ex); } - Int_t AliGenPHOSlib::IpKaon() + Int_t AliGenPHOSlib::IpKaon(TRandom *ran) { // particle composition // - Float_t random[1],random2[1]; - gMC->Rndm(random,1); - gMC->Rndm(random2,1); - if (random2[0] < 0.5) + Float_t random = ran->Rndm(); + Float_t random2 = ran->Rndm(); + if (random2 < 0.5) { - if (random[0] < 0.5) { + if (random < 0.5) { return 321; // K+ } else { return -321; // K- @@ -200,7 +208,7 @@ ClassImp(AliGenPHOSlib) } else { - if (random[0] < 0.5) { + if (random < 0.5) { return 130; // K^0 short } else { return 310; // K^0 long @@ -235,7 +243,7 @@ ClassImp(AliGenPHOSlib) return ka*TMath::Exp(-ex); } - Int_t AliGenPHOSlib::IpEta() + Int_t AliGenPHOSlib::IpEta(TRandom *) { // particle composition // @@ -270,7 +278,7 @@ ClassImp(AliGenPHOSlib) return ka*TMath::Exp(-ex); } - Int_t AliGenPHOSlib::IpOmega() + Int_t AliGenPHOSlib::IpOmega(TRandom *) { // particle composition // @@ -305,7 +313,7 @@ ClassImp(AliGenPHOSlib) return ka*TMath::Exp(-ex); } - Int_t AliGenPHOSlib::IpEtaprime() + Int_t AliGenPHOSlib::IpEtaprime(TRandom *) { // particle composition // @@ -340,7 +348,7 @@ ClassImp(AliGenPHOSlib) return ka*TMath::Exp(-ex); } - Int_t AliGenPHOSlib::IpPhi() + Int_t AliGenPHOSlib::IpPhi(TRandom *) { // particle composition // @@ -375,17 +383,16 @@ ClassImp(AliGenPHOSlib) return ka*TMath::Exp(-ex); } - Int_t AliGenPHOSlib::IpBaryon() + Int_t AliGenPHOSlib::IpBaryon(TRandom *ran) { // particle composition // - Float_t random[1],random2[1]; - gMC->Rndm(random,1); - gMC->Rndm(random2,1); - if (random2[0] < 0.5) + Float_t random = ran->Rndm(); + Float_t random2 = ran->Rndm(); + if (random2 < 0.5) { - if (random[0] < 0.5) { + if (random < 0.5) { return 2212; // p } else { return -2212; // pbar @@ -393,7 +400,7 @@ ClassImp(AliGenPHOSlib) } else { - if (random[0] < 0.5) { + if (random < 0.5) { return 2112; // n } else { return -2112; // n bar @@ -405,7 +412,7 @@ ClassImp(AliGenPHOSlib) typedef Double_t (*GenFunc) (Double_t*, Double_t*); - GenFunc AliGenPHOSlib::GetPt(Param_t param) + GenFunc AliGenPHOSlib::GetPt(Param_t param, const char* tname) { // Return pinter to pT parameterisation GenFunc func; @@ -437,7 +444,7 @@ typedef Double_t (*GenFunc) (Double_t*, Double_t*); return func; } - GenFunc AliGenPHOSlib::GetY(Param_t param) + GenFunc AliGenPHOSlib::GetY(Param_t param, const char* tname) { // Return pointer to Y parameterisation GenFunc func; @@ -470,8 +477,8 @@ typedef Double_t (*GenFunc) (Double_t*, Double_t*); } return func; } -typedef Int_t (*GenFuncIp) (); - GenFuncIp AliGenPHOSlib::GetIp(Param_t param) +typedef Int_t (*GenFuncIp) (TRandom *); + GenFuncIp AliGenPHOSlib::GetIp(Param_t param, const char* tname) { // Return pointer to particle composition GenFuncIp func;