[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"
|
---|
| 7 |
|
---|
| 8 | void plot_performances() {
|
---|
| 9 | setTDRStyle();
|
---|
| 10 | gROOT->Reset();
|
---|
| 11 | TMultiGraph * mg = new TMultiGraph();
|
---|
| 12 |
|
---|
| 13 | const int N = 6;
|
---|
| 14 | float * n = new float[N];
|
---|
| 15 | n[0] = 5; n[1] = 10; n[2] = 20;
|
---|
| 16 | n[3] = 30; n[4] = 40; n[5] = 50;
|
---|
| 17 |
|
---|
| 18 | float * t = new float[N];
|
---|
| 19 | t[0]= 60.44; t[1] = 124.74; t[2] = 239.38;
|
---|
| 20 | t[3]=376.08; t[4] = 499.34; t[5] = 603.238;
|
---|
| 21 | TGraph * time = new TGraph(N,n,t);
|
---|
| 22 | time->SetMarkerStyle(20);
|
---|
| 23 | mg->Add(time,"P");
|
---|
| 24 |
|
---|
| 25 | float * t1 = new float[N];
|
---|
| 26 | t1[0]= 45.01; t1[1] = 93.25; t1[2] = 177.34;
|
---|
| 27 | t1[3]=280.6; t1[4] = 369.97; t1[5] = 444.52;
|
---|
| 28 | TGraph * time1 = new TGraph(N,n,t1);
|
---|
| 29 | time1->SetMarkerStyle(24);
|
---|
| 30 | mg->Add(time1,"P");
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | float * s = new float[N];
|
---|
| 34 | s[0]=119./1.5; s[1]=236./1.5; s[2]=496./1.5;
|
---|
| 35 | s[3]=702./1.5; s[4]=936./1.5; s[5]=1198./1.5;
|
---|
| 36 | TGraph * size = new TGraph(N,n,s);
|
---|
| 37 | size->SetMarkerStyle(21);
|
---|
| 38 | size->SetMarkerColor(kRed);
|
---|
| 39 | // mg->Add(size,"P");
|
---|
| 40 |
|
---|
| 41 | mg->Draw("A");
|
---|
| 42 | mg->GetXaxis()->SetTitle("N (kevts)");
|
---|
| 43 | mg->GetYaxis()->SetTitle("CPU time(s)");
|
---|
| 44 | mg->GetYaxis()->SetTitleOffset(1.21);
|
---|
| 45 |
|
---|
| 46 | TF1 * fit = new TF1("fit","[0]+[1]*x",5,50);
|
---|
| 47 | fit->SetLineColor(kBlack);
|
---|
| 48 | fit->SetLineStyle(2);
|
---|
| 49 | fit->SetLineWidth(1);
|
---|
| 50 | time->Fit("fit","");
|
---|
| 51 |
|
---|
| 52 | TGaxis *sizeaxis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), gPad->GetUxmax(), gPad->GetUymax(),mg->GetYaxis()->GetXmin()*1.5,mg->GetYaxis()->GetXmax()*1.5);
|
---|
| 53 | sizeaxis->SetLineColor(kRed);
|
---|
| 54 | sizeaxis->SetLabelColor(kRed);
|
---|
| 55 | // sizeaxis->Draw();
|
---|
| 56 |
|
---|
| 57 | TPaveText *pave = new TPaveText(5,472,35,600,"r");
|
---|
| 58 | pave->AddText("Delphes performances");
|
---|
| 59 | char text[500];
|
---|
| 60 | sprintf(text,"10 kevts in %.2f s",fit->GetParameter(1));
|
---|
| 61 | pave->AddText(text);
|
---|
| 62 | pave->AddText("pp #rightarrow t #bar{t} X");
|
---|
| 63 | pave->Draw();
|
---|
| 64 | pave->SetBorderSize(0);
|
---|
| 65 | pave->SetFillStyle(0);
|
---|
| 66 | pave->SetTextAlign(12);
|
---|
| 67 | pave->SetTextFont(42);
|
---|
| 68 |
|
---|
| 69 | //TLegend * leg = new TLegend(30,80,50,200);
|
---|
| 70 | TLegend * leg = new TLegend(0.6,0.2,0.9,0.4);
|
---|
| 71 | leg->AddEntry(time,"General","p");
|
---|
| 72 | leg->AddEntry(time1,"Event loop only","p");
|
---|
| 73 | leg->SetBorderSize(0);
|
---|
| 74 | leg->SetFillStyle(0);
|
---|
| 75 | leg->SetTextFont(42);
|
---|
| 76 | leg->Draw();
|
---|
| 77 | }
|
---|