From 73eb61bdea3923eac6032d412cc3e7f65418f28e Mon Sep 17 00:00:00 2001 From: Daniel Barrow Date: Tue, 14 Jan 2025 14:20:27 -0600 Subject: [PATCH 1/9] Remove signal checks and replace nupdg==nupdgUnosc check as that's all we use it for now anyway - also simplifies sample configs --- samplePDF/FarDetectorCoreInfoStruct.h | 1 - samplePDF/samplePDFFDBase.cpp | 6 ++---- samplePDF/samplePDFFDBase.h | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/samplePDF/FarDetectorCoreInfoStruct.h b/samplePDF/FarDetectorCoreInfoStruct.h index 1bc68c51a..4919ba824 100644 --- a/samplePDF/FarDetectorCoreInfoStruct.h +++ b/samplePDF/FarDetectorCoreInfoStruct.h @@ -13,7 +13,6 @@ struct FarDetectorCoreInfo { ~FarDetectorCoreInfo(){ delete [] isNC; } - bool signal; ///< true if signue int nEvents; ///< how many MC events are there double ChannelIndex; std::string flavourName; diff --git a/samplePDF/samplePDFFDBase.cpp b/samplePDF/samplePDFFDBase.cpp index e190bcd2b..afae04cc3 100644 --- a/samplePDF/samplePDFFDBase.cpp +++ b/samplePDF/samplePDFFDBase.cpp @@ -142,7 +142,6 @@ void samplePDFFDBase::ReadSampleConfig() sample_vecno.push_back(osc_channel["samplevecno"].as()); sample_nupdgunosc.push_back(static_cast(osc_channel["nutype"].as())); sample_nupdg.push_back(static_cast(osc_channel["oscnutype"].as())); - sample_signal.push_back(osc_channel["signal"].as()); } //Now get selection cuts @@ -759,7 +758,7 @@ void samplePDFFDBase::CalcXsecNormsBins(int iSample){ // Not strictly needed, but these events don't get included in oscillated predictions, so // no need to waste our time calculating and storing information about xsec parameters // that will never be used. - if (fdobj->isNC[iEvent] && fdobj->signal) { + if (fdobj->isNC[iEvent] && (fdobj->nupdg[iEvent] == fdobj->nupdgUnosc[iEvent]) ) { MACH3LOG_TRACE("Event {}, missed NC/signal check", iEvent); continue; } //DB Abstract check on MaCh3Modes to determine which apply to neutral current @@ -1347,7 +1346,7 @@ void samplePDFFDBase::SetupNuOscillator() { MCSamples[iSample].osc_w_pointer[iEvent] = &Unity; #endif if (MCSamples[iSample].isNC[iEvent]) { - if (MCSamples[iSample].signal) { + if (MCSamples[iSample].nupdg[iEvent] == MCSamples[iSample].nupdgUnosc[iEvent]) { #ifdef _LOW_MEMORY_STRUCTS_ MCSamples[iSample].osc_w_pointer[iEvent] = &Zero_F; #else @@ -1481,7 +1480,6 @@ void samplePDFFDBase::InitialiseSingleFDMCObject(int iSample, int nEvents_) { FarDetectorCoreInfo *fdobj = &MCSamples[iSample]; fdobj->nEvents = nEvents_; - fdobj->signal = false; int nEvents = fdobj->nEvents; fdobj->x_var.resize(nEvents, &Unity); diff --git a/samplePDF/samplePDFFDBase.h b/samplePDF/samplePDFFDBase.h index 2217c248e..acf3f1c54 100644 --- a/samplePDF/samplePDFFDBase.h +++ b/samplePDF/samplePDFFDBase.h @@ -240,5 +240,4 @@ class samplePDFFDBase : public samplePDFBase std::vector sample_vecno; std::vector sample_nupdg; std::vector sample_nupdgunosc; - std::vector sample_signal; }; From 8b624ded29d430077f0bb3ccce2673ac470edc3e Mon Sep 17 00:00:00 2001 From: Daniel Barrow Date: Tue, 14 Jan 2025 14:30:45 -0600 Subject: [PATCH 2/9] Reverse logic of new signal check --- samplePDF/samplePDFFDBase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samplePDF/samplePDFFDBase.cpp b/samplePDF/samplePDFFDBase.cpp index afae04cc3..935694f94 100644 --- a/samplePDF/samplePDFFDBase.cpp +++ b/samplePDF/samplePDFFDBase.cpp @@ -758,7 +758,7 @@ void samplePDFFDBase::CalcXsecNormsBins(int iSample){ // Not strictly needed, but these events don't get included in oscillated predictions, so // no need to waste our time calculating and storing information about xsec parameters // that will never be used. - if (fdobj->isNC[iEvent] && (fdobj->nupdg[iEvent] == fdobj->nupdgUnosc[iEvent]) ) { + if (fdobj->isNC[iEvent] && (fdobj->nupdg[iEvent] != fdobj->nupdgUnosc[iEvent]) ) { MACH3LOG_TRACE("Event {}, missed NC/signal check", iEvent); continue; } //DB Abstract check on MaCh3Modes to determine which apply to neutral current @@ -1346,7 +1346,7 @@ void samplePDFFDBase::SetupNuOscillator() { MCSamples[iSample].osc_w_pointer[iEvent] = &Unity; #endif if (MCSamples[iSample].isNC[iEvent]) { - if (MCSamples[iSample].nupdg[iEvent] == MCSamples[iSample].nupdgUnosc[iEvent]) { + if (MCSamples[iSample].nupdg[iEvent] != MCSamples[iSample].nupdgUnosc[iEvent]) { #ifdef _LOW_MEMORY_STRUCTS_ MCSamples[iSample].osc_w_pointer[iEvent] = &Zero_F; #else From 9df80c17ff42866733229d4e75f667e829cec12e Mon Sep 17 00:00:00 2001 From: Daniel Barrow Date: Fri, 17 Jan 2025 06:48:54 -0600 Subject: [PATCH 3/9] Saved oscillation channel names from config and fill relevant fdmc variable --- samplePDF/samplePDFFDBase.cpp | 2 ++ samplePDF/samplePDFFDBase.h | 1 + 2 files changed, 3 insertions(+) diff --git a/samplePDF/samplePDFFDBase.cpp b/samplePDF/samplePDFFDBase.cpp index 935694f94..fb88f2e5d 100644 --- a/samplePDF/samplePDFFDBase.cpp +++ b/samplePDF/samplePDFFDBase.cpp @@ -137,6 +137,7 @@ void samplePDFFDBase::ReadSampleConfig() std::string splinesuffix = SampleManager->raw()["InputFiles"]["splinesuffix"].as(); for (auto const &osc_channel : SampleManager->raw()["SubSamples"]) { + oscchan_flavnames.push_back(osc_channel["name"].as()); mc_files.push_back(mtupleprefix+osc_channel["mtuplefile"].as()+mtuplesuffix); spline_files.push_back(splineprefix+osc_channel["splinefile"].as()+splinesuffix); sample_vecno.push_back(osc_channel["samplevecno"].as()); @@ -1480,6 +1481,7 @@ void samplePDFFDBase::InitialiseSingleFDMCObject(int iSample, int nEvents_) { FarDetectorCoreInfo *fdobj = &MCSamples[iSample]; fdobj->nEvents = nEvents_; + fdobj->flavourName = oscchan_flavnames[iSample]; int nEvents = fdobj->nEvents; fdobj->x_var.resize(nEvents, &Unity); diff --git a/samplePDF/samplePDFFDBase.h b/samplePDF/samplePDFFDBase.h index acf3f1c54..b05e93491 100644 --- a/samplePDF/samplePDFFDBase.h +++ b/samplePDF/samplePDFFDBase.h @@ -235,6 +235,7 @@ class samplePDFFDBase : public samplePDFBase void InitialiseSingleFDMCObject(int iSample, int nEvents); void InitialiseSplineObject(); + std::vector oscchan_flavnames; std::vector mc_files; std::vector spline_files; std::vector sample_vecno; From 95c8500102f555031ae6ae360df29faa4f0c465a Mon Sep 17 00:00:00 2001 From: Daniel Barrow Date: Fri, 17 Jan 2025 07:08:12 -0600 Subject: [PATCH 4/9] Compare values, not pointers, when performing signal checks. Fill Channel index fdmc variable --- samplePDF/samplePDFFDBase.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/samplePDF/samplePDFFDBase.cpp b/samplePDF/samplePDFFDBase.cpp index fb88f2e5d..3bf7f8814 100644 --- a/samplePDF/samplePDFFDBase.cpp +++ b/samplePDF/samplePDFFDBase.cpp @@ -14,7 +14,7 @@ samplePDFFDBase::samplePDFFDBase(std::string ConfigFileName, covarianceXsec* xse { MACH3LOG_INFO("-------------------------------------------------------------------"); MACH3LOG_INFO("Creating SamplePDFFDBase object"); - + //ETA - safety feature so you can't pass a NULL xsec_cov if(!xsec_cov){ MACH3LOG_ERROR("You've passed me a nullptr to a covarianceXsec... I need this to setup splines!"); @@ -759,7 +759,7 @@ void samplePDFFDBase::CalcXsecNormsBins(int iSample){ // Not strictly needed, but these events don't get included in oscillated predictions, so // no need to waste our time calculating and storing information about xsec parameters // that will never be used. - if (fdobj->isNC[iEvent] && (fdobj->nupdg[iEvent] != fdobj->nupdgUnosc[iEvent]) ) { + if (fdobj->isNC[iEvent] && (*fdobj->nupdg[iEvent] != *fdobj->nupdgUnosc[iEvent]) ) { MACH3LOG_TRACE("Event {}, missed NC/signal check", iEvent); continue; } //DB Abstract check on MaCh3Modes to determine which apply to neutral current @@ -1347,7 +1347,7 @@ void samplePDFFDBase::SetupNuOscillator() { MCSamples[iSample].osc_w_pointer[iEvent] = &Unity; #endif if (MCSamples[iSample].isNC[iEvent]) { - if (MCSamples[iSample].nupdg[iEvent] != MCSamples[iSample].nupdgUnosc[iEvent]) { + if (*MCSamples[iSample].nupdg[iEvent] != *MCSamples[iSample].nupdgUnosc[iEvent]) { #ifdef _LOW_MEMORY_STRUCTS_ MCSamples[iSample].osc_w_pointer[iEvent] = &Zero_F; #else @@ -1482,6 +1482,7 @@ void samplePDFFDBase::InitialiseSingleFDMCObject(int iSample, int nEvents_) { fdobj->nEvents = nEvents_; fdobj->flavourName = oscchan_flavnames[iSample]; + fdobj->ChannelIndex = iSample; int nEvents = fdobj->nEvents; fdobj->x_var.resize(nEvents, &Unity); From 8910af0acf95bb2e702a3cdfc8a59bb78c948b35 Mon Sep 17 00:00:00 2001 From: Kamil Skwarczynski Date: Mon, 20 Jan 2025 18:27:31 +0000 Subject: [PATCH 5/9] FFT test --- mcmc/MCMCProcessor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mcmc/MCMCProcessor.cpp b/mcmc/MCMCProcessor.cpp index b999b167d..3f0c68257 100644 --- a/mcmc/MCMCProcessor.cpp +++ b/mcmc/MCMCProcessor.cpp @@ -58,6 +58,9 @@ MCMCProcessor::MCMCProcessor(const std::string &InputFile) : FancyPlotNames = true; doDiagMCMC = false; useFFTAutoCorrelation = true; + + // KS: ROOT can compile FFT code but it will crash during run time. Turn off FFT dynamically + if (std::system("ls $(root-config --libdir) | grep -i FFT") == 0) useFFTAutoCorrelation = false; OutputSuffix = "_Process"; Post2DPlotThreshold = 1.e-5; From 0ece25c57755598da5c1f3c64f8db8c7b7b32689 Mon Sep 17 00:00:00 2001 From: Kamil Skwarczynski Date: Mon, 20 Jan 2025 20:38:22 +0000 Subject: [PATCH 6/9] update --- cmake/Modules/MaCh3Dependencies.cmake | 8 ++++++++ mcmc/MCMCProcessor.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/MaCh3Dependencies.cmake b/cmake/Modules/MaCh3Dependencies.cmake index 2a6fb0976..245d8db97 100755 --- a/cmake/Modules/MaCh3Dependencies.cmake +++ b/cmake/Modules/MaCh3Dependencies.cmake @@ -49,6 +49,14 @@ set(MaCh3_MINUIT2_ENABLED FALSE) if(ROOT_VERSION GREATER_EQUAL 6.32.00 OR ROOT_CONFIG_MINUIT2 GREATER -1) set(MaCh3_MINUIT2_ENABLED TRUE) endif() + +list(FIND ROOT_FEATURES_LIST "fftw3" ROOT_CONFIG_FFT) +set(MaCh3_FFT_ENABLED FALSE) +if(ROOT_CONFIG_FFT GREATER -1) + cmessage(STATUS "FFT Enabled") + set(MaCh3_FFT_ENABLED TRUE) + target_compile_definitions(MaCh3CompileDefinitions INTERFACE MaCh3_FFT) +endif() ### End ROOT setup #YAML for reading in config files diff --git a/mcmc/MCMCProcessor.cpp b/mcmc/MCMCProcessor.cpp index 3f0c68257..d93827199 100644 --- a/mcmc/MCMCProcessor.cpp +++ b/mcmc/MCMCProcessor.cpp @@ -57,10 +57,13 @@ MCMCProcessor::MCMCProcessor(const std::string &InputFile) : ApplySmoothing = true; FancyPlotNames = true; doDiagMCMC = false; - useFFTAutoCorrelation = true; // KS: ROOT can compile FFT code but it will crash during run time. Turn off FFT dynamically - if (std::system("ls $(root-config --libdir) | grep -i FFT") == 0) useFFTAutoCorrelation = false; +#ifdef MaCh3_FFT + useFFTAutoCorrelation = true; +#else + useFFTAutoCorrelation = false; +#endif OutputSuffix = "_Process"; Post2DPlotThreshold = 1.e-5; From 9faa8e1de219959eb23ea719b86eb977a64f3a4d Mon Sep 17 00:00:00 2001 From: Kamil Skwarczynski Date: Tue, 21 Jan 2025 09:14:02 +0000 Subject: [PATCH 7/9] add more docueamtion --- cmake/Modules/MaCh3Dependencies.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/Modules/MaCh3Dependencies.cmake b/cmake/Modules/MaCh3Dependencies.cmake index 245d8db97..27ba88f88 100755 --- a/cmake/Modules/MaCh3Dependencies.cmake +++ b/cmake/Modules/MaCh3Dependencies.cmake @@ -50,6 +50,7 @@ if(ROOT_VERSION GREATER_EQUAL 6.32.00 OR ROOT_CONFIG_MINUIT2 GREATER -1) set(MaCh3_MINUIT2_ENABLED TRUE) endif() +# KS: Parts of MaCh3 uses Fast Fourier Transform, do some safeguard list(FIND ROOT_FEATURES_LIST "fftw3" ROOT_CONFIG_FFT) set(MaCh3_FFT_ENABLED FALSE) if(ROOT_CONFIG_FFT GREATER -1) From 3a41badefc7faa7b495f17b97b639050d6350915 Mon Sep 17 00:00:00 2001 From: Kamil <45295406+KSkwarczynski@users.noreply.github.com> Date: Tue, 21 Jan 2025 10:13:44 +0000 Subject: [PATCH 8/9] Temporary turn off python CI --- .github/workflows/CIPythonValidations.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CIPythonValidations.yml b/.github/workflows/CIPythonValidations.yml index 184d99273..a2d19d8d2 100644 --- a/.github/workflows/CIPythonValidations.yml +++ b/.github/workflows/CIPythonValidations.yml @@ -3,9 +3,12 @@ name: Validations Python CI # The events that trigger the workflow +# on: +# pull_request: +# branches: [ develop ] +# This wrokflow temporary dont work, please uncoment this when fixed on: - pull_request: - branches: [ develop ] + workflow_dispatch: # Placeholder trigger to allow manual runs only permissions: contents: read From 14d6f07ad5c138e9f52617f7e8abedb5e88b5bde Mon Sep 17 00:00:00 2001 From: Veera Mikola Date: Tue, 21 Jan 2025 11:11:38 +0000 Subject: [PATCH 9/9] Removed a reference to TLorentzVector as it has been removed from new ROOT versions --- samplePDF/HistogramUtils.h | 1 - 1 file changed, 1 deletion(-) diff --git a/samplePDF/HistogramUtils.h b/samplePDF/HistogramUtils.h index c61174add..6e3b34076 100644 --- a/samplePDF/HistogramUtils.h +++ b/samplePDF/HistogramUtils.h @@ -9,7 +9,6 @@ #pragma GCC diagnostic ignored "-Wformat-nonliteral" // ROOT include #include "TGraphAsymmErrors.h" -#include "TLorentzVector.h" #include "TObjString.h" #include "TRandom3.h" #pragma GCC diagnostic pop