1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliGenTunedOnPbPb.cxx 51126 2013-08-19 13:37:49Z fnoferin $ */
18 // Parameterisation based on 5.5 ATeV PbPb data
19 // pi,K, p , K0, lambda, phi, Xi, Omega spectra, v2, v3 (no jets!)
20 // Author: fnoferin@cern.ch
24 #include <TClonesArray.h>
25 #include <TDatabasePDG.h>
29 #include <TParticle.h>
31 #include <TVirtualMC.h>
32 #include <TLorentzVector.h>
35 #include "AliDecayer.h"
36 #include "AliGenEventHeaderTunedPbPb.h"
39 #include "AliGenTunedOnPbPb.h"
41 ClassImp(AliGenTunedOnPbPb)
43 // set default parameters for 10-20% centrality
44 Int_t AliGenTunedOnPbPb::fgPdgInput[fgNspecies] = {211,-211,111,321,-321,2212,-2212,310,3122,-3122,333,3312,-3312,3334,-3334};
45 Float_t AliGenTunedOnPbPb::fgMult[fgNspecies] = {450,450,450,70,70,21,21,70,20,20,8,2.4,2.4,0.4,0.4};
47 Float_t AliGenTunedOnPbPb::fgV3Overv2 = 6.25000000000000000e-01;
48 Float_t AliGenTunedOnPbPb::fgEventplane=0;
50 TF1 *AliGenTunedOnPbPb::fgV2 = NULL;
52 //_____________________________________________________________________________
53 AliGenTunedOnPbPb::AliGenTunedOnPbPb()
57 fChangeWithCentrality(kFALSE),
59 fYlimitForFlatness(2.0),
64 // Default constructor
69 for(Int_t i=0;i < fgNspecies;i++){
70 fgHSpectrum[i] = NULL;
75 //_____________________________________________________________________________
76 AliGenTunedOnPbPb::~AliGenTunedOnPbPb()
79 // Standard destructor
83 //_____________________________________________________________________________
84 void AliGenTunedOnPbPb::Init()
87 // Initialise the generator
94 //_____________________________________________________________________________
95 void AliGenTunedOnPbPb::Generate()
98 // Generate one trigger
101 Float_t avCentr = (fCmin+fCmax)*0.5;
103 Float_t centrality = avCentr;
105 if(fChangeWithCentrality) centrality = fCmin + gRandom->Rndm()*(fCmax-fCmin);
107 SetParameters(centrality);
109 if(!fChangeWithCentrality){
111 for(Int_t i=0;i < fgNspecies;i++){
114 for(Int_t j=1;j<=fgHSpectrum[i]->GetNbinsX();j++){
115 in += fgHSpectrum[i]->GetBinContent(j)*fgHSpectrum[i]->GetBinWidth(j);
119 // replace n-particles with the one in input file if centralidy dependece was disable
125 TMCProcess statusPdg[fgNspecies] = {kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary,kPPrimary};
127 Float_t parV2scaling[3] = {1,0.202538,-0.00214468};
129 Float_t scaleV2 = 1.0;
131 TDatabasePDG *pdgD = TDatabasePDG::Instance();
133 if(fChangeWithCentrality){
134 parV2scaling[0] = 1. / (1 + parV2scaling[1]*avCentr + parV2scaling[2]*avCentr*avCentr); // normalize to average centrality
136 scaleV2 = parV2scaling[0]*(1 + parV2scaling[1]*centrality + parV2scaling[2]*centrality*centrality); // apply the trand of v2 w.r.t. centrality
139 fgV2->SetParameter(2,fgV3Overv2);
141 Float_t psi = gRandom->Rndm()*TMath::Pi();
143 Float_t psi3 = gRandom->Rndm()*TMath::Pi()*2/3;
144 Float_t psi4 = gRandom->Rndm()*TMath::Pi()*2/4;
145 fgV2->SetParameter(1,psi);
146 fgV2->SetParameter(3,psi3);
147 fgV2->SetParameter(4,psi4);
152 for (Int_t j=0;j<3;j++) origin0[j]=fOrigin[j];
155 if(fVertexSmear == kPerEvent) {
157 for (Int_t j=0; j < 3; j++) origin0[j] = fVertex[j];
161 printf("Generate event with centrality = %3.1f%c, |y|<%4.1f\n",centrality,'%',fYMaxValue);
163 for(Int_t isp=0;isp < fgNspecies;isp++){
164 if(! fgHSpectrum[isp]) continue;
166 Int_t npartSp = Int_t(fgMult[isp]*2*fYMaxValue + gRandom->Rndm());
168 printf("Total number of %i = %i\n",fgPdgInput[isp],npartSp);
170 for(Int_t ipart =0; ipart < npartSp; ipart++){
171 Int_t pdg = fgPdgInput[isp];
173 Double_t y = gRandom->Rndm()*2*fYMaxValue - fYMaxValue;
174 Double_t ytanh = TMath::TanH(y);
175 Double_t pt = fgHSpectrum[isp]->GetRandom();
176 Double_t mass = pdgD->GetParticle(pdg)->Mass();
177 Double_t mt2 = pt*pt + mass*mass;
178 Double_t pz = ytanh*TMath::Sqrt(mt2)/TMath::Sqrt(1-ytanh*ytanh);
179 Double_t etot = TMath::Sqrt(mt2 + pz*pz);
180 TLorentzVector tempVect(pt,0,pz,etot);
181 Double_t eta = tempVect.PseudoRapidity();
182 Double_t scaleEtaV2 = 1; // set the eta dependence
183 if(TMath::Abs(y)> fYlimitForFlatness) scaleEtaV2 = 1 - fYdecreaseV2*(TMath::Abs(y) - fYlimitForFlatness);
185 if(fgHv2[isp]) fgV2->SetParameter(0,fgHv2[isp]->Interpolate(pt) * scaleV2 * scaleEtaV2);
186 else fgV2->SetParameter(0,0.);
187 Double_t phi = fgV2->GetRandom(-TMath::Pi(),TMath::Pi());
188 Double_t px = pt*TMath::Cos(phi);
189 Double_t py = pt*TMath::Sin(phi);
190 Float_t p[3] = {px,py,pz};
191 Float_t polar[3] = {0.,0.,0.};
193 if(TMath::Abs(y)< fYlimitForFlatness || gRandom->Rndm() < 1 - fYdecreaseSp*(TMath::Abs(y) - fYlimitForFlatness)){// check on pseudorapidity distribution
194 // printf("%f %f\n",eta,phi - psi); // for debugging
195 PushTrack(1, -1, pdg, p, origin0, polar, time, statusPdg[isp], npart, 1., 1);
204 eventVertex[0] = origin0[0];
205 eventVertex[1] = origin0[1];
206 eventVertex[2] = origin0[2];
209 AliGenEventHeaderTunedPbPb* header = new AliGenEventHeaderTunedPbPb("tunedOnPbPb");
211 header->SetPrimaryVertex(eventVertex);
212 header->SetInteractionTime(time);
213 header->SetNProduced(npart);
214 header->SetCentrality(centrality);
215 header->SetPsi2(psi);
216 header->SetPsi3(psi3);
217 header->SetPsi4(psi4);
218 gAlice->SetGenEventHeader(header);
221 void AliGenTunedOnPbPb::SetPtRange(Float_t ptmin, Float_t ptmax) {
222 AliGenerator::SetPtRange(ptmin, ptmax);
224 //_____________________________________________________________________________
225 TH1F *AliGenTunedOnPbPb::GetMultVsCentrality(Int_t species){
227 snprintf(title,100,"pdg = %i;centrality;dN/dy",fgPdgInput[species]);
228 TH1F *h = new TH1F("multVsCentr",title,100,0,100);
230 for(Int_t i=1;i<=100;i++){
233 h->SetBinContent(i,fgMult[species]);
238 //_____________________________________________________________________________
239 void AliGenTunedOnPbPb::SetParameters(Float_t centrality){
241 if(!fgV2) fgV2 = new TF1("fv2Par","TMath::Max(0.,(1 + 2*[0]*cos(2*(x-[1])) + 2*[0]*[2]*cos(3*(x-[3])) + [0]*[2]*cos(4*(x-[4]))))",-TMath::Pi(),TMath::Pi()); // v4 is approx. 0.5*v3
243 Float_t fr[9] = {0.,0.,0.,0.,0.,0.,0.,0.,0.};
245 if(centrality < 7.5){
246 fr[0] = (7.5 - centrality)/5.;
247 fr[1] = (centrality-2.5)/5.;
249 else if(centrality < 15){
250 fr[1] = (15-centrality)/7.5;
251 fr[2] = (centrality-7.5)/7.5;
253 else if(centrality < 25){
254 fr[2] = (25-centrality)/10.;
255 fr[3] = (centrality-15)/10.;
257 else if(centrality < 35){
258 fr[3] = (35-centrality)/10.;
259 fr[4] = (centrality-25)/10.;
261 else if(centrality < 45){
262 fr[4] = (45-centrality)/10.;
263 fr[5] = (centrality-35)/10.;
265 else if(centrality < 55){
266 fr[5] = (55-centrality)/10.;
267 fr[6] = (centrality-45)/10.;
269 else if(centrality < 65){
270 fr[6] = (65-centrality)/10.;
271 fr[7] = (centrality-55)/10.;
273 else if(centrality < 75){
274 fr[7] = (75-centrality)/10.;
275 fr[8] = (centrality-65)/10.;
281 // parameters as a function of centrality
282 Float_t multCent[9*fgNspecies] = {733.,733.,733.,109.,109.,34.,34.,109.,28.,28.,11.5,3.1,3.1,0.5,0.5,
283 606.,606.,606.,91.,91.,28.,28.,91.,24.,24.,9.,2.7,2.7,0.45,0.45,
284 455.,455.,455.,68.,68.,21.,21.,68.,20.,20.,8.,2.4,2.4,0.4,0.4,
285 307.,307.,307.,46.,46.,14.5,14.5,46.,14.,14.,5.5,1.5,1.5,0.2,0.2,
286 201.,201.,201.,30.,30.,9.6,9.6,30.,9.,9.,3.5,0.9,0.9,0.08,0.08,
287 124.,124.,124.,18.3,18.3,6.1,6.1,18.3,5.1,5.1,2.2,0.6,0.6,0.055,0.055,
288 71.,71.,71.,10.2,10.2,3.6,3.6,10.2,2.6,2.6,1.4,0.36,0.36,0.035,0.035,
289 37.,37.,37.,5.1,5.1,2.,2.,5.1,1.5,1.5,0.5,0.02,0.02,0.015,0.015,
290 17.,17.,17.,2.3,2.3,0.9,0.9,2.3,0.6,0.6,0.16,0.006,0.006,0.005,0.005};
292 Float_t v3Overv2Cent[9] = {1.2,0.82,0.625,0.5,0.45,0.4,0.37,0.3,0.3};
295 for(Int_t j=0;j < 9;j++)
296 fgV3Overv2 += fr[j]*v3Overv2Cent[j];
298 // set parameters for current centrality
299 for(Int_t i=0;i < fgNspecies;i++){
302 for(Int_t j=0;j < 9;j++){
303 fgMult[i] += fr[j]*multCent[i+j*fgNspecies];
308 for(Int_t i=0;i < fgNspecies;i++)
309 fgMult[i] /= TMath::Log(centrality-77.);