{ //canvas only needed for this documentation TCanvas* c1 = new TCanvas("example","",600,400); c1->SetFillStyle(1001); c1->SetFillColor(kWhite); //create one-dimensional TEfficiency object with fixed bin size TEfficiency* pEff = new TEfficiency("eff","my efficiency;x;#epsilon",20,0,10); TRandom3 rand3; bool bPassed; double x; for(int i=0; i<10000; ++i) { //simulate events with variable under investigation x = rand3.Uniform(10); //check selection: bPassed = DoesEventPassSelection(x) bPassed = rand3.Rndm() < TMath::Gaus(x,5,4); pEff->Fill(bPassed,x); } pEff->Draw("AP"); // pEff->Paint("AP"); c1->Pad()->Update(); TGraphAsymmErrors *gg=pEff->GetPaintedGraph(); cout << gg << endl; if(gg){ TAxis *ax = gg->GetXaxis(); Double_t x1 = ax->GetBinLowEdge(1); Double_t x2 = ax->GetBinUpEdge(ax->GetNbins()); cout << x1 << ";" << x2 <Set(20,0,10); TAxis *ay = gg->GetYaxis(); ay->SetRangeUser(0,1.0); // overwrite auto vector names={ "aaa","bbb","ccc","ddd","eee","fff","ggg","hhh","iii","jjj", "aaa","bbb","ccc","ddd","eee","fff","ggg","hhh","iii","jjj" }; for(Int_t k=0;k<20;k++){ ax->SetBinLabel(k+1,names[k].c_str()); } c1->Print("c1.root"); c1->Print("c1.C"); // pEff->Draw("AP"); } c1->Print("c2.root"); c1->Print("c2.C"); c1->Pad()->Update(); // c1->Draw(); c1->Print("c3.root"); c1->Print("c3.C"); // c1->Paint(); c1->Print("c4.root"); c1->Print("c4.C"); c1->Update(); c1->Print("c5.root"); c1->Print("c5.C"); return c1; }