Updated version of the toy model to be used for the balance function analysis
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 25 Dec 2011 21:35:11 +0000 (21:35 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 25 Dec 2011 21:35:11 +0000 (21:35 +0000)
PWG2/EBYE/AliAnalysisTaskToyModel.cxx
PWG2/EBYE/AliAnalysisTaskToyModel.h

index ad3594e..70cf480 100755 (executable)
@@ -35,22 +35,23 @@ AliAnalysisTaskToyModel::AliAnalysisTaskToyModel(const char *name)
   fPtMin(0.0), fPtMax(100.0),\r
   fEtaMin(-1.0), fEtaMax(1.0),\r
   fUseAcceptanceParameterization(kFALSE), fAcceptanceParameterization(0),\r
+  fUseAllCharges(kTRUE), fParticleMass(0.0),\r
   fPtSpectraAllCharges(0), fTemperatureAllCharges(100.),\r
   fReactionPlane(0.0),\r
   fAzimuthalAngleAllCharges(0), fDirectedFlowAllCharges(0.0), \r
   fEllipticFlowAllCharges(0.0), fTriangularFlowAllCharges(0.0),\r
   fQuandrangularFlowAllCharges(0.0), fPentangularFlowAllCharges(0.0),\r
-  fPionPercentage(0.8),\r
+  fPionPercentage(0.8), fPionMass(0.0),\r
   fPtSpectraPions(0), fTemperaturePions(100.),\r
   fAzimuthalAnglePions(0), fDirectedFlowPions(0.0), \r
   fEllipticFlowPions(0.0), fTriangularFlowPions(0.0), \r
   fQuandrangularFlowPions(0.0), fPentangularFlowPions(0.0),\r
-  fKaonPercentage(0.8),\r
+  fKaonPercentage(0.8), fKaonMass(0.0),\r
   fPtSpectraKaons(0), fTemperatureKaons(100.),\r
   fAzimuthalAngleKaons(0), fDirectedFlowKaons(0.0), \r
   fEllipticFlowKaons(0.0), fTriangularFlowKaons(0.0),\r
   fQuandrangularFlowKaons(0.0), fPentangularFlowKaons(0.0),\r
-  fProtonPercentage(0.8),\r
+  fProtonPercentage(0.8), fProtonMass(0.0),\r
   fPtSpectraProtons(0), fTemperatureProtons(100.),\r
   fAzimuthalAngleProtons(0), fDirectedFlowProtons(0.0), \r
   fEllipticFlowProtons(0.0), fTriangularFlowProtons(0.0),\r
@@ -85,95 +86,100 @@ void AliAnalysisTaskToyModel::Init() {
   //==============Particles and spectra==============//\r
   TParticle *pion = new TParticle();\r
   pion->SetPdgCode(211);\r
-  Double_t gPionMass = pion->GetMass();\r
-\r
-  fPtSpectraAllCharges = new TF1("fPtSpectraAllCharges","x*TMath::Exp(-TMath::Power([0]*[0]+x*x,0.5)/[1])",0.,100.);\r
-  fPtSpectraAllCharges->SetParName(0,"Mass");\r
-  fPtSpectraAllCharges->SetParameter(0,gPionMass);\r
-  fPtSpectraAllCharges->SetParName(1,"Temperature");\r
-  fPtSpectraAllCharges->SetParameter(1,fTemperatureAllCharges);\r
-\r
-  fPtSpectraPions = new TF1("fPtSpectraPions","x*TMath::Exp(-TMath::Power([0]*[0]+x*x,0.5)/[1])",0.,100.);\r
-  fPtSpectraPions->SetParName(0,"Mass");\r
-  fPtSpectraPions->SetParameter(0,gPionMass);\r
-  fPtSpectraPions->SetParName(1,"Temperature");\r
-  fPtSpectraPions->SetParameter(1,fTemperaturePions);\r
+  fPionMass = pion->GetMass();\r
 \r
   TParticle *kaon = new TParticle();\r
   kaon->SetPdgCode(321);\r
-  Double_t gKaonMass = kaon->GetMass();\r
-  fPtSpectraKaons = new TF1("fPtSpectraKaons","x*TMath::Exp(-TMath::Power([0]*[0]+x*x,0.5)/[1])",0.,100.);\r
-  fPtSpectraKaons->SetParName(0,"Mass");\r
-  fPtSpectraKaons->SetParameter(0,gKaonMass);\r
-  fPtSpectraKaons->SetParName(1,"Temperature");\r
-  fPtSpectraKaons->SetParameter(1,fTemperatureKaons);\r
-\r
+  fKaonMass = kaon->GetMass();\r
+  \r
   TParticle *proton = new TParticle();\r
   proton->SetPdgCode(2212);\r
-  Double_t gProtonMass = proton->GetMass();\r
-  fPtSpectraProtons = new TF1("fPtSpectraProtons","x*TMath::Exp(-TMath::Power([0]*[0]+x*x,0.5)/[1])",0.,5.);\r
-  fPtSpectraProtons->SetParName(0,"Mass");\r
-  fPtSpectraProtons->SetParameter(0,gProtonMass);\r
-  fPtSpectraProtons->SetParName(1,"Temperature");\r
-  fPtSpectraProtons->SetParameter(1,fTemperatureProtons);\r
+  fProtonMass = proton->GetMass();\r
+\r
+  if(fUseAllCharges) {\r
+    fParticleMass = fPionMass;\r
+    fPtSpectraAllCharges = new TF1("fPtSpectraAllCharges","x*TMath::Exp(-TMath::Power([0]*[0]+x*x,0.5)/[1])",0.,100.);\r
+    fPtSpectraAllCharges->SetParName(0,"Mass");\r
+    fPtSpectraAllCharges->SetParameter(0,fParticleMass);\r
+    fPtSpectraAllCharges->SetParName(1,"Temperature");\r
+    fPtSpectraAllCharges->SetParameter(1,fTemperatureAllCharges);\r
+  }\r
+  else {\r
+    fPtSpectraPions = new TF1("fPtSpectraPions","x*TMath::Exp(-TMath::Power([0]*[0]+x*x,0.5)/[1])",0.,100.);\r
+    fPtSpectraPions->SetParName(0,"Mass");\r
+    fPtSpectraPions->SetParameter(0,fPionMass);\r
+    fPtSpectraPions->SetParName(1,"Temperature");\r
+    fPtSpectraPions->SetParameter(1,fTemperaturePions);\r
+    \r
+    fPtSpectraKaons = new TF1("fPtSpectraKaons","x*TMath::Exp(-TMath::Power([0]*[0]+x*x,0.5)/[1])",0.,100.);\r
+    fPtSpectraKaons->SetParName(0,"Mass");\r
+    fPtSpectraKaons->SetParameter(0,fKaonMass);\r
+    fPtSpectraKaons->SetParName(1,"Temperature");\r
+    fPtSpectraKaons->SetParameter(1,fTemperatureKaons);\r
+    \r
+    fPtSpectraProtons = new TF1("fPtSpectraProtons","x*TMath::Exp(-TMath::Power([0]*[0]+x*x,0.5)/[1])",0.,5.);\r
+    fPtSpectraProtons->SetParName(0,"Mass");\r
+    fPtSpectraProtons->SetParameter(0,fProtonMass);\r
+    fPtSpectraProtons->SetParName(1,"Temperature");\r
+    fPtSpectraProtons->SetParameter(1,fTemperatureProtons);\r
+  }\r
   //==============Particles and spectra==============//\r
 \r
   //==============Flow values==============//\r
-  fAzimuthalAngleAllCharges = new TF1("fAzimuthalAngleAllCharges","1+2.*[1]*TMath::Cos(x-[0])+2.*[2]*TMath::Cos(2*(x-[0]))+2.*[3]*TMath::Cos(3*(x-[0]))+2.*[4]*TMath::Cos(4*(x-[0]))+2.*[5]*TMath::Cos(5*(x-[0]))",0.,2.*TMath::Pi());\r
-  fAzimuthalAngleAllCharges->SetParName(0,"Reaction Plane");\r
-  fAzimuthalAngleAllCharges->SetParameter(0,fReactionPlane);\r
-  fAzimuthalAngleAllCharges->SetParName(1,"Directed flow");\r
-  fAzimuthalAngleAllCharges->SetParameter(1,fDirectedFlowAllCharges);\r
-  fAzimuthalAngleAllCharges->SetParName(2,"Elliptic flow"); \r
-  fAzimuthalAngleAllCharges->SetParameter(2,fEllipticFlowAllCharges);\r
-  fAzimuthalAngleAllCharges->SetParName(3,"Triangular flow");\r
-  fAzimuthalAngleAllCharges->SetParameter(3,fTriangularFlowAllCharges);\r
-  fAzimuthalAngleAllCharges->SetParName(4,"Quandrangular flow");\r
-  fAzimuthalAngleAllCharges->SetParameter(4,fQuandrangularFlowAllCharges);\r
-  fAzimuthalAngleAllCharges->SetParName(5,"Pentangular flow");\r
-  fAzimuthalAngleAllCharges->SetParameter(5,fPentangularFlowAllCharges);\r
-\r
-  fAzimuthalAnglePions = new TF1("fAzimuthalAnglePions","1+2.*[1]*TMath::Cos(x-[0])+2.*[2]*TMath::Cos(2*(x-[0]))+2.*[3]*TMath::Cos(3*(x-[0]))+2.*[4]*TMath::Cos(4*(x-[0]))+2.*[5]*TMath::Cos(5*(x-[0]))",0.,2.*TMath::Pi());\r
-  fAzimuthalAnglePions->SetParName(0,"Reaction Plane");\r
-  fAzimuthalAnglePions->SetParameter(0,fReactionPlane);\r
-  fAzimuthalAnglePions->SetParName(1,"Directed flow");\r
-  fAzimuthalAnglePions->SetParameter(1,fDirectedFlowPions);\r
-  fAzimuthalAnglePions->SetParName(2,"Elliptic flow"); \r
-  fAzimuthalAnglePions->SetParameter(2,fEllipticFlowPions);\r
-  fAzimuthalAnglePions->SetParName(3,"Triangular flow");\r
-  fAzimuthalAnglePions->SetParameter(3,fTriangularFlowPions);\r
-  fAzimuthalAnglePions->SetParName(4,"Quandrangular flow");\r
-  fAzimuthalAnglePions->SetParameter(4,fQuandrangularFlowPions);\r
-  fAzimuthalAnglePions->SetParName(5,"Pentangular flow");\r
-  fAzimuthalAnglePions->SetParameter(5,fPentangularFlowPions);\r
-\r
-  fAzimuthalAngleKaons = new TF1("fAzimuthalAngleKaons","1+2.*[1]*TMath::Cos(x-[0])+2.*[2]*TMath::Cos(2*(x-[0]))+2.*[3]*TMath::Cos(3*(x-[0]))+2.*[4]*TMath::Cos(4*(x-[0]))+2.*[5]*TMath::Cos(5*(x-[0]))",0.,2.*TMath::Pi());\r
-  fAzimuthalAngleKaons->SetParName(0,"Reaction Plane");\r
-  fAzimuthalAngleKaons->SetParameter(0,fReactionPlane);\r
-  fAzimuthalAngleKaons->SetParName(1,"Directed flow");\r
-  fAzimuthalAngleKaons->SetParameter(1,fDirectedFlowKaons);\r
-  fAzimuthalAngleKaons->SetParName(2,"Elliptic flow"); \r
-  fAzimuthalAngleKaons->SetParameter(2,fEllipticFlowKaons);\r
-  fAzimuthalAngleKaons->SetParName(3,"Triangular flow");\r
-  fAzimuthalAngleKaons->SetParameter(3,fTriangularFlowKaons);\r
-  fAzimuthalAngleKaons->SetParName(4,"Quandrangular flow");\r
-  fAzimuthalAngleKaons->SetParameter(4,fQuandrangularFlowKaons);\r
-  fAzimuthalAngleKaons->SetParName(5,"Pentangular flow");\r
-  fAzimuthalAngleKaons->SetParameter(5,fPentangularFlowKaons);\r
-\r
-  fAzimuthalAngleProtons = new TF1("fAzimuthalAngleProtons","1+2.*[1]*TMath::Cos(x-[0])+2.*[2]*TMath::Cos(2*(x-[0]))+2.*[3]*TMath::Cos(3*(x-[0]))+2.*[4]*TMath::Cos(4*(x-[0]))+2.*[5]*TMath::Cos(5*(x-[0]))",0.,2.*TMath::Pi());\r
-  fAzimuthalAngleProtons->SetParName(0,"Reaction Plane");\r
-  fAzimuthalAngleProtons->SetParameter(0,fReactionPlane);\r
-  fAzimuthalAngleProtons->SetParName(1,"Directed flow");\r
-  fAzimuthalAngleProtons->SetParameter(1,fDirectedFlowProtons);\r
-  fAzimuthalAngleProtons->SetParName(2,"Elliptic flow"); \r
-  fAzimuthalAngleProtons->SetParameter(2,fEllipticFlowProtons);\r
-  fAzimuthalAngleProtons->SetParName(3,"Triangular flow");\r
-  fAzimuthalAngleProtons->SetParameter(3,fTriangularFlowProtons);\r
-  fAzimuthalAngleProtons->SetParName(4,"Quandrangular flow");\r
-  fAzimuthalAngleProtons->SetParameter(4,fQuandrangularFlowProtons);\r
-  fAzimuthalAngleProtons->SetParName(5,"Pentangular flow");\r
-  fAzimuthalAngleProtons->SetParameter(5,fPentangularFlowProtons);\r
+  if(fUseAllCharges) {\r
+    fAzimuthalAngleAllCharges = new TF1("fAzimuthalAngleAllCharges","1+2.*[1]*TMath::Cos(x-[0])+2.*[2]*TMath::Cos(2*(x-[0]))+2.*[3]*TMath::Cos(3*(x-[0]))+2.*[4]*TMath::Cos(4*(x-[0]))+2.*[5]*TMath::Cos(5*(x-[0]))",0.,2.*TMath::Pi());\r
+    fAzimuthalAngleAllCharges->SetParName(0,"Reaction Plane");\r
+    fAzimuthalAngleAllCharges->SetParName(1,"Directed flow");\r
+    fAzimuthalAngleAllCharges->SetParameter(1,fDirectedFlowAllCharges);\r
+    fAzimuthalAngleAllCharges->SetParName(2,"Elliptic flow"); \r
+    fAzimuthalAngleAllCharges->SetParameter(2,fEllipticFlowAllCharges);\r
+    fAzimuthalAngleAllCharges->SetParName(3,"Triangular flow");\r
+    fAzimuthalAngleAllCharges->SetParameter(3,fTriangularFlowAllCharges);\r
+    fAzimuthalAngleAllCharges->SetParName(4,"Quandrangular flow");\r
+    fAzimuthalAngleAllCharges->SetParameter(4,fQuandrangularFlowAllCharges);\r
+    fAzimuthalAngleAllCharges->SetParName(5,"Pentangular flow");\r
+    fAzimuthalAngleAllCharges->SetParameter(5,fPentangularFlowAllCharges);\r
+  }\r
+  else {\r
+    fAzimuthalAnglePions = new TF1("fAzimuthalAnglePions","1+2.*[1]*TMath::Cos(x-[0])+2.*[2]*TMath::Cos(2*(x-[0]))+2.*[3]*TMath::Cos(3*(x-[0]))+2.*[4]*TMath::Cos(4*(x-[0]))+2.*[5]*TMath::Cos(5*(x-[0]))",0.,2.*TMath::Pi());\r
+    fAzimuthalAnglePions->SetParName(0,"Reaction Plane");\r
+    fAzimuthalAnglePions->SetParName(1,"Directed flow");\r
+    fAzimuthalAnglePions->SetParameter(1,fDirectedFlowPions);\r
+    fAzimuthalAnglePions->SetParName(2,"Elliptic flow"); \r
+    fAzimuthalAnglePions->SetParameter(2,fEllipticFlowPions);\r
+    fAzimuthalAnglePions->SetParName(3,"Triangular flow");\r
+    fAzimuthalAnglePions->SetParameter(3,fTriangularFlowPions);\r
+    fAzimuthalAnglePions->SetParName(4,"Quandrangular flow");\r
+    fAzimuthalAnglePions->SetParameter(4,fQuandrangularFlowPions);\r
+    fAzimuthalAnglePions->SetParName(5,"Pentangular flow");\r
+    fAzimuthalAnglePions->SetParameter(5,fPentangularFlowPions);\r
+    \r
+    fAzimuthalAngleKaons = new TF1("fAzimuthalAngleKaons","1+2.*[1]*TMath::Cos(x-[0])+2.*[2]*TMath::Cos(2*(x-[0]))+2.*[3]*TMath::Cos(3*(x-[0]))+2.*[4]*TMath::Cos(4*(x-[0]))+2.*[5]*TMath::Cos(5*(x-[0]))",0.,2.*TMath::Pi());\r
+    fAzimuthalAngleKaons->SetParName(0,"Reaction Plane");\r
+    fAzimuthalAngleKaons->SetParName(1,"Directed flow");\r
+    fAzimuthalAngleKaons->SetParameter(1,fDirectedFlowKaons);\r
+    fAzimuthalAngleKaons->SetParName(2,"Elliptic flow"); \r
+    fAzimuthalAngleKaons->SetParameter(2,fEllipticFlowKaons);\r
+    fAzimuthalAngleKaons->SetParName(3,"Triangular flow");\r
+    fAzimuthalAngleKaons->SetParameter(3,fTriangularFlowKaons);\r
+    fAzimuthalAngleKaons->SetParName(4,"Quandrangular flow");\r
+    fAzimuthalAngleKaons->SetParameter(4,fQuandrangularFlowKaons);\r
+    fAzimuthalAngleKaons->SetParName(5,"Pentangular flow");\r
+    fAzimuthalAngleKaons->SetParameter(5,fPentangularFlowKaons);\r
+    \r
+    fAzimuthalAngleProtons = new TF1("fAzimuthalAngleProtons","1+2.*[1]*TMath::Cos(x-[0])+2.*[2]*TMath::Cos(2*(x-[0]))+2.*[3]*TMath::Cos(3*(x-[0]))+2.*[4]*TMath::Cos(4*(x-[0]))+2.*[5]*TMath::Cos(5*(x-[0]))",0.,2.*TMath::Pi());\r
+    fAzimuthalAngleProtons->SetParName(0,"Reaction Plane");\r
+    fAzimuthalAngleProtons->SetParName(1,"Directed flow");\r
+    fAzimuthalAngleProtons->SetParameter(1,fDirectedFlowProtons);\r
+    fAzimuthalAngleProtons->SetParName(2,"Elliptic flow"); \r
+    fAzimuthalAngleProtons->SetParameter(2,fEllipticFlowProtons);\r
+    fAzimuthalAngleProtons->SetParName(3,"Triangular flow");\r
+    fAzimuthalAngleProtons->SetParameter(3,fTriangularFlowProtons);\r
+    fAzimuthalAngleProtons->SetParName(4,"Quandrangular flow");\r
+    fAzimuthalAngleProtons->SetParameter(4,fQuandrangularFlowProtons);\r
+    fAzimuthalAngleProtons->SetParName(5,"Pentangular flow");\r
+    fAzimuthalAngleProtons->SetParameter(5,fPentangularFlowProtons);\r
+  }\r
   //==============Flow values==============//\r
 }\r
 \r
@@ -282,85 +288,69 @@ void AliAnalysisTaskToyModel::UserExec(Option_t *) {
   //Multiplicities\r
   Int_t nMultiplicity = (Int_t)(gRandom->Gaus(fTotalMultiplicityMean,fTotalMultiplicitySigma));\r
   Int_t nNetCharge = (Int_t)(gRandom->Gaus(fNetChargeMean,fNetChargeSigma));\r
-  Int_t nGeneratedPositive = 0.5*(nMultiplicity + nNetCharge);\r
-  Int_t nGeneratedNegative = nMultiplicity - nGeneratedPositive;\r
-  Int_t nGeneratedPositivePions = (Int_t)(fPionPercentage*nGeneratedPositive);\r
-  Int_t nGeneratedNegativePions = (Int_t)(fPionPercentage*nGeneratedNegative);\r
-  Int_t nGeneratedPositiveKaons = (Int_t)(fKaonPercentage*nGeneratedPositive);\r
-  Int_t nGeneratedNegativeKaons = (Int_t)(fKaonPercentage*nGeneratedNegative);\r
-  Int_t nGeneratedPositiveProtons = (Int_t)(fProtonPercentage*nGeneratedPositive);\r
-  Int_t nGeneratedNegativeProtons = (Int_t)(fProtonPercentage*nGeneratedNegative);  \r
-\r
-  Printf("Total positive: %d - Total negative: %d",nGeneratedPositive,nGeneratedNegative);\r
-  Printf("Positive pions: %d - Negative pions: %d",nGeneratedPositivePions,nGeneratedNegativePions);\r
-  Printf("Positive kaons: %d - Negative kaons: %d",nGeneratedPositiveKaons,nGeneratedNegativeKaons);\r
-  Printf("Positive protons: %d - Negative protons: %d",nGeneratedPositiveProtons,nGeneratedNegativeProtons);\r
+  Int_t nGeneratedPositive = 0, nGeneratedNegative = 0;\r
+  Int_t nGeneratedPions = 0, nGeneratedKaons = 0, nGeneratedProtons = 0;\r
+\r
+  //Randomization of the reaction plane\r
+  fReactionPlane = 2.0*TMath::Pi()*gRandom->Rndm();\r
+  if(fUseAllCharges) \r
+    fAzimuthalAngleAllCharges->SetParameter(0,fReactionPlane);\r
+  else {\r
+    fAzimuthalAnglePions->SetParameter(0,fReactionPlane);\r
+    fAzimuthalAngleKaons->SetParameter(0,fReactionPlane);\r
+    fAzimuthalAngleProtons->SetParameter(0,fReactionPlane);\r
+  }\r
 \r
   Int_t gNumberOfAcceptedParticles = 0;\r
-  //positive particles\r
-  for(Int_t iPosCount = 0; iPosCount < nGeneratedPositive; iPosCount++) {\r
-    v_charge = 1.0;\r
-\r
-    v_pt = fPtSpectraAllCharges->GetRandom();\r
-    v_phi = fAzimuthalAngleAllCharges->GetRandom();\r
-    v_eta = gRandom->Gaus(0.0,4.0);\r
-\r
-    v_p[0] = v_pt*TMath::Cos(v_phi);\r
-    v_p[1] = v_pt*TMath::Sin(v_phi);\r
-    v_p[2] = v_pt*TMath::SinH(v_eta);\r
-    v_E = TMath::Sqrt(TMath::Power(0.139,2) +\r
-                     TMath::Power(v_p[0],2) +\r
-                     TMath::Power(v_p[1],2) +\r
-                     TMath::Power(v_p[2],2));\r
-\r
-    v_y = 0.5*TMath::Log((v_E + v_p[2])/(v_E - v_p[2]));\r
-\r
-    //Acceptance\r
-    if((v_eta < fEtaMin) || (v_eta > fEtaMax)) continue;\r
-    if((v_pt < fPtMin) || (v_pt > fPtMax)) continue;\r
-\r
-    // fill charge vector\r
-    chargeVector[0]->push_back(v_charge);\r
-    chargeVector[1]->push_back(v_y);\r
-    chargeVector[2]->push_back(v_eta);\r
-    chargeVector[3]->push_back(v_phi);\r
-    chargeVector[4]->push_back(v_p[0]);\r
-    chargeVector[5]->push_back(v_p[1]);\r
-    chargeVector[6]->push_back(v_p[2]);\r
-    chargeVector[7]->push_back(v_pt);\r
-    chargeVector[8]->push_back(v_E);\r
-    \r
-    if(fRunShuffling) {\r
-      chargeVectorShuffle[0]->push_back(v_charge);\r
-      chargeVectorShuffle[1]->push_back(v_y);\r
-      chargeVectorShuffle[2]->push_back(v_eta);\r
-      chargeVectorShuffle[3]->push_back(v_phi);\r
-      chargeVectorShuffle[4]->push_back(v_p[0]);\r
-      chargeVectorShuffle[5]->push_back(v_p[1]);\r
-      chargeVectorShuffle[6]->push_back(v_p[2]);\r
-      chargeVectorShuffle[7]->push_back(v_pt);\r
-      chargeVectorShuffle[8]->push_back(v_E);\r
+  //Generate particles\r
+  for(Int_t iParticleCount = 0; iParticleCount < nMultiplicity; iParticleCount++) {\r
+    //Decide the charge\r
+    Double_t randomNumberCharge = gRandom->Rndm();\r
+    if(randomNumberCharge <= 0.5*(nMultiplicity + nNetCharge)/nMultiplicity) {\r
+      v_charge = 1.0;\r
+      nGeneratedPositive += 1;\r
+    }\r
+    else {\r
+      nGeneratedNegative += 1;\r
+      v_charge = -1.0;\r
     }\r
-    gNumberOfAcceptedParticles += 1;\r
-           \r
-  }//positive particle loop\r
-\r
-  //negative particles\r
-  for(Int_t iNegCount = 0; iNegCount < nGeneratedNegative; iNegCount++) {\r
-    v_charge = -1.0;\r
 \r
-    v_pt = fPtSpectraAllCharges->GetRandom();\r
-    v_phi = fAzimuthalAngleAllCharges->GetRandom();\r
+    if(!fUseAllCharges) {\r
+      //Decide the specie\r
+      Double_t randomNumberSpecies = gRandom->Rndm();\r
+      if((randomNumberSpecies >= 0.0)&&(randomNumberSpecies < fPionPercentage)) {\r
+       nGeneratedPions += 1;\r
+       v_pt = fPtSpectraPions->GetRandom();\r
+       v_phi = fAzimuthalAnglePions->GetRandom();\r
+       fParticleMass = fPionMass;\r
+      }\r
+      else if((randomNumberSpecies >= fPionPercentage)&&(randomNumberSpecies < fPionPercentage + fKaonPercentage)) {\r
+       nGeneratedKaons += 1;\r
+       v_pt = fPtSpectraKaons->GetRandom();\r
+       v_phi = fAzimuthalAngleKaons->GetRandom();\r
+       fParticleMass = fKaonMass;\r
+      }\r
+      else if((randomNumberSpecies >= fPionPercentage + fKaonPercentage)&&(randomNumberSpecies < fPionPercentage + fKaonPercentage + fProtonPercentage)) {\r
+       nGeneratedProtons += 1;\r
+       v_pt = fPtSpectraProtons->GetRandom();\r
+       v_phi = fAzimuthalAngleProtons->GetRandom();\r
+       fParticleMass = fProtonMass;\r
+      }\r
+    }\r
+    else {\r
+      v_pt = fPtSpectraAllCharges->GetRandom();\r
+      v_phi = fAzimuthalAngleAllCharges->GetRandom();\r
+    }\r
     v_eta = gRandom->Gaus(0.0,4.0);\r
 \r
     v_p[0] = v_pt*TMath::Cos(v_phi);\r
     v_p[1] = v_pt*TMath::Sin(v_phi);\r
     v_p[2] = v_pt*TMath::SinH(v_eta);\r
-    v_E = TMath::Sqrt(TMath::Power(0.139,2) +\r
+    v_E = TMath::Sqrt(TMath::Power(fParticleMass,2) +\r
                      TMath::Power(v_p[0],2) +\r
                      TMath::Power(v_p[1],2) +\r
                      TMath::Power(v_p[2],2));\r
-\r
+    \r
     v_y = 0.5*TMath::Log((v_E + v_p[2])/(v_E - v_p[2]));\r
 \r
     //Acceptance\r
@@ -391,8 +381,13 @@ void AliAnalysisTaskToyModel::UserExec(Option_t *) {
     }\r
     gNumberOfAcceptedParticles += 1;\r
            \r
-  }//negative particle loop\r
+  }//generated particle loop\r
+\r
+  Printf("=======================================================");\r
+  Printf("Total: %d - Total positive: %d - Total negative: %d",nMultiplicity,nGeneratedPositive,nGeneratedNegative);\r
+  Printf("Pions: %lf - Kaons: %lf - Protons: %lf",1.*nGeneratedPions/nMultiplicity,1.*nGeneratedKaons/nMultiplicity,1.*nGeneratedProtons/nMultiplicity);\r
 \r
+  //Calculate the balance function\r
   fBalance->CalculateBalance(gNumberOfAcceptedParticles,chargeVector);\r
 \r
   if(fRunShuffling) {\r
index 4b72277..31a2aa4 100755 (executable)
@@ -56,16 +56,22 @@ class AliAnalysisTaskToyModel : public AliAnalysisTaskSE {
 \r
   //All charges\r
   void SetSpectraTemperatureForAllCharges(Double_t temperature) {\r
+    fUseAllCharges = kTRUE;\r
     fTemperatureAllCharges = temperature;}\r
   void SetDirectedFlowForAllCharges(Double_t v1) {\r
+    fUseAllCharges = kTRUE;\r
     fDirectedFlowAllCharges = v1;}\r
   void SetEllipticFlowForAllCharges(Double_t v2) {\r
+    fUseAllCharges = kTRUE;\r
     fEllipticFlowAllCharges = v2;}\r
   void SetTriangularFlowForAllCharges(Double_t v3) {\r
+    fUseAllCharges = kTRUE;\r
     fTriangularFlowAllCharges = v3;}\r
   void SetQuadrangularFlowForAllCharges(Double_t v4) {\r
+    fUseAllCharges = kTRUE;\r
     fQuandrangularFlowAllCharges = v4;}\r
   void SetPentangularFlowForAllCharges(Double_t v5) {\r
+    fUseAllCharges = kTRUE;\r
     fPentangularFlowAllCharges = v5;}\r
 \r
   //Pions\r
@@ -140,6 +146,8 @@ class AliAnalysisTaskToyModel : public AliAnalysisTaskSE {
   Bool_t fUseAcceptanceParameterization; //flag acceptance parameterization\r
   TF1 *fAcceptanceParameterization; //acceptance parameterization\r
 \r
+  Bool_t   fUseAllCharges; //use all charges\r
+  Double_t fParticleMass; //particle mass\r
   TF1     *fPtSpectraAllCharges; //spectra for all charges\r
   Double_t fTemperatureAllCharges; //temperature for pt spectra\r
   Double_t fReactionPlane; //reaction plane angle\r
@@ -151,6 +159,7 @@ class AliAnalysisTaskToyModel : public AliAnalysisTaskSE {
   Double_t fPentangularFlowAllCharges; //pentangular flow value\r
 \r
   Double_t fPionPercentage; //percentage of pions\r
+  Double_t fPionMass; //pion mass\r
   TF1     *fPtSpectraPions; //spectra for pions\r
   Double_t fTemperaturePions; //temperature for pt spectra\r
   TF1     *fAzimuthalAnglePions; //azimuthal angle for pions\r
@@ -161,6 +170,7 @@ class AliAnalysisTaskToyModel : public AliAnalysisTaskSE {
   Double_t fPentangularFlowPions; //pentangular flow value\r
 \r
   Double_t fKaonPercentage; //percentage of kaons\r
+  Double_t fKaonMass; //kaon mass\r
   TF1     *fPtSpectraKaons; //spectra for kaons\r
   Double_t fTemperatureKaons; //temperature for pt spectra\r
   TF1     *fAzimuthalAngleKaons; //azimuthal angle for kaons\r
@@ -171,6 +181,7 @@ class AliAnalysisTaskToyModel : public AliAnalysisTaskSE {
   Double_t fPentangularFlowKaons; //pentangular flow value\r
 \r
   Double_t fProtonPercentage; //percentage of protons\r
+  Double_t fProtonMass; //proton mass\r
   TF1     *fPtSpectraProtons; //spectra for protons\r
   Double_t fTemperatureProtons; //temperature for pt spectra\r
   TF1     *fAzimuthalAngleProtons; //azimuthal angle for protons\r