2 ////////////////////////////////////////////////////////////////////////////////////////////////////
4 // AliGenAfterBurnerFlow is a After Burner event generator applying flow.
5 // The generator changes Phi coordinate of the particle momentum.
6 // Flow (directed and elliptical) can be defined on particle type level
8 // For examples, parameters and testing macros refer to:
9 // http:/home.cern.ch/radomski
12 // Sylwester Radomski,
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
20 #include "TParticle.h"
21 #include "TLorentzVector.h"
23 #include "AliGenAfterBurnerFlow.h"
24 #include "AliGenCocktailAfterBurner.h"
26 ClassImp(AliGenAfterBurnerFlow)
28 ////////////////////////////////////////////////////////////////////////////////////////////////////
30 AliGenAfterBurnerFlow::AliGenAfterBurnerFlow() {
31 // Deafult Construction
37 ////////////////////////////////////////////////////////////////////////////////////////////////////
39 AliGenAfterBurnerFlow::AliGenAfterBurnerFlow(Float_t reactionPlane) {
40 // Standard Construction
42 // reactionPlane - Reaction Plane Angle in Deg
44 if (reactionPlane < 0 || reactionPlane > 360)
45 Error("AliGenAfterBurnerFlow",
46 "Reaction Plane Angle - %d - ot of bounds [0-360]", reactionPlane);
48 fReactionPlane = reactionPlane;
52 ////////////////////////////////////////////////////////////////////////////////////////////////////
54 AliGenAfterBurnerFlow::~AliGenAfterBurnerFlow() {
55 // Standard Destructor
59 ////////////////////////////////////////////////////////////////////////////////////////////////////
61 void AliGenAfterBurnerFlow::SetDirected(Int_t pdg, Float_t v11, Float_t v12, Float_t v13, Float_t v14) {
63 // Set Directed Flow parameters for a given particle type.
64 // Actual flow coefficient depends on Pt and Y and is caculated by
66 // V1(Pt,Y) = (V11 + V12*Pt) * sign(Y) * (V13 + V14 * Y^3)
68 // where sign = 1 for Y > 0 and -1 for Y < 0
74 // In many cases it is sufficient to set v11 only.
75 // Note: be carefull with parameter v14
78 SetFlowParameters(pdg, 1, v11, v12, v13, v14);
81 ////////////////////////////////////////////////////////////////////////////////////////////////////
83 void AliGenAfterBurnerFlow::SetElliptic(Int_t pdg, Float_t v21, Float_t v22, Float_t v23) {
85 // Set Elliptic Flow parameters for a given particle type.
86 // Actual flow coefficient depends on Pt and Y and is caculated by
88 // V2 = (V21 + V22 * Pt^2) * exp( -V23 * Y^2)
93 // In many cases it is sufficient to set v21 only
96 SetFlowParameters(pdg, 2, v21, v22, v23, 0);
99 ////////////////////////////////////////////////////////////////////////////////////////////////////
101 void AliGenAfterBurnerFlow::SetDefDirected(Float_t v11, Float_t v12, Float_t v13, Float_t v14) {
103 // Set Directed Flow parameters for all particles.
104 // These parameters can be overriden for a specific type by calling
105 // SetDirected() function.
107 // For explanation of parameters refer to SetDirected()
110 SetFlowParameters(0, 1, v11, v12, v13, v14);
113 ////////////////////////////////////////////////////////////////////////////////////////////////////
115 void AliGenAfterBurnerFlow::SetDefElliptic(Float_t v21, Float_t v22, Float_t v23) {
117 // Set Elliptic Flow parameters for all particles.
118 // These parameters can be overriden for a specific type by calling
119 // SetElliptic() function.
121 // For explanation of parameters refer to SetElliptic()
124 SetFlowParameters(0, 2, v21, v22, v23, 0);
127 ////////////////////////////////////////////////////////////////////////////////////////////////////
129 void AliGenAfterBurnerFlow::SetFlowParameters
130 (Int_t pdg, Int_t order, Float_t v1, Float_t v2,Float_t v3,Float_t v4) {
145 // try to find existing entry
146 for (Int_t i=0; i<fCounter; i++) {
147 if (pdg == (Int_t)fParams[i][0] &&
148 order == (Int_t)fParams[i][1]) {
157 if (newEntry && (fCounter > kN-3)) {
158 Error("AliAfterBurnerFlow","Overflow");
167 // Set new particle type
169 fParams[index][0] = pdg;
170 fParams[index][1] = order;
171 fParams[index][2] = v1;
172 fParams[index][3] = v2;
173 fParams[index][4] = v3;
174 fParams[index][5] = v4;
177 ////////////////////////////////////////////////////////////////////////////////////////////////////
179 void AliGenAfterBurnerFlow::Init() {
181 // Standard AliGenerator Initializer
186 ////////////////////////////////////////////////////////////////////////////////////////////////////
188 Float_t AliGenAfterBurnerFlow::GetCoeff
189 (Int_t pdg, Int_t n, Float_t Pt, Float_t Y) {
192 // Return Flow Coefficient for a given particle type flow order
193 // and particle momentum (Pt, Y)
196 Int_t index = kN - n; // default index
199 // try to find specific parametrs
201 for (Int_t i=0; i<fCounter; i++) {
203 if ((Int_t)fParams[i][0] == pdg &&
204 (Int_t)fParams[i][1] == n) {
213 if ((Int_t)fParams[index][1] == 1) { // Directed
215 v = (fParams[index][2] + fParams[index][3] * Pt) * TMath::Sign((Float_t)1.,Y) *
216 (fParams[index][4] + fParams[index][5] * TMath::Abs(Y*Y*Y) );
220 v = (fParams[index][2] + fParams[index][3] * Pt * Pt) *
221 TMath::Exp( - fParams[index][4] * Y * Y);
227 ////////////////////////////////////////////////////////////////////////////////////////////////////
229 void AliGenAfterBurnerFlow::Generate() {
231 // AliGenerator generate function doing actual job.
234 // 1. loop over particles on the stack
235 // 2. find direct and elliptical flow coefficients for
236 // a particle type ore use defaults
237 // 3. calculate delta phi
238 // 4. change phi in orginal particle
240 // Algorythm based on:
241 // A.M. Poskanzer, S.A. Voloshin
242 // "Methods of analysisng anisotropic flow in relativistic nuclear collisions"
243 // PRC 58, 1671 (September 1998)
246 AliGenCocktailAfterBurner *gen;
249 TLorentzVector momentum;
255 // Get Stack of the first Generator
256 gen = (AliGenCocktailAfterBurner *)gAlice->Generator();
257 stack = gen->GetStack(0);
259 // Loop over particles
261 for (Int_t i=0; i<stack->GetNtrack(); i++) {
263 particle = stack->Particle(i);
265 particle->Momentum(momentum);
266 pdg = particle->GetPdgCode();
267 phi = particle->Phi();
272 y = momentum.Rapidity();
274 // Calculate Delta Phi for Directed and Elliptic Flow
276 dPhi = -2 * GetCoeff(pdg, 1, pt, y) * TMath::Sin( phi - fReactionPlane );
277 dPhi -= GetCoeff(pdg, 2, pt, y) * TMath::Sin( 2 * (phi - fReactionPlane));
280 // cout << i << "\t" << pt << "\t" << y << "\t" << (GetCoeff(pdg, 1, pt, y)) << "\t"
281 // << (GetCoeff(pdg, 2, pt, y)) << "\t" << dPhi << endl;
286 momentum.SetPhi(phi);
287 particle->SetMomentum(momentum);
290 cout << "Flow After Burner: DONE" << endl;
294 ////////////////////////////////////////////////////////////////////////////////////////////////////