]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenPHOSlib.cxx
New class used for primary vertex finding (AliITSVertexerTracks)
[u/mrichter/AliRoot.git] / EVGEN / AliGenPHOSlib.cxx
index b4cc49949c3419777a7a3eae4b751a597c4c6c48..fad630e98e96000a5222567629b6e11e7c68df1f 100644 (file)
@@ -1,3 +1,4 @@
+
 /**************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
 
 /*
 $Log$
+Revision 1.7.10.1  2002/06/10 14:57:41  hristov
+Merged with v3-08-02
+
+Revision 1.10  2002/05/02 09:40:50  morsch
+Recover mods from Rev. 1.8
+
+Revision 1.9  2002/04/23 12:54:29  morsch
+New options kPi0Flat y kEtaFlat (Gustavo Conesa)
+
+Revision 1.7  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.6  2000/11/30 07:12:50  alibrary
+Introducing new Rndm and QA classes
+
+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
+
 Revision 1.2  1999/11/04 11:30:48  fca
 Improve comments
 
@@ -45,9 +73,10 @@ New version from G.Martinez & A.Morsch
 //     martinez@subatech.in2p3.fr
 //======================================================================
 
-#include "AliGenPHOSlib.h"
 #include "TMath.h"
-#include "AliRun.h"
+#include "TRandom.h"
+
+#include "AliGenPHOSlib.h"
 
 ClassImp(AliGenPHOSlib)
 
@@ -100,31 +129,62 @@ 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);
-
-    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
+
+//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)
@@ -152,6 +212,7 @@ ClassImp(AliGenPHOSlib)
   Double_t fmtscal=TMath::Power(((sqrt(pt*pt+0.018215)+2.)/
                                  (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ kfmax2;
   return fmtscal*ptpion;
+
 }
 // End Scaling
 //============================================================================
@@ -180,17 +241,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-
@@ -198,7 +258,7 @@ ClassImp(AliGenPHOSlib)
     }
     else
     {  
-      if (random[0] < 0.5) {       
+      if (random < 0.5) {       
         return  130;   // K^0 short
       } else {  
         return  310;   // K^0 long
@@ -233,7 +293,7 @@ ClassImp(AliGenPHOSlib)
   return ka*TMath::Exp(-ex);
 }
 
- Int_t AliGenPHOSlib::IpEta()
+ Int_t AliGenPHOSlib::IpEta(TRandom *)
 {
 //                 particle composition
 //
@@ -241,6 +301,38 @@ ClassImp(AliGenPHOSlib)
         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 Pi0Flat
 //============================================================================
 //============================================================================
 //    O  M  E  G  A  S
@@ -268,7 +360,7 @@ ClassImp(AliGenPHOSlib)
   return ka*TMath::Exp(-ex);
 }
 
- Int_t AliGenPHOSlib::IpOmega()
+ Int_t AliGenPHOSlib::IpOmega(TRandom *)
 {
 //                 particle composition
 //
@@ -303,7 +395,7 @@ ClassImp(AliGenPHOSlib)
   return ka*TMath::Exp(-ex);
 }
 
- Int_t AliGenPHOSlib::IpEtaprime()
+ Int_t AliGenPHOSlib::IpEtaprime(TRandom *)
 {
 //                 particle composition
 //
@@ -338,7 +430,7 @@ ClassImp(AliGenPHOSlib)
   return ka*TMath::Exp(-ex);
 }
 
- Int_t AliGenPHOSlib::IpPhi()
+ Int_t AliGenPHOSlib::IpPhi(TRandom *)
 {
 //                 particle composition
 //
@@ -373,17 +465,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
@@ -391,7 +482,7 @@ ClassImp(AliGenPHOSlib)
     }
     else
     {  
-      if (random[0] < 0.5) {       
+      if (random < 0.5) {       
         return  2112;   // n
       } else {  
         return -2112;   // n bar
@@ -403,29 +494,35 @@ ClassImp(AliGenPHOSlib)
 
 
 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:
@@ -435,31 +532,37 @@ typedef Double_t (*GenFunc) (Double_t*,  Double_t*);
     return func;
 }
 
- GenFunc AliGenPHOSlib::GetY(Param_t param)
+ GenFunc AliGenPHOSlib::GetY(Int_t param, const char* tname) const
 {
 // Return pointer to Y parameterisation
     GenFunc func;
     switch (param)
     {
-    case Pion:
+    case kPion:
         func=YPion;
         break;
-    case Kaon:
+    case kPi0Flat:
+        func=YPi0Flat;
+        break;
+    case kKaon:
         func=YKaon;
         break;
-    case Eta:
+    case kEta:
         func=YEta;
         break;
-    case Omega:
+   case kEtaFlat:
+        func=YEtaFlat;
+        break;
+    case kOmega:
         func=YOmega;
         break;
-    case Etaprime:
+    case kEtaPrime:
         func=YEtaprime;
         break;
-    case Phi:
+    case kPhi:
         func=YPhi;
         break;
-    case Baryon:
+    case kBaryon:
         func=YBaryon;
         break;
     default:
@@ -468,33 +571,39 @@ 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(Int_t param,  const char* tname) const
 {
 // Return pointer to particle composition
     GenFuncIp func;
     switch (param)
     {
-    case Pion:
-        
+    case kPion:       
         func=IpPion;
         break;
-    case Kaon:
+    case kPi0Flat:       
+        func=IpPi0Flat;
+        break;
+    case kKaon:
         func=IpKaon;
         break;
-    case Eta:
+    case kEta:
         func=IpEta;
         break;
-    case Omega:
+    case kEtaFlat:
+        func=IpEtaFlat;
+        break;
+       
+    case kOmega:
         func=IpOmega;
         break;
-    case Etaprime:
+    case kEtaPrime:
         func=IpEtaprime;
         break;
-    case Phi:
+    case kPhi:
         func=IpPhi;
         break;
-    case Baryon:
+    case kBaryon:
         func=IpBaryon;
         break;
     default: