Fork me on GitHub

source: svn/trunk/examples/ProcessingTime.C@ 1233

Last change on this file since 1233 was 1213, checked in by Pavel Demin, 11 years ago

change plot colors

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