]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenMUONlib.cxx
task becomes a subtask of PHOS
[u/mrichter/AliRoot.git] / EVGEN / AliGenMUONlib.cxx
index 97c850d6ea284fe7680a584577b0a39e050c4c34..1b55475a3780bfd5b6b659373850dc51d8ae9744 100644 (file)
 
 /*
 $Log$
+Revision 1.12  2001/03/09 13:01:41  morsch
+- enum constants for paramterisation type (particle family) moved to AliGen*lib.h
+- use AliGenGSIlib::kUpsilon, AliGenPHOSlib::kEtaPrime to access the constants
+
+Revision 1.11  2000/11/30 07:12:50  alibrary
+Introducing new Rndm and QA classes
+
+Revision 1.10  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.9  2000/06/14 15:20:56  morsch
+Include clean-up (IH)
+
+Revision 1.8  2000/06/09 20:32:11  morsch
+All coding rule violations except RS3 corrected
+
+Revision 1.7  2000/05/02 08:12:13  morsch
+Coding rule violations corrected.
+
 Revision 1.6  1999/09/29 09:24:14  fca
 Introduction of the Copyright and cvs Log
 
 */
 
+#include "TMath.h"
+#include "TRandom.h"
+
 #include "AliGenMUONlib.h"
-#include "AliRun.h"
+
 ClassImp(AliGenMUONlib)
 //
 //  Pions
@@ -57,22 +81,22 @@ Double_t AliGenMUONlib::PtPion(Double_t *px, Double_t *dummy)
 Double_t AliGenMUONlib::YPion( Double_t *py, Double_t *dummy)
 {
 // Pion y
+  Double_t y=TMath::Abs(*py);
+/*
   const Double_t ka    = 7000.;
   const Double_t kdy   = 4.;
-
-  Double_t y=TMath::Abs(*py);
-  //
   Double_t ex = y*y/(2*kdy*kdy);
   return ka*TMath::Exp(-ex);
+*/
+  return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
+  
 }
 //                 particle composition
 //
