From d89a12b986bda72da002c2d44eb46e66b3116cd6 Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Wed, 13 Dec 2023 14:55:58 +0100 Subject: [PATCH] Add the possibility of not storing particles table Useful for cosmogenic simulations where the table is huge --- source/persistency/PersistencyManager.cc | 8 ++++++-- source/persistency/PersistencyManager.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/persistency/PersistencyManager.cc b/source/persistency/PersistencyManager.cc index 9bc878f34..f01881306 100644 --- a/source/persistency/PersistencyManager.cc +++ b/source/persistency/PersistencyManager.cc @@ -47,7 +47,7 @@ PersistencyManagerBase(), msg_(0), output_file_("nexus_out"), ready_(false), interacting_evt_(false), save_ie_numb_(false), event_type_("other"), saved_evts_(0), interacting_evts_(0), pmt_bin_size_(-1), sipm_bin_size_(-1), nevt_(0), start_id_(0), first_evt_(true), h5writer_(0), - str_counter_(0), save_str_(true) + str_counter_(0), save_str_(true), particles_(true) { msg_ = new G4GenericMessenger(this, "/nexus/persistency/"); msg_->DeclareProperty("output_file", output_file_, "Path of output file."); @@ -57,6 +57,8 @@ PersistencyManagerBase(), msg_(0), output_file_("nexus_out"), ready_(false), "Starting event ID for this job."); msg_->DeclareProperty("save_strings", save_str_, "True if volume, process... names are saved as strings."); + msg_->DeclareProperty("save_particles", particles_, + "True if particles table is saved."); init_macro_ = ""; macros_.clear(); @@ -126,7 +128,9 @@ G4bool PersistencyManager::Store(const G4Event* event) StoreSteps(); // Store the trajectories of the event - StoreTrajectories(event->GetTrajectoryContainer()); + if (particles_) { + StoreTrajectories(event->GetTrajectoryContainer()); + } // Store ionization hits and sensor hits ihits_ = nullptr; diff --git a/source/persistency/PersistencyManager.h b/source/persistency/PersistencyManager.h index 45cd89f91..1c651d09d 100644 --- a/source/persistency/PersistencyManager.h +++ b/source/persistency/PersistencyManager.h @@ -103,6 +103,7 @@ namespace nexus { G4int str_counter_; ///< incrementing counter for string map G4bool save_str_; ///< Should we store strings as volume names etc.? + G4bool particles_; ///< Store particles table std::map sensdet_bin_; };