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 |
|
---|
13 | TCanvas *canvas;
|
---|
14 |
|
---|
15 | //------------------------------------------------------------------------------
|
---|
16 |
|
---|
17 | void ProcessingTime(const char *inputFile)
|
---|
18 | {
|
---|
19 | TChain *chain = new TChain("Delphes");
|
---|
20 | chain->Add(inputFile);
|
---|
21 |
|
---|
22 | TH1F hist("time", "time", 50, 0, 0.01);
|
---|
23 | Int_t i;
|
---|
24 |
|
---|
25 | TDirectory *currentDirectory = gDirectory;
|
---|
26 |
|
---|
27 | // Graphics style parameters to avoid grey background on figures
|
---|
28 | gStyle->SetCanvasColor(kExRootBackgroundColor);
|
---|
29 | gStyle->SetStatColor(kExRootBackgroundColor);
|
---|
30 | // gStyle->SetTitleColor(kExRootBackgroundColor);
|
---|
31 | gStyle->SetPadColor(kExRootBackgroundColor);
|
---|
32 |
|
---|
33 | gStyle->SetPadTopMargin(0.10);
|
---|
34 | gStyle->SetPadRightMargin(0.10);
|
---|
35 | gStyle->SetPadBottomMargin(0.15);
|
---|
36 | gStyle->SetPadLeftMargin(0.15);
|
---|
37 |
|
---|
38 | gStyle->SetStatFont(kExRootFont);
|
---|
39 | gStyle->SetStatFontSize(kExRootFontSize);
|
---|
40 |
|
---|
41 | gStyle->SetTitleFont(kExRootFont, "");
|
---|
42 | gStyle->SetTitleFont(kExRootFont, "X");
|
---|
43 | gStyle->SetTitleFont(kExRootFont, "Y");
|
---|
44 | gStyle->SetTitleFont(kExRootFont, "Z");
|
---|
45 | gStyle->SetTitleSize(kExRootFontSize, "");
|
---|
46 | gStyle->SetTitleSize(kExRootFontSize, "X");
|
---|
47 | gStyle->SetTitleSize(kExRootFontSize, "Y");
|
---|
48 | gStyle->SetTitleSize(kExRootFontSize, "Z");
|
---|
49 |
|
---|
50 | gStyle->SetLabelFont(kExRootFont, "X");
|
---|
51 | gStyle->SetLabelFont(kExRootFont, "Y");
|
---|
52 | gStyle->SetLabelFont(kExRootFont, "Z");
|
---|
53 | gStyle->SetLabelSize(kExRootFontSize, "X");
|
---|
54 | gStyle->SetLabelSize(kExRootFontSize, "Y");
|
---|
55 | gStyle->SetLabelSize(kExRootFontSize, "Z");
|
---|
56 |
|
---|
57 | gStyle->SetPadTickX(1);
|
---|
58 | gStyle->SetPadTickY(1);
|
---|
59 |
|
---|
60 | gStyle->SetTextFont(kExRootFont);
|
---|
61 | gStyle->SetTextSize(kExRootFontSize);
|
---|
62 |
|
---|
63 | gStyle->SetOptStat(111110);
|
---|
64 | // gStyle->SetOptFit(101);
|
---|
65 |
|
---|
66 | canvas = static_cast<TCanvas*>(gROOT->FindObject("c1"));
|
---|
67 | if(canvas)
|
---|
68 | {
|
---|
69 | canvas->Clear();
|
---|
70 | canvas->UseCurrentStyle();
|
---|
71 | canvas->SetWindowSize(800, 650);
|
---|
72 | }
|
---|
73 | else
|
---|
74 | {
|
---|
75 | canvas = new TCanvas("c1", "c1", 800, 650);
|
---|
76 | }
|
---|
77 | canvas->SetGrid();
|
---|
78 | canvas->SetHighLightColor(kExRootBackgroundColor);
|
---|
79 |
|
---|
80 | currentDirectory->cd();
|
---|
81 |
|
---|
82 | for(i = 1; i < 8; ++i)
|
---|
83 | {
|
---|
84 | chain->Draw("Event.ProcTime >> time", TString::Format("Jet_size == %d", i+1));
|
---|
85 | gr.SetPoint(i, i+1, hist.GetMean()*1000);
|
---|
86 | gr.SetPointError(i, 0, hist.GetRMS()*1000);
|
---|
87 | }
|
---|
88 |
|
---|
89 | gr.GetXaxis()->SetLimits(1.0, 9.0);
|
---|
90 | gr.GetXaxis()->SetTitleOffset(1.5);
|
---|
91 | gr.GetYaxis()->SetTitleOffset(1.75);
|
---|
92 | gr.GetXaxis()->SetTitle("number of jets");
|
---|
93 | gr.GetYaxis()->SetTitle("processing time per event, ms");
|
---|
94 | gr.SetMarkerStyle(kFullDotMedium);
|
---|
95 | gr.Draw("AP");
|
---|
96 | }
|
---|
97 |
|
---|