//////////////////////////////////////////////////////////////////// /// \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). /// /// \details The step lengths are dependent on the geometry. /// //////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include void make_plots(RAT::DU::DSReader* dsReader, TFile *out_file) { 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); out_file->cd(); stepSize->Write(); }