1 | #include "interface/FuncDef.h"
|
---|
2 | #include "TGraph.h"
|
---|
3 | #include "TMultiGraph.h"
|
---|
4 | #include "TF1.h"
|
---|
5 | #include "TText.h"
|
---|
6 | #include "TLegend.h"
|
---|
7 | #include "TPie.h"
|
---|
8 |
|
---|
9 | void plot_performances() {
|
---|
10 | setTDRStyle();
|
---|
11 | gROOT->Reset();
|
---|
12 | TMultiGraph * mg = new TMultiGraph();
|
---|
13 |
|
---|
14 | const int N = 6;
|
---|
15 | float * n = new float[N];
|
---|
16 | n[0] = 5; n[1] = 10; n[2] = 20;
|
---|
17 | n[3] = 30; n[4] = 40; n[5] = 50;
|
---|
18 |
|
---|
19 | float * t = new float[N];
|
---|
20 | t[0]= 60.44; t[1] = 124.74; t[2] = 239.38;
|
---|
21 | t[3]=376.08; t[4] = 499.34; t[5] = 603.238;
|
---|
22 | TGraph * time = new TGraph(N,n,t);
|
---|
23 | time->SetMarkerStyle(20);
|
---|
24 | mg->Add(time,"P");
|
---|
25 |
|
---|
26 | float * t1 = new float[N];
|
---|
27 | t1[0]= 45.01; t1[1] = 93.25; t1[2] = 177.34;
|
---|
28 | t1[3]=280.6; t1[4] = 369.97; t1[5] = 444.52;
|
---|
29 | TGraph * time1 = new TGraph(N,n,t1);
|
---|
30 | time1->SetMarkerStyle(24);
|
---|
31 | mg->Add(time1,"P");
|
---|
32 |
|
---|
33 |
|
---|
34 | float * s = new float[N];
|
---|
35 | s[0]=119./1.5; s[1]=236./1.5; s[2]=496./1.5;
|
---|
36 | s[3]=702./1.5; s[4]=936./1.5; s[5]=1198./1.5;
|
---|
37 | TGraph * size = new TGraph(N,n,s);
|
---|
38 | size->SetMarkerStyle(21);
|
---|
39 | size->SetMarkerColor(kRed);
|
---|
40 | // mg->Add(size,"P");
|
---|
41 |
|
---|
42 | mg->Draw("A");
|
---|
43 | mg->GetXaxis()->SetTitle("N (kevts)");
|
---|
44 | mg->GetYaxis()->SetTitle("CPU time(s)");
|
---|
45 | mg->GetYaxis()->SetTitleOffset(1.21);
|
---|
46 |
|
---|
47 | TF1 * fit = new TF1("fit","[0]+[1]*x",5,50);
|
---|
48 | fit->SetLineColor(kBlack);
|
---|
49 | fit->SetLineStyle(2);
|
---|
50 | fit->SetLineWidth(1);
|
---|
51 | time->Fit("fit","");
|
---|
52 |
|
---|
53 |
|
---|
54 | TGaxis *sizeaxis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), gPad->GetUxmax(), gPad->GetUymax(),mg->GetYaxis()->GetXmin()*1.5,mg->GetYaxis()->GetXmax()*1.5);
|
---|
55 | sizeaxis->SetLineColor(kRed);
|
---|
56 | sizeaxis->SetLabelColor(kRed);
|
---|
57 | // sizeaxis->Draw();
|
---|
58 |
|
---|
59 | TPaveText *pave = new TPaveText(5,472,35,600,"r");
|
---|
60 | pave->AddText("Delphes performances");
|
---|
61 | char text[500];
|
---|
62 | sprintf(text,"1 kevts in %.2f s",fit->GetParameter(1));
|
---|
63 | pave->AddText(text);
|
---|
64 | pave->AddText("pp #rightarrow t #bar{t} X");
|
---|
65 | pave->Draw();
|
---|
66 | pave->SetBorderSize(0);
|
---|
67 | pave->SetFillStyle(0);
|
---|
68 | pave->SetTextAlign(12);
|
---|
69 | pave->SetTextFont(42);
|
---|
70 |
|
---|
71 | //TLegend * leg = new TLegend(30,80,50,200);
|
---|
72 | TLegend * leg = new TLegend(0.6,0.2,0.9,0.4);
|
---|
73 | leg->AddEntry(time,"General","p");
|
---|
74 | leg->AddEntry(time1,"Event loop only","p");
|
---|
75 | leg->SetBorderSize(0);
|
---|
76 | leg->SetFillStyle(0);
|
---|
77 | leg->SetTextFont(42);
|
---|
78 | leg->Draw();
|
---|
79 |
|
---|
80 | float vals[]= {0.74, 0.26};
|
---|
81 | int nvals = sizeof(vals)/sizeof(vals[0]);
|
---|
82 | char * labels[] = {"Event loop","Convertor"};
|
---|
83 | TPie * pie = new TPie("pie","",nvals,vals);
|
---|
84 | pie->Draw();
|
---|
85 |
|
---|
86 | }
|
---|
87 |
|
---|
88 |
|
---|
89 | void plot_filesize() {
|
---|
90 | setTDRStyle();
|
---|
91 | gROOT->Reset();
|
---|
92 | TMultiGraph * mg = new TMultiGraph();
|
---|
93 |
|
---|
94 | const int N = 6;
|
---|
95 | float * n = new float[N];
|
---|
96 | n[0] = 5; n[1] = 10; n[2] = 20;
|
---|
97 | n[3] = 30; n[4] = 40; n[5] = 50;
|
---|
98 |
|
---|
99 | float * s = new float[N];
|
---|
100 | s[0]=119.; s[1]=236.; s[2]=496.;
|
---|
101 | s[3]=702.; s[4]=936.; s[5]=1198.;
|
---|
102 | TGraph * size = new TGraph(N,n,s);
|
---|
103 | size->SetMarkerStyle(21);
|
---|
104 | mg->Add(size,"P");
|
---|
105 |
|
---|
106 | mg->Draw("A");
|
---|
107 | mg->GetXaxis()->SetTitle("N (kevts)");
|
---|
108 | mg->GetYaxis()->SetTitle("File size(MB)");
|
---|
109 | mg->GetYaxis()->SetTitleOffset(1.31);
|
---|
110 |
|
---|
111 | TF1 * fit = new TF1("fit","[0]+[1]*x",5,50);
|
---|
112 | fit->SetLineColor(kBlack);
|
---|
113 | fit->SetLineStyle(2);
|
---|
114 | fit->SetLineWidth(1);
|
---|
115 | size->Fit("fit","F");
|
---|
116 |
|
---|
117 | TPaveText *pave = new TPaveText(5,944,35,1200,"r");
|
---|
118 | pave->AddText("Delphes performances");
|
---|
119 | char text[500];
|
---|
120 | sprintf(text,"1 kevts in %.2f MB",fit->GetParameter(1));
|
---|
121 | pave->AddText(text);
|
---|
122 | pave->AddText("pp #rightarrow t #bar{t} X");
|
---|
123 | pave->Draw();
|
---|
124 | pave->SetBorderSize(0);
|
---|
125 | pave->SetFillStyle(0);
|
---|
126 | pave->SetTextAlign(12);
|
---|
127 | pave->SetTextFont(42);
|
---|
128 |
|
---|
129 | }
|
---|
130 |
|
---|
131 | void plot_timerepartition(float r=30.) {
|
---|
132 | // float s[]= {119, 236, 496, 702, 936, 1198};
|
---|
133 | float vals[]= {0.74, 0.26};
|
---|
134 | int nvals = sizeof(vals)/sizeof(vals[0]);
|
---|
135 | char * labels[] = {"Event loop","Convertor"};
|
---|
136 | TPie * pie = new TPie("pie","",nvals,vals);
|
---|
137 | pie->Draw();
|
---|
138 |
|
---|
139 | TPaveText *pave = new TPaveText(0.1,0.7,0.5,0.97,"br");
|
---|
140 | pave->AddText("Time repartition");
|
---|
141 | pave->Draw();
|
---|
142 | pave->SetBorderSize(0);
|
---|
143 | pave->SetFillStyle(0);
|
---|
144 | pave->SetTextAlign(12);
|
---|
145 | pave->SetTextFont(42);
|
---|
146 |
|
---|
147 | pie->SetAngularOffset(r);
|
---|
148 | pie->SetEntryRadiusOffset( 1, 0.01);
|
---|
149 | pie->SetRadius(.15);
|
---|
150 | pie->SetHeight(0.04);
|
---|
151 | pie->SetLabels(labels);
|
---|
152 | pie->SetLabelsOffset(0);
|
---|
153 | pie->SetTextSize(0.06);
|
---|
154 | pie->Draw("3d");
|
---|
155 | }
|
---|