Adding the first version of the toy model to be used for the balance function analysis
authorpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 25 Dec 2011 16:05:35 +0000 (16:05 +0000)
committerpchrist <pchrist@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 25 Dec 2011 16:05:35 +0000 (16:05 +0000)
PWG2/CMakelibPWG2ebye.pkg
PWG2/EBYE/AliAnalysisTaskBF.cxx
PWG2/EBYE/AliAnalysisTaskToyModel.cxx [new file with mode: 0755]
PWG2/EBYE/AliAnalysisTaskToyModel.h [new file with mode: 0755]
PWG2/PWG2ebyeLinkDef.h

index 20baea4..2411a70 100644 (file)
@@ -27,6 +27,7 @@
 #--------------------------------------------------------------------------------#
 
 set ( SRCS   
+    EBYE/AliAnalysisTaskToyModel.cxx 
     EBYE/AliAnalysisTaskBF.cxx 
     EBYE/AliBalance.cxx 
     EBYE/LRC/AliLRCBase.cxx
index 1491977..a8acb59 100755 (executable)
@@ -711,6 +711,7 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
                    }\r
                    \r
                    delete track_TPC;\r
+                   gNumberOfAcceptedTracks += 1;\r
                    \r
                  } //track loop\r
                }//Vz cut\r
@@ -855,7 +856,8 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
              chargeVectorShuffle[7]->push_back(v_pt);\r
              chargeVectorShuffle[8]->push_back(v_E);\r
            }\r
-           \r
+           gNumberOfAcceptedTracks += 1;\r
+                   \r
          } //track loop\r
        }//Vz cut\r
       }//Vy cut\r
@@ -870,14 +872,18 @@ void AliAnalysisTaskBF::UserExec(Option_t *) {
   fHistNumberOfAcceptedTracks->Fill(gNumberOfAcceptedTracks);\r
   \r
   // calculate balance function\r
-  if(fUseMultiplicity) fBalance->CalculateBalance(gNumberOfAcceptedTracks,chargeVector);\r
-  else                 fBalance->CalculateBalance(fCentrality,chargeVector);\r
+  if(fUseMultiplicity) \r
+    fBalance->CalculateBalance(gNumberOfAcceptedTracks,chargeVector);\r
+  else                 \r
+    fBalance->CalculateBalance(fCentrality,chargeVector);\r
 \r
   if(fRunShuffling) {\r
     // shuffle charges\r
     random_shuffle( chargeVectorShuffle[0]->begin(), chargeVectorShuffle[0]->end() );\r
-    if(fUseMultiplicity) fShuffledBalance->CalculateBalance(gNumberOfAcceptedTracks,chargeVectorShuffle);\r
-    else                 fShuffledBalance->CalculateBalance(fCentrality,chargeVectorShuffle);\r
+    if(fUseMultiplicity) \r
+      fShuffledBalance->CalculateBalance(gNumberOfAcceptedTracks,chargeVectorShuffle);\r
+    else                 \r
+      fShuffledBalance->CalculateBalance(fCentrality,chargeVectorShuffle);\r
   }\r
 }      \r
 \r
