LCOV - code coverage report
Current view: top level - EVGEN - AliGenHIJINGparaBa.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 156 0.6 %
Date: 2016-06-14 17:26:59 Functions: 1 19 5.3 %

          Line data    Source code
       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             : // Parameterisation of pi, K, n and p eta and pt distributions   //
      20             : // eta: according to HIJING (shadowing + quenching)              //
      21             : // pT : according to CDF measurement at 1.8 TeV                  //
      22             : // Author: andreas.morsch@cern.ch                                //
      23             : //                                                               //
      24             : ///////////////////////////////////////////////////////////////////
      25             : 
      26             : #include <TArrayF.h>
      27             : #include <TF1.h>
      28             : #include <TPDGCode.h>
      29             : 
      30             : #include "AliConst.h"
      31             : #include "AliGenEventHeader.h"
      32             : #include "AliGenHIJINGparaBa.h"
      33             : #include "AliRun.h"
      34             : 
      35           6 : ClassImp(AliGenHIJINGparaBa)
      36             : 
      37             : 
      38             : static Double_t ptpi(const Double_t *px, const Double_t *)
      39             : {
      40             :   //
      41             :   //     PT-PARAMETERIZATION CDF, PRL 61(88) 1819
      42             :   //     POWER LAW FOR PT > 500 MEV
      43             :   //     MT SCALING BELOW (T=160 MEV)
      44             :   //
      45             :   const Double_t kp0 = 1.3;
      46             :   const Double_t kxn = 8.28;
      47             :   const Double_t kxlim=0.5;
      48             :   const Double_t kt=0.160;
      49             :   const Double_t kxmpi=0.139;
      50             :   const Double_t kb=1.;
      51             :   Double_t y, y1, xmpi2, ynorm, a;
      52           0 :   Double_t x=*px;
      53             :   //
      54           0 :   y1=TMath::Power(kp0/(kp0+kxlim),kxn);
      55             :   xmpi2=kxmpi*kxmpi;
      56           0 :   ynorm=kb*(TMath::Exp(-sqrt(kxlim*kxlim+xmpi2)/kt));
      57           0 :   a=ynorm/y1;
      58           0 :   if (x > kxlim)
      59           0 :     y=a*TMath::Power(kp0/(kp0+x),kxn);
      60             :   else
      61           0 :     y=kb*TMath::Exp(-sqrt(x*x+xmpi2)/kt);
      62           0 :   return y*x;
      63             : }
      64             : 
      65             : //_____________________________________________________________________________
      66             : static Double_t ptscal(Double_t pt, Int_t np)
      67             : {
      68             :     //    SCALING EN MASSE PAR RAPPORT A PTPI
      69             :     //     MASS PI,K,ETA,RHO,OMEGA,ETA',PHI
      70             :     const Double_t khm[10] = {.13957,.493,.5488,.769,.7826,.958,1.02,0,0,0};
      71             :     //     VALUE MESON/PI AT 5 GEV
      72             :     const Double_t kfmax[10]={1.,0.3,0.55,1.0,1.0,1.0,1.0,0,0,0};
      73           0 :     np--;
      74           0 :     Double_t f5=TMath::Power(((
      75           0 :         sqrt(100.018215)+2.)/(sqrt(100.+khm[np]*khm[np])+2.0)),12.3);
      76           0 :     Double_t fmax2=f5/kfmax[np];
      77             :     // PIONS
      78           0 :     Double_t ptpion=100.*ptpi(&pt, (Double_t*) 0);
      79           0 :     Double_t fmtscal=TMath::Power(((
      80           0 :         sqrt(pt*pt+0.018215)+2.)/ (sqrt(pt*pt+khm[np]*khm[np])+2.0)),12.3)/ 
      81             :         fmax2;
      82           0 :     return fmtscal*ptpion;
      83             : }
      84             : 
      85             : //_____________________________________________________________________________
      86             : static Double_t ptka( Double_t *px, Double_t *)
      87             : {
      88             :     //
      89             :     // pt parametrisation for k
      90             :     //
      91           0 :     return ptscal(*px,2);
      92             : }
      93             : 
      94             : 
      95             : //_____________________________________________________________________________
      96             : static Double_t etapic( Double_t *py, Double_t *)
      97             : {
      98             :   //
      99             :   // eta parametrisation for pi
     100             :   //
     101             :     const Double_t ka1    = 4913.;
     102             :     const Double_t ka2    = 1819.;
     103             :     const Double_t keta1  = 0.22;
     104             :     const Double_t keta2  = 3.66;
     105             :     const Double_t kdeta1 = 1.47;
     106             :     const Double_t kdeta2 = 1.51;
     107           0 :     Double_t y=TMath::Abs(*py);
     108             :     //
     109           0 :     Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
     110           0 :     Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
     111           0 :     return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
     112             : }
     113             : 
     114             : //_____________________________________________________________________________
     115             : static Double_t etakac( Double_t *py, Double_t *)
     116             : {
     117             :     //
     118             :     // eta parametrisation for ka
     119             :     //
     120             :     const Double_t ka1    = 497.6;
     121             :     const Double_t ka2    = 215.6;
     122             :     const Double_t keta1  = 0.79;
     123             :     const Double_t keta2  = 4.09;
     124             :     const Double_t kdeta1 = 1.54;
     125             :     const Double_t kdeta2 = 1.40;
     126           0 :     Double_t y=TMath::Abs(*py);
     127             :     //
     128           0 :     Double_t ex1 = (y-keta1)*(y-keta1)/(2*kdeta1*kdeta1);
     129           0 :     Double_t ex2 = (y-keta2)*(y-keta2)/(2*kdeta2*kdeta2);
     130           0 :     return ka1*TMath::Exp(-ex1)+ka2*TMath::Exp(-ex2);
     131             : }
     132             : 
     133             :  static Double_t ptbaryon( Double_t *px, Double_t *)
     134             : {
     135             : // baryons
     136             : //                pt-distribution
     137             : //____________________________________________________________
     138             : 
     139           0 :   return ptscal(*px,7);  //  7==> Baryon in the PtScal function
     140             : }
     141             : 
     142             :  static Double_t etabaryon( Double_t *py, Double_t *)
     143             : {
     144             : // eta-distribution
     145             : //____________________________________________________________
     146             :     const Float_t  kp0 =  1.10343e+02;
     147             :     const Float_t  kp1 =  1.73247e+01;
     148             :     const Float_t  kp2 = -7.23808e+00;
     149             :     const Float_t  kp3 =  4.48334e-01;
     150           0 :     const Double_t ky = TMath::Abs(*py);
     151             : //
     152           0 :     return (kp0+kp1*ky+kp2*ky*ky+kp3*ky*ky*ky)/20.;
     153             : }
     154             : 
     155             : AliGenHIJINGparaBa::AliGenHIJINGparaBa()
     156           0 :     :AliGenHIJINGpara(),
     157           0 :      fPtba(0),
     158           0 :      fETAba(0)
     159           0 : {
     160             :     //
     161             :     // Default constructor
     162             :     //
     163           0 :     fName="HIGINGparaBa";
     164           0 :     fTitle="HIJING Parametrisation Particle Generator with Baryons";
     165           0 : }
     166             : 
     167             : //_____________________________________________________________________________
     168             : AliGenHIJINGparaBa::AliGenHIJINGparaBa(Int_t npart)
     169           0 :   :AliGenHIJINGpara(npart),
     170           0 :      fPtba(0),
     171           0 :      fETAba(0)
     172           0 : {
     173             :   // 
     174             :   // Standard constructor
     175             :   //
     176           0 :     fName="HIGINGparaBa";
     177           0 :     fTitle="HIJING Parametrisation Particle Generator with Baryons";
     178           0 : }
     179             : 
     180             : //_____________________________________________________________________________
     181           0 : AliGenHIJINGparaBa::~AliGenHIJINGparaBa()
     182           0 : {
     183             :   //
     184             :   // Standard destructor
     185             :   //
     186           0 :     delete fPtba;
     187           0 :     delete fETAba;
     188           0 : }
     189             : 
     190             : //_____________________________________________________________________________
     191             : void AliGenHIJINGparaBa::Init()
     192             : {
     193             :   //
     194             :   // Initialise the HIJING parametrisation
     195             :   //
     196           0 :     Float_t etaMin =-TMath::Log(TMath::Tan(
     197           0 :         TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10)));
     198           0 :     Float_t etaMax = -TMath::Log(TMath::Tan(
     199           0 :         TMath::Max((Double_t)fThetaMin/2,1.e-10)));
     200           0 :     fPtpi   = new TF1("ptpi",&ptpi,0,20,0);
     201           0 :     fPtka   = new TF1("ptka",&ptka,0,20,0);
     202           0 :     fPtba   = new TF1("ptbaryon",&ptbaryon,0,20,0);
     203           0 :     fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
     204           0 :     fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
     205           0 :     fETAba  = new TF1("etabaryon",&etabaryon,etaMin,etaMax,0);
     206             : 
     207           0 :     TF1 etaPic0("etapic(-7,7)",&etapic,    -7, 7, 0);
     208           0 :     TF1 etaKac0("etakac(-7,7)",&etakac,    -7, 7, 0);
     209           0 :     TF1 etaBar0("etabar(-7,7)",&etabaryon, -7, 7, 0);
     210             :     
     211           0 :     TF1 ptPic0("ptpi(0,15)",  &ptpi,     0., 15., 0);
     212           0 :     TF1 ptKac0("ptka(0,15)",  &ptka,     0., 15., 0);
     213           0 :     TF1 ptBar0("ptbar(0,15)", &ptbaryon, 0., 15., 0);
     214             : 
     215           0 :     Float_t intETApi  = etaPic0.Integral(-0.5, 0.5);
     216           0 :     Float_t intETAka  = etaKac0.Integral(-0.5, 0.5);
     217           0 :     Float_t intETAba  = etaBar0.Integral(-0.5, 0.5);
     218             : 
     219           0 :     Float_t scalePi   = 6979./(intETApi/1.5);
     220           0 :     Float_t scaleKa   =  657./(intETAka/2.0);
     221           0 :     Float_t scaleBa   =  364./(intETAba/2.0);
     222             : 
     223             : //  Fraction of events corresponding to the selected pt-range    
     224           0 :     Float_t intPt    = (0.837*ptPic0.Integral(0, 15)+
     225           0 :                         0.105*ptKac0.Integral(0, 15)+
     226           0 :                         0.058*ptBar0.Integral(0, 15));
     227           0 :     Float_t intPtSel = (0.837*ptPic0.Integral(fPtMin, fPtMax)+
     228           0 :                         0.105*ptKac0.Integral(fPtMin, fPtMax)+
     229           0 :                         0.058*ptBar0.Integral(fPtMin, fPtMax));
     230           0 :     Float_t ptFrac   = intPtSel/intPt;
     231             : 
     232             : //  Fraction of events corresponding to the selected eta-range    
     233           0 :     Float_t intETASel  = (scalePi*etaPic0.Integral(etaMin, etaMax)+
     234           0 :                           scaleKa*etaKac0.Integral(etaMin, etaMax)+
     235           0 :                           scaleBa*etaBar0.Integral(etaMin, etaMax));
     236             : //  Fraction of events corresponding to the selected phi-range    
     237           0 :     Float_t phiFrac    = (fPhiMax-fPhiMin)/2/TMath::Pi();
     238             : 
     239           0 :     fParentWeight = Float_t(fNpart)/(intETASel*ptFrac*phiFrac);
     240             :     
     241           0 :     printf("%s: The number of particles in the selected kinematic region corresponds to %f percent of a full event \n", 
     242           0 :            ClassName(),100.*fParentWeight);
     243             : 
     244             : // Issue warning message if etaMin or etaMax are outside the alowed range 
     245             : // of the parametrization
     246           0 :     if (etaMin < -8.001 || etaMax > 8.001) {
     247           0 :         printf("\n \n WARNING FROM AliGenHIJINGParaBa !");
     248           0 :         printf("\n YOU ARE USING THE PARAMETERISATION OUTSIDE ");     
     249           0 :         printf("\n THE ALLOWED PSEUDORAPIDITY RANGE (-8. - 8.)");         
     250           0 :         printf("\n YOUR LIMITS: %f %f \n \n ", etaMin, etaMax);
     251             :     }
     252           0 : }
     253             : 
     254             : //_____________________________________________________________________________
     255             : void AliGenHIJINGparaBa::Generate()
     256             : {
     257             :   //
     258             :   // Generate one trigger
     259             :   //
     260             : 
     261             :   
     262             :     const Float_t kBorne1 = 0.837;
     263             :     const Float_t kBorne2 = kBorne1+0.105;
     264             :     
     265           0 :     Float_t polar[3]= {0,0,0};
     266             :     //
     267             :     const Int_t kPions[3]   = {kPi0, kPiPlus, kPiMinus};
     268             :     const Int_t kKaons[4]   = {kK0Long, kK0Short, kKPlus, kKMinus};
     269             :     const Int_t kBaryons[4] = {kProton, kProtonBar, kNeutron, kNeutronBar};
     270             :     //
     271           0 :     Float_t origin[3];
     272             :     Float_t time;
     273             :     Float_t pt, pl, ptot;
     274             :     Float_t phi, theta;
     275           0 :     Float_t p[3];
     276           0 :     Int_t i, part, nt, j;
     277             :     //
     278             :     TF1 *ptf;
     279             :     TF1 *etaf;
     280             :     //
     281           0 :     Float_t random[6];
     282             :     //
     283           0 :     for (j=0;j<3;j++) origin[j]=fOrigin[j];
     284           0 :     time = fTimeOrigin;
     285             : 
     286           0 :     if(fVertexSmear == kPerEvent) {
     287           0 :         Float_t dv[3];
     288           0 :         dv[2] = 1.e10;
     289           0 :         while(TMath::Abs(dv[2]) > fCutVertexZ*fOsigma[2]) {
     290           0 :             Rndm(random,6);
     291           0 :             for (j=0; j < 3; j++) {
     292           0 :                 dv[j] = fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
     293           0 :                     TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
     294             :             }
     295             :         }
     296           0 :         for (j=0; j < 3; j++) origin[j] += dv[j];
     297             : 
     298           0 :         Rndm(random,2);
     299           0 :         time += fOsigma[2]/TMath::Ccgs()*
     300           0 :           TMath::Cos(2*random[0]*TMath::Pi())*
     301           0 :           TMath::Sqrt(-2*TMath::Log(random[1]));
     302           0 :     } // if kPerEvent
     303           0 :     TArrayF eventVertex;
     304           0 :     eventVertex.Set(3);
     305           0 :     eventVertex[0] = origin[0];
     306           0 :     eventVertex[1] = origin[1];
     307           0 :     eventVertex[2] = origin[2];
     308             :     Float_t eventTime = time;
     309             : 
     310           0 :     for(i=0;i<fNpart;i++) {
     311             :         while(1) {
     312           0 :             Rndm(random,3);
     313           0 :             if(random[0] < kBorne1) {
     314           0 :                 part  = kPions[Int_t (random[1]*3)];
     315           0 :                 ptf   = fPtpi;
     316           0 :                 etaf  = fETApic;
     317           0 :             } else if (random[0] < kBorne2) {
     318           0 :                 part  = kKaons[Int_t (random[1]*4)];
     319           0 :                 ptf   = fPtka;
     320           0 :                 etaf  = fETAkac;
     321           0 :             } else {
     322           0 :                 part  = kBaryons[Int_t (random[1]*4)];
     323           0 :                 ptf   = fPtba;
     324           0 :                 etaf  = fETAba;
     325             :             }
     326             :             
     327           0 :             phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
     328           0 :             theta=2*TMath::ATan(TMath::Exp(-etaf->GetRandom()));
     329           0 :             if(theta<fThetaMin || theta>fThetaMax) continue;
     330           0 :             pt=ptf->GetRandom();
     331           0 :             pl=pt/TMath::Tan(theta);
     332           0 :             ptot=TMath::Sqrt(pt*pt+pl*pl);
     333           0 :             if(ptot<fPMin || ptot>fPMax) continue;
     334           0 :             p[0]=pt*TMath::Cos(phi);
     335           0 :             p[1]=pt*TMath::Sin(phi);
     336           0 :             p[2]=pl;
     337           0 :             if(fVertexSmear==kPerTrack) {
     338           0 :                 Rndm(random,6);
     339           0 :                 for (j=0;j<3;j++) {
     340           0 :                     origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
     341           0 :                         TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
     342             :                 }
     343             : 
     344           0 :                 Rndm(random,2);
     345           0 :                 time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
     346           0 :                   TMath::Cos(2*random[0]*TMath::Pi())*
     347           0 :                   TMath::Sqrt(-2*TMath::Log(random[1]));
     348           0 :             }
     349           0 :             PushTrack(fTrackIt,-1,part,p,origin,polar,time,kPPrimary,nt,fParentWeight);
     350             :             break;
     351             :         } // while(1)
     352             :     } // Particle loop
     353             : // Header
     354           0 :     AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
     355             : // Event Vertex
     356           0 :     header->SetPrimaryVertex(eventVertex);
     357           0 :     header->SetInteractionTime(eventTime);
     358           0 :     gAlice->SetGenEventHeader(header); 
     359           0 : }
     360             : 
     361             : 
     362             : 

Generated by: LCOV version 1.11