//file twocuts.C
void twocuts() {
   //example of two graphical cuts on a 2-d histogram
   //used as cuts when making a Tree projection
   //file hsimple.root generated by ROOT tutorial hsimple.C
   TFile *f = TFile::Open("hsimple.root");
   TH2F *hpxpy = (TH2F*)f->Get("hpxpy");
   TCanvas *c1 = new TCanvas("c1","cuts",600,800);
   c1->Divide(1,2);
   c1->cd(1);
   hpxpy->Draw();
   TCutG *cut1 = new TCutG("cut1",6);
   cut1->SetVarX("px");
   cut1->SetVarY("py");
   cut1->SetPoint(0,-2.12644,1.37712);
   cut1->SetPoint(1,-2.95977,-1.7161);
   cut1->SetPoint(2,-0.775862,-2.94492);
   cut1->SetPoint(3,-0.114943,-0.423729);
   cut1->SetPoint(4,-1.52299,-0.614407);
   cut1->SetPoint(5,-2.12644,1.37712);
   cut1->Draw("l");  
   TCutG *cut2 = new TCutG("cut2",7);
   cut2->SetVarX("px");
   cut2->SetVarY("py");
   cut2->SetPoint(0,-0.143678,2.16102);
   cut2->SetPoint(1,-0.890805,0.783898);
   cut2->SetPoint(2,-0.229885,-2.05508);
   cut2->SetPoint(3,1.81034,-1.08051);
   cut2->SetPoint(4,1.66667,1.03814);
   cut2->SetPoint(5,0.201149,0);
   cut2->SetPoint(6,-0.143678,2.16102);
   cut2->Draw("l");
   
   c1->cd(2);
   TNtuple *ntuple = (TNtuple*)f->Get("ntuple");
   ntuple->Draw("px","cut1 || cut2");
}

