Fork me on GitHub

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

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

first test 2.0

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