From 11d69fe925d33f62cccb483601a7aa116336f22e Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 16:14:51 +0000 Subject: [PATCH 1/9] Add POT weight to tutorial --- SamplesTutorial/SampleHandlerTutorial.cpp | 10 ++++++++-- SamplesTutorial/SampleHandlerTutorial.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index 3f61b38a..8b80f9ee 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -27,7 +27,10 @@ SampleHandlerTutorial::~SampleHandlerTutorial() { void SampleHandlerTutorial::Init() { // ************************************************ if (CheckNodeExists(SampleManager->raw(), "POT")) { - pot = SampleManager->raw()["POT"].as(); + double pot = SampleManager->raw()["POT"].as(); + double nominal_pot = 2.1428e+21; + pot_w = pot / nominal_pot; + } else{ MACH3LOG_ERROR("POT not defined in {}, please add this!", SampleManager->GetFileName()); throw MaCh3Exception(__FILE__, __LINE__); @@ -86,6 +89,9 @@ void SampleHandlerTutorial::SetupSplines() { // ************************************************ void SampleHandlerTutorial::AddAdditionalWeightPointers() { // ************************************************ + for (size_t i = 0; i < TutorialSamples.size(); ++i) { + MCEvents[i].total_weight_pointers.push_back(&(pot_w)); + } } @@ -356,4 +362,4 @@ void SampleHandlerTutorial::SetupMC() { MCEvents[iEvent].NominalSample = TutorialSamples[iEvent].Sample; if(isATM) MCEvents[iEvent].coszenith_true = TutorialSamples[iEvent].TrueCosZenith; } -} +} \ No newline at end of file diff --git a/SamplesTutorial/SampleHandlerTutorial.h b/SamplesTutorial/SampleHandlerTutorial.h index a1fcdd79..a406d62c 100755 --- a/SamplesTutorial/SampleHandlerTutorial.h +++ b/SamplesTutorial/SampleHandlerTutorial.h @@ -79,7 +79,7 @@ class SampleHandlerTutorial : public SampleHandlerBase }; // ============================================= - double pot; + double pot_w; bool isATM; // === HH: Functional parameters === From 0643e5abfffd0c9fca5732b45375a18504b9f242 Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 16:18:45 +0000 Subject: [PATCH 2/9] Add comment so it's not a random magic number --- SamplesTutorial/SampleHandlerTutorial.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index 8b80f9ee..d2f30719 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -28,6 +28,7 @@ void SampleHandlerTutorial::Init() { // ************************************************ if (CheckNodeExists(SampleManager->raw(), "POT")) { double pot = SampleManager->raw()["POT"].as(); + // HW: Nominal POT, taken from the default YAML double nominal_pot = 2.1428e+21; pot_w = pot / nominal_pot; From 41d991e52f2c98c6ec754715d78896b98cab349e Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 16:24:32 +0000 Subject: [PATCH 3/9] Make sure it works with low energy structs --- SamplesTutorial/SampleHandlerTutorial.cpp | 2 +- SamplesTutorial/SampleHandlerTutorial.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index d2f30719..a79617ee 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -29,7 +29,7 @@ void SampleHandlerTutorial::Init() { if (CheckNodeExists(SampleManager->raw(), "POT")) { double pot = SampleManager->raw()["POT"].as(); // HW: Nominal POT, taken from the default YAML - double nominal_pot = 2.1428e+21; + M3::float_t nominal_pot = 2.1428e+21; pot_w = pot / nominal_pot; } else{ diff --git a/SamplesTutorial/SampleHandlerTutorial.h b/SamplesTutorial/SampleHandlerTutorial.h index a406d62c..39048573 100755 --- a/SamplesTutorial/SampleHandlerTutorial.h +++ b/SamplesTutorial/SampleHandlerTutorial.h @@ -79,7 +79,7 @@ class SampleHandlerTutorial : public SampleHandlerBase }; // ============================================= - double pot_w; + M3::float_t pot_w; bool isATM; // === HH: Functional parameters === From 197c9e427f59f72c6c58716585e0eac749147896 Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 16:38:57 +0000 Subject: [PATCH 4/9] dumb type error --- SamplesTutorial/SampleHandlerTutorial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index a79617ee..8e30709d 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -27,7 +27,7 @@ SampleHandlerTutorial::~SampleHandlerTutorial() { void SampleHandlerTutorial::Init() { // ************************************************ if (CheckNodeExists(SampleManager->raw(), "POT")) { - double pot = SampleManager->raw()["POT"].as(); + M3::float_t pot = SampleManager->raw()["POT"].as(); // HW: Nominal POT, taken from the default YAML M3::float_t nominal_pot = 2.1428e+21; pot_w = pot / nominal_pot; From 9c0335800a2356582d80b623229cb8b77b543ce2 Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 16:46:11 +0000 Subject: [PATCH 5/9] Another case of builds on mac not on linux --- SamplesTutorial/SampleHandlerTutorial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index 8e30709d..c5799d29 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -29,7 +29,7 @@ void SampleHandlerTutorial::Init() { if (CheckNodeExists(SampleManager->raw(), "POT")) { M3::float_t pot = SampleManager->raw()["POT"].as(); // HW: Nominal POT, taken from the default YAML - M3::float_t nominal_pot = 2.1428e+21; + const M3::float_t nominal_pot(2.1428e+21); pot_w = pot / nominal_pot; } else{ From 1dc949e3801bd2228f1e47424cb3c25fb538f6f9 Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 16:53:28 +0000 Subject: [PATCH 6/9] C++ compiler being annoying --- SamplesTutorial/SampleHandlerTutorial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index c5799d29..587e8696 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -29,7 +29,7 @@ void SampleHandlerTutorial::Init() { if (CheckNodeExists(SampleManager->raw(), "POT")) { M3::float_t pot = SampleManager->raw()["POT"].as(); // HW: Nominal POT, taken from the default YAML - const M3::float_t nominal_pot(2.1428e+21); + const M3::float_t nominal_pot = static_cast(2.1428e+21); pot_w = pot / nominal_pot; } else{ From 1b22db0da011b4b2741234a9ca547385b1d9836f Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 18:10:49 +0000 Subject: [PATCH 7/9] I tried --- SamplesTutorial/SampleHandlerTutorial.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index 587e8696..49f9f575 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -29,8 +29,7 @@ void SampleHandlerTutorial::Init() { if (CheckNodeExists(SampleManager->raw(), "POT")) { M3::float_t pot = SampleManager->raw()["POT"].as(); // HW: Nominal POT, taken from the default YAML - const M3::float_t nominal_pot = static_cast(2.1428e+21); - pot_w = pot / nominal_pot; + pot_w = pot / 2.1428e+21; } else{ MACH3LOG_ERROR("POT not defined in {}, please add this!", SampleManager->GetFileName()); From d7cba120c0a56b533da7e4b7bcf060314c403ce5 Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 18:33:35 +0000 Subject: [PATCH 8/9] I give up, hopefully this compiles without complaining --- SamplesTutorial/SampleHandlerTutorial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index 49f9f575..8e248cfb 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -27,9 +27,9 @@ SampleHandlerTutorial::~SampleHandlerTutorial() { void SampleHandlerTutorial::Init() { // ************************************************ if (CheckNodeExists(SampleManager->raw(), "POT")) { - M3::float_t pot = SampleManager->raw()["POT"].as(); + M3::float_t pot = SampleManager->raw()["POT"].as(); // HW: Nominal POT, taken from the default YAML - pot_w = pot / 2.1428e+21; + pot_w = pot / 2.1428e+21; } else{ MACH3LOG_ERROR("POT not defined in {}, please add this!", SampleManager->GetFileName()); From 0076033bf6cd2c4cf572c4a196e90ae268f2ee0f Mon Sep 17 00:00:00 2001 From: henry-israel Date: Thu, 12 Nov 2026 19:02:12 +0000 Subject: [PATCH 9/9] pragma --- SamplesTutorial/SampleHandlerTutorial.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SamplesTutorial/SampleHandlerTutorial.cpp b/SamplesTutorial/SampleHandlerTutorial.cpp index 8e248cfb..3b956166 100755 --- a/SamplesTutorial/SampleHandlerTutorial.cpp +++ b/SamplesTutorial/SampleHandlerTutorial.cpp @@ -29,7 +29,14 @@ void SampleHandlerTutorial::Init() { if (CheckNodeExists(SampleManager->raw(), "POT")) { M3::float_t pot = SampleManager->raw()["POT"].as(); // HW: Nominal POT, taken from the default YAML - pot_w = pot / 2.1428e+21; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuseless-cast" + + const M3::float_t nominal_pot = static_cast(2.1428e+21); + +#pragma GCC diagnostic pop + pot_w = pot / nominal_pot; + } else{ MACH3LOG_ERROR("POT not defined in {}, please add this!", SampleManager->GetFileName());