diff --git a/PWG2/EBYE/AliAnalysisTaskToyModel.cxx b/PWG2/EBYE/AliAnalysisTaskToyModel.cxx
new file mode 100755 (executable)
index 0000000..ad3594e
--- /dev/null
@@ -0,0 +1,428 @@
+#include "TChain.h"\r
+#include "TList.h"\r
+#include "TCanvas.h"\r
+#include "TParticle.h"\r
+#include "TLorentzVector.h"\r
+#include "TGraphErrors.h"\r
+#include "TH1F.h"\r
+#include "TH2F.h"\r
+#include "TArrayF.h"\r
+#include "TF1.h"\r
+#include "TRandom.h"\r
+\r
+#include "AliAnalysisTaskSE.h"\r
+#include "AliAnalysisManager.h"\r
+#include "AliLog.h"\r
+\r
+#include "AliAnalysisTaskToyModel.h"\r
+#include "AliBalance.h"\r
+\r
+\r
+// Analysis task for the toy model analysis\r
+// Authors: Panos.Christakoglou@nikhef.nl\r
+\r
+ClassImp(AliAnalysisTaskToyModel)\r
+\r
+//________________________________________________________________________\r
+AliAnalysisTaskToyModel::AliAnalysisTaskToyModel(const char *name) \r
+: AliAnalysisTaskSE(name), \r
+  fBalance(0),\r
+  fRunShuffling(kFALSE), fShuffledBalance(0),\r
+  fList(0), fListBF(0), fListBFS(0),\r
+  fHistEventStats(0),\r
+  fTotalMultiplicityMean(100.), fTotalMultiplicitySigma(0.0),\r
+  fNetChargeMean(0.0), fNetChargeSigma(0.0),\r
+  fPtMin(0.0), fPtMax(100.0),\r
+  fEtaMin(-1.0), fEtaMax(1.0),\r
+  fUseAcceptanceParameterization(kFALSE), fAcceptanceParameterization(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
+  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
+  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
+  fPtSpectraProtons(0), fTemperatureProtons(100.),\r
+  fAzimuthalAngleProtons(0), fDirectedFlowProtons(0.0), \r
+  fEllipticFlowProtons(0.0), fTriangularFlowProtons(0.0),\r
+  fQuandrangularFlowProtons(0.0), fPentangularFlowProtons(0.0) {\r
+  // Constructor\r
+\r
+  // Define input and output slots here\r
+  // Input slot #0 works with a TChain\r
+  DefineInput(0, TChain::Class());\r
+  // Output slot #0 writes into a TH1 container\r
+  DefineOutput(1, TList::Class());\r
+  DefineOutput(2, TList::Class());\r
+  DefineOutput(3, TList::Class());\r
+}\r
+\r
+//________________________________________________________________________\r
+AliAnalysisTaskToyModel::~AliAnalysisTaskToyModel() {\r
+  //Destructor\r
+  delete fPtSpectraAllCharges;\r
+  delete fAzimuthalAngleAllCharges;\r
+  delete fPtSpectraPions;\r
+  delete fAzimuthalAnglePions;\r
+  delete fPtSpectraKaons;\r
+  delete fAzimuthalAngleKaons;\r
+  delete fPtSpectraProtons;\r
+  delete fAzimuthalAngleProtons;\r
+}\r
+\r
+//________________________________________________________________________\r
+void AliAnalysisTaskToyModel::Init() {\r
+  //Initialize objects\r
+  //==============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
+\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
+  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
+  //==============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
+  //==============Flow values==============//\r
+}\r
+\r
+//________________________________________________________________________\r
+void AliAnalysisTaskToyModel::UserCreateOutputObjects() {\r
+  // Create histograms\r
+  // Called once\r
+  if(!fBalance) {\r
+    fBalance = new AliBalance();\r
+    fBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6);\r
+  }\r
+  if(fRunShuffling) {\r
+    if(!fShuffledBalance) {\r
+      fShuffledBalance = new AliBalance();\r
+      fShuffledBalance->SetInterval(-1,-0.8,0.8,16,0.,1.6);\r
+    }\r
+  }\r
+\r
+  //QA list\r
+  fList = new TList();\r
+  fList->SetName("listQA");\r
+  fList->SetOwner();\r
+\r
+  //Balance Function list\r
+  fListBF = new TList();\r
+  fListBF->SetName("listBF");\r
+  fListBF->SetOwner();\r
+\r
+  if(fRunShuffling) {\r
+    fListBFS = new TList();\r
+    fListBFS->SetName("listBFShuffled");\r
+    fListBFS->SetOwner();\r
+  }\r
+\r
+  //Event stats.\r
+  TString gCutName[4] = {"Total","Offline trigger",\r
+                         "Vertex","Analyzed"};\r
+  fHistEventStats = new TH1F("fHistEventStats",\r
+                             "Event statistics;;N_{events}",\r
+                             4,0.5,4.5);\r
+  for(Int_t i = 1; i <= 4; i++)\r
+    fHistEventStats->GetXaxis()->SetBinLabel(i,gCutName[i-1].Data());\r
+  fList->Add(fHistEventStats);\r
+\r
+  // Balance function histograms\r
+  // Initialize histograms if not done yet\r
+  if(!fBalance->GetHistNp(0)){\r
+    AliWarning("Histograms not yet initialized! --> Will be done now");\r
+    AliWarning("--> Add 'gBalance->InitHistograms()' in your configBalanceFunction");\r
+    fBalance->InitHistograms();\r
+  }\r
+\r
+  if(fRunShuffling) {\r
+    if(!fShuffledBalance->GetHistNp(0)) {\r
+      AliWarning("Histograms (shuffling) not yet initialized! --> Will be done now");\r
+      AliWarning("--> Add 'gBalance->InitHistograms()' in your configBalanceFunction");\r
+      fShuffledBalance->InitHistograms();\r
+    }\r
+  }\r
+\r
+  for(Int_t a = 0; a < ANALYSIS_TYPES; a++){\r
+    fListBF->Add(fBalance->GetHistNp(a));\r
+    fListBF->Add(fBalance->GetHistNn(a));\r
+    fListBF->Add(fBalance->GetHistNpn(a));\r
+    fListBF->Add(fBalance->GetHistNnn(a));\r
+    fListBF->Add(fBalance->GetHistNpp(a));\r
+    fListBF->Add(fBalance->GetHistNnp(a));\r
+\r
+    if(fRunShuffling) {\r
+      fListBFS->Add(fShuffledBalance->GetHistNp(a));\r
+      fListBFS->Add(fShuffledBalance->GetHistNn(a));\r
+      fListBFS->Add(fShuffledBalance->GetHistNpn(a));\r
+      fListBFS->Add(fShuffledBalance->GetHistNnn(a));\r
+      fListBFS->Add(fShuffledBalance->GetHistNpp(a));\r
+      fListBFS->Add(fShuffledBalance->GetHistNnp(a));\r
+    }  \r
+  }\r
+\r
+  // Post output data.\r
+  PostData(1, fList);\r
+  PostData(2, fListBF);\r
+  if(fRunShuffling) PostData(3, fListBFS);\r
+}\r
+\r
+//________________________________________________________________________\r
+void AliAnalysisTaskToyModel::UserExec(Option_t *) {\r
+  // Main loop\r
+  // Called for each event\r
+\r
+  // vector holding the charges/kinematics of all tracks (charge,y,eta,phi,p0,p1,p2,pt,E)\r
+  vector<Double_t> *chargeVectorShuffle[9];   // this will be shuffled\r
+  vector<Double_t> *chargeVector[9];          // original charge\r
+  for(Int_t i = 0; i < 9; i++){\r
+    chargeVectorShuffle[i] = new vector<Double_t>;\r
+    chargeVector[i]        = new vector<Double_t>;\r
+  }\r
+\r
+  Double_t v_charge;\r
+  Double_t v_y;\r
+  Double_t v_eta;\r
+  Double_t v_phi;\r
+  Double_t v_p[3];\r
+  Double_t v_pt;\r
+  Double_t v_E;\r
+\r
+  //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
+\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
+    }\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
+    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
+    }\r
+    gNumberOfAcceptedParticles += 1;\r
+           \r
+  }//negative particle loop\r
+\r
+  fBalance->CalculateBalance(gNumberOfAcceptedParticles,chargeVector);\r
+\r
+  if(fRunShuffling) {\r
+    // shuffle charges\r
+    random_shuffle( chargeVectorShuffle[0]->begin(), chargeVectorShuffle[0]->end() );\r
+    fShuffledBalance->CalculateBalance(gNumberOfAcceptedParticles,chargeVectorShuffle);\r
+  }\r
+}      \r
+\r
+//________________________________________________________________________\r
+void  AliAnalysisTaskToyModel::FinishTaskOutput() {\r
+  //Printf("END BF");\r
+\r
+  if (!fBalance) {\r
+    Printf("ERROR: fBalance not available");\r
+    return;\r
+  }  \r
+  if(fRunShuffling) {\r
+    if (!fShuffledBalance) {\r
+      Printf("ERROR: fShuffledBalance not available");\r
+      return;\r
+    }\r
+  }\r
+}\r
+\r
+//________________________________________________________________________\r
+void AliAnalysisTaskToyModel::Terminate(Option_t *) {\r
+  // Draw result to the screen\r
+  // Called once at the end of the query\r
+\r
+  // not implemented ...\r
+\r
+}\r
diff --git a/PWG2/EBYE/AliAnalysisTaskToyModel.h b/PWG2/EBYE/AliAnalysisTaskToyModel.h
new file mode 100755 (executable)
index 0000000..4b72277
--- /dev/null
@@ -0,0 +1,189 @@
+#ifndef ALIANALYSISTASKTOYMODEL_CXX\r
+#define ALIANALYSISTASKTOYMODEL_CXX\r
+\r
+// Analysis task for a simple toy model, currently used for the \r
+// balance function\r
+// Authors: Panos Christakoglou@nikhef.nl\r
+\r
+class TList;\r
+class TH1F;\r
+class TH2F;\r
+class TF1;\r
+\r
+class AliBalance;\r
+\r
+#include "AliAnalysisTaskSE.h"\r
+#include "AliBalance.h"\r
+\r
+\r
+class AliAnalysisTaskToyModel : public AliAnalysisTaskSE {\r
+ public:\r
+  AliAnalysisTaskToyModel(const char *name = "AliAnalysisTaskToyModel");\r
+  virtual ~AliAnalysisTaskToyModel(); \r
+  \r
+  virtual void   Init();\r
+  virtual void   UserCreateOutputObjects();\r
+  virtual void   UserExec(Option_t *option);\r
+  virtual void   FinishTaskOutput();\r
+  virtual void   Terminate(Option_t *);\r
+  \r
+  void SetAnalysisObject(AliBalance *const analysis) {\r
+    fBalance         = analysis;\r
+  }\r
+  void SetShufflingObject(AliBalance *const analysisShuffled) {\r
+    fRunShuffling = kTRUE;\r
+    fShuffledBalance = analysisShuffled;\r
+  }\r
+\r
+  //============Toy model: List of setters============//\r
+  void SetTotalMultiplicity(Double_t mean, Double_t sigma) {\r
+    fTotalMultiplicityMean = mean;\r
+    fTotalMultiplicitySigma = sigma;}\r
+  void SetNetCharge(Double_t mean, Double_t sigma) {\r
+    fNetChargeMean = mean;\r
+    fNetChargeSigma = sigma;}\r
+\r
+  //Acceptance\r
+  void SetKinematicsCutsMC(Double_t ptmin, Double_t ptmax,\r
+                           Double_t etamin, Double_t etamax){\r
+    fPtMin  = ptmin; fPtMax  = ptmax;\r
+    fEtaMin = etamin; fEtaMax = etamax;\r
+  }\r
+\r
+  //Acceptance filter\r
+  void SetAcceptanceParameterization(TF1 *parameterization) {\r
+    fAcceptanceParameterization = parameterization;}\r
+\r
+  //All charges\r
+  void SetSpectraTemperatureForAllCharges(Double_t temperature) {\r
+    fTemperatureAllCharges = temperature;}\r
+  void SetDirectedFlowForAllCharges(Double_t v1) {\r
+    fDirectedFlowAllCharges = v1;}\r
+  void SetEllipticFlowForAllCharges(Double_t v2) {\r
+    fEllipticFlowAllCharges = v2;}\r
+  void SetTriangularFlowForAllCharges(Double_t v3) {\r
+    fTriangularFlowAllCharges = v3;}\r
+  void SetQuadrangularFlowForAllCharges(Double_t v4) {\r
+    fQuandrangularFlowAllCharges = v4;}\r
+  void SetPentangularFlowForAllCharges(Double_t v5) {\r
+    fPentangularFlowAllCharges = v5;}\r
+\r
+  //Pions\r
+  void SetPionPercentage(Double_t percentage) {\r
+    fPionPercentage = percentage;}\r
+  void SetSpectraTemperatureForPions(Double_t temperature) {\r
+    fTemperaturePions = temperature;}\r
+  void SetDirectedFlowForPions(Double_t v1) {\r
+    fDirectedFlowPions = v1;}\r
+  void SetEllipticFlowForPions(Double_t v2) {\r
+    fEllipticFlowPions = v2;}\r
+  void SetTriangularFlowForPions(Double_t v3) {\r
+    fTriangularFlowPions = v3;}\r
+  void SetQuadrangularFlowForPions(Double_t v4) {\r
+    fQuandrangularFlowPions = v4;}\r
+  void SetPentangularFlowForPions(Double_t v5) {\r
+    fPentangularFlowPions = v5;}\r
+  \r
+  //Kaons\r
+  void SetKaonPercentage(Double_t percentage) {\r
+    fKaonPercentage = percentage;}\r
+  void SetSpectraTemperatureForKaons(Double_t temperature) {\r
+    fTemperatureKaons = temperature;}\r
+  void SetDirectedFlowForKaons(Double_t v1) {\r
+    fDirectedFlowKaons = v1;}\r
+  void SetEllipticFlowForKaons(Double_t v2) {\r
+    fEllipticFlowKaons = v2;}\r
+  void SetTriangularFlowForKaons(Double_t v3) {\r
+    fTriangularFlowKaons = v3;}\r
+  void SetQuadrangularFlowForKaons(Double_t v4) {\r
+    fQuandrangularFlowKaons = v4;}\r
+  void SetPentangularFlowForKaons(Double_t v5) {\r
+    fPentangularFlowKaons = v5;}\r
+\r
+  //Protons\r
+  void SetProtonPercentage(Double_t percentage) {\r
+    fProtonPercentage = percentage;}\r
+  void SetSpectraTemperatureForProtons(Double_t temperature) {\r
+    fTemperatureProtons = temperature;}\r
+  void SetDirectedFlowForProtons(Double_t v1) {\r
+    fDirectedFlowProtons = v1;}\r
+  void SetEllipticFlowForProtons(Double_t v2) {\r
+    fEllipticFlowProtons = v2;}\r
+  void SetTriangularFlowForProtons(Double_t v3) {\r
+    fTriangularFlowProtons = v3;}\r
+  void SetQuadrangularFlowForProtons(Double_t v4) {\r
+    fQuandrangularFlowProtons = v4;}\r
+  void SetPentangularFlowForProtons(Double_t v5) {\r
+    fPentangularFlowProtons = v5;}\r
+  //============Toy model: List of setters============//\r
+\r
+ private:\r
+  AliBalance *fBalance; //BF object\r
+  Bool_t fRunShuffling;//run shuffling or not\r
+  AliBalance *fShuffledBalance; //BF object (shuffled)\r
+  TList *fList; //fList object\r
+  TList *fListBF; //fList object\r
+  TList *fListBFS; //fList object\r
+\r
+  TH1F *fHistEventStats; //event stats\r
+\r
+  //Toy model input\r
+  Double_t fTotalMultiplicityMean; //mean for the total multiplicity\r
+  Double_t fTotalMultiplicitySigma; //sigma for the total multiplicity\r
+  Double_t fNetChargeMean; //mean for the net charge\r
+  Double_t fNetChargeSigma; //sigma for the net charge\r
+  Double_t fPtMin; //pt min for acceptance\r
+  Double_t fPtMax; //pt max for acceptance\r
+  Double_t fEtaMin; //eta min for acceptance\r
+  Double_t fEtaMax; //eta max for acceptance\r
+\r
+  Bool_t fUseAcceptanceParameterization; //flag acceptance parameterization\r
+  TF1 *fAcceptanceParameterization; //acceptance parameterization\r
+\r
+  TF1     *fPtSpectraAllCharges; //spectra for all charges\r
+  Double_t fTemperatureAllCharges; //temperature for pt spectra\r
+  Double_t fReactionPlane; //reaction plane angle\r
+  TF1     *fAzimuthalAngleAllCharges; //azimuthal angle\r
+  Double_t fDirectedFlowAllCharges; //directed flow value\r
+  Double_t fEllipticFlowAllCharges; //elliptic flow value\r
+  Double_t fTriangularFlowAllCharges; //triangular flow value\r
+  Double_t fQuandrangularFlowAllCharges; //quadrangular flow value\r
+  Double_t fPentangularFlowAllCharges; //pentangular flow value\r
+\r
+  Double_t fPionPercentage; //percentage of pions\r
+  TF1     *fPtSpectraPions; //spectra for pions\r
+  Double_t fTemperaturePions; //temperature for pt spectra\r
+  TF1     *fAzimuthalAnglePions; //azimuthal angle for pions\r
+  Double_t fDirectedFlowPions; //directed flow value\r
+  Double_t fEllipticFlowPions; //elliptic flow value\r
+  Double_t fTriangularFlowPions; //triangular flow value\r
+  Double_t fQuandrangularFlowPions; //quadrangular flow value\r
+  Double_t fPentangularFlowPions; //pentangular flow value\r
+\r
+  Double_t fKaonPercentage; //percentage of kaons\r
+  TF1     *fPtSpectraKaons; //spectra for kaons\r
+  Double_t fTemperatureKaons; //temperature for pt spectra\r
+  TF1     *fAzimuthalAngleKaons; //azimuthal angle for kaons\r
+  Double_t fDirectedFlowKaons; //directed flow value\r
+  Double_t fEllipticFlowKaons; //elliptic flow value\r
+  Double_t fTriangularFlowKaons; //triangular flow value\r
+  Double_t fQuandrangularFlowKaons; //quadrangular flow value\r
+  Double_t fPentangularFlowKaons; //pentangular flow value\r
+\r
+  Double_t fProtonPercentage; //percentage of protons\r
+  TF1     *fPtSpectraProtons; //spectra for protons\r
+  Double_t fTemperatureProtons; //temperature for pt spectra\r
+  TF1     *fAzimuthalAngleProtons; //azimuthal angle for protons\r
+  Double_t fDirectedFlowProtons; //directed flow value\r
+  Double_t fEllipticFlowProtons; //elliptic flow value\r
+  Double_t fTriangularFlowProtons; //triangular flow value\r
+  Double_t fQuandrangularFlowProtons; //quadrangular flow value\r
+  Double_t fPentangularFlowProtons; //pentangular flow value\r
+\r
+  AliAnalysisTaskToyModel(const AliAnalysisTaskToyModel&); // not implemented\r
+  AliAnalysisTaskToyModel& operator=(const AliAnalysisTaskToyModel&); // not implemented\r
+  \r
+  ClassDef(AliAnalysisTaskToyModel, 1); // example of analysis\r
+};\r
+\r
+#endif\r
index 0e2ba75..472ee40 100644 (file)
@@ -7,6 +7,8 @@
 #pragma link C++ class AliBalance+;
 #pragma link C++ class AliAnalysisTaskBF+;
 
+#pragma link C++ class AliAnalysisTaskToyModel+;
+
 #pragma link C++ class AliAnalysisTaskLRC+;
 #pragma link C++ class AliLRCAnalysis+;
 #pragma link C++ class AliLRCFit+;