{
// Macro to plot the Super-Kamiokande muon decay data.  The data is in
// mudkTime.dat which saves one lifetime per line (in microseconds).
std::ifstream input("mudkTime.dat");

TH1F* h = new TH1F("mudkTime","Muon Decay Times",50,0.0,10000.0);
h->SetXTitle("Decay Times (ns)");
h->SetYTitle("Decays per 200 ns");

double time;
for (;;) {
    input >> time;
    if (!input.good()) break;
    time *= 1000;
    h->Fill(time);
}
input.close();

// Make sure to plot the:
// n -- Histogram name
// e -- Histogram entries
// m -- Histogram mean
// r -- Histogram RMS
// u -- Histogram underflows
// o -- Histogram overflows
gStyle->SetOptStat("nemruo");

// Draw the histogram with error bars
h->Draw("E");

// Save the histogram picture
gPad->Print("mudkTime.png");
}
