#include "Riostream.h" #include "TAxis.h" #include "TGaxis.h" void dose80() { ifstream in; in.open(Form("test1.txt")); Float_t px,py; Int_t nlines = 0; Int_t xmin=-10, xmax=10, Nx=1000; // TProfile limits and number of bins, for x TCanvas *c1 = new TCanvas("c1","Profile histogram example",200,10,700,500); TProfile *h11 = new TProfile("hprof","Profile of pz versus px",Nx,xmin,xmax,0,100); while (1) { in >> px >> py; if (!in.good()) break; nlines++; h11->Fill(px,py,1); } h11->Draw("20"); TAxis *xaxis = h11->GetXaxis(); Double_t x = 0, y = 0; // x- and y-axis values Double_t tDose = 80; // target dose to look for Double_t delta = 0.1; // we look for tDose +- delta Double_t minD = tDose-delta, maxD = tDose+delta; // interval around the desired dose for (Int_t i=1; i<=Nx; ++i) { y = h11->GetBinContent(i); if (y>minD && yGetBinCenter(i); cout << x << " " << y << endl; // print x value and dose } } }