Skip to content

Commit 9f293c9

Browse files
committed
time range of ionization
1 parent e16e5cd commit 9f293c9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

inc/TRestGeant4Event.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ class TRestGeant4Event : public TRestEvent {
186186
return energyMap[volumeName];
187187
}
188188

189+
std::pair<double, double> GetTimeRangeOfIonizationInVolume(const std::string& volumeName) const;
190+
189191
inline void ClearTracks() { fTracks.clear(); }
190192

191193
TRestHits GetHits(Int_t volID = -1) const;

src/TRestGeant4Event.cxx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,3 +1340,21 @@ void TRestGeant4Event::AddEnergyInVolumeForParticleForProcess(Double_t energy, c
13401340
fEnergyInVolumePerParticlePerProcess[volumeName][particleName][processName] += energy;
13411341
fTotalDepositedEnergy += energy;
13421342
}
1343+
1344+
std::pair<double, double> TRestGeant4Event::GetTimeRangeOfIonizationInVolume(const string& volumeName) const {
1345+
std::pair<double, double> result = {std::numeric_limits<double>::max(),
1346+
std::numeric_limits<double>::min()};
1347+
1348+
for (const auto& track : fTracks) {
1349+
const auto& hits = track.GetHits();
1350+
for (int i = 0; i < int(hits.GetNumberOfHits()); i++) {
1351+
if (hits.GetVolumeName(i) == volumeName && hits.GetEnergy(i) > 0) {
1352+
const double time = hits.GetTime(i);
1353+
result.first = std::min(result.first, time);
1354+
result.second = std::max(result.second, time);
1355+
}
1356+
}
1357+
}
1358+
1359+
return result;
1360+
}

0 commit comments

Comments
 (0)