3 #pragma GCC diagnostic ignored "-Wuseless-cast"
4 #pragma GCC diagnostic ignored "-Wfloat-conversion"
24 const std::vector<M3::float_t>& xPts)
const {
26 if (xPts[segment] > xvar && segment != 0) {
28 MACH3LOG_ERROR(
"IT SHOULD ALWAYS BE BELOW! (except when segment 0)");
33 for (
size_t j = 0; j < xPts.size(); ++j) {
60 if(xArray.size() == 0)
continue;
69 if (xvar <= xArray[0]) {
72 }
else if (xvar >= xArray[nPoints-1]) {
76 }
else if( xArray[PreviousSegment+1] > xvar && xvar >= xArray[PreviousSegment] ) {
77 segment = PreviousSegment;
84 while (kHigh - segment > 1) {
88 if (xvar > xArray[kHalf]) {
97 if (segment >= nPoints-1 && nPoints > 1) segment = nPoints-2;
132 for (
int i = 0; i < nPoints; i++) {
141 TTree *FastSplineInfoTree =
new TTree(
"FastSplineInfoTree",
"FastSplineInfoTree");
145 FastSplineInfoTree->Branch(
"nPts", &nPoints,
"nPts/I");
146 FastSplineInfoTree->Branch(
"xPts", xtemp,
"xPts[nPts]/F");
156 FastSplineInfoTree->Fill();
160 FastSplineInfoTree->Write();
162 delete FastSplineInfoTree;
169 TTree *FastSplineInfoTree = SplineFile->Get<TTree>(
"FastSplineInfoTree");
172 FastSplineInfoTree->SetBranchAddress(
"nPts", &nPoints);
173 FastSplineInfoTree->SetBranchAddress(
"xPts", &xtemp);
180 FastSplineInfoTree->GetEntry(i);
184 if(nPoints == -999)
continue;
constexpr int _nTF1Coeff_
KS: For TF1 we store at most 5 coefficients, we could make it more flexible but for now define it her...
Custom exception class used throughout MaCh3.
virtual ~SplineBase()
Destructor.
void CheckSegmentValidity(const M3::int_t i, const M3::int_t segment, const M3::float_t xvar, const std::vector< M3::float_t > &xPts) const
Validates that the spline segment is correct for the given variation.
void GetTF1Coeff(TF1_red *&spl, int &nPoints, float *&coeffs) const
CW: Gets the polynomial coefficients for TF1.
short int nParams
Number of parameters that have splines.
void FindSplineSegment()
CW:Code used in step by step reweighting, Find Spline Segment for each param.
short int * SplineSegments
std::vector< FastSplineInfo > SplineInfoArray
float * ParamValues
Store parameter values they are not in FastSplineInfo as in case of GPU we need to copy paste it to G...
void LoadFastSplineInfoDir(std::unique_ptr< TFile > &SplineFile)
KS: Load preprocessed FastSplineInfo.
void PrepareFastSplineInfoDir(std::unique_ptr< TFile > &SplineFile) const
KS: Prepare Fast Spline Info within SplineFile.
CW: A reduced TF1 class only. Only saves parameters for each TF1 and how many parameters each paramet...
double GetParameter(M3::int_t Parameter)
Get a parameter value.
int GetSize()
Get the size.