ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FGolf/tcmet/scripts/plotDeltaMETHistos1.C
Revision: 1.1
Committed: Fri Jan 22 09:58:14 2010 UTC (15 years, 3 months ago) by benhoob
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Log Message:
*** empty log message ***

File Contents

# Content
1 void plotDeltaMETHistos1(TH1F* h1, TH1F* h2,TH1F* h3,
2 char* c1, char* c2, char* c3,
3 char* title,char* xtitle,float min,bool drawLeg,bool writeLatex){
4
5 gROOT->LoadMacro("scripts/fround.C");
6 gStyle->SetOptStat(0);
7
8 h1->SetFillColor(0);
9 h2->SetFillColor(0);
10 h3->SetFillColor(0);
11 h1->SetLineWidth(2);
12 h2->SetLineWidth(2);
13 h3->SetLineWidth(2);
14 h1->SetLineColor(1);
15 h2->SetLineColor(2);
16 h3->SetLineColor(4);
17 h2->SetMarkerColor(2);
18 h3->SetMarkerColor(4);
19 h1->SetTitle(title);
20 h1->GetXaxis()->SetTitle(xtitle);
21 h1->Draw();
22 h2->Draw("same");
23 h3->Draw("same");
24
25 float max=h1->GetMaximum();
26 if(h2->GetMaximum()>max) max=h2->GetMaximum();
27 if(h3->GetMaximum()>max) max=h3->GetMaximum();
28
29 h1->SetMaximum(1.1*max);
30 h1->SetMinimum(min);
31
32 if(writeLatex){
33 stringstream s1;
34 s1<<"RMS = "<<fround(h3->GetRMS(1),2)<<endl;
35 stringstream s2;
36 s2<<"N(TOT) = "<<h3->GetEntries()<<endl;
37 TLatex *t=new TLatex();
38 t->SetNDC();
39 t->SetTextColor(4);
40 t->SetTextSize(0.06);
41 t->DrawLatex(0.15,0.65,s1.str().c_str());
42 t->DrawLatex(0.15,0.75,s2.str().c_str());
43 }
44
45 if(drawLeg){
46 TLegend *leg=new TLegend(0.6,0.6,0.85,0.85);
47 leg->AddEntry(h1,c1);
48 leg->AddEntry(h2,c2);
49 leg->AddEntry(h3,c3);
50 leg->SetFillColor(0);
51 leg->SetBorderSize(1);
52 leg->Draw();
53 }
54
55 }
56
57 void plotDeltaMETHistos1(TH1F* h1, TH1F* h2,
58 char* c1, char* c2,
59 char* title,char* xtitle,float min,bool drawLeg,bool writeLatex){
60
61 gROOT->LoadMacro("scripts/fround.C");
62 gStyle->SetOptStat(0);
63
64 h1->SetFillColor(0);
65 h2->SetFillColor(0);
66 h1->SetLineWidth(2);
67 h2->SetLineWidth(2);
68 h1->SetLineColor(1);
69 h2->SetLineColor(2);
70 h2->SetMarkerColor(2);
71 h1->SetTitle(title);
72 h1->GetXaxis()->SetTitle(xtitle);
73 h1->Draw();
74 h2->Draw("same");
75
76 float max=h1->GetMaximum();
77 if(h2->GetMaximum()>max) max=h2->GetMaximum();
78
79 h1->SetMaximum(1.1*max);
80 h1->SetMinimum(min);
81
82 if(writeLatex){
83 stringstream s1;
84 s1<<"RMS = "<<fround(h1->GetRMS(1),2)<<endl;
85 stringstream s2;
86 s2<<"RMS = "<<fround(h2->GetRMS(1),2)<<endl;
87 TLatex *t=new TLatex();
88 t->SetNDC();
89 t->SetTextSize(0.06);
90 t->SetTextColor(1);
91 t->DrawLatex(0.15,0.75,s1.str().c_str());
92 t->SetTextColor(2);
93 t->DrawLatex(0.15,0.65,s2.str().c_str());
94 }
95
96 if(drawLeg){
97 TLegend *leg=new TLegend(0.6,0.6,0.85,0.85);
98 leg->AddEntry(h1,c1);
99 leg->AddEntry(h2,c2);
100 leg->SetFillColor(0);
101 leg->SetBorderSize(1);
102 leg->Draw();
103 }
104
105 }
106