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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // AliGenAfterBurnerFlow is a After Burner event generator applying flow.
21 // The generator changes Phi coordinate of the particle momentum.
22 // Flow (directed and elliptical) can be defined on particle type level
24 // For examples, parameters and testing macros refer to:
25 // http:/home.cern.ch/radomski
28 // Sylwester Radomski,
33 //////////////////////////////////////////////////////////////////////////////
35 #include <Riostream.h>
36 #include "TParticle.h"
37 #include "TLorentzVector.h"
39 #include "AliGenAfterBurnerFlow.h"
41 #include "AliGenCocktailAfterBurner.h"
43 // emanuele ---------------------------------------------------------------(
45 #include "AliCollisionGeometry.h"
46 #include "AliGenCocktailEntry.h"
48 // emanuele ---------------------------------------------------------------)
50 ClassImp(AliGenAfterBurnerFlow)
52 ////////////////////////////////////////////////////////////////////////////////////////////////////
54 AliGenAfterBurnerFlow::AliGenAfterBurnerFlow():
59 // Default Construction
63 ////////////////////////////////////////////////////////////////////////////////////////////////////
65 AliGenAfterBurnerFlow::AliGenAfterBurnerFlow(Float_t reactionPlane):
66 fReactionPlane(reactionPlane),
70 // Standard Construction
72 // reactionPlane - Reaction Plane Angle given in Deg [0-360]
73 // but stored and applied in radiants (standard for TParticle & AliCollisionGeometry)
75 // emanuele ---------------------------------------------------------------(
77 if(reactionPlane == 0) { Info("AliGenAfterBurnerFlow", "Using a random R.P. Angle event by event ( ! not the same used by Hijing ! ) ") ; }
78 else if(reactionPlane < 0) { Info("AliGenAfterBurnerFlow", "Using the Hijing R.P. Angle event by event ") ; }
79 else if(reactionPlane > 0) { Info("AliGenAfterBurnerFlow", "Using a fixed R.P. Angle ( psi = %d deg.) for every event ", reactionPlane) ; }
81 // it was // if(reactionPlane < 0 || reactionPlane > 360) Error("AliGenAfterBurnerFlow", "Reaction Plane Angle - %d - out of bounds [0-360]", reactionPlane); //
83 // emanuele ---------------------------------------------------------------(
85 fReactionPlane = 2 * TMath::Pi() * (reactionPlane/360) ; // r.p. given in degrees (Radomski's way) but stored and applied in radiants (TParticle's way)
89 ////////////////////////////////////////////////////////////////////////////////////////////////////
91 AliGenAfterBurnerFlow::~AliGenAfterBurnerFlow() {
92 // Standard Destructor
96 ////////////////////////////////////////////////////////////////////////////////////////////////////
98 void AliGenAfterBurnerFlow::SetDirectedSimple(Int_t pdg, Float_t v1) {
101 // The same directed flow is applied to all specified particles
102 // independently on transverse momentum or rapidity
104 // PDG - particle type to apply directed flow
105 // if (PDG == 0) use as default
108 SetFlowParameters(pdg, 1, 0, v1, 0, 0, 0);
111 ////////////////////////////////////////////////////////////////////////////////////////////////////
113 void AliGenAfterBurnerFlow::SetDirectedParam
114 (Int_t pdg, Float_t v11, Float_t v12, Float_t v13, Float_t v14) {
117 // Directed flow is parameterised as follows
119 // V1(Pt,Y) = (V11 + V12*Pt) * sign(Y) * (V13 + V14 * Y^3)
121 // where sign = 1 for Y > 0 and -1 for Y < 0
127 // PDG - particle type to apply directed flow
128 // if (PDG == 0) use as default
131 SetFlowParameters(pdg, 1, 1, v11, v12, v13, v14);
134 ////////////////////////////////////////////////////////////////////////////////////////////////////
136 void AliGenAfterBurnerFlow::SetEllipticSimple(Int_t pdg, Float_t v2) {
139 // The same Elliptic flow is applied to all specified particles
140 // independently on transverse momentum or rapidity
142 // PDG - particle type to apply directed flow
143 // if (PDG == 0) use as default
145 // V2 - flow coefficient
147 // NOTE: for starting playing with FLOW
148 // start with this function and values 0.05 - 0.1
151 SetFlowParameters(pdg, 2, 0, v2, 0, 0, 0);
154 ////////////////////////////////////////////////////////////////////////////////////////////////////
156 void AliGenAfterBurnerFlow::SetEllipticParamPion
157 (Int_t pdg, Float_t v21, Float_t pTmax, Float_t v22) {
161 // Elliptic flow is parametrised to reproduce
162 // V2 of Pions at RHIC energies and is given by:
164 // V2 = v21 * (pT/pTMax ) * exp (-v22 * y^2) where pT <= pTmax
165 // v21 * exp (-v22 * y^2) where pT > pTmax
167 // v21 - value at saturation
168 // pTmax - saturation transverse momentum
169 // v22 - rapidity decrising
172 SetFlowParameters(pdg, 2, 1, v21, pTmax, v22, 0);
175 ////////////////////////////////////////////////////////////////////////////////////////////////////
177 void AliGenAfterBurnerFlow::SetEllipticParamOld
178 (Int_t pdg, Float_t v21, Float_t v22, Float_t v23) {
182 // Elliptic flow is parameterised using
183 // old MevSim parameterisation
185 // V2 = (V21 + V22 pT^2) * exp (-v22 * y^2)
188 SetFlowParameters(pdg, 2, 2, v21, v22, v23, 0);
191 ////////////////////////////////////////////////////////////////////////////////////////////////////
193 void AliGenAfterBurnerFlow::SetFlowParameters
194 (Int_t pdg, Int_t order, Int_t type, Float_t v1, Float_t v2,Float_t v3,Float_t v4) {
200 Bool_t newEntry = kTRUE;
205 index = fgkN - order;
209 // try to find existing entry
210 for (Int_t i=0; i<fCounter; i++) {
211 if (pdg == (Int_t)fParams[i][0] &&
212 order == (Int_t)fParams[i][1]) {
221 if (newEntry && (fCounter > fgkN-3)) {
222 Error("AliAfterBurnerFlow","Overflow");
231 // Set new particle type
233 fParams[index][0] = pdg;
234 fParams[index][1] = order;
235 fParams[index][2] = type;
236 fParams[index][3] = v1;
237 fParams[index][4] = v2;
238 fParams[index][5] = v3;
239 fParams[index][6] = v4;
242 ////////////////////////////////////////////////////////////////////////////////////////////////////
244 void AliGenAfterBurnerFlow::Init() {
246 // Standard AliGenerator Initializer
251 ////////////////////////////////////////////////////////////////////////////////////////////////////
253 Float_t AliGenAfterBurnerFlow::GetCoefficient
254 (Int_t pdg, Int_t n, Float_t Pt, Float_t Y) {
257 // Return Flow Coefficient for a given particle type flow order
258 // and particle momentum (Pt, Y)
261 Int_t index = fgkN - n; // default index
264 // try to find specific parametrs
266 for (Int_t i=0; i<fCounter; i++) {
268 if ((Int_t)fParams[i][0] == pdg &&
269 (Int_t)fParams[i][1] == n) {
278 Int_t type = (Int_t)fParams[index][2];
280 if ((Int_t)fParams[index][1] == 1) { // Directed
283 v = fParams[index][3];
285 v = (fParams[index][3] + fParams[index][4] * Pt) * TMath::Sign((Float_t)1.,Y) *
286 (fParams[index][5] + fParams[index][6] * TMath::Abs(Y*Y*Y) );
290 if (type == 0) v = fParams[index][3];
292 // Pion parameterisation
295 if (Pt < fParams[index][4])
296 v = fParams[index][3] * (Pt / fParams[index][4]) ;
298 v = fParams[index][3];
300 v *= TMath::Exp( - fParams[index][5] * Y * Y);
303 // Old parameterisation
306 v = (fParams[index][3] + fParams[index][4] * Pt * Pt) *
307 TMath::Exp( - fParams[index][5] * Y * Y);
313 ////////////////////////////////////////////////////////////////////////////////////////////////////
315 void AliGenAfterBurnerFlow::Generate() {
317 // AliGenerator generate function doing actual job.
320 // 1. loop over particles on the stack
321 // 2. find direct and elliptical flow coefficients for
322 // a particle type ore use defaults
323 // 3. calculate delta phi
324 // 4. change phi in orginal particle
326 // Algorythm based on:
327 // A.M. Poskanzer, S.A. Voloshin
328 // "Methods of analysisng anisotropic flow in relativistic nuclear collisions"
329 // PRC 58, 1671 (September 1998)
332 AliGenCocktailAfterBurner *gen;
335 TLorentzVector momentum;
341 // Get Stack of the first Generator
342 gen = (AliGenCocktailAfterBurner *)gAlice->GetMCApp()->Generator();
344 // emanuele ---------------------------------------------------------------(
346 AliGenerator* genHijing = 0 ;
347 AliCollisionGeometry* geom = 0 ;
348 AliGenCocktailEntry* entry = 0 ;
349 TList* fEntries = 0 ;
351 TRandom* rand = new TRandom(0) ;
352 Float_t fHow = fReactionPlane ; // this is a temp. solution not to add a new data member in the .h
354 for(Int_t ns=0;ns<gen->GetNumberOfEvents();ns++)
356 gen->SetActiveEventNumber(ns) ;
357 stack = gen->GetStack(ns); // it was 0.
358 fEntries = gen->Entries() ;
360 TIter next(fEntries) ;
361 while((entry = (AliGenCocktailEntry*)next()))
363 if(fHow == 0) // hijing R.P.
365 Info("Generate (e)","Using R.P. from HIJING ... ");
366 genHijing = entry->Generator() ; // cout <<" * GENERATOR IS "<< genHijing << " : " << genHijing->GetName() << endl;
367 if(genHijing->ProvidesCollisionGeometry())
369 geom = gen->GetCollisionGeometry(ns) ; // cout << " * GEOMETRY YES * " << endl ;
370 fReactionPlane = geom->ReactionPlaneAngle() ;
374 Error("Generate (e)", "NO CollisionGeometry !!! - using fixed R.P. angle = 0. ") ;
375 fReactionPlane = 0. ;
378 else if(fHow < 0) // random R.P.
380 Info("Generate (e)","Using random R.P.s ... ");
381 fReactionPlane = 2 * TMath::Pi() * rand->Rndm() ;
383 else // if constant R.P. -> do nothing (fReactionPlane already setted)
385 Info("Generate (e)","Using a fixed R.P. psi = %d rad.",fReactionPlane);
387 cout << " * Reaction Plane Angle (event " << ns << ") = " << fReactionPlane << " rad. ( = " << (360*fReactionPlane/(2*TMath::Pi())) << " deg.) * " << endl ;
390 // emanuele ---------------------------------------------------------------)
392 // Loop over particles
394 for (Int_t i=0; i<stack->GetNtrack(); i++)
396 particle = stack->Particle(i);
398 particle->Momentum(momentum);
399 pdg = particle->GetPdgCode();
400 phi = particle->Phi();
405 //y = momentum.Rapidity() ;
407 // emanuele ---------------------------------------------------------------(
409 if(TMath::Abs(momentum.Z()) != TMath::Abs(momentum.T())) { y = momentum.Rapidity() ; }
411 // cout << " * Lorentz Vector (momentum) = " << momentum.X() << " , " << momentum.Y() << " , " << momentum.Z() << " , " << momentum.T() << " . * " << endl ;
412 // cout << " * pt = " << momentum.Pt() << " . * " << endl ;
413 // cout << " * Y = " << y << " . * " << endl ;
415 // emanuele ---------------------------------------------------------------)
417 // Calculate Delta Phi for Directed and Elliptic Flow
419 dPhi = -2 * GetCoefficient(pdg, 1, pt, y) * TMath::Sin( phi - fReactionPlane );
420 dPhi -= GetCoefficient(pdg, 2, pt, y) * TMath::Sin( 2 * (phi - fReactionPlane));
425 momentum.SetPhi(phi);
426 particle->SetMomentum(momentum);
429 // emanuele ---------------------------------------------------------------(
431 // emanuele ---------------------------------------------------------------)
433 Info("Generate","Flow After Burner: DONE");
436 ////////////////////////////////////////////////////////////////////////////////////////////////////