1 | /*
|
---|
2 | root -l examples/ProcessingTime.C\(\"delphes_output.root\"\)
|
---|
3 | */
|
---|
4 |
|
---|
5 | static const Font_t kExRootFont = 42;
|
---|
6 | static const Float_t kExRootFontSize = 0.04;
|
---|
7 | static const Color_t kExRootBackgroundColor = 10;
|
---|
8 |
|
---|
9 | //------------------------------------------------------------------------------
|
---|
10 |
|
---|
11 | TGraphErrors gr;
|
---|
12 | TPaveText comment(0.20, 0.72, 0.50, 0.81, "brNDC");
|
---|
13 |
|
---|
14 | TCanvas *canvas;
|
---|
15 |
|
---|
16 | //------------------------------------------------------------------------------
|
---|
17 |
|
---|
18 | void ProcessingTime(const char *inputFile)
|
---|
19 | {
|
---|
20 | TChain *chain = new TChain("Delphes");
|
---|
21 | chain->Add(inputFile);
|
---|
22 |
|
---|
23 | TH1F hist("time", "time", 50, 0, 0.01);
|
---|
24 | Int_t i;
|
---|
25 |
|
---|
26 | TDirectory *currentDirectory = gDirectory;
|
---|
27 |
|
---|
28 | // Graphics style parameters to avoid grey background on figures
|
---|
29 | gStyle->SetCanvasColor(kExRootBackgroundColor);
|
---|
30 | gStyle->SetStatColor(kExRootBackgroundColor);
|
---|
31 | // gStyle->SetTitleColor(kExRootBackgroundColor);
|
---|
32 | gStyle->SetPadColor(kExRootBackgroundColor);
|
---|
33 |
|
---|
34 | gStyle->SetPadTopMargin(0.10);
|
---|
35 | gStyle->SetPadRightMargin(0.10);
|
---|
36 | gStyle->SetPadBottomMargin(0.15);
|
---|
37 | gStyle->SetPadLeftMargin(0.15);
|
---|
38 |
|
---|
39 | gStyle->SetStatFont(kExRootFont);
|
---|
40 | gStyle->SetStatFontSize(kExRootFontSize);
|
---|
41 |
|
---|
42 | gStyle->SetTitleFont(kExRootFont, "");
|
---|
43 | gStyle->SetTitleFont(kExRootFont, "X");
|
---|
44 | gStyle->SetTitleFont(kExRootFont, "Y");
|
---|
45 | gStyle->SetTitleFont(kExRootFont, "Z");
|
---|
46 | gStyle->SetTitleSize(kExRootFontSize, "");
|
---|
47 | gStyle->SetTitleSize(kExRootFontSize, "X");
|
---|
48 | gStyle->SetTitleSize(kExRootFontSize, "Y");
|
---|
49 | gStyle->SetTitleSize(kExRootFontSize, "Z");
|
---|
50 |
|
---|
51 | gStyle->SetLabelFont(kExRootFont, "X");
|
---|
52 | gStyle->SetLabelFont(kExRootFont, "Y");
|
---|
53 | gStyle->SetLabelFont(kExRootFont, "Z");
|
---|
54 | gStyle->SetLabelSize(kExRootFontSize, "X");
|
---|
55 | gStyle->SetLabelSize(kExRootFontSize, "Y");
|
---|
56 | gStyle->SetLabelSize(kExRootFontSize, "Z");
|
---|
57 |
|
---|
58 | gStyle->SetPadTickX(1);
|
---|
59 | gStyle->SetPadTickY(1);
|
---|
60 |
|
---|
61 | gStyle->SetTextFont(kExRootFont);
|
---|
62 | gStyle->SetTextSize(kExRootFontSize);
|
---|
63 |
|
---|
64 | gStyle->SetOptStat(111110);
|
---|
65 | // gStyle->SetOptFit(101);
|
---|
66 |
|
---|
67 | canvas = static_cast<TCanvas*>(gROOT->FindObject("c1"));
|
---|
68 | if(canvas)
|
---|
69 | {
|
---|
70 | canvas->Clear();
|
---|
71 | canvas->UseCurrentStyle();
|
---|
72 | canvas->SetWindowSize(800, 650);
|
---|
73 | }
|
---|
74 | else
|
---|
75 | {
|
---|
76 | canvas = new TCanvas("c1", "c1", 800, 650);
|
---|
77 | }
|
---|
78 | canvas->SetGrid();
|
---|
79 | canvas->SetHighLightColor(kExRootBackgroundColor);
|
---|
80 |
|
---|
81 | currentDirectory->cd();
|
---|
82 |
|
---|
83 | for(i = 1; i < 9; ++i)
|
---|
84 | {
|
---|
85 | chain->Draw("Event.ProcTime >> time", TString::Format("Jet_size == %d", i+1));
|
---|
86 | gr.SetPoint(i, i+1, hist.GetMean()*1000);
|
---|
87 | gr.SetPointError(i, 0, hist.GetRMS()*1000);
|
---|
88 | }
|
---|
89 |
|
---|
90 | gr.GetXaxis()->SetLimits(1.0, 10.0);
|
---|
91 | gr.GetXaxis()->SetTitleOffset(1.5);
|
---|
92 | gr.GetYaxis()->SetTitleOffset(1.75);
|
---|
93 | gr.GetXaxis()->SetTitle("jet multiplicity");
|
---|
94 | gr.GetYaxis()->SetTitle("processing time per event, ms");
|
---|
95 | gr.SetMarkerStyle(kFullCircle);
|
---|
96 | gr.SetMarkerColor(kRed);
|
---|
97 | gr.SetMarkerSize(1);
|
---|
98 | gr.SetLineColor(kRed);
|
---|
99 | gr.SetLineWidth(2);
|
---|
100 | gr.Draw("AP");
|
---|
101 |
|
---|
102 | comment.SetTextSize(kExRootFontSize);
|
---|
103 | comment.SetTextFont(kExRootFont);
|
---|
104 | comment.SetTextAlign(22);
|
---|
105 | comment.SetFillColor(kExRootBackgroundColor);
|
---|
106 | comment.SetBorderSize(0);
|
---|
107 | comment.AddText("ttbar + jets events");
|
---|
108 | comment.Draw();
|
---|
109 | }
|
---|
110 |
|
---|