TChain and TCut, superimposing two histograms

Hello,
how can I superimpose the histograms h1 and h2 in the following macro? Moreover, is this the correct way to use cuts? In fact, when I try to plot only one histogram I get an error message related to TCut.
Thank you,
Mark

void macro(){

TCut c1 “a==b”;
TCut c2 “d>e”;

TChain ch(“tree”);
ch.Add(“myfile1.root”);
ch.Add(“myfile2.root”);

TCanvas *C = new TCanvas();

TH1F *h1 = new TH1F(“h1”,“h1”, nbins, x1, x2);
TH1F *h2 = new TH1F(“h2”, “h2”, nbins, x1, x2);

ch.Draw(“Y>>h1”, c1 && c2);
ch.Draw(“X>>h2”, c1 && c2);

C->SaveAs(“myplot.pdf”);
}

The 2nd Draw should be:

ch.Draw(“X>>h2”, c1 && c2,"same");

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.