From 07df660da493be1205eef4801bbea9e29a405092 Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Thu, 6 Apr 2023 10:39:06 +0200 Subject: [PATCH 1/9] Eliminate the need of specifying a persistency manager --- source/base/NexusApp.cc | 18 ++++++++++-------- source/base/NexusApp.h | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/source/base/NexusApp.cc b/source/base/NexusApp.cc index 982f077d90..e47ade92fa 100644 --- a/source/base/NexusApp.cc +++ b/source/base/NexusApp.cc @@ -36,7 +36,7 @@ NexusApp::NexusApp(G4String init_macro): G4RunManager(), gen_name_(""), geo_name_(""), pm_name_(""), runact_name_(""), evtact_name_(""), stepact_name_(""), trkact_name_(""), - stkact_name_("") + stkact_name_(""), pman_(false) { // Create and configure a generic messenger for the app msg_ = make_unique(this, "/nexus/", "Nexus control commands."); @@ -105,13 +105,13 @@ NexusApp::NexusApp(G4String init_macro): G4RunManager(), gen_name_(""), pg->SetGenerator(ObjFactory::Instance().CreateObject(gen_name_)); this->SetUserAction(pg.release()); - if (pm_name_ == "") { - G4Exception("[NexusApp]", "NexusApp()", FatalException, "A persistency manager must be specified."); - } - pm_ = ObjFactory::Instance().CreateObject(pm_name_); - pm_->SetMacros(init_macro, macros_, delayed_); - // PersistencyManager::Initialize(init_macro, macros_, delayed_); + // Set the persistency manager, if needed + if (pm_name_ != "") { + pm_ = ObjFactory::Instance().CreateObject(pm_name_); + pm_->SetMacros(init_macro, macros_, delayed_); + pman_ = true; + } // Set the user action instances, if any, in the run manager if (runact_name_ != "") { @@ -153,7 +153,9 @@ NexusApp::NexusApp(G4String init_macro): G4RunManager(), gen_name_(""), NexusApp::~NexusApp() { // Close output file before finishing - pm_->CloseFile(); + if (pman_) { + pm_->CloseFile(); + } } diff --git a/source/base/NexusApp.h b/source/base/NexusApp.h index 1a01cf8edb..4741a2a8df 100644 --- a/source/base/NexusApp.h +++ b/source/base/NexusApp.h @@ -55,6 +55,8 @@ namespace nexus { G4String trkact_name_; ///< Name of the chosen tracking action G4String stkact_name_; ///< Name of the chosen stacking action + G4bool pman_; ///< True if the persistency manager is set + std::vector macros_; std::vector delayed_; From 56f85c88eb97e098c4eb479a708b64b638406edc Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Thu, 6 Apr 2023 10:39:30 +0200 Subject: [PATCH 2/9] Add example of not using persistency manager --- macros/NEXT100_debug.config.mac | 25 +++++++++++++++++++++++++ macros/NEXT100_debug.init.mac | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 macros/NEXT100_debug.config.mac create mode 100644 macros/NEXT100_debug.init.mac diff --git a/macros/NEXT100_debug.config.mac b/macros/NEXT100_debug.config.mac new file mode 100644 index 0000000000..73e52ae234 --- /dev/null +++ b/macros/NEXT100_debug.config.mac @@ -0,0 +1,25 @@ +## ---------------------------------------------------------------------------- +## nexus | NEXT100_debug.config.mac +## +## Initialization macro to simulate geantinos crossing the NEXT-100 detector. +## It is useful to debug the geometry. +## +## The NEXT Collaboration +## ---------------------------------------------------------------------------- + +##### VERBOSITY ##### +/run/verbose 0 +/event/verbose 0 +/tracking/verbose 1 + +/process/em/verbose 0 + +##### GEOMETRY ##### +/Geometry/Next100/specific_vertex 5 5 0 mm + +##### GENERATOR ##### +/Generator/SingleParticle/particle geantino +/Generator/SingleParticle/min_energy 1 eV +/Generator/SingleParticle/max_energy 1 eV +/Generator/SingleParticle/region AD_HOC +/Generator/SingleParticle/momentum 0 0 1 \ No newline at end of file diff --git a/macros/NEXT100_debug.init.mac b/macros/NEXT100_debug.init.mac new file mode 100644 index 0000000000..b69810faf3 --- /dev/null +++ b/macros/NEXT100_debug.init.mac @@ -0,0 +1,20 @@ +## ---------------------------------------------------------------------------- +## nexus | NEXT100_debug.init.mac +## +## Initialization macro to simulate geantinos crossing the NEXT-100 detector. +## It is useful to debug the geometry. +## +## The NEXT Collaboration +## ---------------------------------------------------------------------------- + +/PhysicsList/RegisterPhysics G4EmStandardPhysics_option4 +/PhysicsList/RegisterPhysics G4DecayPhysics +/PhysicsList/RegisterPhysics G4RadioactiveDecayPhysics +/PhysicsList/RegisterPhysics NexusPhysics +/PhysicsList/RegisterPhysics G4StepLimiterPhysics + +/nexus/RegisterGeometry Next100 + +/nexus/RegisterGenerator SingleParticleGenerator + +/nexus/RegisterMacro macros/NEXT100_debug.config.mac From 7516abf8fea5f6f7ce436848741bba9b8afdaba2 Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Thu, 6 Apr 2023 10:39:47 +0200 Subject: [PATCH 3/9] Remove unused variable --- source/persistency/PersistencyManager.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/persistency/PersistencyManager.cc b/source/persistency/PersistencyManager.cc index d3f944119a..7ec5a534f2 100644 --- a/source/persistency/PersistencyManager.cc +++ b/source/persistency/PersistencyManager.cc @@ -254,7 +254,6 @@ void PersistencyManager::StoreIonizationHits(G4VHitsCollection* hc) dynamic_cast(hc); if (!hits) return; - double evt_energy = 0.; std::string sdname = hits->GetSDname(); for (size_t i=0; ientries(); i++) { @@ -280,8 +279,6 @@ void PersistencyManager::StoreIonizationHits(G4VHitsCollection* hc) xyz[0], xyz[1], xyz[2], hit->GetTime(), hit->GetEnergyDeposit(), sdname.c_str()); - - evt_energy += hit->GetEnergyDeposit(); } } From 84458eed5a73d6dc7f2fb783da3bc01395a11892 Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Thu, 6 Apr 2023 10:39:59 +0200 Subject: [PATCH 4/9] Add default name for output file to avoid crash if not specified --- source/base/NexusApp.cc | 4 +++ source/persistency/PersistencyManager.cc | 27 +++------------------ source/persistency/PersistencyManager.h | 6 ++--- source/persistency/PersistencyManagerBase.h | 17 +++++++------ 4 files changed, 19 insertions(+), 35 deletions(-) diff --git a/source/base/NexusApp.cc b/source/base/NexusApp.cc index e47ade92fa..0cec92464b 100644 --- a/source/base/NexusApp.cc +++ b/source/base/NexusApp.cc @@ -188,6 +188,10 @@ void NexusApp::Initialize() G4RunManager::Initialize(); + if (pman_) { + pm_->OpenFile(); + } + for (unsigned int j=0; jDeclareMethod("outputFile", &PersistencyManager::OpenFile, ""); + msg_->DeclareProperty("output_file", output_file_, "Path of output file."); msg_->DeclareProperty("eventType", event_type_, "Type of event: bb0nu, bb2nu, background."); msg_->DeclareProperty("start_id", start_id_, @@ -71,31 +71,12 @@ PersistencyManager::~PersistencyManager() -/* void PersistencyManager::Initialize(G4String init_macro, std::vector& macros, - std::vector& delayed_macros) -{ - - // Get a pointer to the current singleton instance of the persistency - // manager using the method of the base class - PersistencyManager* current = dynamic_cast - (G4VPersistencyManager::GetPersistencyManager()); - - // If no instance exists yet, create a new one. - // (Notice that the above dynamic cast would also return 0 if an instance - // of another G4VPersistencyManager-derived was previously set, resulting - // in the leak of that object since the pointer will no longer be - // accessible.) - if (!current) current = - new PersistencyManager(init_macro, macros, delayed_macros); -} */ - - -void PersistencyManager::OpenFile(G4String filename) +void PersistencyManager::OpenFile() { // If the output file was not set yet, do so if (!h5writer_) { h5writer_ = new HDF5Writer(); - G4String hdf5file = filename + ".h5"; + G4String hdf5file = output_file_ + ".h5"; h5writer_->Open(hdf5file, store_steps_); return; } else { diff --git a/source/persistency/PersistencyManager.h b/source/persistency/PersistencyManager.h index 29e5884cf3..ad8b4fb246 100644 --- a/source/persistency/PersistencyManager.h +++ b/source/persistency/PersistencyManager.h @@ -56,7 +56,7 @@ namespace nexus { virtual G4bool Retrieve(G4VPhysicalVolume*&); public: - void OpenFile(G4String); + void OpenFile(); void CloseFile(); @@ -73,11 +73,9 @@ namespace nexus { private: G4GenericMessenger* msg_; ///< User configuration messenger - // G4String init_macro_; - // std::vector macros_; - //std::vector delayed_macros_; std::vector secondary_macros_; + G4String output_file_; ///< Path of output file G4bool ready_; ///< Is the PersistencyManager ready to go? G4bool store_evt_; ///< Should we store the current event? G4bool store_steps_; ///< Should we store the steps for the current event? diff --git a/source/persistency/PersistencyManagerBase.h b/source/persistency/PersistencyManagerBase.h index 81f0b524ab..3b5dc0f366 100644 --- a/source/persistency/PersistencyManagerBase.h +++ b/source/persistency/PersistencyManagerBase.h @@ -2,8 +2,8 @@ #define BASE_PERSISTENCY_MANAGER_H #include -//#include #include + #include @@ -11,17 +11,18 @@ class PersistencyManagerBase: public G4VPersistencyManager { public: - virtual void CloseFile() = 0; + virtual void OpenFile() = 0; + virtual void CloseFile() = 0; - G4String init_macro_; - std::vector macros_; - std::vector delayed_macros_; + G4String init_macro_; + std::vector macros_; + std::vector delayed_macros_; - inline void SetMacros(G4String init, std::vector mcrs, std::vector delayed) - {init_macro_ = init; macros_ = mcrs; delayed_macros_ = delayed;} + inline void SetMacros(G4String init, std::vector mcrs, std::vector delayed) + {init_macro_ = init; macros_ = mcrs; delayed_macros_ = delayed;} }; -#endif \ No newline at end of file +#endif From 3e24b4151c6f4ee74ce842914944d3d4f0aa02ff Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Thu, 6 Apr 2023 10:40:26 +0200 Subject: [PATCH 5/9] Use new variable name in the persistency manager --- source/persistency/PersistencyManager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/persistency/PersistencyManager.cc b/source/persistency/PersistencyManager.cc index cce3c0d483..ade93ba659 100644 --- a/source/persistency/PersistencyManager.cc +++ b/source/persistency/PersistencyManager.cc @@ -50,7 +50,7 @@ PersistencyManagerBase(), msg_(0), output_file_("nexus_out"), ready_(false), { msg_ = new G4GenericMessenger(this, "/nexus/persistency/"); msg_->DeclareProperty("output_file", output_file_, "Path of output file."); - msg_->DeclareProperty("eventType", event_type_, + msg_->DeclareProperty("event_type", event_type_, "Type of event: bb0nu, bb2nu, background."); msg_->DeclareProperty("start_id", start_id_, "Starting event ID for this job."); From 32ea4c7ed28d35b73e0f1e93e6c5204bdded2137 Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Thu, 6 Apr 2023 10:41:11 +0200 Subject: [PATCH 6/9] Modify automatic tests with new variable name --- tests/pytest/produce_output_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pytest/produce_output_test.py b/tests/pytest/produce_output_test.py index 1b174499df..c6db0627ef 100644 --- a/tests/pytest/produce_output_test.py +++ b/tests/pytest/produce_output_test.py @@ -54,7 +54,7 @@ def test_create_nexus_output_file_next100(config_tmpdir, output_tmpdir, /Generator/SingleParticle/max_energy 10. keV /Generator/SingleParticle/region CENTER -/nexus/persistency/outputFile {output_tmpdir}/{full_base_name_next100} +/nexus/persistency/output_file {output_tmpdir}/{full_base_name_next100} /nexus/random_seed 21051817 """ config_path = os.path.join(config_tmpdir, full_base_name_next100+'.config.mac') @@ -121,7 +121,7 @@ def test_create_nexus_output_file_new(config_tmpdir, output_tmpdir, NEXUSDIR, /Generator/SingleParticle/max_energy 10. keV /Generator/SingleParticle/region CENTER -/nexus/persistency/outputFile {output_tmpdir}/{full_base_name_new} +/nexus/persistency/output_file {output_tmpdir}/{full_base_name_new} /nexus/random_seed 21051817 """ config_path = os.path.join(config_tmpdir, full_base_name_new+'.config.mac') @@ -224,7 +224,7 @@ def test_create_nexus_output_file_flex100(config_tmpdir, output_tmpdir, NEXUSDIR /Generator/SingleParticle/region AD_HOC /Geometry/NextFlex/specific_vertex 0. 0. 500. mm -/nexus/persistency/outputFile {output_tmpdir}/{full_base_name_flex100} +/nexus/persistency/output_file {output_tmpdir}/{full_base_name_flex100} /nexus/random_seed 21051817 """ config_path = os.path.join(config_tmpdir, full_base_name_flex100+'.config.mac') @@ -290,7 +290,7 @@ def test_create_nexus_output_file_demopp(config_tmpdir, output_tmpdir, NEXUSDIR, /Generator/SingleParticle/max_energy 10. keV /Generator/SingleParticle/region AD_HOC - /nexus/persistency/outputFile {output_tmpdir}/{full_base_name_demopp.format(run=run)} + /nexus/persistency/output_file {output_tmpdir}/{full_base_name_demopp.format(run=run)} /nexus/random_seed 21051817 """ From e0813073d97132ccdffac868dddb803025704880 Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Thu, 6 Apr 2023 10:45:10 +0200 Subject: [PATCH 7/9] Update example macros with new variable names --- macros/DEMOPP_fullKr.config.mac | 2 +- macros/DEMOPP_grid.config.mac | 2 +- macros/DEMOPP_plate.config.mac | 2 +- macros/DEMOPP_psf.config.mac | 2 +- macros/DEMO_muons.config.mac | 2 +- macros/MagBox.config.mac | 2 +- macros/NEW.config.mac | 4 ++-- macros/NEW_2nuECEC.config.mac | 2 +- macros/NEW_S1_table.config.mac | 2 +- macros/NEW_S2_table.config.mac | 2 +- macros/NEW_argon.config.mac | 2 +- macros/NEW_elgap.config.mac | 2 +- macros/NEW_fullKr.config.mac | 2 +- macros/NEW_geantino.config.mac | 2 +- macros/NEW_hallA.config.mac | 4 ++-- macros/NEW_optical.config.mac | 2 +- macros/NEW_pair.config.mac | 2 +- macros/NEW_translated_bb0nu.config.mac | 2 +- macros/NEXT100.Neutron.config.mac | 4 ++-- macros/NEXT100.config.mac | 4 ++-- macros/NEXT100_S1_table.config.mac | 2 +- macros/NEXT100_S2_table.config.mac | 2 +- macros/NEXT100_full.config.mac | 2 +- macros/NEXT100_muons.config.mac | 2 +- macros/NEXT_options.config.mac | 4 ++-- macros/NextFlex_fullKr.config.mac | 2 +- macros/NextTonScale.config.mac | 2 +- macros/black_box.config.mac | 2 +- macros/calibration/NEW_disk_source.config.mac | 2 +- macros/calibration/NEW_external_source.config.mac | 2 +- macros/calibration/NEW_internal_source.config.mac | 2 +- macros/nexus_example1.config.mac | 2 +- macros/nexus_example3.config.mac | 2 +- macros/ton_muons_vertical.config.mac | 2 +- macros/validation/NEW_valid_isotope.config.mac | 4 ++-- 35 files changed, 41 insertions(+), 41 deletions(-) diff --git a/macros/DEMOPP_fullKr.config.mac b/macros/DEMOPP_fullKr.config.mac index 53aaca789a..5fd75ddaa1 100644 --- a/macros/DEMOPP_fullKr.config.mac +++ b/macros/DEMOPP_fullKr.config.mac @@ -33,6 +33,6 @@ # PERSISTENCY -/nexus/persistency/outputFile out_Kr83.sim +/nexus/persistency/output_file out_Kr83.sim /nexus/random_seed 14562 diff --git a/macros/DEMOPP_grid.config.mac b/macros/DEMOPP_grid.config.mac index 8e095571ff..cae31f9ce0 100644 --- a/macros/DEMOPP_grid.config.mac +++ b/macros/DEMOPP_grid.config.mac @@ -35,7 +35,7 @@ # PERSISTENCY -/nexus/persistency/outputFile DEMO_electron +/nexus/persistency/output_file DEMO_electron /nexus/random_seed 14562 diff --git a/macros/DEMOPP_plate.config.mac b/macros/DEMOPP_plate.config.mac index 35ea860406..41027ea286 100644 --- a/macros/DEMOPP_plate.config.mac +++ b/macros/DEMOPP_plate.config.mac @@ -34,7 +34,7 @@ # PERSISTENCY -/nexus/persistency/outputFile DEMO_electron +/nexus/persistency/output_file DEMO_electron /nexus/random_seed 14562 diff --git a/macros/DEMOPP_psf.config.mac b/macros/DEMOPP_psf.config.mac index e2bc650e76..7333f616cb 100644 --- a/macros/DEMOPP_psf.config.mac +++ b/macros/DEMOPP_psf.config.mac @@ -37,6 +37,6 @@ /Geometry/NextDemo/el_gap_gen_disk_zmax 1.0 # PERSISTENCY -/nexus/persistency/outputFile demopp_psf_generation +/nexus/persistency/output_file demopp_psf_generation /nexus/random_seed 12345 diff --git a/macros/DEMO_muons.config.mac b/macros/DEMO_muons.config.mac index 5fb4fcd8b9..0983848646 100644 --- a/macros/DEMO_muons.config.mac +++ b/macros/DEMO_muons.config.mac @@ -50,4 +50,4 @@ /PhysicsList/Nexus/electroluminescence false # PERSISTENCY -/nexus/persistency/outputFile DEMO_muons.next +/nexus/persistency/output_file DEMO_muons.next diff --git a/macros/MagBox.config.mac b/macros/MagBox.config.mac index 58d2c2402d..b549ee1345 100644 --- a/macros/MagBox.config.mac +++ b/macros/MagBox.config.mac @@ -32,4 +32,4 @@ /PhysicsList/Nexus/electroluminescence false ### PERSISTENCY -/nexus/persistency/outputFile output.next +/nexus/persistency/output_file output.next diff --git a/macros/NEW.config.mac b/macros/NEW.config.mac index a79acd0311..ef1ab4bd10 100644 --- a/macros/NEW.config.mac +++ b/macros/NEW.config.mac @@ -27,7 +27,7 @@ /PhysicsList/Nexus/electroluminescence false /PhysicsList/Nexus/photoelectric false -/nexus/persistency/eventType background -/nexus/persistency/outputFile NextNew.Bi214.DICE_BOARD.next +/nexus/persistency/event_type background +/nexus/persistency/output_file NextNew.Bi214.DICE_BOARD.next /process/em/verbose 0 diff --git a/macros/NEW_2nuECEC.config.mac b/macros/NEW_2nuECEC.config.mac index 86cd7fbef7..0c87e28267 100644 --- a/macros/NEW_2nuECEC.config.mac +++ b/macros/NEW_2nuECEC.config.mac @@ -22,6 +22,6 @@ /control/execute macros/physics/IonizationElectron.mac -/nexus/persistency/outputFile new_ecec.next +/nexus/persistency/output_file new_ecec.next /nexus/random_seed 542862 diff --git a/macros/NEW_S1_table.config.mac b/macros/NEW_S1_table.config.mac index 5ad89931e3..319c3a3ceb 100644 --- a/macros/NEW_S1_table.config.mac +++ b/macros/NEW_S1_table.config.mac @@ -28,4 +28,4 @@ /control/execute macros/physics/IonizationElectron.mac # PERSISTENCY -/nexus/persistency/outputFile S1_param.next +/nexus/persistency/output_file S1_param.next diff --git a/macros/NEW_S2_table.config.mac b/macros/NEW_S2_table.config.mac index ba9e6d6b6b..8a9022345f 100644 --- a/macros/NEW_S2_table.config.mac +++ b/macros/NEW_S2_table.config.mac @@ -25,4 +25,4 @@ /PhysicsList/Nexus/photoelectric false -/nexus/persistency/outputFile table.NEW.next +/nexus/persistency/output_file table.NEW.next diff --git a/macros/NEW_argon.config.mac b/macros/NEW_argon.config.mac index 43c6967098..d36db5d395 100644 --- a/macros/NEW_argon.config.mac +++ b/macros/NEW_argon.config.mac @@ -34,4 +34,4 @@ /PhysicsList/Nexus/electroluminescence false /PhysicsList/Nexus/photoelectric false -/nexus/persistency/outputFile New.Na22_Ar.next +/nexus/persistency/output_file New.Na22_Ar.next diff --git a/macros/NEW_elgap.config.mac b/macros/NEW_elgap.config.mac index ce4c2a80e9..e77b551346 100644 --- a/macros/NEW_elgap.config.mac +++ b/macros/NEW_elgap.config.mac @@ -16,4 +16,4 @@ /nexus/random_seed 1 /nexus/persistency/start_id 0 -/nexus/persistency/outputFile new_elgap.nexus +/nexus/persistency/output_file new_elgap.nexus diff --git a/macros/NEW_fullKr.config.mac b/macros/NEW_fullKr.config.mac index 608bd0dfed..723fdc948a 100644 --- a/macros/NEW_fullKr.config.mac +++ b/macros/NEW_fullKr.config.mac @@ -30,4 +30,4 @@ /Generator/Kr83mGenerator/region ACTIVE # PERSISTENCY -/nexus/persistency/outputFile Kr83_full_nexus_ACTIVE_7bar.sim +/nexus/persistency/output_file Kr83_full_nexus_ACTIVE_7bar.sim diff --git a/macros/NEW_geantino.config.mac b/macros/NEW_geantino.config.mac index 222fbc3552..de90953bae 100644 --- a/macros/NEW_geantino.config.mac +++ b/macros/NEW_geantino.config.mac @@ -26,4 +26,4 @@ # GEOMETRY /Geometry/NextNew/pressure 10. bar -/nexus/persistency/outputFile geantinos.next +/nexus/persistency/output_file geantinos.next diff --git a/macros/NEW_hallA.config.mac b/macros/NEW_hallA.config.mac index 7eb3d79e06..5987bdc048 100644 --- a/macros/NEW_hallA.config.mac +++ b/macros/NEW_hallA.config.mac @@ -30,5 +30,5 @@ /PhysicsList/Nexus/drift false /PhysicsList/Nexus/electroluminescence false -/nexus/persistency/eventType background -/nexus/persistency/outputFile NextNew.HALLA_INNER.next +/nexus/persistency/event_type background +/nexus/persistency/output_file NextNew.HALLA_INNER.next diff --git a/macros/NEW_optical.config.mac b/macros/NEW_optical.config.mac index a36a88a4d2..9bea3deba7 100644 --- a/macros/NEW_optical.config.mac +++ b/macros/NEW_optical.config.mac @@ -24,4 +24,4 @@ /control/execute macros/physics/IonizationElectron.mac -/nexus/persistency/outputFile myoutput.next +/nexus/persistency/output_file myoutput.next diff --git a/macros/NEW_pair.config.mac b/macros/NEW_pair.config.mac index 86833e3ccd..f1a54dca78 100644 --- a/macros/NEW_pair.config.mac +++ b/macros/NEW_pair.config.mac @@ -25,4 +25,4 @@ /control/execute macros/physics/IonizationElectron.mac -/nexus/persistency/outputFile myoutput.next +/nexus/persistency/output_file myoutput.next diff --git a/macros/NEW_translated_bb0nu.config.mac b/macros/NEW_translated_bb0nu.config.mac index 69a2288369..4fa97e8abb 100644 --- a/macros/NEW_translated_bb0nu.config.mac +++ b/macros/NEW_translated_bb0nu.config.mac @@ -21,4 +21,4 @@ /control/execute macros/physics/IonizationElectron.mac -/nexus/persistency/outputFile bb0_GS_mode1_S1L1f.next +/nexus/persistency/output_file bb0_GS_mode1_S1L1f.next diff --git a/macros/NEXT100.Neutron.config.mac b/macros/NEXT100.Neutron.config.mac index 1e8fdf3549..e3d672ac60 100644 --- a/macros/NEXT100.Neutron.config.mac +++ b/macros/NEXT100.Neutron.config.mac @@ -39,5 +39,5 @@ /PhysicsList/Nexus/electroluminescence false ##### PERSISTENCY ##### -/nexus/persistency/eventType background -/nexus/persistency/outputFile Next100.Neutron.next +/nexus/persistency/event_type background +/nexus/persistency/output_file Next100.Neutron.next diff --git a/macros/NEXT100.config.mac b/macros/NEXT100.config.mac index 6176c92ae4..cd1ddec056 100644 --- a/macros/NEXT100.config.mac +++ b/macros/NEXT100.config.mac @@ -34,6 +34,6 @@ /PhysicsList/Nexus/electroluminescence false ##### PERSISTENCY ##### -/nexus/persistency/outputFile Next100.next +/nexus/persistency/output_file Next100.next ## eventType options: bb0nu, bb2nu, background -/nexus/persistency/eventType background +/nexus/persistency/event_type background diff --git a/macros/NEXT100_S1_table.config.mac b/macros/NEXT100_S1_table.config.mac index 04fbb285a2..da8ae6db19 100644 --- a/macros/NEXT100_S1_table.config.mac +++ b/macros/NEXT100_S1_table.config.mac @@ -26,4 +26,4 @@ # PHYSICS /control/execute macros/physics/IonizationElectron.mac -/nexus/persistency/outputFile S1_param.next +/nexus/persistency/output_file S1_param.next diff --git a/macros/NEXT100_S2_table.config.mac b/macros/NEXT100_S2_table.config.mac index a6c130892d..fcb794b2c0 100644 --- a/macros/NEXT100_S2_table.config.mac +++ b/macros/NEXT100_S2_table.config.mac @@ -27,4 +27,4 @@ /Generator/ScintGenerator/region AD_HOC #### PERSISTENCY #### -/nexus/persistency/outputFile Next100_X_0_Y_0_Z_0.next +/nexus/persistency/output_file Next100_X_0_Y_0_Z_0.next diff --git a/macros/NEXT100_full.config.mac b/macros/NEXT100_full.config.mac index 5e73f6e205..acdc9e5dda 100644 --- a/macros/NEXT100_full.config.mac +++ b/macros/NEXT100_full.config.mac @@ -26,4 +26,4 @@ /Generator/Kr83mGenerator/region ACTIVE ##### PERSISTENCY ##### -/nexus/persistency/outputFile Next100_full.next +/nexus/persistency/output_file Next100_full.next diff --git a/macros/NEXT100_muons.config.mac b/macros/NEXT100_muons.config.mac index 1c263ed2cb..a0130ccc18 100644 --- a/macros/NEXT100_muons.config.mac +++ b/macros/NEXT100_muons.config.mac @@ -63,4 +63,4 @@ ### PERSISTENCY /nexus/persistency/start_id 0 -/nexus/persistency/outputFile Next100Muons_example.next +/nexus/persistency/output_file Next100Muons_example.next diff --git a/macros/NEXT_options.config.mac b/macros/NEXT_options.config.mac index 25b2756113..84379d62ca 100644 --- a/macros/NEXT_options.config.mac +++ b/macros/NEXT_options.config.mac @@ -100,5 +100,5 @@ ##### PERSISTENCY ##### /nexus/persistency/start_id 1000 -/nexus/persistency/outputFile Next100.next -/nexus/persistency/eventType background # bb0nu, bb2nu... +/nexus/persistency/output_file Next100.next +/nexus/persistency/event_type background # bb0nu, bb2nu... diff --git a/macros/NextFlex_fullKr.config.mac b/macros/NextFlex_fullKr.config.mac index dc1fab7d77..3f61fe14e3 100644 --- a/macros/NextFlex_fullKr.config.mac +++ b/macros/NextFlex_fullKr.config.mac @@ -110,4 +110,4 @@ ### CONTROL /nexus/random_seed -1 /nexus/persistency/start_id 0 -/nexus/persistency/outputFile NextFlex.next +/nexus/persistency/output_file NextFlex.next diff --git a/macros/NextTonScale.config.mac b/macros/NextTonScale.config.mac index fd2f8cf3b9..0ac5e56914 100644 --- a/macros/NextTonScale.config.mac +++ b/macros/NextTonScale.config.mac @@ -69,4 +69,4 @@ ### PERSISTENCY /nexus/persistency/start_id 0 -/nexus/persistency/outputFile NextTon.next +/nexus/persistency/output_file NextTon.next diff --git a/macros/black_box.config.mac b/macros/black_box.config.mac index e77e1f1c07..a07ea8b39d 100644 --- a/macros/black_box.config.mac +++ b/macros/black_box.config.mac @@ -31,4 +31,4 @@ ### JOB CONTROL /nexus/random_seed -1 /nexus/persistency/start_id 0 -/nexus/persistency/outputFile black_box.next +/nexus/persistency/output_file black_box.next diff --git a/macros/calibration/NEW_disk_source.config.mac b/macros/calibration/NEW_disk_source.config.mac index 53f22bbf9e..144eb435cd 100644 --- a/macros/calibration/NEW_disk_source.config.mac +++ b/macros/calibration/NEW_disk_source.config.mac @@ -48,4 +48,4 @@ /PhysicsList/Nexus/electroluminescence false # Persistency -/nexus/persistency/outputFile New.source.next +/nexus/persistency/output_file New.source.next diff --git a/macros/calibration/NEW_external_source.config.mac b/macros/calibration/NEW_external_source.config.mac index 70b0df70e1..160886ec11 100644 --- a/macros/calibration/NEW_external_source.config.mac +++ b/macros/calibration/NEW_external_source.config.mac @@ -50,4 +50,4 @@ /PhysicsList/Nexus/electroluminescence false # Persistency -/nexus/persistency/outputFile New.source.next +/nexus/persistency/output_file New.source.next diff --git a/macros/calibration/NEW_internal_source.config.mac b/macros/calibration/NEW_internal_source.config.mac index f5463bc940..39cd52cfd1 100644 --- a/macros/calibration/NEW_internal_source.config.mac +++ b/macros/calibration/NEW_internal_source.config.mac @@ -52,4 +52,4 @@ /PhysicsList/Nexus/electroluminescence false # Persistency -/nexus/persistency/outputFile New.source.next +/nexus/persistency/output_file New.source.next diff --git a/macros/nexus_example1.config.mac b/macros/nexus_example1.config.mac index 3d742d6115..d746f51edf 100644 --- a/macros/nexus_example1.config.mac +++ b/macros/nexus_example1.config.mac @@ -19,4 +19,4 @@ /control/execute macros/physics/IonizationElectron.mac -/nexus/persistency/outputFile nexus.next \ No newline at end of file +/nexus/persistency/output_file nexus.next \ No newline at end of file diff --git a/macros/nexus_example3.config.mac b/macros/nexus_example3.config.mac index f0ef6302ff..78ffc83951 100644 --- a/macros/nexus_example3.config.mac +++ b/macros/nexus_example3.config.mac @@ -21,4 +21,4 @@ /control/execute macros/physics/IonizationElectron.mac -/nexus/persistency/outputFile nexus.next +/nexus/persistency/output_file nexus.next diff --git a/macros/ton_muons_vertical.config.mac b/macros/ton_muons_vertical.config.mac index 6e8294084f..9e2cae8d02 100644 --- a/macros/ton_muons_vertical.config.mac +++ b/macros/ton_muons_vertical.config.mac @@ -52,4 +52,4 @@ ### PERSISTENCY /nexus/persistency/start_id 0 -/nexus/persistency/outputFile TonMuons_vertical_example.next +/nexus/persistency/output_file TonMuons_vertical_example.next diff --git a/macros/validation/NEW_valid_isotope.config.mac b/macros/validation/NEW_valid_isotope.config.mac index 44dd573e2d..bc89ba6b22 100644 --- a/macros/validation/NEW_valid_isotope.config.mac +++ b/macros/validation/NEW_valid_isotope.config.mac @@ -42,5 +42,5 @@ /Actions/ValidationTrackingAction/valid_file NEW_valid.isotope.DICE_BOARD.csv # PERSISTENCY -/nexus/persistency/eventType background -/nexus/persistency/outputFile NEW_valid.isotope.DICE_BOARD.next +/nexus/persistency/event_type background +/nexus/persistency/output_file NEW_valid.isotope.DICE_BOARD.next From 57d3a3bbfc1da96c0558ea676a12342b50fc3a59 Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Tue, 27 Jun 2023 16:47:09 +0200 Subject: [PATCH 8/9] Add new lines at the end of the file and turn off verbosity The particle has been changed from geantino to electron to cover a more general case of interaction with the detector materials. --- macros/NEXT100_debug.config.mac | 10 +++++----- macros/nexus_example1.config.mac | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/macros/NEXT100_debug.config.mac b/macros/NEXT100_debug.config.mac index 73e52ae234..1b831da9c4 100644 --- a/macros/NEXT100_debug.config.mac +++ b/macros/NEXT100_debug.config.mac @@ -10,7 +10,7 @@ ##### VERBOSITY ##### /run/verbose 0 /event/verbose 0 -/tracking/verbose 1 +/tracking/verbose 0 /process/em/verbose 0 @@ -18,8 +18,8 @@ /Geometry/Next100/specific_vertex 5 5 0 mm ##### GENERATOR ##### -/Generator/SingleParticle/particle geantino -/Generator/SingleParticle/min_energy 1 eV -/Generator/SingleParticle/max_energy 1 eV +/Generator/SingleParticle/particle e- +/Generator/SingleParticle/min_energy 100 keV +/Generator/SingleParticle/max_energy 100 keV /Generator/SingleParticle/region AD_HOC -/Generator/SingleParticle/momentum 0 0 1 \ No newline at end of file +/Generator/SingleParticle/momentum 0 0 1 diff --git a/macros/nexus_example1.config.mac b/macros/nexus_example1.config.mac index d746f51edf..fe8c07e91b 100644 --- a/macros/nexus_example1.config.mac +++ b/macros/nexus_example1.config.mac @@ -19,4 +19,4 @@ /control/execute macros/physics/IonizationElectron.mac -/nexus/persistency/output_file nexus.next \ No newline at end of file +/nexus/persistency/output_file nexus.next From 51a6865a3a81d26c091f47318a08c797290a3b2c Mon Sep 17 00:00:00 2001 From: Paola Ferrario Date: Tue, 27 Jun 2023 16:47:34 +0200 Subject: [PATCH 9/9] Use the recommended way of checking if a string is empty --- source/base/NexusApp.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/base/NexusApp.cc b/source/base/NexusApp.cc index 0cec92464b..0a4e2a009e 100644 --- a/source/base/NexusApp.cc +++ b/source/base/NexusApp.cc @@ -91,7 +91,7 @@ NexusApp::NexusApp(G4String init_macro): G4RunManager(), gen_name_(""), // Set the detector construction instance in the run manager auto dc = make_unique(); - if (geo_name_ == "") { + if (geo_name_.empty()) { G4Exception("[NexusApp]", "NexusApp()", FatalException, "A geometry must be specified."); } dc->SetGeometry(ObjFactory::Instance().CreateObject(geo_name_)); @@ -99,7 +99,7 @@ NexusApp::NexusApp(G4String init_macro): G4RunManager(), gen_name_(""), // Set the primary generation instance in the run manager auto pg = make_unique(); - if (gen_name_ == "") { + if (gen_name_.empty()) { G4Exception("[NexusApp]", "NexusApp()", FatalException, "A generator must be specified."); } pg->SetGenerator(ObjFactory::Instance().CreateObject(gen_name_)); @@ -107,34 +107,34 @@ NexusApp::NexusApp(G4String init_macro): G4RunManager(), gen_name_(""), // Set the persistency manager, if needed - if (pm_name_ != "") { + if (!pm_name_.empty()) { pm_ = ObjFactory::Instance().CreateObject(pm_name_); pm_->SetMacros(init_macro, macros_, delayed_); pman_ = true; } // Set the user action instances, if any, in the run manager - if (runact_name_ != "") { + if (!runact_name_.empty()) { auto runact = ObjFactory::Instance().CreateObject(runact_name_); this->SetUserAction(runact.release()); } - if (evtact_name_ != "") { + if (!evtact_name_.empty()) { auto evtact = ObjFactory::Instance().CreateObject(evtact_name_); this->SetUserAction(evtact.release()); } - if (stkact_name_ != "") { + if (!stkact_name_.empty()) { auto stkact = ObjFactory::Instance().CreateObject(stkact_name_); this->SetUserAction(stkact.release()); } - if (trkact_name_ != "") { + if (!trkact_name_.empty()) { auto trkact = ObjFactory::Instance().CreateObject(trkact_name_); this->SetUserAction(trkact.release()); } - if (stepact_name_ != "") { + if (!stepact_name_.empty()) { auto stepact = ObjFactory::Instance().CreateObject(stepact_name_); this->SetUserAction(stepact.release()); }