myChain->Draw("x>>myHist", "y>0");
TGraph* myGraph = new TGraph(); int i = 0; for (Long64_t event = 0; event < myChain->GetEntries(); event++) { myChain->GetEntry(event); double avg = myTree.data->Average(); myGraph->SetPoint(i, event, avg); i++; } myGraph->Draw("ALP");This code loops over all events in the chain and calculates the average "data" value for each file. The resulting graph is then plotted using the Draw method. The package library used in these examples is ROOT.