////////////////////////////////////////////////////////////////////
/// \file soc.cc
///
/// \brief This extracts the peak finding times from a SOC file
///
/// \author P G Jones
///
/// REVISION HISTORY:\n
/// 2014-05-29 : P G Jones - Added header information.\n
/// 2015-06-22 : R Stainforth - Updated centroid histogram
/// to account for EXTASY timing offset from
/// the trigger mask in the .mac and .root
/// files associated with this test.
// 2018-02-10 : R Lane - change to function arguments necessary for ROOT 6 compatibility
///
/// \details These should only be correct if the SOC processors all
/// work correctly.
///
////////////////////////////////////////////////////////////////////
#include
#include
#include
#include
#include
#include
void soc(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", 60, 200.0, 500.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;
}