-
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
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];
+}
+////////////////////////////////////////////////////////////////////////////////////////////////////
#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
--- /dev/null
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
+
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
--- /dev/null
+#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
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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;
//////////////////////////////////////////////////////////////////////////////////
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
//////////////////////////////////////////////////////////////////////////////////
AliGenGeVSim::~AliGenGeVSim() {
+ //
+ // Default Destructor
+ //
+ // Removes TObjArray keeping list of registered particle types
+ //
if (fPartTypes != NULL) delete fPartTypes;
}
//////////////////////////////////////////////////////////////////////////////////
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;
//////////////////////////////////////////////////////////////////////////////////
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;
}
//////////////////////////////////////////////////////////////////////////////////
void AliGenGeVSim::InitFormula() {
-
+ //
+ // private function
+ //
+ // Initalizes formulas used in GeVSim.
+ // Manages strings and creates TFormula objects from strings
+ //
// Deconvoluted Pt Y formula
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"};
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++) {
//////////////////////////////////////////////////////////////////////////////////
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();
//////////////////////////////////////////////////////////////////////////////////
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"};
//////////////////////////////////////////////////////////////////////////////////
+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
//////////////////////////////////////////////////////////////////////////////////
void AliGenGeVSim::Generate() {
-
+ //
+ // Standard AliGenerator function
+ // This function do actual job and puts particles on stack.
+ //
Int_t i;
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);
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++) {
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)
// 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
// 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++;
}
}
#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)
};
#pragma link C++ class AliGenReaderEcalJets++;
#pragma link C++ class AliGenGeVSim+;
#pragma link C++ class AliGeVSimParticle+;
+#pragma link C++ class AliGenAfterBurnerFlow+;
#endif
AliGenHBTprocessor.cxx \
AliGenReader.cxx AliGenReaderCwn.cxx AliGenReaderTreeK.cxx \
AliGenReaderEcalHijing.cxx AliGenReaderEcalJets.cxx \
- AliGeVSimParticle.cxx AliGenGeVSim.cxx
+ AliGeVSimParticle.cxx AliGenGeVSim.cxx \
+ AliGenAfterBurnerFlow.cxx
+
# C++ Headers
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)