From 465e3c6240f8dc1f4139e0e748618da67ba075bb Mon Sep 17 00:00:00 2001 From: EdAtkin Date: Wed, 20 Nov 2024 23:44:46 +0000 Subject: [PATCH] Adding in a method to get the spline interpolation type for splines whcih affect a particular DetID --- covariance/covarianceXsec.cpp | 14 ++++++++++++++ covariance/covarianceXsec.h | 2 ++ splines/splineFDBase.cpp | 7 ++++++- splines/splineFDBase.h | 4 ++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/covariance/covarianceXsec.cpp b/covariance/covarianceXsec.cpp index fefae18ca..acd7874b6 100644 --- a/covariance/covarianceXsec.cpp +++ b/covariance/covarianceXsec.cpp @@ -1,4 +1,5 @@ #include "covariance/covarianceXsec.h" +#include "samplePDF/Structs.h" // ******************************************** // ETA - YAML constructor @@ -121,6 +122,19 @@ const std::vector covarianceXsec::GetSplineParsNamesFromDetID(const return returnVec; } +const std::vector covarianceXsec::GetSplineInterpolationFromDetID(const int DetID) { + std::vector returnVec; + for (auto &pair : _fSystToGlobalSystIndexMap[SystType::kSpline]) { + auto &SplineIndex = pair.first; + auto &SystIndex = pair.second; + if ((GetParDetID(SystIndex) & DetID )){ + returnVec.push_back(SplineParams.at(SplineIndex)._SplineInterpolationType); + } + } + + return returnVec; +} + // ******************************************** // DB Grab the Spline Modes for the relevant DetID const std::vector< std::vector > covarianceXsec::GetSplineModeVecFromDetID(const int DetID) { diff --git a/covariance/covarianceXsec.h b/covariance/covarianceXsec.h index 0936cc362..273a5052b 100644 --- a/covariance/covarianceXsec.h +++ b/covariance/covarianceXsec.h @@ -32,6 +32,8 @@ class covarianceXsec : public covarianceBase { /// @brief Get interpolation type for a given parameter /// @param i spline parameter index, not confuse with global index inline SplineInterpolation GetParSplineInterpolation(const int i) {return SplineParams.at(i)._SplineInterpolationType;} + /// @brief Get the interpolation types for splines affecting a particular DetID + const std::vector GetSplineInterpolationFromDetID(int DetID); /// @brief Get the name of the spline associated with the spline at index i /// @param i spline parameter index, not to be confused with global index std::string GetParSplineName(const int i) {return _fSplineNames[i];} diff --git a/splines/splineFDBase.cpp b/splines/splineFDBase.cpp index d2e31cc89..5bd85e05c 100644 --- a/splines/splineFDBase.cpp +++ b/splines/splineFDBase.cpp @@ -1,5 +1,6 @@ #include "splineFDBase.h" #include +#include "samplePDF/Structs.h" //**************************************** splineFDBase::splineFDBase(covarianceXsec *xsec_) @@ -67,6 +68,10 @@ bool splineFDBase::AddSample(std::string SampleName, int DetID, std::vector SplineInterpolation_Sample = xsec->GetSplineInterpolationFromDetID(DetID); + // Keep track of this for all samples + SplineInterpolationTypes.push_back(SplineInterpolation_Sample); + //std::vector SplineParsIndex_Sample_temp = xsec->GetSplineParsIndexFromDetID(DetID); std::vector SplineFileParPrefixNames_Sample = xsec->GetSplineParsNamesFromDetID(DetID); @@ -257,7 +262,7 @@ void splineFDBase::FindSplineSegment() xVarArray[iSyst]=xvar; _int_ segment = 0; - _int_ kHigh = nPoints - 1; + _int_ kHigh = nPoints - 1; //KS: We expect new segment is very close to previous const _int_ PreviousSegment = UniqueSystCurrSegment[iSyst]; diff --git a/splines/splineFDBase.h b/splines/splineFDBase.h index 8b99d4026..18e6a8993 100644 --- a/splines/splineFDBase.h +++ b/splines/splineFDBase.h @@ -4,6 +4,7 @@ #include "TH3F.h" //MaCh3 +#include "samplePDF/Structs.h" #include "splines/SplineBase.h" /// @brief Bin-by-bin class calculating response for spline parameters. @@ -91,6 +92,9 @@ class splineFDBase : public SplineBase { /// to evaluate splines at. Each internal vector will be of size of the number of spline /// systematics which affect that sample. std::vector< std::vector > GlobalSystIndex; + /// @brief spline interpolation types for each sample. These vectors are from + /// a call to GetSplineInterpolationFromDetID() + std::vector< std::vector > SplineInterpolationTypes; int nUniqueSysts; std::vector UniqueSystNames;