Fork me on GitHub

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

Last change on this file since 482 was 443, checked in by Xavier Rouby, 15 years ago

new header in all files

File size: 6.7 KB
Line 
1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
6** \------------- arXiv:0903.2225v1 ------------/ **
7** **
8** **
9** This package uses: **
10** ------------------ **
11** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 **
12** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
13** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
14** FROG: [hep-ex/0901.2718v1] **
15** HepMC: Comput. Phys. Commun.134 (2001) 41 **
16** **
17** ------------------------------------------------------------------ **
18** **
19** Main authors: **
20** ------------- **
21** **
22** Severine Ovyn Xavier Rouby **
23** severine.ovyn@uclouvain.be xavier.rouby@cern **
24** **
25** Center for Particle Physics and Phenomenology (CP3) **
26** Universite catholique de Louvain (UCL) **
27** Louvain-la-Neuve, Belgium **
28** **
29** Copyright (C) 2008-2009, **
30** All rights reserved. **
31** **
32***********************************************************************/
33
34#include "interface/FuncDef.h"
35#include "TGraph.h"
36#include "TMultiGraph.h"
37#include "TF1.h"
38#include "TText.h"
39#include "TLegend.h"
40#include "TPie.h"
41
42void plot_performances() {
43 setTDRStyle();
44 gROOT->Reset();
45 TMultiGraph * mg = new TMultiGraph();
46
47 const int N = 6;
48 float * n = new float[N];
49 n[0] = 5; n[1] = 10; n[2] = 20;
50 n[3] = 30; n[4] = 40; n[5] = 50;
51
52 float * t = new float[N];
53 // v1.2b
54 //t[0]= 60.44; t[1] = 124.74; t[2] = 239.38; t[3]=376.08; t[4] = 499.34; t[5] = 603.238;
55
56 // v1.5b
57 t[0]= 70.34; t[1] = 112.77; t[2] = 223.44; t[3]=332.39; t[4] = 451.85; t[5] = 555.68;
58 TGraph * time = new TGraph(N,n,t);
59 time->SetMarkerStyle(20);
60 mg->Add(time,"P");
61
62 float * t1 = new float[N];
63 // v1.2b
64 //t1[0]= 45.01; t1[1] = 93.25; t1[2] = 177.34; t1[3]=280.6; t1[4] = 369.97; t1[5] = 444.52;
65
66 // v1.5b
67 t1[0]= 38.43; t1[1] = 80.69; t1[2] = 157.83; t1[3]=227.67; t1[4] = 317.2; t1[5] = 395.74;
68 TGraph * time1 = new TGraph(N,n,t1);
69 time1->SetMarkerStyle(24);
70 mg->Add(time1,"P");
71
72
73 float * s = new float[N];
74 // v1.2b
75 //s[0]=119./1.5; s[1]=236./1.5; s[2]=496./1.5; s[3]=702./1.5; s[4]=936./1.5; s[5]=1198./1.5;
76
77 // v1.5b
78 s[0]=200/1.5; s[1]=233./1.5; s[2]=464./1.5; s[3]=694./1.5; s[4]=925./1.5; s[5]=1184./1.5;
79 TGraph * size = new TGraph(N,n,s);
80 size->SetMarkerStyle(21);
81 size->SetMarkerColor(kRed);
82// mg->Add(size,"P");
83
84 mg->Draw("A");
85 mg->GetXaxis()->SetTitle("N (kevts)");
86 mg->GetYaxis()->SetTitle("CPU time(s)");
87 mg->GetYaxis()->SetTitleOffset(1.21);
88
89 TF1 * fit = new TF1("fit","[0]+[1]*x",5,50);
90 fit->SetLineColor(kBlack);
91 fit->SetLineStyle(2);
92 fit->SetLineWidth(1);
93 time->Fit("fit","");
94
95
96 TGaxis *sizeaxis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), gPad->GetUxmax(), gPad->GetUymax(),mg->GetYaxis()->GetXmin()*1.5,mg->GetYaxis()->GetXmax()*1.5);
97 sizeaxis->SetLineColor(kRed);
98 sizeaxis->SetLabelColor(kRed);
99// sizeaxis->Draw();
100
101 TPaveText *pave = new TPaveText(5,472,35,600,"r");
102 pave->AddText("Delphes performances");
103 char text[500];
104 sprintf(text,"1 kevts in %.2f s",fit->GetParameter(1));
105 pave->AddText(text);
106 pave->AddText("pp #rightarrow t #bar{t} X");
107 pave->Draw();
108 pave->SetBorderSize(0);
109 pave->SetFillStyle(0);
110 pave->SetTextAlign(12);
111 pave->SetTextFont(42);
112
113 //TLegend * leg = new TLegend(30,80,50,200);
114 TLegend * leg = new TLegend(0.6,0.2,0.9,0.4);
115 leg->AddEntry(time,"General","p");
116 leg->AddEntry(time1,"Event loop only","p");
117 leg->SetBorderSize(0);
118 leg->SetFillStyle(0);
119 leg->SetTextFont(42);
120 leg->Draw();
121
122 float vals[]= {0.74, 0.26};
123 int nvals = sizeof(vals)/sizeof(vals[0]);
124 char * labels[] = {"Event loop","Convertor"};
125 TPie * pie = new TPie("pie","",nvals,vals);
126 //pie->Draw();
127
128}
129
130
131void plot_filesize() {
132 setTDRStyle();
133 gROOT->Reset();
134 TMultiGraph * mg = new TMultiGraph();
135
136 const int N = 6;
137 float * n = new float[N];
138 n[0] = 5; n[1] = 10; n[2] = 20;
139 n[3] = 30; n[4] = 40; n[5] = 50;
140
141 float * s = new float[N];
142 s[0]=119.; s[1]=236.; s[2]=496.;
143 s[3]=702.; s[4]=936.; s[5]=1198.;
144 TGraph * size = new TGraph(N,n,s);
145 size->SetMarkerStyle(21);
146 mg->Add(size,"P");
147
148 mg->Draw("A");
149 mg->GetXaxis()->SetTitle("N (kevts)");
150 mg->GetYaxis()->SetTitle("File size(MB)");
151 mg->GetYaxis()->SetTitleOffset(1.31);
152
153 TF1 * fit = new TF1("fit","[0]+[1]*x",5,50);
154 fit->SetLineColor(kBlack);
155 fit->SetLineStyle(2);
156 fit->SetLineWidth(1);
157 size->Fit("fit","F");
158
159 TPaveText *pave = new TPaveText(5,944,35,1200,"r");
160 pave->AddText("Delphes performances");
161 char text[500];
162 sprintf(text,"1 kevts in %.2f MB",fit->GetParameter(1));
163 pave->AddText(text);
164 pave->AddText("pp #rightarrow t #bar{t} X");
165 pave->Draw();
166 pave->SetBorderSize(0);
167 pave->SetFillStyle(0);
168 pave->SetTextAlign(12);
169 pave->SetTextFont(42);
170
171}
172
173void plot_timerepartition(float r=30.) {
174// float s[]= {119, 236, 496, 702, 936, 1198};
175 float vals[]= {0.74, 0.26};
176 int nvals = sizeof(vals)/sizeof(vals[0]);
177 char * labels[] = {"Event loop","Convertor"};
178 TPie * pie = new TPie("pie","",nvals,vals);
179 pie->Draw();
180
181 TPaveText *pave = new TPaveText(0.1,0.7,0.5,0.97,"br");
182 pave->AddText("Time repartition");
183 pave->Draw();
184 pave->SetBorderSize(0);
185 pave->SetFillStyle(0);
186 pave->SetTextAlign(12);
187 pave->SetTextFont(42);
188
189 pie->SetAngularOffset(r);
190 pie->SetEntryRadiusOffset( 1, 0.01);
191 pie->SetRadius(.15);
192 pie->SetHeight(0.04);
193 pie->SetLabels(labels);
194 pie->SetLabelsOffset(0);
195 pie->SetTextSize(0.06);
196 pie->Draw("3d");
197}
Note: See TracBrowser for help on using the repository browser.