{ TGraph * gr_letratio = new TGraph(); char finname[50]; int j = 1; Double_t x, q; q = 0.5; // 0.5 for "median" // for (int j = 0; j<5;j++){ for (int i = 0; i<26;i++){ sprintf(finname, "jobs%i/runjob%i001_eventdata_out.root",j,i); TFile * f = new TFile(finname,"OPEN"); TH1F * h = (TH1F*)f->Get("h_spratio"); cout << i << " " << h->GetMean() << " +/- " << h->GetRMS() << endl; h->ComputeIntegral(); // just a precaution h->GetQuantiles(1, &x, &q); std::cout << "median = " << x << std::endl; h->Delete(); f->Close(); } // } }