--- /dev/null
+//
+// This macro is a part of "Alice PPR fast flow analysis package"
+//
+// The macro creates new pico DST structure in the file
+// "flowPiocEvent.root" and create structure "flowData" inside
+//
+// Once Ntuple is created it can be filled with data using
+// macro AliFlowReconstruction.C
+//
+// Sylwester Radomski, GSI
+// email: S.Radomski@gsi.de
+// 22. Oct. 2002
+//
+
+AliFlowCreatePico() {
+
+ const char* fileName = "flowPicoEvent.root";
+ const char* structure = "runNumber:evNumber:Mult:truePsi:trueV2:Psi:PsiA:PsiB:V2";
+
+ TFile *file = new TFile(fileName, "recreate");
+ TNtuple *data = new TNtuple("flowData","Flow Data", structure);
+
+ data->Print();
+
+ data->Write();
+ file->Close();
+
+ gSystem->Exit(0);
+}
--- /dev/null
+//
+// This macro is a part of "Alice PPR fast flow analysis package"
+//
+// The macro draw event plane resolution for a given
+// multiplicity and V2. As source data it is using
+// "flowData" NTuple in "flowPicoEvent.root" file.
+// Data source structure have to be created
+// by AliFlowCreate.C and filed by AliFlowReconstruction.C
+//
+// INPUT PARAMETERS:
+// type: type of plot:
+// 0 - Event Plane Resolution
+// 1 - Sub-Events Correlation
+// 2 - V2 distribution
+//
+// info: if !0 display histogram info
+//
+// if (plotName != 0) two files are created in "plots" directory
+// plotName.eps and plotMame.gif
+//
+// Sylwester Radomski, GSI
+// mail: S.Radomski@gsi
+// 23. Oct. 2002
+//
+
+
+AliFlowDist(int multiplicity, float trueV2, int type = 0, int info = 0,
+ const char *plotName = 0) {
+
+ gROOT->SetStyle("Plain");
+ gStyle->SetOptTitle(0);
+
+ if (info) gStyle->SetOptStat(1110);
+ else gStyle->SetOptStat(0);
+
+
+ if (type > 2 || type < 0) {
+ ::Error("AliFlowDrawSummary","Wrong Type [0-1] : %d", type);
+ return;
+ }
+
+ const char *what[3] = {"Psi - truePsi>> htemp(40,-40,40)",
+ "PsiA - PsiB >> htemp(40,-40,40)",
+ "V2 >> htemp(40,0.0, 0.14)" };
+
+ const char *xTitle[3] = {"Event Plane Resolution [deg]",
+ "Sub-Events Correlation [deg]",
+ "V_{2}"};
+
+ const char *where = "Mult == %d && (trueV2 > %f) && (trueV2 < %f)";
+
+ TFile *inFile = new TFile("flowPicoEvent.root");
+ TNtuple *data = (TNtuple*) inFile->Get("flowData");
+
+ char buff[80];
+ sprintf(buff, where, multiplicity, trueV2-0.001, trueV2+0.001);
+
+ data->Draw(what[type], buff, "");
+
+ TH1 *h = (TH1*)gPad->FindObject("htemp");
+ h->GetXaxis()->SetTitle(xTitle[type]);
+
+ gPad->SetTicks(1,1);
+ //gPad->Update();
+
+ if (plotName) {
+
+ char buffer[60];
+
+ sprintf(buffer, "plots/%s.eps", plotName);
+ gPad->Print(buffer, "eps");
+
+ sprintf(buffer, "plots/%s.gif", plotName);
+ gPad->Print(buffer, "gif");
+ }
+}
--- /dev/null
+//
+// This macro is a part of "Alice PPR fast flow analysis package"
+//
+// The macro draws event plane resolution and V2 resolution in function
+// of V2 and multiplicity
+//
+// IMPUT PARAMETERS
+// type:
+// 0 - event plane resolution
+// 1 - V2 resolution
+//
+// desc 0/1 - draw Graph descriptions
+//
+// Sylwester Radomski, GSI
+// mail: S.Radomski@gsi.de
+// Oct 31, 2002
+//
+
+AliFlowDrawSummary(int type = 0, int desc = 0, const char* fileName = 0) {
+
+ gROOT->SetStyle("Plain");
+
+ if (type > 1) {
+ ::Error("AliFlowDrawSummary","Wrong Type [0-1] : %d", type);
+ return;
+ }
+
+ const Int_t startMarker = 21;
+ const char *dataName = "flowPicoEvent.root";
+ TFile *dataFile = new TFile(dataName,"UPDATE");
+ TNtuple *data = (TNtuple *) dataFile->Get("flowData");
+
+ TGraphErrors *g;
+ TH1D *h;
+
+ const char* patt = "Mult == %d && trueV2 > %f && trueV2 < %f";
+
+ const char* varName[2] = {"Psi - truePsi >> htemp(90, -90, 90) ",
+ "100 * (trueV2-V2)/trueV2 >> htemp(100,-200,200)"};
+
+ const char* yTitle[2] = {"Event Plane Resolution [deg]",
+ "V_{2} Resolution [%]"};
+
+ char buff[100];
+
+ Double_t v2 = 0.02;
+
+ const Int_t nMultPoint = 11;
+ const Int_t nV2Point = 4;
+
+ const Int_t multPoints[nMultPoint] = {200, 400, 600, 800, 1000, 1500, 2000, 2500, 3000,
+ 4000, 5000};// 6000, 8000, 10000};
+
+ const Double_t v2Points[nV2Point] = {0.04, 0.06, 0.08, 0.1};
+ //const Double_t v2Points[nV2Point] = {0.06};
+
+ TCanvas *c = new TCanvas();
+ c->SetFillColor(10);
+ c->SetTicks(1,1);
+
+ TCanvas *d = new TCanvas();
+
+ for (Int_t j=0; j<nV2Point; j++) {
+
+ g = new TGraphErrors();
+ g->SetMarkerStyle(18+j);
+
+ for(Int_t i=0; i<nMultPoint; i++) {
+
+ Int_t totalMult = multPoints[i];
+ Double_t totalV2 = v2Points[j];
+
+ sprintf(buff, patt, totalMult, totalV2-0.001, totalV2+0.001);
+ data->Draw(varName[type], buff);
+ h = (TH1D*)gPad->GetPrimitive("htemp");
+
+ ::Info("AliFlowDrawSummary", buff);
+
+ g->SetPoint(i, multPoints[i], h->GetRMS());
+ g->SetPointError(i, 0, h->GetRMS() / TMath::Sqrt(h->GetEntries()));
+ }
+
+ g->SetMinimum(0);
+ g->SetMarkerSize(1);
+ g->SetMarkerStyle(startMarker+j);
+
+ c->cd();
+ if (j==0) {
+ g->Draw("APL");
+ g->GetHistogram()->SetXTitle("Number of Good Tracks");
+ g->GetHistogram()->SetYTitle(yTitle[type]);
+ }
+ else g->Draw("PL");
+ d->cd();
+ }
+
+ if (desc) {
+
+ TText *text;
+ TMarker *marker;
+ c->cd();
+
+ const char* info = "v2 = %.2f";
+
+ for (Int_t j=0; j<nV2Point; j++) {
+
+ Double_t y;
+ if (type == 0) y = 30 - 3*y;
+ else y = 70 - 5*j;
+
+ marker = new TMarker(3000, y+1, startMarker+j);
+ marker->Draw("a");
+ marker->ls();
+
+ sprintf(buff, info, v2Points[j]);
+ text = new TText(3100, y, buff);
+ //text->SetTextColor(j-1);
+ text->Draw();
+ }
+ }
+
+ if (fileName) {
+
+ char buffer[60];
+ sprintf(buffer, "plots/%s.eps", fileName);
+ c->Print(buffer, "eps");
+
+ sprintf(buffer, "plots/%s.gif", fileName);
+ c->Print(buffer, "gif");
+ }
+}
--- /dev/null
+//
+// This macro is a part of "Alice PPR fast flow analysis package"
+//
+// The macro Draw event plane resolution and V2 resolution
+// for a given multiplicity in function of V2
+//
+// INPUT PARAMETERS
+// type:
+// 0 - event plane resolution
+// 1 - V2 reslution
+//
+// Sylwester Radomski, GSI
+// mail: S.Radomski@gsi.de
+// 31 Oct 2002
+//
+
+AliFlowDrawV2(int type, const char *fileName = 0) {
+
+ gROOT->SetStyle("Plain");
+
+ if (type > 2) {
+ ::Error("AliFLowDrawV2", "Wrong Type [0-1]: %d ", type);
+ return;
+ }
+
+ const char *dataName = "flowPicoEvent.root";
+ TFile *dataFile = new TFile(dataName,"UPDATE");
+ TNtuple *data = (TNtuple *) dataFile->Get("flowData");
+
+ TGraphErrors *g = new TGraphErrors();
+ TH1D *h;
+
+ const char* patt = "Mult == %d && trueV2 > %f && trueV2 < %f";
+ const char* varName[2] = {"Psi - truePsi >> htemp(90, -90, 90)",
+ "100 * (trueV2-V2)/trueV2 >> htemp(100,-200,200)"};
+
+ const char* xTitle = "V_{2}";
+ const char* yTitle[2] = {"Event Plane Resolution [deg]",
+ "V_{2} Resolution [%]"};
+
+ char buff[100];
+
+ Int_t mult = 1000;
+ const Int_t nV2Point = 5;
+ const Double_t v2Points[nV2Point] = {0.02, 0.04, 0.06, 0.08, 0.1};
+
+ TCanvas *c = new TCanvas();
+ c->SetFillColor(10);
+ c->SetTicks(1,1);
+
+ TCanvas *d = new TCanvas();
+
+ for(Int_t i=0; i<nV2Point; i++) {
+
+ Double_t totalV2 = v2Points[i];
+
+ sprintf(buff, patt, mult, totalV2-0.001, totalV2+0.001);
+ data->Draw(varName[type], buff);
+ h = (TH1D*)gPad->GetPrimitive("htemp");
+
+ ::Info("AliFlowDrawV2",buff);
+
+ g->SetPoint(i, v2Points[i], h->GetRMS());
+ g->SetPointError(i, 0, h->GetRMS()/20. );
+ }
+
+ g->SetMinimum(0);
+ g->SetMarkerSize(1);
+ g->SetMarkerStyle(21);
+
+ c->cd();
+ g->Draw("APL");
+ g->GetHistogram()->SetXTitle(xTitle);
+ g->GetHistogram()->SetYTitle(yTitle[type]);
+
+ c->Modified();
+ c->Update();
+
+ if (fileName) {
+
+ char buffer[60];
+ sprintf(buffer, "plots/%s.eps", fileName);
+ c->Print(buffer, "eps");
+
+ sprintf(buffer, "plots/%s.gif", fileName);
+ c->Print(buffer, "gif");
+ }
+}
--- /dev/null
+//
+// This macro is a part of "Alice PPR fast flow analysis package"
+//
+// The macro does:
+// 1) open existing database with Flow Pico DST ("flowPicoEvent.root")
+// 2) open source data - galice.root type file with events
+// 3) reconstruct psi, psiA, psiB (sub-events in eta space) and v2.
+// 4) fill Flow Pico DST with reconstructed data
+//
+// INPUT PARAMETERS:
+// inputName: file with events
+// if (inputName == 0) macro tries to fetch system variable FILE_NAME
+// and use its value as the name of the file. (useful for bath processing)
+//
+// maxN: maximum number of events to be processed, if 0 process all events
+//
+// NOTE:
+// file "flowPicoEvent.root" with "flowData" NTuple have to exist
+// it can be created by "AliFlowCreate.C"
+//
+// Sylwester Radomski, GSI
+// mail: S.Radomski@gsi
+// 23. Oct. 2002
+//
+////////////////////////////////////////////////////////////////////////////////
+
+//#include "TTree.h"
+//#include "TNtuple.h"
+//#include "TFile.h"
+//#include "AliRun.h"
+
+void AliFlowReconstruction(const char* inputName = 0, Int_t maxN = 0) {
+
+ const char *dataName = "flowPicoEvent.root";
+
+ TTree *kine;
+ TNtuple *data;
+
+ Double_t trueV2, truePsi;
+ Double_t v2, psi, psiA, psiB;
+ Int_t N;
+ Int_t mult;
+
+ if (gAlice) delete gAlice;
+ gAlice = 0;
+
+ TFile *dataFile = new TFile(dataName,"UPDATE");
+ data = (TNtuple *) dataFile->Get("flowData");
+
+ TFile *inputFile;
+
+ if (!inputName) {
+ TFile *inputFile = new TFile(gSystem->Getenv("FILE_NAME"), "READ");
+ ::Info("AliFlowReconstruction", "Using: %s",gSystem->Getenv("FILE_NAME"));
+ } else {
+ TFile *inputFile = new TFile(inputName, "READ");
+ }
+
+ gAlice = (AliRun*) inputFile->Get("gAlice");
+
+ N = gAlice->GetEventsPerRun();
+ if (maxN != 0 && maxN < N) N = maxN;
+
+ ::Info("AliFlowReconstruction", "Number of events to be processed = %d", N);
+
+ for (Int_t i=0; i<N; i++) {
+
+ ::Info("Processing event i = %d", i);
+
+ gAlice->GetEvent(i);
+
+ AliHeader *header = gAlice->GetHeader();
+ AliGenGeVSimEventHeader *egHeader = (AliGenGeVSimEventHeader*)header->GenEventHeader();
+
+ truePsi = egHeader->GetEventPlane() * 180 / TMath::Pi();
+ while(truePsi > 90) truePsi -= 180;
+
+ trueV2 = egHeader->GetEllipticFlow(211);
+
+ mult = gAlice->GetNtrack();
+ kine = gAlice->TreeK();
+
+ psi = FlowPsi(kine, 0);
+ psiA = FlowPsi(kine, 1);
+ psiB = FlowPsi(kine, -1);
+
+ v2 = FlowV2(kine, psi);
+ data->Fill(1, i, mult, truePsi, trueV2, psi, psiA, psiB, v2);
+ }
+
+ dataFile->cd();
+ data->Write();
+
+ delete data;
+
+ delete gAlice;
+ gAlice = 0;
+
+ dataFile->Close();
+ inputFile->Close();
+
+ delete dataFile;
+ delete inputFile;
+
+ gSystem->Exit(0);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+Double_t FlowPsi(TTree *kine, Int_t etaPart) {
+ //
+ // this function calculates psi from list of particles
+ // etaPart - division to sub-events in eta
+ // 0 all particles,
+ // -1 negative eta
+ // 1 positive eta
+ //
+
+ Int_t mult = kine->GetEntries();
+ Double_t *phi, *eta;
+ Double_t psi;
+
+ Double_t Ssin = 0, Scos = 0;
+
+ kine->Draw("Particles->Phi():Particles->Eta()", "", "goff");
+ phi = kine->GetV1();
+ eta = kine->GetV2();
+
+ for (Int_t i=0; i<mult; i++) {
+
+ if ( (etaPart * eta[i]) < 0 ) continue;
+
+ Ssin += sin( 2 * phi[i] );
+ Scos += cos( 2 * phi[i] );
+ }
+
+ //psi = atan( Ssin / Scos ) / 2;
+ psi = atan2 (Ssin, Scos) / 2;
+ psi = psi * 180. / TMath::Pi();
+
+ return psi;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+Double_t FlowV2(TTree *kine, Double_t psi) {
+
+ Int_t mult = kine->GetEntries();
+ Double_t *phi;
+ Double_t V2;
+
+ Double_t Ssin = 0, Scos = 0;
+
+ kine->Draw("Particles->Phi()", "", "goff");
+ phi = kine->GetV1();
+
+ for (Int_t i=0; i<mult; i++) {
+
+ Ssin += sin( 2 * (phi[i] - psi) );
+ Scos += cos( 2 * (phi[i] - psi) );
+ }
+
+ V2 = sqrt(Ssin*Ssin + Scos*Scos) / mult;
+
+ return V2;
+}
+
+////////////////////////////////////////////////////////////////////////////////
--- /dev/null
+
+Flow ReadMe
+
+The Flow package in AliRoot consistes of two parts.
+
+1) Macros for fast flow analysis used for PPR studies
+2) Interface to STAR flow analysis package
+
+
+>> Alice PPR fast flow analysis package
+
+This package is composed out of macros:
+
+AliFlowPicoCreate.C - create pico event structures in "flowPicoEvent.root"
+AliFlowReconstruction.C - fill pico event structure from Kinematics
+
+All analysis macros are using "flowPicoEvent.root" file with data
+
+AliFlowDist.C - draw different distributions
+ for a given multiplicity and V2
+
+AliFlowDrawV2.C - Draw event plane resolution and V2 resolution
+ for a given multiplicity in function of V2
+
+AliFlowDrawSummary.C - Draw resolution in function of multiplicity
+ and V2.
+
+>> Alice Interface to STAR Flow analysis package
+
+