////////////////////////////////////////////////////////////////////
/// \file PlotSOC.cc
///
/// \brief Functions to plot soc centroid times
///
/// \author P G Jones
///
/// REVISION HISTORY:\n
/// 2014-04-03 : P G Jones - First Revision.\n
///
/// \details The centroid times are calculated by the soc peak fitter
/// proc and the soc data itself the soc data proc.
///
////////////////////////////////////////////////////////////////////
#include
#include
#include
#include
#include
#include
#include
using namespace std;
/// Plot the centroid hit time
///
/// @param[in] fileName of the RAT::SOC root file to analyse
/// @return the histogram plot
TH1D* PlotCentroid( const string& fileName )
{
TH1D* hCentroid = new TH1D( "hCentroid", "Centroid hit time", 500, 0.0, 500.0 );
// If this is being done on data that does not require remote database connection
// eg.: a simple simulation with default run number (0)
// We can disable the remote connections:
//
// NOTE: Don't do this if you are using real data!!!
RAT::DB::Get()->SetAirplaneModeStatus(true);
RAT::DU::SOCReader socReader( fileName );
for( size_t isoc = 0; isoc < socReader.GetSOCCount(); isoc++ )
{
const RAT::DS::SOC& rSOC = socReader.GetSOC( isoc );
vector pmtIDs = rSOC.GetSOCPMTIDs();
for( size_t ipmt = 0; ipmt < pmtIDs.size(); ipmt++ )
hCentroid->Fill( rSOC.GetSOCPMT( pmtIDs[ipmt] ).GetTimeCentroid() );
}
hCentroid->GetYaxis()->SetTitle( "Time [ns]" );
hCentroid->GetXaxis()->SetTitle( "Centroid hit time" );
hCentroid->Draw();
return hCentroid;
}