ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Analysis2010/macros/plotTables.C
Revision: 1.1
Committed: Fri Nov 12 17:03:15 2010 UTC (14 years, 5 months ago) by yilmaz
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
macros

File Contents

# Content
1 /*
2 #include "TFile.h"
3 #include "TCanvas.h"
4 #include "DataFormats/HeavyIonEvent/interface/Centrality.h"
5 #include "TGraph.h"
6 #include <string>
7 #include <iostream>
8
9 using namespace std;
10 */
11
12 void plotTables(){
13
14 string files[10] = {
15 "tables_Data_AMPTOrgan_d1110.root",
16 "tables_Run150590_AMPTOrgan_d1110.root",
17 "tables_Run150593_AMPTOrgan_d1110.root"
18 }
19
20 string dirs[10] = {
21 "CentralityTable_PixelHits40_AMPTOrgan_v0_r150476v2_mc",
22 "CentralityTable_PixelHits40_AMPTOrgan_v0_r150590_mc",
23 "CentralityTable_PixelHits40_AMPTOrgan_v0_r150593_mc"
24 /*
25
26 "CentralityTable_HFhits40_AMPTOrgan_v0_r150476v2_mc",
27 "CentralityTable_HFhits40_AMPTOrgan_v0_r150590_mc",
28 "CentralityTable_HFhits40_AMPTOrgan_v0_r150593_mc"
29 */
30 };
31
32 string labels[10] = {"Run 150476","Run 150590","Run 150593"};
33
34 TFile* inf[10];
35 int color[20] = {4,2,1,3,5,6};
36
37 int Ntables = 3;
38 int jump = 4;
39 int Nbins = 40;
40
41 TGraph* gBoundary[10];
42 CentralityBins* bins[10];
43 for(int i = 0; i< Ntables; ++i){
44 inf[i] = new TFile(files[i].data());
45 cout<<"Table : "<<i<<endl;
46 const char* objectName = Form("%s/run1",dirs[i].data());
47 cout<<"Name : "<<objectName<<endl;
48
49 bins[i] = (CentralityBins*)inf[i]->Get(objectName);
50 gBoundary[i] = new TGraph(Nbins/jump);
51 gBoundary[i]->SetTitle(";Lower cut on Number of Pixel Hits;Bin Number");
52 // gBoundary[i]->SetTitle(";Lower cut on HF hit energy [GeV];Bin Number");
53
54 for(int bin = 0; bin < Nbins; ++bin){
55 double edge = bins[i]->lowEdgeOfBin(bin);
56
57 if(bin % jump == 3){
58 gBoundary[i]->SetPoint(bin/jump,edge,bin);
59 }
60 }
61 }
62
63 TCanvas* c1 = new TCanvas("c1","",400,400);
64 // c1->SetLogx();
65 TLegend* leg = new TLegend(0.5,0.7,0.9,0.9);
66 gBoundary[0]->GetXaxis()->SetNdivisions(7);
67
68 for(int i = 0; i< Ntables; ++i){
69 gBoundary[i]->SetMarkerColor(color[i]);
70
71 if(i == 0) gBoundary[i]->Draw("Ap");
72 else gBoundary[i]->Draw("p same");
73
74 leg->AddEntry(gBoundary[i],labels[i].data(),"p");
75 }
76
77 leg->Draw();
78 c1->Print("TablesComparisonPixel_d1111.gif");
79 // c1->Print("TablesComparisonHF_d1111.gif");
80 }
81