X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EVGEN%2FAliGenPHOSlib.cxx;h=00d50c367e1f3cd72d0a407aa01116b923d57b2d;hb=12885ca447d5d2ac6627fdff125ce89eeefc67b1;hp=4a7417e1800bdcb9c44787ec58163e0bccc7b789;hpb=886b6f7342e357a2c0ffa88df944a470082fa498;p=u%2Fmrichter%2FAliRoot.git diff --git a/EVGEN/AliGenPHOSlib.cxx b/EVGEN/AliGenPHOSlib.cxx index 4a7417e1800..00d50c367e1 100644 --- a/EVGEN/AliGenPHOSlib.cxx +++ b/EVGEN/AliGenPHOSlib.cxx @@ -1,3 +1,4 @@ + /************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * @@ -13,9 +14,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -*/ +/* $Id$ */ //====================================================================== // AliGenPHOSlib class contains parameterizations of the @@ -30,16 +29,22 @@ $Log$ // param represents the particle to be simulated : // Pion, Kaon, Eta, Omega, Etaprime, Phi or Baryon // Pt distributions are calculated from the transverse mass scaling -// with Pions, using the PtScal fonction taken from AliGenMUONlib +// with Pions, using the PtScal function taken from AliGenMUONlib // version aliroot 3.01 // -// Gines MARTINEZ GPS @ SUBATECH, Nantes , France +// Gines MARTINEZ. Laurent APHECETCHE and Yves SCHUTZ +// GPS @ SUBATECH, Nantes , France (October 1999) // http://www-subatech.in2p3.fr/~photons/subatech // martinez@subatech.in2p3.fr +// Additional particle species simulation options has been added: +// Charged Pion, Charged Kaons, KLong Proton, Anti-Proton, Neutron, +// Anti-Neutron --> Changes made by Gustavo Conesa in November 2004 //====================================================================== +#include "TMath.h" +#include "TRandom.h" + #include "AliGenPHOSlib.h" -#include "AliRun.h" ClassImp(AliGenPHOSlib) @@ -53,69 +58,121 @@ ClassImp(AliGenPHOSlib) Double_t AliGenPHOSlib::PtPion(Double_t *px, Double_t *) { // Pion transverse momentum distribtuion taken -// from AliGenMUONlib class, version 3.01 of alirrot +// from AliGenMUONlib class, version 3.01 of aliroot // PT-PARAMETERIZATION CDF, PRL 61(88) 1819 // POWER LAW FOR PT > 500 MEV // MT SCALING BELOW (T=160 MEV) // - const Double_t p0 = 1.3; - const Double_t xn = 8.28; - const Double_t xlim=0.5; - const Double_t t=0.160; - const Double_t xmpi=0.139; - const Double_t b=1.; - Double_t y, y1, xmpi2, ynorm, a; + const Double_t kp0 = 1.3; + const Double_t kxn = 8.28; + const Double_t kxlim=0.5; + const Double_t kt=0.160; + const Double_t kxmpi=0.139; + const Double_t kb=1.; + Double_t y, y1, kxmpi2, ynorm, a; Double_t x=*px; // - y1=TMath::Power(p0/(p0+xlim),xn); - xmpi2=xmpi*xmpi; - ynorm=b*(TMath::Exp(-sqrt(xlim*xlim+xmpi2)/t)); + y1=TMath::Power(kp0/(kp0+kxlim),kxn); + kxmpi2=kxmpi*kxmpi; + ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+kxmpi2)/kt)); a=ynorm/y1; - if (x > xlim) - y=a*TMath::Power(p0/(p0+x),xn); + if (x > kxlim) + y=a*TMath::Power(kp0/(kp0+x),kxn); else - y=b*TMath::Exp(-sqrt(x*x+xmpi2)/t); + y=kb*TMath::Exp(-sqrt(x*x+kxmpi2)/kt); return y*x; } -// -// y-distribution -// Double_t AliGenPHOSlib::YPion( Double_t *py, Double_t *) { - const Double_t a = 7000.; - const Double_t dy = 4.; +// +// pion y-distribution +// + + const Double_t ka = 7000.; + const Double_t kdy = 4.; Double_t y=TMath::Abs(*py); // - Double_t ex = y*y/(2*dy*dy); - return a*TMath::Exp(-ex); + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); } + + Int_t AliGenPHOSlib::IpPion(TRandom *ran) +{ // particle composition pi+, pi0, pi- // - Int_t AliGenPHOSlib::IpPion() -{ - Float_t random[1]; - gMC->Rndm(random,1); - if ( (3.*random[0]) < 1. ) - { - return 211 ; - } - else - { - if ( (3.*random[0]) >= 2.) - { - return -211 ; - } - else - { + Float_t random = ran->Rndm(); + + if ( (3.*random) < 1. ) + { + return 211 ; + } + else + { + if ( (3.*random) >= 2.) + { + return -211 ; + } + else + { return 111 ; } } } -// End Pions + Int_t AliGenPHOSlib::IpChargedPion(TRandom *ran) +{ +// particle composition pi+, pi0, pi- +// + + Float_t random = ran->Rndm(); + + if ( (2.*random) < 1. ) + { + return 211 ; + } + else + { + return -211 ; + } +} + +//End Pions +//====================================================================== +// Pi 0 Flat Distribution +// Transverse momentum distribution PtPi0Flat +// Rapidity distribution YPi0Flat +// Particle distribution IdPi0Flat 111 (pi0) +// + +Double_t AliGenPHOSlib::PtPi0Flat(Double_t */*px*/, Double_t *) +{ +// Pion transverse momentum flat distribution + +return 1; + +} + +Double_t AliGenPHOSlib::YPi0Flat( Double_t */*py*/, Double_t *) +{ + +// pion y-distribution +// + return 1.; +} + + Int_t AliGenPHOSlib::IpPi0Flat(TRandom *) +{ + +// particle composition pi0 +// + return 111 ; +} +// End Pi0Flat //============================================================= // + Double_t AliGenPHOSlib::PtScal(Double_t pt, Int_t np) +{ // Mt-scaling // Fonction for the calculation of the Pt distribution for a // given particle np, from the pion Pt distribution using the @@ -123,59 +180,61 @@ ClassImp(AliGenPHOSlib) // aliroot version 3.01, and was extended for baryons // np = 1=>Pions 2=>Kaons 3=>Etas 4=>Omegas 5=>ETA' 6=>PHI // 7=>BARYONS-BARYONBARS - Double_t AliGenPHOSlib::PtScal(Double_t pt, Int_t np) -{ + // SCALING EN MASSE PAR RAPPORT A PTPI // MASS 1=>PI, 2=>K, 3=>ETA, 4=>OMEGA, 5=>ETA',6=>PHI - const Double_t hm[10] = {0.1396, 0.494, 0.547, 0.782, 0.957, 1.02, + const Double_t khm[10] = {0.1396, 0.494, 0.547, 0.782, 0.957, 1.02, // MASS 7=>BARYON-BARYONBAR 0.938, 0. , 0., 0.}; // VALUE MESON/PI AT 5 GEV - const Double_t fmax[10]={1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}; + const Double_t kfmax[10]={1., 1., 1., 1., 1., 1., 1., 1., 1., 1.}; np--; - Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+hm[np]*hm[np])+2.0)),12.3); - Double_t fmax2=f5/fmax[np]; + Double_t f5=TMath::Power(((sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3); + Double_t kfmax2=f5/kfmax[np]; // PIONS Double_t ptpion=100.*PtPion(&pt, (Double_t*) 0); Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/ - (sqrt(pt*pt+hm[np]*hm[np])+2.0)),12.3)/ fmax2; + (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ kfmax2; return fmtscal*ptpion; + } // End Scaling //============================================================================ // K A O N S -// kaon -// pt-distribution -//____________________________________________________________ Double_t AliGenPHOSlib::PtKaon( Double_t *px, Double_t *) { +// kaon +// pt-distribution +//____________________________________________________________ + return PtScal(*px,2); // 2==> Kaon in the PtScal function } -// y-distribution -//____________________________________________________________ Double_t AliGenPHOSlib::YKaon( Double_t *py, Double_t *) { - const Double_t a = 1000.; - const Double_t dy = 4.; +// y-distribution +//____________________________________________________________ + + const Double_t ka = 1000.; + const Double_t kdy = 4.; Double_t y=TMath::Abs(*py); // - Double_t ex = y*y/(2*dy*dy); - return a*TMath::Exp(-ex); + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); } + Int_t AliGenPHOSlib::IpKaon(TRandom *ran) +{ // particle composition // - Int_t AliGenPHOSlib::IpKaon() -{ - 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- @@ -183,177 +242,246 @@ ClassImp(AliGenPHOSlib) } else { - if (random[0] < 0.5) { - return 311; // K^0 + if (random < 0.5) { + return 130; // K^0 short } else { - return -311; // K^0 bar + return 310; // K^0 long } } } + + Int_t AliGenPHOSlib::IpChargedKaon(TRandom *ran) +{ +// particle composition +// + + Float_t random = ran->Rndm(); + + if (random < 0.5) { + return 321; // K+ + } else { + return -321; // K- + } + + +} +Int_t AliGenPHOSlib::IpKaon0L(TRandom *) +{ + // particle composition + // + + return 130; // K^0 long +} // End Kaons //============================================================================ //============================================================================ // E T A S -// etas -// pt-distribution -//____________________________________________________________ Double_t AliGenPHOSlib::PtEta( Double_t *px, Double_t *) { +// etas +// pt-distribution +//____________________________________________________________ + return PtScal(*px,3); // 3==> Eta in the PtScal function } -// y-distribution -//____________________________________________________________ Double_t AliGenPHOSlib::YEta( Double_t *py, Double_t *) { - const Double_t a = 1000.; - const Double_t dy = 4.; +// y-distribution +//____________________________________________________________ + + const Double_t ka = 1000.; + const Double_t kdy = 4.; Double_t y=TMath::Abs(*py); // - Double_t ex = y*y/(2*dy*dy); - return a*TMath::Exp(-ex); + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); } + Int_t AliGenPHOSlib::IpEta(TRandom *) +{ // particle composition // - Int_t AliGenPHOSlib::IpEta() -{ + return 221; // eta } // End Etas + +//====================================================================== +// Eta Flat Distribution +// Transverse momentum distribution PtEtaFlat +// Rapidity distribution YEtaFlat +// Particle distribution IdEtaFlat 111 (pi0) +// + +Double_t AliGenPHOSlib::PtEtaFlat(Double_t */*px*/, Double_t *) +{ +// Eta transverse momentum flat distribution + + return 1; + +} + +Double_t AliGenPHOSlib::YEtaFlat( Double_t */*py*/, Double_t *) +{ +// +// pion y-distribution +// + return 1.; +} + + Int_t AliGenPHOSlib::IpEtaFlat(TRandom *) +{ +// +// particle composition eta +// + return 221 ; +} +// End EtaFlat //============================================================================ //============================================================================ // O M E G A S + Double_t AliGenPHOSlib::PtOmega( Double_t *px, Double_t *) +{ // omegas // pt-distribution //____________________________________________________________ - Double_t AliGenPHOSlib::PtOmega( Double_t *px, Double_t *) -{ + return PtScal(*px,4); // 4==> Omega in the PtScal function } -// y-distribution -//____________________________________________________________ Double_t AliGenPHOSlib::YOmega( Double_t *py, Double_t *) { - const Double_t a = 1000.; - const Double_t dy = 4.; +// y-distribution +//____________________________________________________________ + + const Double_t ka = 1000.; + const Double_t kdy = 4.; Double_t y=TMath::Abs(*py); // - Double_t ex = y*y/(2*dy*dy); - return a*TMath::Exp(-ex); + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); } + Int_t AliGenPHOSlib::IpOmega(TRandom *) +{ // particle composition // - Int_t AliGenPHOSlib::IpOmega() -{ + return 223; // Omega } // End Omega //============================================================================ //============================================================================ // E T A P R I M E + Double_t AliGenPHOSlib::PtEtaprime( Double_t *px, Double_t *) +{ // etaprime // pt-distribution //____________________________________________________________ - Double_t AliGenPHOSlib::PtEtaprime( Double_t *px, Double_t *) -{ + return PtScal(*px,5); // 5==> Etaprime in the PtScal function } -// y-distribution -//____________________________________________________________ Double_t AliGenPHOSlib::YEtaprime( Double_t *py, Double_t *) { - const Double_t a = 1000.; - const Double_t dy = 4.; +// y-distribution +//____________________________________________________________ + + const Double_t ka = 1000.; + const Double_t kdy = 4.; Double_t y=TMath::Abs(*py); // - Double_t ex = y*y/(2*dy*dy); - return a*TMath::Exp(-ex); + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); } + Int_t AliGenPHOSlib::IpEtaprime(TRandom *) +{ // particle composition // - Int_t AliGenPHOSlib::IpEtaprime() -{ + return 331; // Etaprime } // End EtaPrime //=================================================================== //============================================================================ // P H I S + Double_t AliGenPHOSlib::PtPhi( Double_t *px, Double_t *) +{ // phi // pt-distribution //____________________________________________________________ - Double_t AliGenPHOSlib::PtPhi( Double_t *px, Double_t *) -{ + return PtScal(*px,6); // 6==> Phi in the PtScal function } -// y-distribution -//____________________________________________________________ Double_t AliGenPHOSlib::YPhi( Double_t *py, Double_t *) { - const Double_t a = 1000.; - const Double_t dy = 4.; +// y-distribution +//____________________________________________________________ + + const Double_t ka = 1000.; + const Double_t kdy = 4.; Double_t y=TMath::Abs(*py); // - Double_t ex = y*y/(2*dy*dy); - return a*TMath::Exp(-ex); + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); } + Int_t AliGenPHOSlib::IpPhi(TRandom *) +{ // particle composition // - Int_t AliGenPHOSlib::IpPhi() -{ + return 333; // Phi } // End Phis //=================================================================== //============================================================================ // B A R Y O N S == protons, protonsbar, neutrons, and neutronsbars + Double_t AliGenPHOSlib::PtBaryon( Double_t *px, Double_t *) +{ // baryons // pt-distribution //____________________________________________________________ - Double_t AliGenPHOSlib::PtBaryon( Double_t *px, Double_t *) -{ + return PtScal(*px,7); // 7==> Baryon in the PtScal function } -// y-distribution -//____________________________________________________________ Double_t AliGenPHOSlib::YBaryon( Double_t *py, Double_t *) { - const Double_t a = 1000.; - const Double_t dy = 4.; +// y-distribution +//____________________________________________________________ + + const Double_t ka = 1000.; + const Double_t kdy = 4.; Double_t y=TMath::Abs(*py); // - Double_t ex = y*y/(2*dy*dy); - return a*TMath::Exp(-ex); + Double_t ex = y*y/(2*kdy*kdy); + return ka*TMath::Exp(-ex); } + Int_t AliGenPHOSlib::IpBaryon(TRandom *ran) +{ // particle composition // - Int_t AliGenPHOSlib::IpBaryon() -{ - 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 @@ -361,113 +489,187 @@ ClassImp(AliGenPHOSlib) } else { - if (random[0] < 0.5) { + if (random < 0.5) { return 2112; // n } else { return -2112; // n bar } } +} + + Int_t AliGenPHOSlib::IpProton(TRandom *) +{ +// particle composition +// + return 2212; // p + +} + Int_t AliGenPHOSlib::IpAProton(TRandom *) +{ +// particle composition +// + return -2212; // p bar + +} + + Int_t AliGenPHOSlib::IpNeutron(TRandom *) +{ +// particle composition +// + return 2112; // n + +} + Int_t AliGenPHOSlib::IpANeutron(TRandom *) +{ +// particle composition +// + return -2112; // n + } // End Baryons //=================================================================== + typedef Double_t (*GenFunc) (Double_t*, Double_t*); - GenFunc AliGenPHOSlib::GetPt(Param_t param) +GenFunc AliGenPHOSlib::GetPt(Int_t param, const char* /*tname*/) const { +// Return pinter to pT parameterisation GenFunc func; switch (param) - { - case Pion: + { + case kPion: func=PtPion; break; - case Kaon: + case kPi0Flat: + func=PtPi0Flat; + break; + case kKaon: func=PtKaon; break; - case Eta: + case kEta: func=PtEta; break; - case Omega: + case kEtaFlat: + func=PtEtaFlat; + break; + case kOmega: func=PtOmega; break; - case Etaprime: + case kEtaPrime: func=PtEtaprime; break; - case Baryon: + case kBaryon: func=PtBaryon; break; - default: + default: func=0; printf(" unknown parametrisationn"); - } + } return func; } - GenFunc AliGenPHOSlib::GetY(Param_t param) +GenFunc AliGenPHOSlib::GetY(Int_t param, const char* /*tname*/) const { - GenFunc func; - switch (param) + // Return pointer to Y parameterisation + GenFunc func; + switch (param) { - case Pion: - func=YPion; - break; - case Kaon: - func=YKaon; - break; - case Eta: - func=YEta; - break; - case Omega: - func=YOmega; - break; - case Etaprime: - func=YEtaprime; - break; - case Phi: - func=YPhi; - break; - case Baryon: - func=YBaryon; - break; + case kPion: + func=YPion; + break; + case kPi0Flat: + func=YPi0Flat; + break; + case kKaon: + func=YKaon; + break; + case kEta: + func=YEta; + break; + case kEtaFlat: + func=YEtaFlat; + break; + case kOmega: + func=YOmega; + break; + case kEtaPrime: + func=YEtaprime; + break; + case kPhi: + func=YPhi; + break; + case kBaryon: + func=YBaryon; + break; default: - func=0; - printf(" unknown parametrisationn"); + func=0; + printf(" unknown parametrisationn"); } - return func; + return func; } -typedef Int_t (*GenFuncIp) (); - GenFuncIp AliGenPHOSlib::GetIp(Param_t param) +typedef Int_t (*GenFuncIp) (TRandom *); +GenFuncIp AliGenPHOSlib::GetIp(Int_t param, const char* /*tname*/) const { - GenFuncIp func; - switch (param) + // Return pointer to particle composition + GenFuncIp func; + switch (param) { - case Pion: - - func=IpPion; - break; - case Kaon: - func=IpKaon; - break; - case Eta: - func=IpEta; - break; - case Omega: - func=IpOmega; - break; - case Etaprime: - func=IpEtaprime; - break; - case Phi: - func=IpPhi; - break; - case Baryon: - func=IpBaryon; - break; + case kPion: + func=IpPion; + break; + case kChargedPion: + func=IpChargedPion; + break; + case kPi0Flat: + func=IpPi0Flat; + break; + case kKaon: + func=IpKaon; + break; + case kChargedKaon: + func=IpChargedKaon; + break; + case kKaon0L: + func=IpKaon0L; + break; + case kEta: + func=IpEta; + break; + case kEtaFlat: + func=IpEtaFlat; + break; + + case kOmega: + func=IpOmega; + break; + case kEtaPrime: + func=IpEtaprime; + break; + case kPhi: + func=IpPhi; + break; + case kBaryon: + func=IpBaryon; + break; + case kProton: + func=IpProton; + break; + case kAProton: + func=IpAProton; + break; + case kNeutron: + func=IpNeutron; + break; + case kANeutron: + func=IpANeutron; + break; + default: - func=0; - printf(" unknown parametrisationn"); + func=0; + printf(" unknown parametrisationn"); } - return func; + return func; }