From fc6f576b9007052d780fe474e81a2ff63e6e27cb Mon Sep 17 00:00:00 2001 From: Liban Warsame Date: Thu, 7 Nov 2024 13:02:14 +0000 Subject: [PATCH 1/2] Keep track of status of interaction modes for each systematic, flag when spline has been found for a mode which wasn't specified in the cov yaml --- splines/splinesDUNE.cpp | 72 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/splines/splinesDUNE.cpp b/splines/splinesDUNE.cpp index 2421ab3..0058d94 100644 --- a/splines/splinesDUNE.cpp +++ b/splines/splinesDUNE.cpp @@ -22,6 +22,27 @@ void splinesDUNE::FillSampleArray(std::string SampleName, std::vector> ModeStatus; + + //Create map of Mode Status + for (unsigned iSyst = 0; iSyst < SplineFileParPrefixNames[iSample].size(); iSyst++) + { + auto modes = SplineModeVecs[iSample][iSyst]; + ModeStatus.emplace_back(); + + for (auto const & mode : modes) + { + //Add Modes from config + ModeStatus.back()[MaCh3mode_ToDUNEString((MaCh3_Mode)mode).c_str()] = kInConfig; + } + } + int nOscChannels = nOscChans[iSample]; for (int iOscChan = 0; iOscChan < nOscChannels; iOscChan++) @@ -94,12 +115,23 @@ void splinesDUNE::FillSampleArray(std::string SampleName, std::vectorGetName()); - MACH3LOG_ERROR("This is not ok, please check the spline file or the xsec systematic yaml file"); - throw MaCh3Exception(__FILE__, __LINE__); + //Check if mode has been registered already + if(ModeStatus[SystNum].count(Mode)) + { + //Chech if mode has been found in config + if(ModeStatus[SystNum][Mode]!=kInFile) + { + ModeStatus[SystNum][Mode]=kInConfigAndInFile; + } + else + { + continue; //Skip if mode has been found in file but not config + } + } + else + { + ModeStatus[SystNum][Mode]=kInFile; //If mode hasn't been registered then skip because it's not in the config + continue; } TSpline3 *Obj = (TSpline3 *)Key->ReadObj(); @@ -127,7 +159,6 @@ void splinesDUNE::FillSampleArray(std::string SampleName, std::vectorGetNp(); bool isFlat = true; - for (int iKnot = 0; iKnot < nKnots; iKnot++) { double x = -999; @@ -148,10 +179,10 @@ void splinesDUNE::FillSampleArray(std::string SampleName, std::vector MissedModes; + for (auto const & ModeUsage : ModeStatus[iSyst]) + { + if(ModeUsage.second==kInFile) + { + MissedModes.push_back(ModeUsage.first); + } + } + + if(MissedModes.size()!=0) + { + MACH3LOG_INFO("Parameter {} has splines for {} modes which have not been read in!", SplineFileParPrefixNames[iSample][iSyst].c_str(), MissedModes.size()); + std::cout << "Modes: "; + for (auto const & Mode : MissedModes) + { + std::cout << Mode << " "; + } + std::cout << std::endl; + } + } return; } From 7b852e78acdb1fef8beff9b87ac9a2d0b60812bf Mon Sep 17 00:00:00 2001 From: Liban Warsame Date: Thu, 7 Nov 2024 13:06:40 +0000 Subject: [PATCH 2/2] Tidy up --- splines/splinesDUNE.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/splines/splinesDUNE.cpp b/splines/splinesDUNE.cpp index 0058d94..f1c8904 100644 --- a/splines/splinesDUNE.cpp +++ b/splines/splinesDUNE.cpp @@ -115,6 +115,7 @@ void splinesDUNE::FillSampleArray(std::string SampleName, std::vectorGetNp(); bool isFlat = true; + for (int iKnot = 0; iKnot < nKnots; iKnot++) { double x = -999; @@ -180,9 +182,9 @@ void splinesDUNE::FillSampleArray(std::string SampleName, std::vector