1 |
/*************************************************
|
2 |
Plots 2 profile plots onto same canvas before
|
3 |
and after a specific cut.
|
4 |
|
5 |
Should be used with my rootlogon.C
|
6 |
|
7 |
|
8 |
Example Use:
|
9 |
ProfileBeforeNAfter(TreePhotonAndJet,"(recPhtn.et-genParticle1.et)/genParticle1.et:genParticle1.et","recPhtn.isLoosePhoton>0","recPhtn.isTightPhoton>0&&recPhtn.r9>0.93","Loose #gamma","Tight #gamma","(RecEt-GenEt)/GenEt","E_{T} (GeV)")
|
10 |
|
11 |
Michael B. Anderson
|
12 |
June 30, 2008
|
13 |
*************************************************/
|
14 |
|
15 |
void ProfileBeforeNAfter(TTree* aTree,
|
16 |
TString thingToPlot,
|
17 |
TString cuts1,
|
18 |
TString cuts2,
|
19 |
TString label1="",
|
20 |
TString label2="",
|
21 |
TString title="",
|
22 |
TString xAxisLabel="") {
|
23 |
|
24 |
int events1 = aTree->Draw(thingToPlot,cuts1,"box");
|
25 |
htemp->ProfileX()->Draw();
|
26 |
h1=(TH1*)htemp_pfx->Clone();
|
27 |
|
28 |
int events2 = aTree->Draw(thingToPlot,cuts2,"box");
|
29 |
htemp->ProfileX()->Draw();
|
30 |
h2=(TH1*)htemp_pfx->Clone();
|
31 |
|
32 |
if (title == "") {
|
33 |
h1->SetTitle(thingToPlot);
|
34 |
} else {
|
35 |
h1->SetTitle(title);
|
36 |
}
|
37 |
if (xAxisLabel != "") h1->GetXaxis()->SetTitle(xAxisLabel);
|
38 |
|
39 |
cout << "Plotting " << thingToPlot << endl;
|
40 |
cout << events1 << " events pass " << cuts1 << endl;
|
41 |
cout << events2 << " events pass " << cuts2 << endl;
|
42 |
cout << "y mean1 = " << h1->GetMean(2) << endl;
|
43 |
cout << "y mean2 = " << h2->GetMean(2) << endl;
|
44 |
|
45 |
// This is a thing loaded in the rootlogon.C
|
46 |
Plot2hists1D(h1,h2,label1,label2);
|
47 |
|
48 |
}
|