////////////////////////////////////////////////////////////////////
/// \file insoc.cc
///
/// \brief Loads standard information from a soc file
///
/// \author P G Jones
///
/// REVISION HISTORY:\n
/// 2014-05-29 : P G Jones - Added header information.\n
// 2018-02-10 : R Lane - change to function arguments necessary for ROOT 6 compatibility
///
/// \details The standard information is checked to ensure the insoc
/// producer works correctly.
///
////////////////////////////////////////////////////////////////////
#include
#include
#include
#include
#include
#include
#include
void insoc(std::string event_file, std::string outfile)
{
RAT::DU::SOCReader* socReader = new RAT::DU::SOCReader(event_file);
TFile *outtfile = new TFile(outfile.c_str(),"RECREATE");
TH1D* hTimeCentroid = new TH1D( "hTimeCentroid", "Peak finding time centroid", 40, 200.0, 400.0 );
hTimeCentroid->SetXTitle( "Fitted Time Centroid [ns]" );
hTimeCentroid->SetYTitle( "Count per 5 ns bin." );
const TVector3 mcPosition( 1000.0, 0.0, 0.0 ); // Should load this
for( size_t isoc = 0; isoc < socReader->GetSOCCount(); isoc++ )
{
const RAT::DS::SOC& rSoc = socReader->GetSOC( isoc );
std::vector pmtIDs = rSoc.GetSOCPMTIDs();
for( size_t ipmt = 0; ipmt < pmtIDs.size(); ipmt++ )
if( rSoc.GetSOCPMT( pmtIDs[ipmt] ).GetPeakFindOK() == 0 )
hTimeCentroid->Fill( rSoc.GetSOCPMT( pmtIDs[ipmt] ).GetTimeCentroid() );
}
outtfile->cd();
hTimeCentroid->Write();
outtfile->Close();
delete outtfile;
delete socReader;
}