LDMX Software
CascadeHistoryStore.cxx
Go to the documentation of this file.
1
6
7namespace simcore {
8namespace bertini {
9
10CascadeHistoryStore& CascadeHistoryStore::getInstance() {
11 // Meyer's singleton, thread_local for MT Geant4
12 thread_local CascadeHistoryStore instance;
13 return instance;
14}
15
16void CascadeHistoryStore::addHistory(int trackId,
17 ldmx::CascadeHistory history) {
18 // If there's already a history for this track, merge or replace
19 // For now, we replace (shouldn't happen unless track ID recycling)
20 histories_[trackId] = std::move(history);
21}
22
23std::map<int, ldmx::CascadeHistory> CascadeHistoryStore::extractHistories() {
24 std::map<int, ldmx::CascadeHistory> result = std::move(histories_);
25 histories_.clear();
26 return result;
27}
28
29const ldmx::CascadeHistory* CascadeHistoryStore::getHistory(int trackId) const {
30 auto it = histories_.find(trackId);
31 if (it != histories_.end()) {
32 return &it->second;
33 }
34 return nullptr;
35}
36
37} // namespace bertini
38} // namespace simcore
Thread-local storage for cascade histories during simulation.
All CascadeSteps from a single photonuclear interaction.
std::map< int, ldmx::CascadeHistory > extractHistories()
Moves histories out and clears store.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...