////////////////////////////////////////////////////////////////////
/// \file geoprint.cc
///
/// \brief Extracts step lengths from tracking
///
/// \author P G Jones
///
/// REVISION HISTORY:\n
/// 2014-05-29 : P G Jones - Added header information.\n
/// 2016-10-19 : M Stringer - Changes to how MCTracks are accessed (PR #1508).
// 2018-02-10 : R Lane - change to function arguments necessary for ROOT 6 compatibility
///
/// \details The step lengths are dependent on the geometry.
///
////////////////////////////////////////////////////////////////////
#include
#include
#include
#include
#include
#include
#include
void geoprint(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* stepSize = new TH1D("hStepSize", "Distance between volume boundaries for isotropic particle tracks", 1000, 0, 3500);
stepSize->SetYTitle("Events per bin");
stepSize->SetXTitle("Distance between volume boundaries (mm)");
for( size_t iEntry = 0; iEntry < dsReader->GetEntryCount(); iEntry++ )
{
const RAT::DS::Entry& rDS = dsReader->GetEntry( iEntry );
const RAT::DS::MC& rMC = rDS.GetMC();
std::vector mcTrackIDs = rMC.GetMCTrackIDs();
for( size_t iTrack = 0; iTrack < mcTrackIDs.size(); iTrack++ )
{
const RAT::DS::MCTrack& rMCTrack = rMC.GetMCTrack( mcTrackIDs.at(iTrack) );
for( size_t iStep = 0; iStep < rMCTrack.GetMCTrackStepCount(); iStep++ )
stepSize->Fill( rMCTrack.GetMCTrackStep( iStep ).GetLength() );
}
}
stepSize->SetMinimum(0);
outtfile->cd();
stepSize->Write();
outtfile->Close();
delete outtfile;
delete dsReader;
}