From 0321b05eb0549d4ace252cf6dee86134edca4d51 Mon Sep 17 00:00:00 2001 From: hristov Date: Wed, 6 Nov 2002 08:39:54 +0000 Subject: [PATCH] New macros for Flow physics (S.Radomski) --- FLOW/AliFlowCreatePico.C | 29 ++++++ FLOW/AliFlowDist.C | 76 ++++++++++++++++ FLOW/AliFlowDrawSummary.C | 131 +++++++++++++++++++++++++++ FLOW/AliFlowDrawV2.C | 88 ++++++++++++++++++ FLOW/AliFlowReconstruction.C | 168 +++++++++++++++++++++++++++++++++++ FLOW/README.txt | 30 +++++++ 6 files changed, 522 insertions(+) create mode 100644 FLOW/AliFlowCreatePico.C create mode 100644 FLOW/AliFlowDist.C create mode 100644 FLOW/AliFlowDrawSummary.C create mode 100644 FLOW/AliFlowDrawV2.C create mode 100644 FLOW/AliFlowReconstruction.C create mode 100644 FLOW/README.txt diff --git a/FLOW/AliFlowCreatePico.C b/FLOW/AliFlowCreatePico.C new file mode 100644 index 00000000000..2936fa76def --- /dev/null +++ b/FLOW/AliFlowCreatePico.C @@ -0,0 +1,29 @@ +// +// 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); +} diff --git a/FLOW/AliFlowDist.C b/FLOW/AliFlowDist.C new file mode 100644 index 00000000000..35181a55477 --- /dev/null +++ b/FLOW/AliFlowDist.C @@ -0,0 +1,76 @@ +// +// 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"); + } +} diff --git a/FLOW/AliFlowDrawSummary.C b/FLOW/AliFlowDrawSummary.C new file mode 100644 index 00000000000..bf8f7d2b7bc --- /dev/null +++ b/FLOW/AliFlowDrawSummary.C @@ -0,0 +1,131 @@ +// +// 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; jSetMarkerStyle(18+j); + + for(Int_t i=0; iDraw(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; jDraw("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"); + } +} diff --git a/FLOW/AliFlowDrawV2.C b/FLOW/AliFlowDrawV2.C new file mode 100644 index 00000000000..3d6f456f251 --- /dev/null +++ b/FLOW/AliFlowDrawV2.C @@ -0,0 +1,88 @@ +// +// 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; iDraw(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"); + } +} diff --git a/FLOW/AliFlowReconstruction.C b/FLOW/AliFlowReconstruction.C new file mode 100644 index 00000000000..9d691c63fd1 --- /dev/null +++ b/FLOW/AliFlowReconstruction.C @@ -0,0 +1,168 @@ +// +// 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; iGetEvent(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; iGetEntries(); + 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> 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 + + -- 2.39.3