00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019
00020 #include <math.h>
00021 #include "TMath.h"
00022 #include <iostream.h>
00023 #include <iomanip.h>
00024
00025
00026 const Int_t nHars = 4;
00027 const Int_t nSels = 2;
00028 const Int_t nSubs = 2;
00029 Int_t runNumber = 0;
00030 char runName[6];
00031 char fileNumber[4] = "x";
00032 char fileName[30];
00033 TFile* histFile;
00034 char tmp[10];
00035 char runNo[10];
00036 TCanvas* can;
00037
00038 TCanvas* plot(Int_t pageNumber=0, Int_t selN=0, Int_t harN=0){
00039 gInterpreter->ProcessLine(".O0");
00040
00041 Bool_t includeFtpc = kTRUE;
00042 Bool_t reCent = kFALSE;
00043
00044 bool multiGraph = kFALSE;
00045 bool singleGraph = kFALSE;
00046 if (selN == 0) multiGraph = kTRUE;
00047
00048 TCanvas* cOld = (TCanvas*)gROOT->GetListOfCanvases();
00049 if (cOld) cOld->Delete();
00050
00051
00052 gROOT->SetStyle("Bold");
00053 gROOT->ForceStyle();
00054 gStyle->SetOptStat(10);
00055 gStyle->SetPalette(1);
00056
00057
00058
00059 const char* baseName1[] = {
00060 "Flow_Res_Sel",
00061 "Flow_Trigger",
00062 "Flow_VertexZ",
00063 "Flow_VertexXY2D",
00064 "Flow_EtaSymVerZ2D_Tpc",
00065 "Flow_EtaSym_Tpc",
00066 "Flow_EtaSymVerZ2D_Ftpc",
00067 "Flow_EtaSym_Ftpc",
00068 "Flow_CTBvsZDC2D",
00069 "Flow_Cent",
00070 "Flow_Mult",
00071 "Flow_OrigMult",
00072 "Flow_MultOverOrig",
00073 "Flow_MultEta",
00074 "Flow_MultPart",
00075 "Flow_Charge_Ftpc",
00076 "Flow_DcaGlobal_Tpc",
00077 "Flow_DcaGlobal_Ftpc",
00078 "Flow_Dca_Tpc",
00079 "Flow_Dca_Ftpc",
00080 "Flow_Chi2_Tpc",
00081 "Flow_Chi2_Ftpc",
00082 "Flow_FitPts_Tpc",
00083 "Flow_MaxPts_Tpc",
00084 "Flow_FitOverMax_Tpc",
00085 "Flow_FitPts_Ftpc",
00086 "Flow_MaxPts_Ftpc",
00087 "Flow_FitOverMax_Ftpc",
00088
00089 "Flow_EtaPtPhi2D.PhiEta",
00090 "Flow_EtaPtPhi2D.PhiPt",
00091 "Flow_YieldAll2D",
00092 "Flow_YieldAll.Eta",
00093 "Flow_YieldAll.Pt",
00094 "Flow_YieldPart2D",
00095 "Flow_YieldPart.Eta",
00096 "Flow_YieldPart.Pt",
00097
00098
00099 "Flow_MeanDedxPos2D",
00100 "Flow_MeanDedxNeg2D",
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 "Flow_PidMult",
00112 "Flow_Phi_FarEast_Sel",
00113 "Flow_Phi_Flat_FarEast_Sel",
00114 "Flow_Phi_East_Sel",
00115 "Flow_Phi_Flat_East_Sel",
00116 "Flow_Phi_West_Sel",
00117 "Flow_Phi_Flat_West_Sel",
00118 "Flow_Phi_FarWest_Sel",
00119 "Flow_Phi_Flat_FarWest_Sel",
00120 "Flow_Phi_FtpcFarEast_Sel",
00121 "Flow_Phi_Flat_FtpcFarEast_Sel",
00122 "Flow_Phi_FtpcEast_Sel",
00123 "Flow_Phi_Flat_FtpcEast_Sel",
00124 "Flow_Phi_FtpcWest_Sel",
00125 "Flow_Phi_Flat_FtpcWest_Sel",
00126 "Flow_Phi_FtpcFarWest_Sel",
00127 "Flow_Phi_Flat_FtpcFarWest_Sel",
00128 "Flow_Mul_Sel",
00129 "Flow_Yield2D_Sel",
00130 "Flow_Yield.Eta_Sel",
00131 "Flow_Yield.Pt_Sel",
00132 "Flow_Psi_Subs",
00133 "Flow_Psi_Sel",
00134 "Flow_PhiLab_Sel",
00135 "Flow_Psi_Diff_Sel",
00136 "Flow_Psi_Sub_Corr_Sel",
00137 "Flow_Psi_Sub_Corr_Diff_Sel",
00138 "Flow_Phi_Corr_Sel",
00139 "Flow_vObs2D_Sel",
00140 "Flow_vObsEta_Sel",
00141 "Flow_vObsPt_Sel",
00142 "Flow_v2D_Sel",
00143 "Flow_vEta_Sel",
00144 "Flow_vPt_Sel",
00145 "Flow_q_Sel",
00146 "FlowLYZ_vEta_Sel",
00147 "FlowLYZ_vPt_Sel",
00148 "Flow_vObs2D_ScalarProd_Sel",
00149 "Flow_v2D_ScalarProd_Sel",
00150 "Flow_vEta_ScalarProd_Sel",
00151 "Flow_vPt_ScalarProd_Sel"
00152 };
00153
00154 const char* baseName2[] = {
00155 "Flow_Res_Sel",
00156 "Flow_Trigger",
00157 "Flow_VertexZ",
00158 "Flow_VertexXY2D",
00159 "Flow_EtaSymVerZ2D_Tpc",
00160 "Flow_EtaSym_Tpc",
00161 "Flow_CTBvsZDC2D",
00162 "Flow_Cent",
00163 "Flow_Mult",
00164 "Flow_OrigMult",
00165 "Flow_MultOverOrig",
00166 "Flow_MultEta",
00167 "Flow_MultPart",
00168 "Flow_Dca_Tpc",
00169 "Flow_DcaGlobal_Tpc",
00170 "Flow_Chi2_Tpc",
00171 "Flow_FitPts_Tpc",
00172 "Flow_MaxPts_Tpc",
00173 "Flow_FitOverMax_Tpc",
00174
00175 "Flow_EtaPtPhi2D.PhiEta",
00176 "Flow_EtaPtPhi2D.PhiPt",
00177 "Flow_YieldAll2D",
00178 "Flow_YieldAll.Eta",
00179 "Flow_YieldAll.Pt",
00180 "Flow_YieldPart2D",
00181 "Flow_YieldPart.Eta",
00182 "Flow_YieldPart.Pt",
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197 "Flow_PidMult",
00198 "Flow_Phi_FarEast_Sel",
00199 "Flow_Phi_Flat_FarEast_Sel",
00200 "Flow_Phi_East_Sel",
00201 "Flow_Phi_Flat_East_Sel",
00202 "Flow_Phi_West_Sel",
00203 "Flow_Phi_Flat_West_Sel",
00204 "Flow_Phi_FarWest_Sel",
00205 "Flow_Phi_Flat_FarWest_Sel",
00206 "Flow_Mul_Sel",
00207 "Flow_Yield2D_Sel",
00208 "Flow_Yield.Eta_Sel",
00209 "Flow_Yield.Pt_Sel",
00210 "Flow_Psi_Subs",
00211 "Flow_Psi_Sel",
00212 "Flow_PhiLab_Sel",
00213 "Flow_Psi_Diff_Sel",
00214 "Flow_Psi_Sub_Corr_Sel",
00215 "Flow_Psi_Sub_Corr_Diff_Sel",
00216 "Flow_Phi_Corr_Sel",
00217 "Flow_vObs2D_Sel",
00218 "Flow_vObsEta_Sel",
00219 "Flow_vObsPt_Sel",
00220 "Flow_v2D_Sel",
00221 "Flow_vEta_Sel",
00222 "Flow_vPt_Sel",
00223 "Flow_q_Sel",
00224 "FlowLYZ_vEta_Sel",
00225 "FlowLYZ_vPt_Sel",
00226 "Flow_vObs2D_ScalarProd_Sel",
00227 "Flow_v2D_ScalarProd_Sel",
00228 "Flow_vEta_ScalarProd_Sel",
00229 "Flow_vPt_ScalarProd_Sel"
00230 };
00231
00232 const char* baseName3[] = {
00233 "Flow_Res_Sel",
00234 "Flow_Trigger",
00235 "Flow_VertexZ",
00236 "Flow_VertexXY2D",
00237 "Flow_EtaSymVerZ2D_Tpc",
00238 "Flow_EtaSym_Tpc",
00239 "Flow_EtaSymVerZ2D_Ftpc",
00240 "Flow_EtaSym_Ftpc",
00241 "Flow_CTBvsZDC2D",
00242 "Flow_Cent",
00243 "Flow_Mult",
00244 "Flow_OrigMult",
00245 "Flow_MultOverOrig",
00246 "Flow_MultEta",
00247 "Flow_MultPart",
00248 "Flow_Charge_Ftpc",
00249 "Flow_DcaGlobal_Tpc",
00250 "Flow_DcaGlobal_Ftpc",
00251 "Flow_Dca_Tpc",
00252 "Flow_Dca_Ftpc",
00253 "Flow_Chi2_Tpc",
00254 "Flow_Chi2_Ftpc",
00255 "Flow_FitPts_Tpc",
00256 "Flow_MaxPts_Tpc",
00257 "Flow_FitOverMax_Tpc",
00258 "Flow_FitPts_Ftpc",
00259 "Flow_MaxPts_Ftpc",
00260 "Flow_FitOverMax_Ftpc",
00261
00262 "Flow_EtaPtPhi2D.PhiEta",
00263 "Flow_EtaPtPhi2D.PhiPt",
00264 "Flow_YieldAll2D",
00265 "Flow_YieldAll.Eta",
00266 "Flow_YieldAll.Pt",
00267 "Flow_YieldPart2D",
00268 "Flow_YieldPart.Eta",
00269 "Flow_YieldPart.Pt",
00270
00271
00272 "Flow_MeanDedxPos2D",
00273 "Flow_MeanDedxNeg2D",
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284 "Flow_PidMult",
00285 "Flow_Mul_Sel",
00286 "Flow_Yield2D_Sel",
00287 "Flow_Yield.Eta_Sel",
00288 "Flow_Yield.Pt_Sel",
00289 "Flow_Psi_Subs",
00290 "Flow_Psi_Sel",
00291 "Flow_PhiLab_Sel",
00292 "Flow_Psi_Diff_Sel",
00293 "Flow_Psi_Sub_Corr_Sel",
00294 "Flow_Psi_Sub_Corr_Diff_Sel",
00295 "Flow_Phi_Corr_Sel",
00296 "Flow_QXY2D_Sel",
00297 "Flow_QFTPCSubXY2D_Sel",
00298 "Flow_QTPCSubXY2D_Sel",
00299 "Flow_vObs2D_Sel",
00300 "Flow_vObsEta_Sel",
00301 "Flow_vObsPt_Sel",
00302 "Flow_v2D_Sel",
00303 "Flow_vEta_Sel",
00304 "Flow_vPt_Sel",
00305 "Flow_q_Sel",
00306 "FlowLYZ_vEta_Sel",
00307 "FlowLYZ_vPt_Sel",
00308 "Flow_vObs2D_ScalarProd_Sel",
00309 "Flow_v2D_ScalarProd_Sel",
00310 "Flow_vEta_ScalarProd_Sel",
00311 "Flow_vPt_ScalarProd_Sel"
00312 };
00313
00314 const Int_t firstMultFtpc = 38;
00315 const Int_t firstMultTpc = 27;
00316 Int_t nSingles;
00317 Int_t nName;
00318 if (reCent) {
00319 nName = sizeof(baseName3) / sizeof(char*);
00320 nSingles = firstMultFtpc + 1;
00321 } else if (includeFtpc) {
00322 nName = sizeof(baseName1) / sizeof(char*);
00323 nSingles = firstMultFtpc + 1;
00324 } else {
00325 nName = sizeof(baseName2) / sizeof(char*);
00326 nSingles = firstMultTpc + 1;
00327 }
00328 const Int_t nNames = nName;
00329
00330
00331 char* baseName[nNames];
00332 char* shortName[nNames];
00333 for (int n = 0; n < nNames; n++) {
00334 baseName[n] = new char[35];
00335 shortName[n] = new char[35];
00336 float etaMax;
00337 if (reCent) {
00338 strcpy(baseName[n], baseName3[n]);
00339 etaMax = 4.5;
00340 } else if (includeFtpc) {
00341 strcpy(baseName[n], baseName1[n]);
00342 etaMax = 4.5;
00343 } else {
00344 strcpy(baseName[n], baseName2[n]);
00345 etaMax = 1.5;
00346 }
00347 strcpy(shortName[n], baseName[n]);
00348 char* cp = strstr(shortName[n],"_Sel");
00349 if (cp) *cp = '\0';
00350 }
00351
00352
00353 if (runNumber == 0) {
00354 cout << " run number? ";
00355 fgets(runNo, sizeof(runNo), stdin);
00356 runNumber = atoi(runNo);
00357 sprintf(runName, "ana%2d", runNumber);
00358 cout << " run name = " << runName << endl;
00359 }
00360
00361
00362 if (strstr(fileNumber, "x")!=0) {
00363 cout << " anaXX.root file number? [0= flow.hist.root] ";
00364 fgets(fileNumber, sizeof(fileNumber), stdin);
00365 fileNumber[strlen(fileNumber)-1] = '\0';
00366 if (strlen(fileNumber) == 1 && strstr(fileNumber,"0")) {
00367 sprintf(fileName, "flow.hist.root");
00368 } else {
00369 sprintf(fileName, "ana%s.root", fileNumber);
00370 }
00371 cout << " file name = " << fileName << endl;
00372 histFile = new TFile(fileName);
00373 }
00374
00375
00376 while (pageNumber <= 1 || pageNumber > nNames) {
00377 if (pageNumber < 0) {
00378 plotAll(nNames, selN, harN, -pageNumber);
00379 return can;
00380 }
00381 if (pageNumber == 1) {
00382 can = plotResolution();
00383 return can;
00384 }
00385 cout << "-1: \t All" << endl;
00386 for (int i = 0; i < nNames; i++) {
00387 cout << i+1 << ":\t " << shortName[i] << endl;
00388 }
00389 cout << " page number? ";
00390 fgets(tmp, sizeof(tmp), stdin);
00391 pageNumber = atoi(tmp);
00392 }
00393 if (pageNumber > 0 && pageNumber <= nSingles) {
00394 singleGraph = kTRUE;
00395 multiGraph = kFALSE;
00396 }
00397 pageNumber--;
00398 cout << pageNumber+1 << ": graph name= " << shortName[pageNumber] << endl;
00399
00400
00401 float twopi = 2. * TMath::Pi();
00402 float phiMax = twopi;
00403 float Ycm = 0.0;
00404 TString* histProjName = NULL;
00405
00406
00407 char* cp = strstr(shortName[pageNumber],"Subs");
00408 int columns = (cp) ? nSubs * nSels : nSels;
00409 int rows;
00410 rows = (strstr(shortName[pageNumber],"Phi_") ||
00411 strstr(shortName[pageNumber],"Psi_Diff") ? 2 : nHars);
00412
00413 if (strcmp(shortName[pageNumber],"Flow_Phi_Corr")==0) rows = nHars;
00414 if (strcmp(shortName[pageNumber],"Flow_Psi_Sub_Corr_Diff")==0) rows = 3;
00415 int pads = rows*columns;
00416 cout << "pads = " << pads << endl;
00417
00418
00419 if (multiGraph) {
00420 int canvasWidth = 600, canvasHeight = 780;
00421 } else {
00422 int canvasWidth = 780, canvasHeight = 600;
00423 }
00424 TString* canName = new TString(shortName[pageNumber]);
00425 if (runNumber) {
00426 *canName += runNumber;
00427 }
00428 cout << canName->Data() << endl;
00429 can = new TCanvas(canName->Data(), canName->Data(), canvasWidth, canvasHeight);
00430 can->ToggleEventStatus();
00431 if (multiGraph) {
00432 TPaveLabel* title = new TPaveLabel(0.1,0.96,0.9,0.99,shortName[pageNumber]);
00433 title->Draw();
00434 }
00435 TPaveLabel* run = new TPaveLabel(0.1,0.01,0.2,0.03,runName);
00436 run->Draw();
00437 TDatime now;
00438 TPaveLabel* date = new TPaveLabel(0.7,0.01,0.9,0.03,now.AsString());
00439 date->Draw();
00440 TPad* graphPad = new TPad("Graphs","Graphs",0.01,0.05,0.97,0.95);
00441 graphPad->Draw();
00442 graphPad->cd();
00443
00444 if (multiGraph) {
00445 graphPad->Divide(columns,rows);
00446 int firstK = 0, firstJ = 0, lastK = columns, lastJ = rows;
00447 } else if (singleGraph) {
00448 int firstK = 0, firstJ = 0, lastK = 1, lastJ = 1;
00449 } else {
00450 int firstK = selN -1, firstJ = harN -1, lastK = selN, lastJ = harN;
00451 }
00452 TLine* lineZeroY = new TLine(-etaMax, 0., etaMax, 0.);
00453 TLine* lineYcm = new TLine(Ycm, -10., Ycm, 10.);
00454 TLine* lineOnePhi = new TLine(0., 1., phiMax, 1.);
00455 for (int j = firstJ; j < lastJ; j++) {
00456 float order = (float)(j+1);
00457 for (int k = firstK ; k < lastK; k++) {
00458 int padN = j*columns + k + 1;
00459
00460
00461 char* temp = new char[35];
00462 strcpy(temp,shortName[pageNumber]);
00463 char* cproj = strstr(temp,".");
00464 if (cproj) {
00465 *cproj = '\0';
00466 if (singleGraph) {
00467 cproj = strstr(temp,"2");
00468 if (cproj) {
00469 *cproj = '\0';
00470 strcat(temp,"3D");
00471 } else {
00472 strcat(temp,"2D");
00473 }
00474 } else {
00475 strcat(temp,"2D_Sel");
00476 }
00477 TString* histName = new TString(temp);
00478 histProjName = new TString(baseName[pageNumber]);
00479 if (!singleGraph) {
00480 *histProjName += k+1;
00481 histProjName->Append("_Har");
00482 *histProjName += j+1;
00483 }
00484 } else {
00485 TString* histName = new TString(baseName[pageNumber]);
00486 }
00487 if (!singleGraph) {
00488 *histName += k+1;
00489 histName->Append("_Har");
00490 *histName += j+1;
00491 }
00492 cout << " col= " << k+1 << " row= " << order << " pad= " << padN << "\t"
00493 << histName->Data() << endl;
00494
00495
00496 bool twoD = kFALSE;
00497 bool threeD = kFALSE;
00498 if (histProjName) {
00499 if (strstr(temp,"3D")) {
00500 twoD = kTRUE;
00501 TH3* hist3D = dynamic_cast<TH3*>(histFile->Get(histName->Data()));
00502 if (!hist3D) {
00503 cout << "### Can't find histogram " << histName->Data() << endl;
00504 return can;
00505 }
00506 } else {
00507 TH2* hist2D = dynamic_cast<TH2*>(histFile->Get(histName->Data()));
00508 if (!hist2D) {
00509 cout << "### Can't find histogram " << histName->Data() << endl;
00510 return can;
00511 }
00512 }
00513 } else {
00514 if (strstr(shortName[pageNumber],"3D")!=0) {
00515 threeD = kTRUE;
00516 TH3* hist3D = dynamic_cast<TH3*>(histFile->Get(histName->Data()));
00517 if (!hist3D) {
00518 cout << "### Can't find histogram " << histName->Data() << endl;
00519 return can;
00520 }
00521 } else if (strstr(shortName[pageNumber],"2D")!=0) {
00522 twoD = kTRUE;
00523 TH2* hist2D = dynamic_cast<TH2*>(histFile->Get(histName->Data()));
00524 if (!hist2D) {
00525 cout << "### Can't find histogram " << histName->Data() << endl;
00526 return can;
00527 }
00528 } else {
00529 TH1* hist = dynamic_cast<TH1*>(histFile->Get(histName->Data()));
00530 if (!hist) {
00531 cout << "### Can't find histogram " << histName->Data() << endl;
00532 return can;
00533 }
00534 float max = hist->GetXaxis()->GetXmax();
00535 }
00536 }
00537
00538
00539 if (multiGraph) graphPad->cd(padN);
00540 if (threeD) {
00541 gStyle->SetOptStat(10);
00542 hist3D->Draw("BOX");
00543 } else if (twoD) {
00544 if (strstr(shortName[pageNumber],".PhiEta")!=0) {
00545 TH2D* projZX = hist3D->Project3D("zx");
00546 projZX->SetName(histProjName->Data());
00547 projZX->SetYTitle("azimuthal angle (rad)");
00548 projZX->SetXTitle("rapidity");
00549 gStyle->SetOptStat(0);
00550 if (projZX) projZX->Draw("COLZ");
00551 } else if (strstr(shortName[pageNumber],".PhiPt")!=0) {
00552 TH2D* projZY = hist3D->Project3D("zy");
00553 projZY->SetName(histProjName->Data());
00554 projZY->SetYTitle("azimuthal angle (rad");
00555 projZY->SetXTitle("Pt (GeV/c)");
00556 gStyle->SetOptStat(0);
00557 if (projZY) projZY->Draw("COLZ");
00558 } else if ((strstr(shortName[pageNumber],"QXY")!=0)) {
00559 TLine* lineZeroX = new TLine(-0.5, 0., 0.5, 0.);
00560 TLine* lineZeroY = new TLine(0., -0.5, 0., 0.5);
00561 gStyle->SetOptStat(100110);
00562 hist2D->Draw("COLZ");
00563
00564 lineZeroX->Draw();
00565 lineZeroY->Draw();
00566 } else if ((strstr(shortName[pageNumber],"TPCSubXY")!=0)) {
00567 TLine* lineZeroX = new TLine(-1., 0., 1., 0.);
00568 TLine* lineZeroY = new TLine(0., -1., 0., 1.);
00569 gStyle->SetOptStat(100110);
00570 hist2D->Draw("COLZ");
00571
00572 lineZeroX->Draw();
00573 lineZeroY->Draw();
00574 } else if (strstr(shortName[pageNumber],"XY")!=0) {
00575 TLine* lineZeroX = new TLine(-1., 0., 1., 0.);
00576 TLine* lineZeroY = new TLine(0., -1., 0., 1.);
00577 gStyle->SetOptStat(10);
00578 hist2D->Draw("COLZ");
00579 lineZeroX->Draw();
00580 lineZeroY->Draw();
00581 } else if (strstr(shortName[pageNumber],"Dedx")!=0) {
00582 TVirtualPad::Pad()->SetLogz();
00583 gStyle->SetOptStat(10);
00584 hist2D->Draw("COLZ");
00585 } else if (strstr(shortName[pageNumber],"_v")!=0) {
00586 hist2D->SetMaximum(20.);
00587 hist2D->SetMinimum(-20.);
00588 gStyle->SetOptStat(0);
00589 hist2D->Draw("COLZ");
00590 } else {
00591 gStyle->SetOptStat(10);
00592 hist2D->Draw("COLZ");
00593 }
00594 } else if (strstr(shortName[pageNumber],".Eta")!=0) {
00595 if (singleGraph) {
00596 TH1D* projX = hist2D->ProjectionX(histName->Data());
00597 } else {
00598
00599 TH1D* projX = hist2D->ProjectionX(histName->Data());
00600 }
00601 projX->SetName(histProjName->Data());
00602 char* xTitle = hist2D->GetXaxis()->GetTitle();
00603 projX->SetXTitle(xTitle);
00604 projX->SetYTitle("Counts");
00605 gStyle->SetOptStat(0);
00606 if (projX) projX->Draw("H");
00607 if (!singleGraph) lineZeroY->Draw();
00608 } else if (strstr(shortName[pageNumber],".Pt")!=0) {
00609 if (singleGraph) {
00610 TH1D* projY = hist2D->ProjectionY(histName->Data());
00611 } else {
00612 TH1D* projY = hist2D->ProjectionY(histName->Data(), -1, 9999, "E");
00613 }
00614 projY->SetName(histProjName->Data());
00615 projY->SetXTitle("Pt (GeV/c)");
00616 projY->SetYTitle("Counts");
00617 TVirtualPad::Pad()->SetLogy();
00618 gStyle->SetOptStat(0);
00619 if (projY) projY->Draw("H");
00620 } else if (strstr(shortName[pageNumber],".Phi")!=0) {
00621 if (singleGraph) {
00622 TH1D* projY = hist2D->ProjectionY(histName->Data());
00623 } else {
00624 TH1D* projY = hist2D->ProjectionY(histName->Data(), -1, 9999, "E");
00625 }
00626 projY->SetName(histProjName->Data());
00627 projY->SetXTitle("azimuthal angle (rad");
00628 projY->SetYTitle("Counts");
00629 gStyle->SetOptStat(0);
00630 if (projY) projY->Draw("H");
00631 } else if (strstr(shortName[pageNumber],"Corr")!=0) {
00632 float norm = (hist->Integral()) ? ((float)(hist->GetNbinsX()) / hist->Integral()) : 1.;
00633 cout << " Normalized by: " << norm << endl;
00634 hist->Scale(norm);
00635 if (strstr(shortName[pageNumber],"Diff")!=0) {
00636 TF1* funcCos1 = new TF1("funcCos1",
00637 "1+[0]*2/100*cos([1]*x)", 0., twopi);
00638 funcCos1->SetParNames("k=1", "har");
00639 funcCos1->SetParameters(0, order+1);
00640 funcCos1->SetParLimits(1, 1, 1);
00641
00642 delete funcCos1;
00643 } else if (strstr(shortName[pageNumber],"Sub")!=0) {
00644 TF1* funcSubCorr = new TF1("SubCorr", SubCorr, 0., twopi/order, 2);
00645 funcSubCorr->SetParNames("chi", "har");
00646 funcSubCorr->SetParameters(1., order);
00647 funcSubCorr->SetParLimits(1, 1, 1);
00648 hist->Fit("SubCorr");
00649 delete funcSubCorr;
00650 } else {
00651 TF1* funcCos3 = new TF1("funcCos3",
00652 "1+[0]*2/100*cos([3]*x)+[1]*2/100*cos(([3]+1)*x)+[2]*2/100*cos(([3]+2)*x)",
00653 0., twopi/order);
00654 funcCos3->SetParNames("n=har", "n=har+1", "n=har+2", "har");
00655 funcCos3->SetParameters(0, 0, 0, order);
00656 funcCos3->SetParLimits(3, 1, 1);
00657
00658 delete funcCos3;
00659 }
00660 if (strstr(shortName[pageNumber],"Phi")!=0)
00661 hist->SetMinimum(0.9*(hist->GetMinimum()));
00662 gStyle->SetOptStat(10);
00663 gStyle->SetOptFit(111);
00664 hist->Draw("E1");
00665 } else if (strstr(shortName[pageNumber],"_q")!=0) {
00666 gStyle->SetOptStat(110);
00667 gStyle->SetOptFit(111);
00668 hist->Draw("E1");
00669 float n_qBins = (float)hist->GetNbinsX();
00670 double area = hist->Integral() * max / n_qBins;
00671 TString* histName = new TString("Flow_Mul_Sel");
00672 *histName += k+1;
00673 histName->Append("_Har");
00674 *histName += j+1;
00675 TH1* histMult = dynamic_cast<TH1*>(histFile->Get(histName->Data()));
00676 if (!histMult) {
00677 cout << "### Can't find histogram " << histName->Data() << endl;
00678 return can;
00679 }
00680 delete histName;
00681 float mult = histMult->GetMean();
00682 TF1* fit_q = new TF1("qDist", qDist, 0., max, 4);
00683 fit_q->SetParNames("v", "mult", "area", "g");
00684 float qMean = hist->GetMean();
00685 float vGuess = (qMean > 1.) ? sqrt(2.*(qMean - 1.) / mult) : 0.03;
00686
00687 vGuess *= 100.;
00688 cout << "vGuess = " << vGuess << endl;
00689 fit_q->SetParameters(vGuess, mult, area, 0.3);
00690 fit_q->SetParLimits(1, 1, 1);
00691 fit_q->SetParLimits(2, 1, 1);
00692 hist->Fit("qDist", "Q");
00693
00694 fit_q->Draw();
00695 fit_q->FixParameter(3, 0.);
00696 fit_q->SetLineStyle(kDotted);
00697 hist->Fit("qDist", "Q+");
00698 fit_q->Draw("same");
00699 fit_q->ReleaseParameter(3);
00700 fit_q->SetParameter(3, 0.5);
00701 fit_q->FixParameter(0, 0.);
00702 fit_q->SetLineStyle(kDashed);
00703 hist->Fit("qDist", "Q+");
00704 fit_q->Draw("same");
00705 fit_q->ReleaseParameter(0);
00706 } else if (strstr(shortName[pageNumber],"PhiLab")!=0) {
00707 hist->Draw("E1");
00708 float norm = (hist->Integral()) ? ((float)(hist->GetNbinsX()) / hist->Integral()) : 1.;
00709 cout << " Normalized by: " << norm << endl;
00710 hist->Scale(norm);
00711 hist->SetMinimum(0.);
00712 hist->SetMaximum(1.3);
00713 TF1* funcCosSin = new TF1("funcCosSin",
00714 "1.+[0]*2./100.*cos([2]*x)+[1]*2./100.*sin([2]*x)", 0., twopi);
00715 funcCosSin->SetParNames("100*cos", "100*sin", "har");
00716 funcCosSin->SetParameters(0, 0, order);
00717 funcCosSin->SetParLimits(2, 1, 1);
00718 hist->Fit("funcCosSin");
00719 delete funcCosSin;
00720 gStyle->SetOptFit(111);
00721 } else if (strstr(shortName[pageNumber],"Phi")!=0) {
00722
00723 hist->SetMinimum(0.);
00724 gStyle->SetOptStat(10);
00725 hist->Draw();
00726 } else if (strstr(shortName[pageNumber],"Psi_Diff")!=0) {
00727 hist->Draw("E1");
00728 } else if (strstr(shortName[pageNumber],"Psi")!=0) {
00729 float norm = (hist->Integral()) ? ((float)(hist->GetNbinsX()) / hist->Integral()) : 1.;
00730 cout << " Normalized by: " << norm << endl;
00731 hist->Scale(norm);
00732 hist->SetMinimum(0.);
00733 TF1* funcCosSin = new TF1("funcCosSin",
00734 "1.+[0]*2./100.*cos([2]*x)+[1]*2./100.*sin([2]*x)", 0., twopi/order);
00735 funcCosSin->SetParNames("100*cos", "100*sin", "har");
00736 funcCosSin->SetParameters(0, 0, order);
00737 funcCosSin->SetParLimits(2, 1, 1);
00738 hist->Fit("funcCosSin");
00739 delete funcCosSin;
00740 gStyle->SetOptFit(111);
00741 hist->Draw("E1");
00742 } else if (strstr(shortName[pageNumber],"Eta")!=0) {
00743 gStyle->SetOptStat(100110);
00744 if (strstr(shortName[pageNumber],"_v")!=0 ) {
00745 hist->SetMaximum(10.);
00746 hist->SetMinimum(-10.);
00747 hist->Draw();
00748 lineYcm->Draw();
00749 } else {
00750 hist->Draw();
00751 }
00752 lineZeroY->Draw();
00753 } else if (strstr(shortName[pageNumber],"Pt")!=0) {
00754 if (strstr(shortName[pageNumber],"_v")!=0 ) {
00755 hist->SetMaximum(25.);
00756 hist->SetMinimum(-5.);
00757 }
00758 gStyle->SetOptStat(100110);
00759 hist->Draw();
00760 if (strstr(shortName[pageNumber],"v")!=0) {
00761 TLine* lineZeroPt = new TLine(0., 0., max, 0.);
00762 lineZeroPt->Draw();
00763 }
00764 } else if (strstr(shortName[pageNumber],"Bin")!=0) {
00765 if (strstr(shortName[pageNumber],"Pt")!=0) {
00766 TLine* lineDiagonal = new TLine(0., 0., max, max);
00767 } else {
00768 TLine* lineDiagonal = new TLine(-max, -max, max, max);
00769 }
00770 gStyle->SetOptStat(0);
00771 hist->SetMarkerStyle(21);
00772 hist->SetMarkerColor(2);
00773 hist->Draw();
00774 lineDiagonal->Draw();
00775 } else if (strstr(shortName[pageNumber],"PidMult")!=0) {
00776 TVirtualPad::Pad()->SetLogy();
00777 gStyle->SetOptStat(0);
00778 hist->Draw();
00779 } else {
00780 gStyle->SetOptStat(100110);
00781 hist->Draw();
00782 }
00783 delete [] temp;
00784 delete histName;
00785 if (histProjName) delete histProjName;
00786 }
00787 }
00788 delete [] shortName;
00789
00790 return can;
00791 }
00792
00793
00794 TCanvas* plotResolution() {
00795 char* resName[] = {
00796 "Flow_Cos_Sel",
00797 "Flow_Res_Sel",
00798 "Flow_v_Sel"
00799
00800
00801
00802 };
00803 int columns = nSels;
00804 int rows = sizeof(resName) / sizeof(char*);
00805 int pads = rows*columns;
00806
00807
00808 can = new TCanvas(resName[1], resName[1], 600, 780);
00809 can->ToggleEventStatus();
00810 TPaveLabel* run = new TPaveLabel(0.1,0.01,0.2,0.03,runName);
00811 run->Draw();
00812 TDatime now;
00813 TPaveLabel* date = new TPaveLabel(0.7,0.01,0.9,0.03,now.AsString());
00814 date->Draw();
00815 TLine* lineZeroHar = new TLine(0.5, 0., nHars+0.5, 0.);
00816 TPad* graphPad = new TPad("Graphs","Graphs",0.01,0.05,0.97,0.99);
00817 graphPad->Draw();
00818 graphPad->cd();
00819 graphPad->Divide(columns,rows);
00820
00821
00822 float v;
00823 float err;
00824 for (int j = 0; j < rows; j++) {
00825 int resNumber = j;
00826 cout << "resolution name= " << resName[resNumber] << endl;
00827 for (int k = 0; k < columns; k++) {
00828 int padN = j*columns + k +1;
00829 TString* histName = new TString(resName[resNumber]);
00830 *histName += k+1;
00831 cout << "row= " << j << " col= " << k << " pad= " << padN << "\t"
00832 << histName->Data() << endl;
00833 TH1* hist = dynamic_cast<TH1*>(histFile->Get(histName->Data()));
00834 if (!hist) {
00835 cout << "### Can't find histogram " << histName->Data() << endl;
00836 return can;
00837 }
00838 graphPad->cd(padN);
00839 gStyle->SetOptStat(0);
00840 if (strstr(resName[resNumber],"_v")!=0) {
00841 hist->SetMaximum(10.);
00842 hist->SetMinimum(-5.);
00843 } else {
00844 hist->SetMaximum(1.1);
00845 hist->SetMinimum(0.);
00846 }
00847 for (int n=1; n < nHars+1; n++) {
00848 v = hist->GetBinContent(n);
00849 err = hist->GetBinError(n);
00850 cout << " " << n << ": " << setprecision(3) << v << " +/- " << err << endl;
00851 if (TMath::IsNaN(v)) {
00852 hist->SetBinContent(n, 0.);
00853 hist->SetBinError(n, 0.);
00854 }
00855 }
00856 hist->Draw();
00857 lineZeroHar->Draw();
00858 delete histName;
00859 }
00860 }
00861
00862 return can;
00863 }
00864
00865 void plotAll(Int_t nNames, Int_t selN, Int_t harN, Int_t first = 1) {
00866 for (int i = first; i < nNames + 1; i++) {
00867 can = plot(i, selN, harN);
00868 can->Update();
00869 cout << "save? y/[n], quit? q" << endl;
00870 fgets(tmp, sizeof(tmp), stdin);
00871 if (strstr(tmp,"y")!=0) can->Print(".pdf");
00872 else if (strstr(tmp,"q")!=0) return;
00873 else if (strstr(tmp," ")!=0) continue;
00874 }
00875 cout << " plotAll Done" << endl;
00876 }
00877
00878
00879
00880 static Double_t qDist(double* q, double* par) {
00881
00882
00883 double sig2 = 0.5 * (1. + par[3]);
00884 double expo = (par[1]*par[0]*par[0]/10000. + q[0]*q[0]) / (2*sig2);
00885 Double_t dNdq = par[2] * (q[0]*exp(-expo)/sig2) *
00886 TMath::BesselI0(q[0]*par[0]/100.*sqrt(par[1])/sig2);
00887
00888 return dNdq;
00889 }
00890
00891
00892
00893 static Double_t SubCorr(double* x, double* par) {
00894
00895
00896
00897 double chi2 = par[0] * par[0] / 2;
00898 double z = chi2 * cos(par[1]*x[0]);
00899 double TwoOverPi = 2./TMath::Pi();
00900
00901 Double_t dNdPsi = exp(-chi2)/TwoOverPi * (TwoOverPi*(1.+chi2)
00902 + z*(TMath::BesselI0(z) + TMath::StruveL0(z))
00903 + chi2*(TMath::BesselI1(z) + TMath::StruveL1(z)));
00904
00905 return dNdPsi;
00906 }
00907
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090
01091
01092
01093
01094