]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New version of AliGeVSim code. New class for flow afterburner (S.Radomski)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 Apr 2002 07:25:26 +0000 (07:25 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 30 Apr 2002 07:25:26 +0000 (07:25 +0000)
EVGEN/AliGeVSimParticle.cxx
EVGEN/AliGeVSimParticle.h
EVGEN/AliGenAfterBurnerFlow.cxx [new file with mode: 0644]
EVGEN/AliGenAfterBurnerFlow.h [new file with mode: 0644]
EVGEN/AliGenGeVSim.cxx
EVGEN/AliGenGeVSim.h
EVGEN/EVGENLinkDef.h
EVGEN/Makefile
EVGEN/libEVGEN.pkg

index a69f9525d2430ac93766f05cddc2195da6f06205..311b7b8ac3b6cd05ed11fbf3188fb97b2a6fa32a 100644 (file)
@@ -1,28 +1,51 @@
-
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// AliGeVSimParticle is a helper class for GeVSim (AliGenGeVSim) event generator.
+// An object of this class represents one particle type and contain 
+// information about particle type thermal parameters.
+//
+// For examples, parameters and testing macros refer to:
+// http:/home.cern.ch/radomski
+//
+// Author:
+// Sylwester Radomski,
+// GSI, March 2002
+// 
+// S.Radomski@gsi.de
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include "TMath.h"
 #include "AliGeVSimParticle.h"
 
 ClassImp(AliGeVSimParticle);
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
 
-////////////////////////////////////////////////////////////////////////////
-
-AliGeVSimParticle::AliGeVSimParticle
-(Int_t pdg, Int_t n, Float_t T, Float_t dY, Float_t exp) {
-
+AliGeVSimParticle::AliGeVSimParticle(Int_t pdg, Int_t n, Float_t T, Float_t dY, Float_t exp) {
+  //
+  //  pdg - Particle type code in PDG standard (see: http://pdg.lbl.gov)
+  //  n   - Multiplicity of particle type
+  //  T   - Inverse slope parameter ("temperature")
+  //  dY  - Raridity Width (only for model 1)
+  //  exp - expansion velocity (only for model 4) 
+  
   fPDG = pdg;
   fN = n;
   fT = T;
   fSigmaY = dY;
   fExpansion = exp;
 
-  fV1 = 0.;
-  fV2 = 0.;
+  fV1[0] = fV1[1] = fV1[2] = fV1[3] = 0.;
+  fV2[0] = fV2[1] = fV2[2] = 0.;
 }
 
-////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
 
-AliGeVSimParticle::AliGeVSimParticle
-(Int_t pdg) {
+AliGeVSimParticle::AliGeVSimParticle(Int_t pdg) {
+  //
+  //  pdg - Particle type code in PDG standard (see: http://pdg.lbl.gov)
+  // 
 
   fPDG = pdg;
   fN = 0;
@@ -30,26 +53,105 @@ AliGeVSimParticle::AliGeVSimParticle
   fSigmaY = 0.;
   fExpansion = 0.;
   
-  fV1 = 0.;
-  fV2 = 0.;
+  fV1[0] = fV1[1] = fV1[2] = fV1[3] = 0.;
+  fV2[0] = fV2[1] = fV2[2] = 0.; 
 }
 
-////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGeVSimParticle::SetDirectedFlow(Float_t v11, Float_t v12, Float_t v13, Float_t v14) {
+  //
+  // Set Directed Flow parameters.
+  // Acctual flow coefficient is calculated as follows
+  //
+  // V1(Pt,Y) = (V11 + V12*Pt) * sign(Y) * (V13 + V14 * Y^3)
+  //
+  // where sign = 1 for Y > 0 and -1 for Y < 0
+  // 
+  // Defaults values
+  // v12 = v14 = 0
+  // v13 = 1
+  // 
+  // Note 1: In many cases it is sufficient to set v11 only.
+  // Note 2: Be carefull with parameter v14
+  // 
+
+
+  fV1[0] = v11;
+  fV1[1] = v12;
+  fV1[2] = v13;
+  fV1[3] = v14;
+}
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGeVSimParticle::SetEllipticFlow(Float_t v21, Float_t v22, Float_t v23) {
+  //
+  // Set Elliptic Flow parameters.
+  // Acctual flow coefficient is calculated as follows
+  //
+  // V2 = (V21 + V22 * Pt^2) * exp( -V23 * Y^2)
+  // 
+  // Default values:
+  // v22 = v23 = 0
+  //
+  // Note: In many cases it is sufficient to set v21 only
+  //
+  
+  fV2[0] = v21;
+  fV2[1] = v22;
+  fV2[2] = v23;
+}
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
 
+Float_t AliGeVSimParticle::GetDirectedFlow(Float_t pt, Float_t y) {
+  //
+  // Return coefficient of a directed flow for a given pt and y.
+  // For coefficient calculation method refer to SetDirectedFlow()
+  // 
+  
+  Float_t v;
+  
+  v = (fV1[0] + fV1[1]* pt) * TMath::Sign(1.,y) *
+    (fV1[2] + fV1[3] * TMath::Abs(y*y*y) );
 
+  return v;
+}
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
 
+Float_t AliGeVSimParticle::GetEllipticFlow(Float_t pt, Float_t y) {
+  //
+  // Return coefficient of a elliptic flow for a given pt and y.
+  // For coefficient calculation method refer to SetEllipticFlow()
+  // 
+    
+  return  (fV2[0] + fV2[2] * pt * pt) * TMath::Exp( -fV2[3] * y*y );
+}
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
 
+Float_t AliGeVSimParticle::GetDirectedFlow() {
+  //
+  // Simplified version of GetDirectedFlow(pt,y) for backward compatibility
+  // Return fV1[0]
+  //
+  
+  return fV1[0];
+}
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
+Float_t AliGeVSimParticle::GetEllipticFlow() {
+  //
+  // Simplified version of GetEllipticFlow(pt,y) for backward compatibility
+  // Return fV2[0]
+  //
+  
+  return fV2[0];
+}
 
+////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 
index 9fa1a6788320832bc2f83ffcb43360cdfb8d950f..ea9ee43c21529dea190701919f56b62109935139 100644 (file)
@@ -1,60 +1,82 @@
 #ifndef ALIGEVSIMPARTICLE_H
 #define ALIGEVSIMPARTICLE_H
 
-#include "TObject.h"
+////////////////////////////////////////////////////////////////////////////////
+//
+// AliGeVSimParticle is a helper class for GeVSim (AliGenGeVSim) event generator.
+// An object of this class represents one particle type and contain 
+// information about particle type thermal parameters.
+//
+// For examples, parameters and testing macros refer to:
+// http:/home.cern.ch/radomski
+//
+// Author:
+// Sylwester Radomski,
+// GSI, March 2002
+// 
+// S.Radomski@gsi.de
+//
+////////////////////////////////////////////////////////////////////////////////
 
+#include "TObject.h"
 
 class AliGeVSimParticle : public TObject {
 
-
-  Int_t fPDG;            // Particle type code
-
-  Float_t fN;            // Multiplicity (subject to scalling)
-  Float_t fT;            // Slope Parameter (subject to scalling)
-  Float_t fSigmaY;       // Rapidity Width
-  Float_t fExpansion;    // Expansion Velocity in c units (subject to scalling)
-
-  Float_t fV1;           // Direct Flow coefficient (subject to scalling)
-  Float_t fV2;           // Elliptical flow coefficient (subject to scalling)
-
  public:
-
+  
   ////////////////////////////////////////////////////////////////////////////
-
+  
   AliGeVSimParticle() {}
   AliGeVSimParticle(Int_t pdg); 
   AliGeVSimParticle(Int_t pdg, Int_t n, 
                    Float_t T, Float_t dY = 1., Float_t exp=0.);
-
+  
   ~AliGeVSimParticle() {}
-
+  
   ////////////////////////////////////////////////////////////////////////////
-
-  Int_t GetPdgCode() {return fPDG;}
-
-
-  Float_t GetMultiplicity() {return fN;}
-  Float_t GetTemperature() {return fT;}
-  Float_t GetSigmaY() {return fSigmaY;}
-  Float_t GetExpansionVelocity() {return fExpansion;}
+  
+  Int_t GetPdgCode() const {return fPDG;}
+  
+  Float_t GetMultiplicity() const {return fN;}
+  Float_t GetTemperature() const {return fT;}
+  Float_t GetSigmaY() const {return fSigmaY;}
+  Float_t GetExpansionVelocity() const {return fExpansion;}
   
   void SetMultiplicity(Float_t n) {fN = n;}
   void SetExpansionVelocity(Float_t vel) {fExpansion = vel;}
-
+  
   // Flow
+  
+  void SetDirectedFlow(Float_t v11, Float_t v12=0, Float_t v13=1, Float_t v14=0);
+  void SetEllipticFlow(Float_t v21, Float_t v22=0, Float_t v23=0);
+  
+  Float_t GetDirectedFlow(Float_t pt, Float_t y);
+  Float_t GetEllipticFlow(Float_t pt, Float_t y);
+  
+  Float_t GetDirectedFlow();
+  Float_t GetEllipticFlow();
 
-  void SetDirectFlow(Float_t v1) {fV1 = v1;}
-  void SetEllipticalFlow(Float_t v2) {fV2 = v2;}
-
-  Float_t GetDirectFlow() {return fV1;}
-  Float_t GetEllipticalFlow() {return fV2;}
-
-
+  
   ////////////////////////////////////////////////////////////////////////////
-
+  
+ private:
+  
+  Int_t fPDG;            // Particle type code
+  
+  Float_t fN;            // Multiplicity (subject to scalling)
+  Float_t fT;            // Slope Parameter (subject to scalling)
+  Float_t fSigmaY;       // Rapidity Width
+  Float_t fExpansion;    // Expansion Velocity in c units (subject to scalling)
+  
+  Float_t fV1[4];        // Direct Flow coefficient parameters (subject to scalling)
+  Float_t fV2[3];        // Elliptical flow coefficient parameters (subject to scalling)
+  
+ public:
+  
   ClassDef(AliGeVSimParticle, 1)
-
+    
 };
 
+////////////////////////////////////////////////////////////////////////////////
 
 #endif
diff --git a/EVGEN/AliGenAfterBurnerFlow.cxx b/EVGEN/AliGenAfterBurnerFlow.cxx
new file mode 100644 (file)
index 0000000..8ecfb8c
--- /dev/null
@@ -0,0 +1,295 @@
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// 
+// AliGenAfterBurnerFlow is a After Burner event generator applying flow.
+// The generator changes Phi coordinate of the particle momentum.
+// Flow (directed and elliptical) can be defined on particle type level
+//
+// For examples, parameters and testing macros refer to:
+// http:/home.cern.ch/radomski
+//
+// Author:
+// Sylwester Radomski,
+// GSI, April 2002
+// 
+// S.Radomski@gsi.de
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#include <iostream.h>
+#include "TParticle.h"
+#include "TLorentzVector.h"
+#include "AliStack.h"
+#include "AliGenAfterBurnerFlow.h"
+#include "AliGenCocktailAfterBurner.h"
+
+ClassImp(AliGenAfterBurnerFlow)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+AliGenAfterBurnerFlow::AliGenAfterBurnerFlow() {
+  // Deafult Construction
+  
+  fReactionPlane = 0;
+  fCounter = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+AliGenAfterBurnerFlow::AliGenAfterBurnerFlow(Float_t reactionPlane) {
+  // Standard Construction
+  // 
+  // reactionPlane - Reaction Plane Angle in Deg
+
+  if (reactionPlane < 0 || reactionPlane > 360)
+    Error("AliGenAfterBurnerFlow", 
+         "Reaction Plane Angle - %d - ot of bounds [0-360]", reactionPlane);
+
+  fReactionPlane = reactionPlane;
+  fCounter = 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+AliGenAfterBurnerFlow::~AliGenAfterBurnerFlow() {
+  // Standard Destructor
+
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGenAfterBurnerFlow::SetDirected(Int_t pdg, Float_t v11, Float_t v12, Float_t v13, Float_t v14) {
+  //
+  // Set Directed Flow parameters for a given particle type.
+  // Actual flow coefficient depends on Pt and Y and is caculated by
+  //  
+  // V1(Pt,Y) = (V11 + V12*Pt) * sign(Y) * (V13 + V14 * Y^3)
+  //
+  // where sign = 1 for Y > 0 and -1 for Y < 0
+  // 
+  // Defaults values
+  // v12 = v14 = 0
+  // v13 = 1
+  // 
+  // In many cases it is sufficient to set v11 only.
+  // Note: be carefull with parameter v14
+  // 
+
+  SetFlowParameters(pdg, 1, v11, v12, v13, v14);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGenAfterBurnerFlow::SetElliptic(Int_t pdg, Float_t v21, Float_t v22, Float_t v23) {
+  //
+  // Set Elliptic Flow parameters for a given particle type.
+  // Actual flow coefficient depends on Pt and Y and is caculated by
+  //
+  // V2 = (V21 + V22 * Pt^2) * exp( -V23 * Y^2)
+  // 
+  // Default values:
+  // v22 = v23 = 0
+  //
+  // In many cases it is sufficient to set v21 only
+  //
+
+  SetFlowParameters(pdg, 2, v21, v22, v23, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGenAfterBurnerFlow::SetDefDirected(Float_t v11, Float_t v12, Float_t v13, Float_t v14) {
+  // 
+  // Set Directed Flow parameters for all particles.
+  // These parameters can be overriden for a specific type by calling
+  // SetDirected() function.
+  //
+  // For explanation of parameters refer to SetDirected()
+  //
+
+  SetFlowParameters(0, 1, v11, v12, v13, v14);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGenAfterBurnerFlow::SetDefElliptic(Float_t v21, Float_t v22, Float_t v23) {
+  // 
+  // Set Elliptic Flow parameters for all particles.
+  // These parameters can be overriden for a specific type by calling
+  // SetElliptic() function.
+  //
+  // For explanation of parameters refer to SetElliptic()
+  //
+
+  SetFlowParameters(0, 2, v21, v22, v23, 0);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGenAfterBurnerFlow::SetFlowParameters
+(Int_t pdg, Int_t order, Float_t v1, Float_t v2,Float_t v3,Float_t v4) {
+  // 
+  // private function
+  // 
+  
+  Int_t index = 0;
+  Int_t newEntry = 1;
+
+  // Defaults
+
+  if (pdg == 0) {
+    index = kN - order;
+    newEntry = 0;
+  }
+
+  // try to find existing entry
+  for (Int_t i=0; i<fCounter; i++) {
+    if (pdg == (Int_t)fParams[i][0] && 
+       order == (Int_t)fParams[i][1]) {
+      
+      index = i;
+      newEntry = 0;
+    }
+  }
+  
+  // check fCounter
+
+  if (newEntry && (fCounter > kN-3)) {
+    Error("AliAfterBurnerFlow","Overflow");
+    return;
+  }
+  
+  if (newEntry) {
+    index = fCounter;
+    fCounter++;
+  }
+  
+  // Set new particle type
+
+  fParams[index][0] = pdg;
+  fParams[index][1] = order;
+  fParams[index][2] = v1;
+  fParams[index][3] = v2;
+  fParams[index][4] = v3;
+  fParams[index][5] = v4;  
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGenAfterBurnerFlow::Init() {
+  // 
+  // Standard AliGenerator Initializer
+  //
+
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+Float_t AliGenAfterBurnerFlow::GetCoeff
+(Int_t pdg, Int_t n, Float_t Pt, Float_t Y) {
+  //
+  // private function
+  // Return Flow Coefficient for a given particle type flow order
+  // and particle momentum (Pt, Y)
+  //
+
+  Int_t index = kN - n;  // default index 
+  Float_t v = 0;
+
+  // try to find specific parametrs
+
+  for (Int_t i=0; i<fCounter; i++) {
+    
+    if ((Int_t)fParams[i][0] == pdg &&
+       (Int_t)fParams[i][1] == n) {
+      
+      index = i;
+      break;
+    }
+  } 
+  
+  // calculate v
+  
+  if ((Int_t)fParams[index][1] == 1) { // Directed
+    
+    v = (fParams[index][2] + fParams[index][3] * Pt) * TMath::Sign(1.,Y) *
+      (fParams[index][4] + fParams[index][5] * TMath::Abs(Y*Y*Y) );
+
+  } else {  // Elliptic
+
+    v = (fParams[index][2] + fParams[index][3] * Pt * Pt) *
+      TMath::Exp( - fParams[index][4] * Y * Y);
+  }
+  
+  return v;
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliGenAfterBurnerFlow::Generate() {
+  // 
+  // AliGenerator generate function doing actual job.
+  // Algorythm:
+  //
+  // 1. loop over particles on the stack
+  // 2. find direct and elliptical flow coefficients for 
+  //    a particle type ore use defaults
+  // 3. calculate delta phi
+  // 4. change phi in orginal particle
+  // 
+  // Algorythm based on:
+  // A.M. Poskanzer, S.A. Voloshin
+  // "Methods of analysisng anisotropic flow in relativistic nuclear collisions"
+  // PRC 58, 1671 (September 1998)
+  //
+  
+  AliGenCocktailAfterBurner *gen;
+  AliStack *stack;
+  TParticle *particle;
+  TLorentzVector momentum;
+
+  Int_t pdg;
+  Float_t phi, dPhi;
+  Float_t pt, y;
+
+  // Get Stack of the first Generator
+  gen = (AliGenCocktailAfterBurner *)gAlice->Generator();
+  stack = gen->GetStack(0);
+
+  // Loop over particles
+
+  for (Int_t i=0; i<stack->GetNtrack(); i++) {
+
+    particle = stack->Particle(i);
+
+    particle->Momentum(momentum);
+    pdg = particle->GetPdgCode();
+    phi = particle->Phi();
+
+    // get Pt, Y
+
+    pt = momentum.Pt();
+    y = momentum.Rapidity();
+
+    // Calculate Delta Phi for Directed and Elliptic Flow
+    
+    dPhi = -2 * GetCoeff(pdg, 1, pt, y) * TMath::Sin( phi - fReactionPlane );
+    dPhi -= GetCoeff(pdg, 2, pt, y) * TMath::Sin( 2 * (phi - fReactionPlane));
+    
+    
+    // cout << i << "\t" << pt << "\t" << y << "\t" << (GetCoeff(pdg, 1, pt, y)) << "\t"
+    //  << (GetCoeff(pdg, 2, pt, y)) << "\t" << dPhi << endl;
+
+    // Set new phi 
+    
+    phi += dPhi;
+    momentum.SetPhi(phi);
+    particle->SetMomentum(momentum);
+  }
+
+  cout << "Flow After Burner: DONE" << endl;
+  
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/EVGEN/AliGenAfterBurnerFlow.h b/EVGEN/AliGenAfterBurnerFlow.h
new file mode 100644 (file)
index 0000000..ed02db6
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef AliGenAfterBurnerFlow_h
+#define AliGenAfterBurnerFlow_h
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// 
+// AliGenAfterBurnerFlow is a After Burner event generator applying flow.
+// The generator changes Phi coordinate of the particle momentum.
+// Flow (directed and elliptical) can be defined on particle type level
+//
+// For examples, parameters and testing macros refer to:
+// http:/home.cern.ch/radomski
+//
+// Author:
+// Sylwester Radomski,
+// GSI, April 2002
+// 
+// S.Radomski@gsi.de
+//
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+#include "AliGenerator.h"
+
+class TObjArray;
+
+class AliGenAfterBurnerFlow : public AliGenerator {
+
+ public:
+
+  AliGenAfterBurnerFlow();
+  AliGenAfterBurnerFlow(Float_t reactionPlane);
+
+  ~AliGenAfterBurnerFlow();
+
+  void SetDirected(Int_t pdg, Float_t v11, Float_t v12 = 0, Float_t v13 = 1, Float_t v14 = 0);
+  void SetElliptic(Int_t pdg, Float_t v21, Float_t v22 = 0, Float_t v23 = 0);
+
+  void SetDefDirected(Float_t v11, Float_t v12 = 0, Float_t v13 = 1, Float_t v14 = 0);
+  void SetDefElliptic(Float_t v21, Float_t v22 = 0, Float_t v23 = 0);
+
+  void Init();
+  void Generate(); 
+
+ private:
+
+  static const Int_t kN = 30;
+
+  Float_t GetCoeff(Int_t pdg, Int_t n, Float_t Pt, Float_t Y);
+  void SetFlowParameters(Int_t pdg, Int_t order, Float_t v1, Float_t v2, Float_t v3, Float_t v4);
+
+  Float_t fReactionPlane;      // Reaction plane angle (in rad)
+  Float_t fParams[kN][6];      // parameters (0: pdg, 1: order, 2-5: actual parameters) 
+  Int_t   fCounter;            // counter
+
+ public:
+
+  ClassDef(AliGenAfterBurnerFlow,1)
+
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif
index d45eca039d2112d1e6c3881f847d64026a5509f7..344d6013dcf2720939b08dc2edd790ed6e9f02b8 100644 (file)
@@ -1,18 +1,62 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// AliGenGeVSim is a class implementing simple Monte-Carlo event generator for 
+// testing algorythms and detector performance.
+//
+// In this event generator particles are generated from thermal distributions 
+// without any dynamics and addicional constrains. Distribution parameters like
+// multiplicity, particle type yields, inverse slope parameters, flow coeficients 
+// and expansion velocities are expleicite defined by the user.
+//
+// GeVSim contains four thermal distributions the same as
+// MevSim event generator developed for STAR experiment.
+//
+// In addition custom distributions can be used be the mean of TF2 function
+// named "gevsimPtY". 
+//  
+// Azimuthal distribution is deconvoluted from (Pt,Y) distribution
+// and is described by two Fourier coefficients representing 
+// Directed and Elliptic flow. Coefficients depend on Pt and Y.
+// 
+// To apply flow to event ganerated by an arbitraly event generator
+// refer to AliGenAfterBurnerFlow class.
+//
+// For examples, parameters and testing macros refer to:
+// http:/home.cern.ch/radomski
+//  
+// Author:
+// Sylwester Radomski,
+// GSI, March 2002
+//  
+// S.Radomski@gsi.de
+//
+////////////////////////////////////////////////////////////////////////////////
 
 #include <iostream.h>
 
 #include "TROOT.h"
 #include "TCanvas.h"
 #include "TParticle.h"
-#include "AliGenGeVSim.h"
+#include "TObjArray.h"
+#include "TF1.h"
+#include "TF2.h"
+
 #include "AliRun.h"
 #include "AliPDG.h"
+#include "AliGenerator.h"
+
+#include "AliGenGeVSim.h"
+#include "AliGeVSimParticle.h"
+
 
 ClassImp(AliGenGeVSim);
 
 //////////////////////////////////////////////////////////////////////////////////
 
 AliGenGeVSim::AliGenGeVSim() : AliGenerator(-1) {
+  //
+  //  Default constructor
+  // 
 
   fModel = 1;
   fPsi = 0;
@@ -25,19 +69,31 @@ AliGenGeVSim::AliGenGeVSim() : AliGenerator(-1) {
 //////////////////////////////////////////////////////////////////////////////////
 
 AliGenGeVSim::AliGenGeVSim(Int_t model, Float_t psi) : AliGenerator(-1) {
+  //
+  //  Standard Constructor.
+  //  
+  //  model - thermal model to be used:
+  //          1    - deconvoluted pt and Y source
+  //          2,3  - thermalized sphericaly symetric sources  
+  //          4    - thermalized source with expansion
+  //          5    - custom model defined in TF2 object named "gevsimPtY" 
+  //  
+  //  psi   - reaction plane in degrees
+  //
 
   // checking consistancy
 
   if (model < 1 || model > 5) 
-    Error("AliGenGeVSim","Model Id ( %d ) out of range [1..4]", model);
+    Error("AliGenGeVSim","Model Id ( %d ) out of range [1..5]", model);
+
 
-  if (psi < 0 || psi > TMath::Pi() ) 
-    Error ("AliGenGeVSim", "Reaction plane angle ( %d )out of space [0..2 x Pi]", psi);
+  if (psi < 0 || psi > 360 ) 
+    Error ("AliGenGeVSim", "Reaction plane angle ( %d )out of range [0..360]", psi);
 
   // setting parameters
 
   fModel = model;
-  fPsi = psi;
+  fPsi = psi * 2 * TMath::Pi() / 360. ;
 
   // initialization 
 
@@ -49,6 +105,11 @@ AliGenGeVSim::AliGenGeVSim(Int_t model, Float_t psi) : AliGenerator(-1) {
 //////////////////////////////////////////////////////////////////////////////////
 
 AliGenGeVSim::~AliGenGeVSim() {
+  //
+  //  Default Destructor
+  //  
+  //  Removes TObjArray keeping list of registered particle types
+  //
 
   if (fPartTypes != NULL) delete fPartTypes;
 }
@@ -57,6 +118,11 @@ AliGenGeVSim::~AliGenGeVSim() {
 //////////////////////////////////////////////////////////////////////////////////
 
 Bool_t AliGenGeVSim::CheckPtYPhi(Float_t pt, Float_t y, Float_t phi) {
+  //
+  // private function used by Generate()
+  //
+  // Check bounds of Pt, Rapidity and Azimuthal Angle of a track
+  //
 
   if ( TestBit(kPtRange) && ( pt < fPtMin || pt > fPtMax )) return kFALSE;
   if ( TestBit(kPhiRange) && ( phi < fPhiMin || phi > fPhiMax )) return kFALSE;
@@ -73,11 +139,16 @@ Bool_t AliGenGeVSim::CheckPtYPhi(Float_t pt, Float_t y, Float_t phi) {
 //////////////////////////////////////////////////////////////////////////////////
 
 Bool_t AliGenGeVSim::CheckP(Float_t p[3]) {
+  //
+  // private function used by Generate()
+  //
+  // Check bounds of a total momentum of a track
+  //
 
   if ( !TestBit(kMomentumRange) ) return kTRUE;
 
-  Float_t P = TMath::Sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2]);
-  if ( P < fPMin || P > fPMax) return kFALSE;
+  Float_t momentum = TMath::Sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2]);
+  if ( momentum < fPMin || momentum > fPMax) return kFALSE;
 
   return kTRUE;
 }
@@ -85,7 +156,12 @@ Bool_t AliGenGeVSim::CheckP(Float_t p[3]) {
 //////////////////////////////////////////////////////////////////////////////////
 
 void AliGenGeVSim::InitFormula() {
-
+  //
+  // private function
+  //
+  // Initalizes formulas used in GeVSim.
+  // Manages strings and creates TFormula objects from strings
+  // 
 
   // Deconvoluted Pt Y formula
 
@@ -117,12 +193,12 @@ void AliGenGeVSim::InitFormula() {
   
   const char *formE = " ( sqrt([0]*[0] + x*x) * cosh(y) ) ";
   const char *formG = " ( 1 / sqrt( 1 - [2]*[2] ) ) ";
-  const char *formYp = "( [2] * sqrt( ([0]*[0]+x*x)*cosh(y)*cosh(y) - [0]*[0] ) / ( [1] * sqrt(1-[2]*[2])) ) ";
+  const char *formYp = "( [2]*sqrt(([0]*[0]+x*x)*cosh(y)*cosh(y)-[0]*[0])/([1]*sqrt(1-[2]*[2]))) ";
 
   const char* formula[3] = {
     " x * %s * exp( -%s / [1]) ", 
     " (x * %s) / ( exp( %s / [1]) - 1 ) ",
-    " x * %s * exp (- %s * %s / [1] ) * (  (sinh(%s)/%s) + ([1]/(%s * %s)) * (  sinh(%s)/%s - cosh(%s) ) )  "
+    " x*%s*exp(-%s*%s/[1])*((sinh(%s)/%s)+([1]/(%s*%s))*(sinh(%s)/%s-cosh(%s)))"
   };
 
   const char* paramNames[3] = {"Mass", "Temperature", "ExpVel"};
@@ -147,7 +223,7 @@ void AliGenGeVSim::InitFormula() {
   for (i=0; i<3; i++) {    
 
     fPtYFormula[i]->SetNpx(100);        // 40 MeV  
-    fPtYFormula[i]->SetNpy(100);        //
+     fPtYFormula[i]->SetNpy(100);        //
 
     for (j=0; j<3; j++) {
 
@@ -175,6 +251,12 @@ void AliGenGeVSim::InitFormula() {
 //////////////////////////////////////////////////////////////////////////////////
 
 void AliGenGeVSim::AddParticleType(AliGeVSimParticle *part) {
+  //
+  // Adds new type of particles.
+  // 
+  // Parameters are defeined in AliGeVSimParticle object
+  // This method has to be called for every particle type
+  //
 
   if (fPartTypes == NULL) 
      fPartTypes = new TObjArray();
@@ -186,8 +268,33 @@ void AliGenGeVSim::AddParticleType(AliGeVSimParticle *part) {
 //////////////////////////////////////////////////////////////////////////////////
 
 Float_t AliGenGeVSim::FindScaler(Int_t paramId, Int_t pdg) {
-
-
+  //
+  // private function
+  // Finds Scallar for a given parameter.
+  // Function used in event-by-event mode.
+  //
+  // There are two types of scallars: deterministic and random
+  // and they can work on either global or particle type level.
+  // For every variable there are four scallars defined.  
+  //  
+  // Scallars are named as folowa
+  // deterministic global level : "gevsimParam"        (eg. "gevsimTemp")
+  // deterinistig type level    : "gevsimPdgParam"     (eg. "gevsim211Mult")
+  // random global level        : "gevsimParamRndm"    (eg. "gevsimMultRndm")
+  // random type level          : "gevsimPdgParamRndm" (eg. "gevsim-211V2Rndm");
+  //
+  // Pdg - code of a particle type in PDG standard (see: http://pdg.lbl.gov)
+  // Param - parameter name. Allowed parameters:
+  //
+  // "Temp"   - inverse slope parameter
+  // "SigmaY" - rapidity width - for model (1) only
+  // "ExpVel" - expansion velocity - for model (4) only
+  // "V1"     - directed flow
+  // "V2"     - elliptic flow
+  // "Mult"   - multiplicity
+  //
+  
+  
   static const char* params[] = {"Temp", "SigmaY", "ExpVel", "V1", "V2", "Mult"};
   static const char* ending[] = {"", "Rndm"};
 
@@ -228,7 +335,64 @@ Float_t AliGenGeVSim::FindScaler(Int_t paramId, Int_t pdg) {
 
 //////////////////////////////////////////////////////////////////////////////////
 
+void AliGenGeVSim::DetermineReactionPlane() {
+  //
+  // private function used by Generate()
+  //
+  // Retermines Reaction Plane angle and set this value 
+  // as a parameter [0] in fPhiFormula
+  //
+  // Note: if "gevsimPsiRndm" function is found it override both 
+  //       "gevsimPhi" function and initial fPsi value
+  //
+  
+  TF1 *form;
+  
+  form = 0;
+  form = (TF1 *)gROOT->GetFunction("gevsimPsi");
+  if (form != 0) fPsi = form->Eval(gAlice->GetEvNumber());
+  
+   form = 0;
+  form = (TF1 *)gROOT->GetFunction("gevsimPsiRndm");
+  if (form != 0) fPsi = form->GetRandom();
+  
+  fPhiFormula->SetParameter(0, fPsi);
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+
+TFormula* AliGenGeVSim::DetermineModel() {
+  //
+  // private function used by Generate() 
+  //
+  // Determines model to be used in generation
+  // if "gevsimModel" function is found its overrides initial value
+  // of a fModel variable.
+  // 
+  // Function return TFormula object corresponding to a selected model.
+  // 
+  
+  TF1 *form = 0;
+  form = (TF1 *)gROOT->GetFunction("gevsimModel");
+  if (form != 0) fModel = (Int_t)form->Eval(gAlice->GetEvNumber());
+  
+  if (fModel == 1) return fPtFormula;
+  if (fModel > 1) return fPtYFormula[fModel-2];
+  return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+
 void AliGenGeVSim::Init() {
+  //
+  // Standard AliGenerator initializer.
+  // 
+  // The function check if fModel was set to 5 (custom distribution)
+  // If fModel==5 try to find function named "gevsimPtY"
+  // If fModel==5 and no "gevsimPtY" formula exist Error is thrown.
+  //
+  // Griding 100x100 is applied for custom function 
+  //
 
   // init custom formula
 
@@ -251,7 +415,10 @@ void AliGenGeVSim::Init() {
 //////////////////////////////////////////////////////////////////////////////////
 
 void AliGenGeVSim::Generate() {
-
+  //
+  // Standard AliGenerator function
+  // This function do actual job and puts particles on stack.
+  //
 
   Int_t i;
 
@@ -261,14 +428,13 @@ void AliGenGeVSim::Generate() {
   Float_t polar[3] = {0,0,0};   // polarisation
   Float_t p[3] = {0,0,0};       // particle momentum
   Float_t time = 0;             // time of creation
-  Double_t pt, y, phi;           // particle momentum in {pt, y, phi}  
+  Double_t pt, y, phi;          // particle momentum in {pt, y, phi}  
 
   Int_t multiplicity;           
   Float_t paramScaler;
+  TFormula *model = 0;
 
-  TFormula *model = NULL;
-
-  const Int_t parent = -1;
+  const Int_t kParent = -1;
   Int_t id;  
 
   TLorentzVector *v = new TLorentzVector(0,0,0,0);
@@ -297,30 +463,12 @@ void AliGenGeVSim::Generate() {
   Int_t nParams = 6;
 
 
-  // Reaction Plane Determination
-
-  TF1 *form;
+  // reaction plane determination and model
 
-  form = 0;
-  form = (TF1 *)gROOT->GetFunction("gevsimPsi");
-  if (form != 0) fPsi = form->Eval(gAlice->GetEvNumber());
-
-  form = 0;
-  form = (TF1 *)gROOT->GetFunction("gevsimPsiRndm");
-  if (form != 0) fPsi = form->GetRandom();
+  DetermineReactionPlane();
+  model = DetermineModel();
   
-  fPhiFormula->SetParameter(0, fPsi);
-
-  // setting selected model
-
-  form = 0;
-  form = (TF1 *)gROOT->GetFunction("gevsimModel");
-  if (form != 0) fModel = (Int_t)form->Eval(gAlice->GetEvNumber());
-  
-  if (fModel == 1) model = fPtFormula;
-  if (fModel > 1) model = fPtYFormula[fModel-2];
-
-
   // loop over particle types
 
   for (nType = 0; nType < fPartTypes->GetEntries(); nType++) {
@@ -344,7 +492,7 @@ void AliGenGeVSim::Generate() {
 
       if (nParam == 0) {
        model->SetParameter("Temperature", paramScaler * partType->GetTemperature());
-       cout << "temperature Set to: " << (paramScaler * partType->GetTemperature()) << endl;
+       cout << "temperature set to: " << (paramScaler * partType->GetTemperature()) << endl;
       }
 
       if (nParam == 1 && fModel == 1) 
@@ -369,8 +517,8 @@ void AliGenGeVSim::Generate() {
 
       // flow
 
-      if (nParam == 3) fPhiFormula->SetParameter(1, paramScaler * partType->GetDirectFlow());
-      if (nParam == 4) fPhiFormula->SetParameter(2, paramScaler * partType->GetEllipticalFlow());
+      if (nParam == 3) fPhiFormula->SetParameter(1, paramScaler * partType->GetDirectedFlow());
+      if (nParam == 4) fPhiFormula->SetParameter(2, paramScaler * partType->GetEllipticFlow());
       
       // multiplicity
 
@@ -418,7 +566,7 @@ void AliGenGeVSim::Generate() {
 
       // putting particle on the stack
 
-      SetTrack(fTrackIt, parent, pdg, p, orgin, polar, time, kPPrimary, id, 1);     
+      SetTrack(fTrackIt, kParent, pdg, p, orgin, polar, time, kPPrimary, id, 1);     
       nParticle++;
     }
   }
index e81faee28e2daa0fe6fdba4df4d9a1a8745c6f6b..d7895f26275871096cae67be889f899cb1337e7f 100644 (file)
@@ -1,49 +1,92 @@
 #ifndef ALIGENGEVSIM_H
 #define ALIGENGEVSIM_H
 
-#include "TObjArray.h"
-#include "TF1.h"
-#include "TF2.h"
-#include "AliGenerator.h"
-#include "AliGeVSimParticle.h"
+////////////////////////////////////////////////////////////////////////////////
+//
+// AliGenGeVSim is a class implementing simple Monte-Carlo event generator for 
+// testing algorythms and detector performance.
+//
+// In this event generator particles are generated from thermal distributions 
+// without any dynamics and addicional constrains. Distribution parameters like
+// multiplicity, particle type yields, inverse slope parameters, flow coeficients 
+// and expansion velocities are expleicite defined by the user.
+//
+// GeVSim contains four thermal distributions the same as
+// MevSim event generator developed for STAR experiment.
+//
+// In addition custom distributions can be used be the mean of TF2 function
+// named "gevsimPtY". 
+//  
+// Azimuthal distribution is deconvoluted from (Pt,Y) distribution
+// and is described by two Fourier coefficients representing 
+// Directed and Elliptical flow. 
+// 
+// To apply flow to event ganerated by an arbitraly event generator
+// refer to AliGenAfterBurnerFlow class.
+// For examples, parameters and testing macros refer to:
+// http:/home.cern.ch/radomski
+//  
+// Author:
+// Sylwester Radomski,
+// GSI, March 2002
+//  
+// S.Radomski@gsi.de
+//
+////////////////////////////////////////////////////////////////////////////////
+
+class TFormula;
+class TF1;
+class TF2;
+class TObjArray;
+class AliGeVSimParticle;
 
 
 class AliGenGeVSim : public AliGenerator {
 
+ public:
+  
+  AliGenGeVSim();
+  AliGenGeVSim(Int_t model, Float_t psi);
+  
+  virtual ~AliGenGeVSim();
+  
+  /////////////////////////////////////////////////////////////////
+  
+  void AddParticleType(AliGeVSimParticle *part);
+  
+  void Init();
+  void Generate();
+  
+  /////////////////////////////////////////////////////////////////
+  
+ private:
+  
   Int_t   fModel;            // Selected model (1-5)
   Float_t fPsi;              // Reaction Plane angle (0-2pi)
-
+  
   TF1 *fPtFormula;           // Pt formula for model (1)
   TF1 *fYFormula;            // Y formula for model (1)
   TF2 *fPtYFormula[4];       // Pt,Y formulae for model (2)-(4) and custom
   TF1 *fPhiFormula;          // phi formula 
-
+  
   TObjArray *fPartTypes;     // Registered particles
-
+  
   void InitFormula();        
+  void DetermineReactionPlane();
+  TFormula* DetermineModel();
   //void PlotDistributions();
   
   Bool_t CheckPtYPhi(Float_t pt, Float_t y, Float_t phi);
   Bool_t CheckP(Float_t p[3]);
-
+  
   Float_t FindScaler(Int_t paramId, Int_t pdg);
-
- public:
-
-  AliGenGeVSim();
-  AliGenGeVSim(Int_t model, Float_t psi);
-
-  virtual ~AliGenGeVSim();
-
-  /////////////////////////////////////////////////////////////////
-
-  void AddParticleType(AliGeVSimParticle *part);
   
-  void Init();
-  void Generate();
-
   /////////////////////////////////////////////////////////////////
 
+ public:
+
   ClassDef(AliGenGeVSim, 1)
 
 };
index a3144d443dda83f9659bcd5e3360b3346f086186..af35178a41101b12931fa97e46a3d5029932e2bd 100644 (file)
@@ -53,6 +53,7 @@
 #pragma link C++ class  AliGenReaderEcalJets++;
 #pragma link C++ class  AliGenGeVSim+;
 #pragma link C++ class  AliGeVSimParticle+;
+#pragma link C++ class  AliGenAfterBurnerFlow+;
 #endif
 
 
index 7186755208d166a98f593e7bf60424e5b5a1031f..eff5b2c89245d48b56bf8089dc63a30c8898eacf 100644 (file)
@@ -27,7 +27,9 @@ SRCS          = AliGenHIJINGpara.cxx AliGenHIJINGparaBa.cxx \
                 AliGenHBTprocessor.cxx \
                AliGenReader.cxx AliGenReaderCwn.cxx AliGenReaderTreeK.cxx \
                AliGenReaderEcalHijing.cxx AliGenReaderEcalJets.cxx \
-               AliGeVSimParticle.cxx AliGenGeVSim.cxx
+               AliGeVSimParticle.cxx AliGenGeVSim.cxx \
+               AliGenAfterBurnerFlow.cxx
+
 
 
 # C++ Headers
index 18240be57e8f896452731a771708cb15420ba642..56fce3e3cc0a2ab8ccd9da43eefd69bec0f64873 100644 (file)
@@ -16,7 +16,8 @@ SRCS          = AliGenHIJINGpara.cxx AliGenBox.cxx AliGenFixed.cxx \
                AliGenReader.cxx AliGenReaderCwn.cxx AliGenReaderTreeK.cxx \
                 AliGenReaderEcalHijing.cxx AliGenReaderEcalJets.cxx\
                AliGenHIJINGparaBa.cxx AliGeVSimParticle.cxx AliGenGeVSim.cxx\
-               AliGenThetaSlice.cxx AliGenSTRANGElib.cxx
+               AliGenThetaSlice.cxx AliGenSTRANGElib.cxx \
+               AliGenAfterBurnerFlow.cxx
 
 # Headerfiles for this particular package (Path respect to own directory)
 HDRS= $(SRCS:.cxx=.h)