Fork me on GitHub

source: git/examples/ProcessingTime.C@ 0e0f211

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 0e0f211 was 21f3c04, checked in by Pavel Demin <demin@…>, 10 years ago

replace \(\"...\"\) with '("...")' in ROOT command line examples

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[d7d2da3]1/*
[21f3c04]2root -l examples/ProcessingTime.C'("delphes_output.root")'
[d7d2da3]3*/
4
[a9d423d]5static const Font_t kExRootFont = 42;
6static const Float_t kExRootFontSize = 0.04;
7static const Color_t kExRootBackgroundColor = 10;
8
[d7d2da3]9//------------------------------------------------------------------------------
10
[6ea86ce]11TGraph gr;
12TGraphErrors grerr;
[c1263ee]13TPaveText comment(0.20, 0.75, 0.50, 0.84, "brNDC");
[d7d2da3]14
[a9d423d]15TCanvas *canvas;
16
[d7d2da3]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
[a9d423d]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
[6ea86ce]84 for(i = 0; i < 9; ++i)
[d7d2da3]85 {
[6ea86ce]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);
[d7d2da3]90 }
91
[6ea86ce]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");
[501f858]97 gr.SetMarkerStyle(kFullCircle);
[6ea86ce]98 gr.SetMarkerColor(kBlack);
[501f858]99 gr.SetMarkerSize(1);
[6ea86ce]100 gr.SetLineColor(kBlack);
[501f858]101 gr.SetLineWidth(2);
[6ea86ce]102 grerr.SetFillStyle(1001);
[d6eccdb]103 grerr.SetFillColor(17);
[6ea86ce]104 grerr.Draw("A3");
105 gr.Draw("P");
[501f858]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();
[d7d2da3]114}
115
Note: See TracBrowser for help on using the repository browser.