From 5006a4cdc3da9b79b94d273cb01ede052b4e37da Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Wed, 9 Oct 2024 17:57:13 +0200 Subject: [PATCH] fix filter --- src/TRestGeant4Track.cxx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/TRestGeant4Track.cxx b/src/TRestGeant4Track.cxx index 0095034..d428ee8 100644 --- a/src/TRestGeant4Track.cxx +++ b/src/TRestGeant4Track.cxx @@ -118,10 +118,11 @@ void TRestGeant4Track::PrintTrack(size_t maxHits) const { << (GetParentTrack() != nullptr ? TString::Format(" - Parent particle: %s", GetParentTrack()->GetParticleName().Data()).Data() : "") - << " - Created by '" << fCreatorProcess - << "' with initial " - "KE of " - << ToEnergyString(fInitialKineticEnergy) << "" << endl; + << " - Created by '" << fCreatorProcess << "' in volume '" << GetInitialVolume() + << "' with initial KE of " << ToEnergyString(fInitialKineticEnergy) << " - Initial position " + << VectorToString(fInitialPosition) << " mm at time " << ToTimeString(fGlobalTimestamp) + << " - Time length of " << ToTimeString(fTimeLength) << " and spatial length of " + << ToLengthString(fLength) << endl; cout << " Initial position " << VectorToString(fInitialPosition) << " mm at time " << ToTimeString(fGlobalTimestamp) << " - Time length of " << ToTimeString(fTimeLength) @@ -187,11 +188,10 @@ void TRestGeant4Track::PrintTrackFilterVolumes(const std::set& volu ? TString::Format(" - Parent particle: %s", GetParentTrack()->GetParticleName().Data()).Data() : "") << " - Created by '" << fCreatorProcess << "' in volume '" << GetInitialVolume() - << "' with initial KE of " << ToEnergyString(fInitialKineticEnergy) << "" << endl; - - cout << " Initial position " << VectorToString(fInitialPosition) << " mm at time " - << ToTimeString(fGlobalTimestamp) << " - Time length of " << ToTimeString(fTimeLength) - << " and spatial length of " << ToLengthString(fLength) << endl; + << "' with initial KE of " << ToEnergyString(fInitialKineticEnergy) << " - Initial position " + << VectorToString(fInitialPosition) << " mm at time " << ToTimeString(fGlobalTimestamp) + << " - Time length of " << ToTimeString(fTimeLength) << " and spatial length of " + << ToLengthString(fLength) << endl; for (unsigned int i = 0; i < GetNumberOfHits(); i++) { TString processName = GetProcessName(fHits.GetHitProcess(i)); @@ -205,6 +205,9 @@ void TRestGeant4Track::PrintTrackFilterVolumes(const std::set& volu // in case process name is not found, use ID volumeName = TString(std::to_string(fHits.GetHitVolume(i))); } + if (volumeNames.find(volumeName.Data()) == volumeNames.end()) { + continue; + } cout << " - Hit " << i << " - Energy: " << ToEnergyString(fHits.GetEnergy(i)) << " - Process: " << processName << " - Volume: " << volumeName << " - Position: " << VectorToString(TVector3(fHits.GetX(i), fHits.GetY(i), fHits.GetZ(i)))