19 const Int_t nHars = 2;
20 const Int_t nOrders = 2;
23 char fileNum[4] =
"x";
29 TCanvas* plotCumulant(Int_t pageNumber=0, Int_t selN=2, Int_t orderN=0, Int_t harN=0){
31 bool multiGraph = kFALSE;
32 bool singleGraph = kFALSE;
33 if (orderN == 0) multiGraph = kTRUE;
34 bool mixGraph = kFALSE;
35 TCanvas* cOld = (TCanvas*)gROOT->GetListOfCanvases();
36 if (cOld) cOld->Delete();
38 gROOT->SetStyle(
"Bold");
42 const char* baseName[] = {
43 "Flow_Cumul_v_Order2",
44 "Flow_Cumul_v_Order4",
48 "Flow_Cumul_vEta_Order",
49 "Flow_Cumul_vPt_Order"
52 const int nNames =
sizeof(baseName) /
sizeof(
char*);
53 const int nSingles = 5;
57 char* shortName[] =
new char*[nNames];
58 for (
int n = 0; n < nNames; n++) {
59 shortName[n] =
new char[30];
60 strcpy(shortName[n], baseName[n]);
61 char* cp = strstr(shortName[n],
"Order");
67 cout <<
" run number? ";
68 fgets(tmp,
sizeof(tmp), stdin);
69 runNumber = atoi(tmp);
70 sprintf(runName,
"ana%2d", runNumber);
71 cout <<
" run name = " << runName << endl;
75 if (strstr(fileNum,
"x")!=0) {
76 cout <<
" anaXX.root file number? [0= flow.hist.root] ";
77 fgets(fileNum,
sizeof(fileNum), stdin);
78 fileNum[strlen(fileNum)-1] =
'\0';
79 if (strlen(fileNum) == 1 && strstr(fileNum,
"0")) {
80 sprintf(fileName,
"flow.hist.root");
82 sprintf(fileName,
"ana%s.root", fileNum);
84 cout <<
" file name = " << fileName << endl;
85 histFile =
new TFile(fileName);
89 while (pageNumber <= 0 || pageNumber > nNames) {
91 plotCumulantAll(nNames, orderN, selN, harN, -pageNumber);
94 cout <<
"-1: \t All" << endl;
95 for (
int i = 0; i < nNames; i++) {
96 cout << i+1 <<
":\t " << baseName[i] << endl;
98 cout <<
" page number? ";
99 fgets(tmp,
sizeof(tmp), stdin);
100 pageNumber = atoi(tmp);
102 if (pageNumber > 0 && pageNumber <= nSingles) {
105 strcpy(shortName[pageNumber-1], baseName[pageNumber-1]);
108 cout <<
" graph name= " << shortName[pageNumber] << endl;
110 if (strstr(shortName[pageNumber],
"Mix")!=0) {
116 int columns = nOrders;
118 int pads = rows*columns;
122 int canvasWidth = 600, canvasHeight = 780;
124 int canvasWidth = 780, canvasHeight = 600;
126 c =
new TCanvas(shortName[pageNumber], shortName[pageNumber],
127 canvasWidth, canvasHeight);
128 c->ToggleEventStatus();
130 TPaveLabel* title =
new TPaveLabel(0.1,0.96,0.9,0.99,shortName[pageNumber]);
133 TPaveLabel* run =
new TPaveLabel(0.1,0.01,0.2,0.03,runName);
136 TPaveLabel* date =
new TPaveLabel(0.7,0.01,0.9,0.03,now.AsString());
138 TPad* graphPad =
new TPad(
"Graphs",
"Graphs",0.01,0.05,0.97,0.95);
143 graphPad->Divide(columns,rows);
144 int firstK = 0, firstJ = 0, lastK = columns, lastJ = rows;
145 }
else if (singleGraph) {
146 int firstK = 0, firstJ = 0, lastK = 1, lastJ = 1;
148 int firstK = orderN/2 -1, firstJ = harN -1, lastK = orderN/2, lastJ = harN;
150 for (
int j = firstJ; j < lastJ; j++) {
151 for (
int k = firstK ; k < lastK; k++) {
153 sprintf(countOrder,
"%d",2*(k+1));
154 int padN = j*columns + k + 1;
157 TString* histName =
new TString(baseName[pageNumber]);
159 histName->Append(*countOrder);
161 histName->Append(
"_Sel");
164 histName->Append(
"_Har");
166 }
else if (mixGraph && strcmp(shortName[pageNumber],
"Flow_CumulMix_v") != 0) {
167 histName->Append(
"_Har");
170 cout <<
" col= " << k+1 <<
" row= " << j+1 <<
" pad= " << padN <<
"\t"
171 << histName->Data() << endl;
175 if (strstr(shortName[pageNumber],
"2D")!=0) {
177 TH2* hist2D =
dynamic_cast<TH2*
>(histFile->Get(histName->Data()));
179 cout <<
"### Can't find histogram " << histName->Data() << endl;
183 TH1* hist =
dynamic_cast<TH1*
>(histFile->Get(histName->Data()));
185 cout <<
"### Can't find histogram " << histName->Data() << endl;
188 float xMax = hist->GetXaxis()->GetXmax();
192 if (multiGraph) graphPad->cd(padN);
194 gStyle->SetOptStat(10);
196 hist2D->Draw(
"LEGO1");
198 gStyle->SetOptStat(100110);
201 if (strstr(shortName[pageNumber],
"Eta")!=0) {
202 if (strstr(shortName[pageNumber],
"_v")!=0) {
209 hist->SetMaximum(yMax);
210 hist->SetMinimum(yMin);
211 TLine* lineZeroEta =
new TLine(-xMax, 0., xMax, 0.);
213 TLine* lineEtaCM =
new TLine(Ycm, yMin, Ycm, yMax);
215 }
else if (strstr(shortName[pageNumber],
"Pt")!=0) {
216 if (strstr(shortName[pageNumber],
"_v")!=0) {
223 hist->SetMaximum(yMax);
224 hist->SetMinimum(yMin);
225 TLine* lineZeroPt =
new TLine(0., 0., xMax, 0.);
228 hist->SetMinimum(0.);
229 TLine* lineZeroHar =
new TLine(0.5, 0., nHars+0.5, 0.);
236 for (
int m = 0; m < nNames; m++) {
237 delete [] shortName[m];
244 void plotCumulantAll(Int_t nNames, Int_t orderN, Int_t selN, Int_t harN, Int_t first = 1) {
245 for (
int i = first; i < nNames + 1; i++) {
246 c = plotCumulant(i, selN, orderN, harN);
248 cout <<
"save? y/[n], quit? q" << endl;
249 fgets(tmp,
sizeof(tmp), stdin);
250 if (strstr(tmp,
"y")!=0) c->Print(
".ps");
251 else if (strstr(tmp,
"q")!=0)
return;
253 cout <<
" plotCumulantAll Done" << endl;