-Int_t AliGenMUONlib::IpPion()
+Int_t AliGenMUONlib::IpPion(TRandom *ran)
 {
 // Pion composition 
-    Float_t random[1];
-    gMC->Rndm(random,1);
-    if (random[0] < 0.5) {
+    if (ran->Rndm() < 0.5) {
        return  211;
     } else {
        return -211;
@@ -115,24 +139,24 @@ Double_t AliGenMUONlib::PtKaon( Double_t *px, Double_t *dummy)
 Double_t AliGenMUONlib::YKaon( Double_t *py, Double_t *dummy)
 {
 // Kaon y
+  Double_t y=TMath::Abs(*py);
+/*
   const Double_t ka    = 1000.;
   const Double_t kdy   = 4.;
-  
-
-  Double_t y=TMath::Abs(*py);
   //
   Double_t ex = y*y/(2*kdy*kdy);
   return ka*TMath::Exp(-ex);
+*/
+
+  return 1.16526e+04+y*-3.79886e+03+y*y*4.31130e+02;
 }
 
 //                 particle composition
 //
-Int_t AliGenMUONlib::IpKaon()
+Int_t AliGenMUONlib::IpKaon(TRandom *ran)
 {
 // Kaon composition
-    Float_t random[1];
-    gMC->Rndm(random,1);
-    if (random[0] < 0.5) {
+    if (ran->Rndm() < 0.5) {
        return  321;
     } else {
        return -321;
@@ -173,7 +197,7 @@ Double_t AliGenMUONlib::YJpsi(Double_t *py, Double_t *dummy)
 }
 //                 particle composition
 //
-Int_t AliGenMUONlib::IpJpsi()
+Int_t AliGenMUONlib::IpJpsi(TRandom *)
 {
 // J/Psi composition
     return 443;
@@ -214,7 +238,7 @@ Double_t AliGenMUONlib::YUpsilon(Double_t *py, Double_t *dummy)
 }
 //                 particle composition
 //
-Int_t AliGenMUONlib::IpUpsilon()
+Int_t AliGenMUONlib::IpUpsilon(TRandom *)
 {
 // y composition
     return 553;
@@ -240,7 +264,7 @@ Double_t AliGenMUONlib::YPhi( Double_t *px, Double_t *dummy)
 }
 //                 particle composition
 //
-Int_t AliGenMUONlib::IpPhi()
+Int_t AliGenMUONlib::IpPhi(TRandom *)
 {
 // Phi composition
     return 41;
@@ -257,9 +281,10 @@ Double_t AliGenMUONlib::PtCharm( Double_t *px, Double_t *dummy)
 // Charm pT
   const Double_t kpt0 = 4.08;
   const Double_t kxn  = 9.40;
+
   Double_t x=*px;
   //
-  Double_t pass1 = 1.+(x/kpt0)*(x/kpt0);
+  Double_t pass1 = 1.+(x/kpt0);
   return x/TMath::Power(pass1,kxn);
 }
 //                  y-distribution
@@ -270,23 +295,23 @@ Double_t AliGenMUONlib::YCharm( Double_t *px, Double_t *dummy)
     return YJpsi(px,dum);
 }
 
-Int_t AliGenMUONlib::IpCharm()
+Int_t AliGenMUONlib::IpCharm(TRandom *ran)
 {  
 // Charm composition
-    Float_t random[2];
+    Float_t random;
     Int_t ip;
 //    411,421,431,4122
-    gMC->Rndm(random,2);
-    if (random[0] < 0.5) {
+    random = ran->Rndm();
+    if (random < 0.5) {
        ip=411;
-    } else if (random[0] < 0.75) {
+    } else if (random < 0.75) {
        ip=421;
-    } else if (random[0] < 0.90) {
+    } else if (random < 0.90) {
        ip=431;
     } else {
        ip=4122;
     }
-    if (random[1] < 0.5) {ip=-ip;}
+    if (ran->Rndm() < 0.5) {ip=-ip;}
     
     return ip;
 }
@@ -316,52 +341,52 @@ Double_t AliGenMUONlib::YBeauty( Double_t *px, Double_t *dummy)
     return YJpsi(px,dum);
 }
 
-Int_t AliGenMUONlib::IpBeauty()
+Int_t AliGenMUONlib::IpBeauty(TRandom *ran)
 {  
 // Beauty Composition
-    Float_t random[2];
+    Float_t random;
     Int_t ip;
-    gMC->Rndm(random,2);
-    if (random[0] < 0.5) {
+    random = ran->Rndm();
+    if (random < 0.5) {
        ip=511;
-    } else if (random[0] < 0.75) {
+    } else if (random < 0.75) {
        ip=521;
-    } else if (random[0] < 0.90) {
+    } else if (random < 0.90) {
        ip=531;
     } else {
        ip=5122;
     }
-    if (random[1] < 0.5) {ip=-ip;}
+    if (ran->Rndm() < 0.5) {ip=-ip;}
     
     return ip;
 }
 
 typedef Double_t (*GenFunc) (Double_t*,  Double_t*);
-GenFunc AliGenMUONlib::GetPt(Param_t param)
+GenFunc AliGenMUONlib::GetPt(Int_t param,  const char* tname)
 {
 // Return pointer to pT parameterisation
     GenFunc func;
     switch (param) 
     {
-    case phi_p:
+    case kPhi:
        func=PtPhi;
        break;
-    case jpsi_p:
+    case kJpsi:
        func=PtJpsi;
        break;
-    case upsilon_p:
+    case kUpsilon:
        func=PtUpsilon;
        break;
-    case charm_p:
+    case kCharm:
        func=PtCharm;
        break;
-    case beauty_p:
+    case kBeauty:
        func=PtBeauty;
        break;
-    case pion_p:
+    case kPion:
        func=PtPion;
        break;
-    case kaon_p:
+    case kKaon:
        func=PtKaon;
        break;
     default:
@@ -371,31 +396,31 @@ GenFunc AliGenMUONlib::GetPt(Param_t param)
     return func;
 }
 
-GenFunc AliGenMUONlib::GetY(Param_t param)
+GenFunc AliGenMUONlib::GetY(Int_t param, const char* tname)
 {
 // Return pointer to y- parameterisation
     GenFunc func;
     switch (param) 
     {
-    case phi_p:
+    case kPhi:
        func=YPhi;
        break;
-    case jpsi_p:
+    case kJpsi:
        func=YJpsi;
        break;
-    case upsilon_p:
+    case kUpsilon:
        func=YUpsilon;
        break;
-    case charm_p:
+    case kCharm:
        func=YCharm;
        break;
-    case beauty_p:
+    case kBeauty:
        func=YBeauty;
        break;
-    case pion_p:
+    case kPion:
        func=YPion;
        break;
-    case kaon_p:
+    case kKaon:
        func=YKaon;
        break;
     default:
@@ -404,32 +429,32 @@ GenFunc AliGenMUONlib::GetY(Param_t param)
     }
     return func;
 }
-typedef Int_t (*GenFuncIp) ();
-GenFuncIp AliGenMUONlib::GetIp(Param_t param)
+typedef Int_t (*GenFuncIp) (TRandom *);
+GenFuncIp AliGenMUONlib::GetIp(Int_t param,  const char* tname)
 {
 // Return pointer to particle type parameterisation
     GenFuncIp func;
     switch (param) 
     {
-    case phi_p:
+    case kPhi:
        func=IpPhi;
        break;
-    case jpsi_p:
+    case kJpsi:
        func=IpJpsi;
        break;
-    case upsilon_p:
+    case kUpsilon:
        func=IpUpsilon;
        break;
-    case charm_p:
+    case kCharm:
        func=IpCharm;
        break;
-    case beauty_p:
+    case kBeauty:
        func=IpBeauty;
        break;
-    case pion_p:
+    case kPion:
        func=IpPion;
        break;
-    case kaon_p:
+    case kKaon:
        func=IpKaon;
        break;
     default: