using namespace std; using namespace TMath; void Main(){ TFile *in = new TFile("EfficiencyResults.root"); TTree *tree = (TTree*)in->Get("Efficiency"); double entries, eff, sig1, count, sig2; tree->SetBranchAddress("Entries",&entries); tree->SetBranchAddress("Efficiency",&eff); tree->SetBranchAddress("Eff_Sigma",&sig1); tree->SetBranchAddress("Counts",&count); tree->SetBranchAddress("Counts_Sigma",&sig2); const int ds = tree->GetEntries(); double hent[ds], hcount[ds], hsig[ds], hex[ds]; for(int i = 0; iGetEntry(i); hent[i] = entries; hcount[i] = count; hsig[i] = sig2/Sqrt(40); hex[i] = 0; } TGraphErrors *g = new TGraphErrors(ds,hent,hcount,hex,hsig); g->Fit("pol1"); g->GetYaxis()->SetTitle("Counts"); g->GetXaxis()->SetTitle("Signal"); g->SetMarkerColor(kBlue); g->SetMarkerStyle(20); g->Draw("ALP RX"); gPad->Update(); }