Base class for calculating weight from spline.
More...
#include <Splines/SplineBase.h>
|
| SplineBase () |
| Constructor. More...
|
|
virtual | ~SplineBase () |
| Destructor. More...
|
|
virtual void | Evaluate ()=0 |
| CW: This Eval should be used when using two separate x,{y,a,b,c,d} arrays to store the weights; probably the best one here! Same thing but pass parameter spline segments instead of variations. More...
|
|
virtual std::string | GetName () const |
| Get class name. More...
|
|
short int | GetNParams () const |
| Get number of spline parameters. More...
|
|
virtual void | PrepareSplineFile (std::string FileName)=0 |
| KS: Prepare spline file that can be used for fast loading. More...
|
|
virtual void | LoadSplineFile (std::string FileName)=0 |
| KS: Load preprocessed spline file. More...
|
|
Base class for calculating weight from spline.
Definition at line 25 of file SplineBase.h.
◆ SplineBase()
SplineBase::SplineBase |
( |
| ) |
|
Constructor.
Definition at line 7 of file SplineBase.cpp.
short int nParams
Number of parameters that have splines.
short int * SplineSegments
float * ParamValues
Store parameter values they are not in FastSplineInfo as in case of GPU we need to copy paste it to G...
◆ ~SplineBase()
SplineBase::~SplineBase |
( |
| ) |
|
|
virtual |
◆ CalcSplineWeights()
virtual void SplineBase::CalcSplineWeights |
( |
| ) |
|
|
protectedpure virtual |
◆ Evaluate()
virtual void SplineBase::Evaluate |
( |
| ) |
|
|
pure virtual |
CW: This Eval should be used when using two separate x,{y,a,b,c,d} arrays to store the weights; probably the best one here! Same thing but pass parameter spline segments instead of variations.
Implemented in SMonolith, BinnedSplineHandler, and PySplineBase.
◆ FindSplineSegment()
void SplineBase::FindSplineSegment |
( |
| ) |
|
|
protected |
CW:Code used in step by step reweighting, Find Spline Segment for each param.
Definition at line 24 of file SplineBase.cpp.
40 if(xArray.size() == 0)
continue;
49 if (xvar <= xArray[0]) {
52 }
else if (xvar >= xArray[nPoints-1]) {
56 }
else if( xArray[PreviousSegment+1] > xvar && xvar >= xArray[PreviousSegment] ) {
57 segment = PreviousSegment;
64 while (kHigh - segment > 1) {
68 if (xvar > xArray[kHalf]) {
77 if (segment >= nPoints-1 && nPoints > 1) segment = nPoints-2;
88 MACH3LOG_ERROR(
"IT SHOULD ALWAYS BE BELOW! (except when segment 0)");
Custom exception class for MaCh3 errors.
std::vector< FastSplineInfo > SplineInfoArray
◆ GetName()
virtual std::string SplineBase::GetName |
( |
| ) |
const |
|
inlinevirtual |
◆ GetNParams()
short int SplineBase::GetNParams |
( |
| ) |
const |
|
inline |
Get number of spline parameters.
Definition at line 39 of file SplineBase.h.
◆ getTF1Coeff()
void SplineBase::getTF1Coeff |
( |
TF1_red *& |
spl, |
|
|
int & |
nPoints, |
|
|
float *& |
coeffs |
|
) |
| |
|
protected |
CW: Gets the polynomial coefficients for TF1.
- Parameters
-
spl | pointer to TF1_red that will be checked |
nPoints | number of knots |
coeffs | Array holding coefficients for each knot |
Definition at line 106 of file SplineBase.cpp.
123 for (
int i = 0; i < nPoints; i++) {
constexpr int _nTF1Coeff_
KS: For TF1 we store at most 5 coefficients, we could make it more flexible but for now define it her...
double GetParameter(M3::int_t Parameter)
Get a parameter value.
int GetSize()
Get the size.
◆ LoadFastSplineInfoDir()
void SplineBase::LoadFastSplineInfoDir |
( |
std::unique_ptr< TFile > & |
SplineFile | ) |
|
|
protected |
KS: Load preprocessed FastSplineInfo.
- Parameters
-
File | File from which we load new tree |
Definition at line 159 of file SplineBase.cpp.
161 TTree *FastSplineInfoTree = SplineFile->Get<TTree>(
"FastSplineInfoTree");
164 FastSplineInfoTree->SetBranchAddress(
"nPts", &nPoints);
165 FastSplineInfoTree->SetBranchAddress(
"xPts", &xtemp);
172 FastSplineInfoTree->GetEntry(i);
176 if(nPoints == -999)
continue;
◆ LoadSplineFile()
virtual void SplineBase::LoadSplineFile |
( |
std::string |
FileName | ) |
|
|
pure virtual |
KS: Load preprocessed spline file.
- Parameters
-
FileName | Path to ROOT file with predefined reduced Spline Monolith |
Implemented in SMonolith, and BinnedSplineHandler.
◆ ModifyWeights()
virtual void SplineBase::ModifyWeights |
( |
| ) |
|
|
protectedpure virtual |
◆ PrepareFastSplineInfoDir()
void SplineBase::PrepareFastSplineInfoDir |
( |
std::unique_ptr< TFile > & |
SplineFile | ) |
const |
|
protected |
KS: Prepare Fast Spline Info within SplineFile.
- Parameters
-
File | File to which we add new tree |
Definition at line 131 of file SplineBase.cpp.
133 TTree *FastSplineInfoTree =
new TTree(
"FastSplineInfoTree",
"FastSplineInfoTree");
137 FastSplineInfoTree->Branch(
"nPts", &nPoints,
"nPts/I");
138 FastSplineInfoTree->Branch(
"xPts", xtemp,
"xPts[nPts]/F");
148 FastSplineInfoTree->Fill();
152 FastSplineInfoTree->Write();
154 delete FastSplineInfoTree;
◆ PrepareSplineFile()
virtual void SplineBase::PrepareSplineFile |
( |
std::string |
FileName | ) |
|
|
pure virtual |
◆ nParams
short int SplineBase::nParams |
|
protected |
Number of parameters that have splines.
Definition at line 78 of file SplineBase.h.
◆ ParamValues
float* SplineBase::ParamValues |
|
protected |
Store parameter values they are not in FastSplineInfo as in case of GPU we need to copy paste it to GPU.
Definition at line 76 of file SplineBase.h.
◆ SplineInfoArray
Array of FastSplineInfo structs: keeps information on each xsec spline for fast evaluation Method identical to TSpline3::Eval(double) but faster because less operations
Definition at line 71 of file SplineBase.h.
◆ SplineSegments
short int* SplineBase::SplineSegments |
|
protected |
Store currently found segment they are not in FastSplineInfo as in case of GPU we need to copy paste it to GPU
- Warning
- this is being used sometimes by GPU, therefore must be raw pointer!
Definition at line 74 of file SplineBase.h.
The documentation for this class was generated from the following files: