/////////////////////////////////////////////////////////////////////////////// /// \file detection.cc /// /// \brief This extracts the MC Photoelectron count /// /// \author P G Jones /// /// REVISION HISTORY:\n /// 2014-07-21 : P G Jones - moved to rat-tools validation.\n // 2018-02-10 : R Lane - change to function arguments necessary for ROOT 6 compatibility /// /// \details This plots the number of photoelectrons, i.e. the number of photons /// that hit the photocathode and are absorbed. /// /////////////////////////////////////////////////////////////////////////////// #include #include #include #include void detection(std::string event_file, std::string outfile) { RAT::DU::DSReader* dsReader = new RAT::DU::DSReader(event_file); TFile *outtfile = new TFile(outfile.c_str(),"RECREATE"); TH1D* hNhits = new TH1D( "nHits", "nHits", 200, 0.0, 2000.0 ); hNhits->SetXTitle( "Number of hits per event." ); hNhits->SetYTitle( "Count per 10 hit bin." ); for( size_t iEntry = 0; iEntry < dsReader->GetEntryCount(); iEntry++ ) { const RAT::DS::Entry& rDS = dsReader->GetEntry( iEntry ); hNhits->Fill( rDS.GetMC().GetMCPECount() ); } outtfile->cd(); hNhits->Write(); outtfile->Close(); delete outtfile; delete dsReader; }