////////////////////////////////////////////////////////////////////
/// \file ntuple.c
///
/// \brief Extracts standard information from ntuple files.
///
/// \author P G Jones <p.g.jones@qmul.ac.uk>
///
/// REVISION HISTORY:\n
///     2014-05-29 : P G Jones - Added header information.\n
///
/// \details
///
////////////////////////////////////////////////////////////////////
#include <TFile.h>
#include <TTree.h>
#include <TH1F.h>

void make_plots(TFile*, TTree* T, TFile* out_file)
{
  TH1F* hKE = new TH1F("hKE", "Particle Kinetic Energy", 8, 0.0, 8.0);
  hKE->SetYTitle("Events per 1MeV bin");
  hKE->SetXTitle("Particle Kinetic Energy [MeV]");
  TH1F* hNhits = new TH1F("hNhits", "Nhits", 2, 0.0, 100.0);
  hNhits->SetYTitle("Events per 50 nhit bin");
  hNhits->SetXTitle("Nhits");
  TH1F* hEnergy = new TH1F("hEnergy", "Reconstructed Energy", 8, 0.0, 8.0);
  hEnergy->SetYTitle("Events per 1MeV bin");
  hEnergy->SetXTitle("Reconstructed Energy [MeV]");

  T->Draw("mcke1>>hKE", "", "goff");
  T->Draw("nhits>>hNhits", "", "goff");
  T->Draw("energy>>hEnergy", "waterFit==1", "goff");


  out_file->cd();
  hKE->Write();
  hNhits->Write();
  hEnergy->Write();
}