Skip to content

Commit

Permalink
Adding in a method to get the spline interpolation type for splines w…
Browse files Browse the repository at this point in the history
…hcih affect a particular DetID
  • Loading branch information
EdAtkin committed Nov 20, 2024
1 parent 8611ffb commit 465e3c6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
14 changes: 14 additions & 0 deletions covariance/covarianceXsec.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "covariance/covarianceXsec.h"
#include "samplePDF/Structs.h"

// ********************************************
// ETA - YAML constructor
Expand Down Expand Up @@ -121,6 +122,19 @@ const std::vector<std::string> covarianceXsec::GetSplineParsNamesFromDetID(const
return returnVec;
}

const std::vector<SplineInterpolation> covarianceXsec::GetSplineInterpolationFromDetID(const int DetID) {
std::vector<SplineInterpolation> 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<int> > covarianceXsec::GetSplineModeVecFromDetID(const int DetID) {
Expand Down
2 changes: 2 additions & 0 deletions covariance/covarianceXsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<SplineInterpolation> 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];}
Expand Down
7 changes: 6 additions & 1 deletion splines/splineFDBase.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "splineFDBase.h"
#include <memory>
#include "samplePDF/Structs.h"

//****************************************
splineFDBase::splineFDBase(covarianceXsec *xsec_)
Expand Down Expand Up @@ -67,6 +68,10 @@ bool splineFDBase::AddSample(std::string SampleName, int DetID, std::vector<std:
//Keep track of this for all the samples
GlobalSystIndex.push_back(GlobalSystIndex_Sample);

std::vector<SplineInterpolation> SplineInterpolation_Sample = xsec->GetSplineInterpolationFromDetID(DetID);
// Keep track of this for all samples
SplineInterpolationTypes.push_back(SplineInterpolation_Sample);

//std::vector<int> SplineParsIndex_Sample_temp = xsec->GetSplineParsIndexFromDetID(DetID);

std::vector<std::string> SplineFileParPrefixNames_Sample = xsec->GetSplineParsNamesFromDetID(DetID);
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 4 additions & 0 deletions splines/splineFDBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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<int> > GlobalSystIndex;
/// @brief spline interpolation types for each sample. These vectors are from
/// a call to GetSplineInterpolationFromDetID()
std::vector< std::vector<SplineInterpolation> > SplineInterpolationTypes;

int nUniqueSysts;
std::vector<std::string> UniqueSystNames;
Expand Down

0 comments on commit 465e3c6

Please sign in to comment.