ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/FGolf/tcmet/scripts/plotMETHistos1.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

# User Rev Content
1 benhoob 1.1 void plotMETHistos1(TH1F* h1, TH1F* h2,TH1F* h3,TH1F* h4,
2     char* title,char* xtitle,float min,bool drawLeg){
3    
4     gROOT->LoadMacro("scripts/fround.C");
5    
6     gStyle->SetOptStat(0);
7     gPad->SetLogy(1);
8    
9     h1->SetFillColor(0);
10     h2->SetFillColor(0);
11     h3->SetFillColor(0);
12     h4->SetFillColor(0);
13     h1->SetLineWidth(2);
14     h2->SetLineWidth(2);
15     h3->SetLineWidth(2);
16     h4->SetLineWidth(2);
17     h1->SetLineColor(1);
18     h2->SetLineColor(2);
19     h3->SetLineColor(4);
20     h4->SetLineColor(6);
21     h2->SetMarkerColor(2);
22     h3->SetMarkerColor(4);
23     h4->SetMarkerColor(6);
24     h1->SetTitle(title);
25     h1->GetXaxis()->SetTitle(xtitle);
26    
27     h1->Draw();
28     h2->Draw("same");
29     h3->Draw("same");
30     h4->Draw("same");
31    
32     float max=h1->GetMaximum();
33     if(h2->GetMaximum()>max) max=h2->GetMaximum();
34     if(h3->GetMaximum()>max) max=h3->GetMaximum();
35     if(h4->GetMaximum()>max) max=h4->GetMaximum();
36    
37     h1->SetMaximum(1.5*max);
38     h1->SetMinimum(min);
39    
40     TLine line;
41     line.SetLineStyle(2);
42     line.DrawLine(50,min,50,1.5*max);
43    
44     stringstream s;
45     s<<"#epsilon = "<<fround(1e4*h4->Integral(26,60)/h4->Integral(1,60),2)<<"#times10^{-4}"<<endl;
46     TLatex *t=new TLatex();
47     t->SetNDC();
48     t->SetTextColor(6);
49     t->DrawLatex(0.15,0.15,s.str().c_str());
50    
51     if(drawLeg){
52     TLegend *leg=new TLegend(0.6,0.6,0.85,0.85);
53     leg->AddEntry(h1,"caloMET");
54     leg->AddEntry(h2,"muCorrMET");
55     leg->AddEntry(h3,"tcMET");
56     leg->AddEntry(h4,"tcMETNew");
57     leg->SetFillColor(0);
58     leg->SetBorderSize(1);
59     leg->Draw();
60     }
61    
62     }
63    
64     void plotMETHistos1(TH1F* h1, TH1F* h2,TH1F* h3,
65     char* c1, char* c2, char* c3,
66     char* title,char* xtitle,float min,bool drawLeg,bool writeLatex){
67    
68     gROOT->LoadMacro("scripts/fround.C");
69    
70     gStyle->SetOptStat(0);
71     gPad->SetLogy(1);
72    
73     h1->SetFillColor(0);
74     h2->SetFillColor(0);
75     h3->SetFillColor(0);
76     h1->SetLineWidth(2);
77     h2->SetLineWidth(2);
78     h3->SetLineWidth(2);
79     h1->SetLineColor(1);
80     h2->SetLineColor(2);
81     h3->SetLineColor(4);
82     h2->SetMarkerColor(2);
83     h3->SetMarkerColor(4);
84     h1->SetTitle(title);
85     h1->GetXaxis()->SetTitle(xtitle);
86    
87     h1->Draw();
88     h2->Draw("same");
89     h3->Draw("same");
90    
91     float max=h1->GetMaximum();
92     if(h2->GetMaximum()>max) max=h2->GetMaximum();
93     if(h3->GetMaximum()>max) max=h3->GetMaximum();
94    
95     h1->SetMaximum(1.1*max);
96     h1->SetMinimum(min);
97    
98     TLine line;
99     line.SetLineStyle(2);
100     line.DrawLine(50,min,50,1.5*max);
101    
102     if(writeLatex){
103     stringstream s1;
104     s1<<"N(>50) = "<<h1->Integral(26,60)<<endl;
105     stringstream s2;
106     s2<<"N(>50) = "<<h2->Integral(26,60)<<endl;
107     stringstream s3;
108     s3<<"N(>50) = "<<h3->Integral(26,60)<<endl;
109     TLatex *t=new TLatex();
110     t->SetNDC();
111     t->SetTextSize(0.06);
112     t->DrawLatex(0.15,0.35,s1.str().c_str());
113     t->SetTextColor(2);
114     t->DrawLatex(0.15,0.25,s2.str().c_str());
115     t->SetTextColor(4);
116     t->DrawLatex(0.15,0.15,s3.str().c_str());
117     }
118    
119     if(drawLeg){
120     TLegend *leg=new TLegend(0.6,0.6,0.85,0.85);
121     leg->AddEntry(h1,c1);
122     leg->AddEntry(h2,c2);
123     leg->AddEntry(h3,c3);
124     leg->SetFillColor(0);
125     leg->SetBorderSize(1);
126     leg->Draw();
127     }
128    
129     }
130    
131     void plotMETHistos1(TH1F* h1, TH1F* h2,
132     char* c1, char* c2,
133     char* title,char* xtitle,float min,bool drawLeg,bool writeLatex){
134    
135     gROOT->LoadMacro("scripts/fround.C");
136    
137     gStyle->SetOptStat(0);
138     gPad->SetLogy(1);
139    
140     h1->SetFillColor(0);
141     h2->SetFillColor(0);
142     h1->SetLineWidth(2);
143     h2->SetLineWidth(2);
144     h1->SetLineColor(1);
145     h2->SetLineColor(2);
146     h2->SetMarkerColor(2);
147     h1->SetTitle(title);
148     h1->GetXaxis()->SetTitle(xtitle);
149    
150     h1->Draw();
151     h2->Draw("same");
152    
153     float max=h1->GetMaximum();
154     if(h2->GetMaximum()>max) max=h2->GetMaximum();
155    
156     h1->SetMaximum(1.5*max);
157     h1->SetMinimum(min);
158    
159     TLine line;
160     line.SetLineStyle(2);
161     line.DrawLine(50,min,50,1.5*max);
162    
163     stringstream s1;
164     if(writeLatex){
165     s1<<"N(>50) = "<<h1->Integral(26,60)<<endl;
166     stringstream s2;
167     s2<<"N(>50) = "<<h2->Integral(26,60)<<endl;
168     TLatex *t=new TLatex();
169     t->SetNDC();
170     t->SetTextSize(0.06);
171     t->SetTextColor(1);
172     t->DrawLatex(0.15,0.25,s1.str().c_str());
173     t->SetTextColor(2);
174     t->DrawLatex(0.15,0.15,s2.str().c_str());
175     }
176    
177     if(drawLeg){
178     TLegend *leg=new TLegend(0.6,0.6,0.85,0.85);
179     leg->AddEntry(h1,c1);
180     leg->AddEntry(h2,c2);
181     leg->SetFillColor(0);
182     leg->SetBorderSize(1);
183     leg->Draw();
184     }
185    
186     }
187