Fork me on GitHub

source: svn/trunk/routines/plot_performances.C@ 196

Last change on this file since 196 was 195, checked in by Xavier Rouby, 16 years ago

update

File size: 3.9 KB
RevLine 
[194]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"
[195]7#include "TPie.h"
[194]8
9void 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
[195]53
[194]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];
[195]62 sprintf(text,"1 kevts in %.2f s",fit->GetParameter(1));
[194]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}
[195]80
81
82void plot_filesize() {
83 setTDRStyle();
84 gROOT->Reset();
85 TMultiGraph * mg = new TMultiGraph();
86
87 const int N = 6;
88 float * n = new float[N];
89 n[0] = 5; n[1] = 10; n[2] = 20;
90 n[3] = 30; n[4] = 40; n[5] = 50;
91
92 float * s = new float[N];
93 s[0]=119.; s[1]=236.; s[2]=496.;
94 s[3]=702.; s[4]=936.; s[5]=1198.;
95 TGraph * size = new TGraph(N,n,s);
96 size->SetMarkerStyle(21);
97 mg->Add(size,"P");
98
99 mg->Draw("A");
100 mg->GetXaxis()->SetTitle("N (kevts)");
101 mg->GetYaxis()->SetTitle("File size(MB)");
102 mg->GetYaxis()->SetTitleOffset(1.31);
103
104 TF1 * fit = new TF1("fit","[0]+[1]*x",5,50);
105 fit->SetLineColor(kBlack);
106 fit->SetLineStyle(2);
107 fit->SetLineWidth(1);
108 size->Fit("fit","F");
109
110 TPaveText *pave = new TPaveText(5,944,35,1200,"r");
111 pave->AddText("Delphes performances");
112 char text[500];
113 sprintf(text,"1 kevts in %.2f MB",fit->GetParameter(1));
114 pave->AddText(text);
115 pave->AddText("pp #rightarrow t #bar{t} X");
116 pave->Draw();
117 pave->SetBorderSize(0);
118 pave->SetFillStyle(0);
119 pave->SetTextAlign(12);
120 pave->SetTextFont(42);
121
122}
123
124void plot_timerepartition(float r=30.) {
125// float s[]= {119, 236, 496, 702, 936, 1198};
126 float vals[]= {0.74, 0.26};
127 int nvals = sizeof(vals)/sizeof(vals[0]);
128 char * labels[] = {"Event loop","Convertor"};
129 TPie * pie = new TPie("pie","",nvals,vals);
130 pie->Draw();
131
132 TPaveText *pave = new TPaveText(0.1,0.7,0.5,0.97,"br");
133 pave->AddText("Time repartition");
134 pave->Draw();
135 pave->SetBorderSize(0);
136 pave->SetFillStyle(0);
137 pave->SetTextAlign(12);
138 pave->SetTextFont(42);
139
140 pie->SetAngularOffset(r);
141 pie->SetEntryRadiusOffset( 1, 0.01);
142 pie->SetRadius(.15);
143 pie->SetHeight(0.04);
144 pie->SetLabels(labels);
145 pie->SetLabelsOffset(0);
146 pie->SetTextSize(0.06);
147 pie->Draw("3d");
148}
Note: See TracBrowser for help on using the repository browser.