7 #pragma GCC diagnostic ignored "-Wuseless-cast"
8 #pragma GCC diagnostic ignored "-Wfloat-conversion"
38 const std::vector<M3::float_t>& xPts)
const {
40 if (xPts[segment] > xvar && segment != 0) {
42 MACH3LOG_ERROR(
"IT SHOULD ALWAYS BE BELOW! (except when segment 0)");
47 for (
size_t j = 0; j < xPts.size(); ++j) {
74 if(xArray.size() == 0)
continue;
83 if (xvar <= xArray[0]) {
86 }
else if (xvar >= xArray[nPoints-1]) {
90 }
else if( xArray[PreviousSegment+1] > xvar && xvar >= xArray[PreviousSegment] ) {
91 segment = PreviousSegment;
98 while (kHigh - segment > 1) {
102 if (xvar > xArray[kHalf]) {
111 if (segment >= nPoints-1 && nPoints > 1) segment = nPoints-2;
146 for (
int i = 0; i < nPoints; i++) {
155 TTree *FastSplineInfoTree =
new TTree(
"FastSplineInfoTree",
"FastSplineInfoTree");
159 FastSplineInfoTree->Branch(
"nPts", &nPoints,
"nPts/I");
160 FastSplineInfoTree->Branch(
"xPts", xtemp,
"xPts[nPts]/F");
170 FastSplineInfoTree->Fill();
174 FastSplineInfoTree->Write();
176 delete FastSplineInfoTree;
183 TTree *FastSplineInfoTree = SplineFile->Get<TTree>(
"FastSplineInfoTree");
186 FastSplineInfoTree->SetBranchAddress(
"nPts", &nPoints);
187 FastSplineInfoTree->SetBranchAddress(
"xPts", &xtemp);
194 FastSplineInfoTree->GetEntry(i);
198 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.
SplineMonolithGPU * gpu_monolith
KS: Store info about Spline monolith, this allow to obtain better step time. As all necessary informa...
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.
void SynchroniseMemTransfer() const
KS: After calculations are done on GPU we copy memory to CPU. This operation is asynchronous meaning ...
unsigned int NSplines_valid
Number of valid splines.
short int nParams
Number of parameters that have splines.
virtual std::string GetName() const
Get class name.
short int _max_knots
Max knots for production.
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...
bool useGPU
Whether to use GPU or not.
void LoadFastSplineInfoDir(std::unique_ptr< TFile > &SplineFile)
KS: Load preprocessed FastSplineInfo.
SplineBase(const bool Use_GPU=true)
Constructor.
void PrepareFastSplineInfoDir(std::unique_ptr< TFile > &SplineFile) const
KS: Prepare Fast Spline Info within SplineFile.
void SetupSegments()
Since we find segment before actual reweight and sometimes we want to copy it to GPU we have differen...
__host__ void InitGPU_Vals(float **vals)
Allocate memory for spline segments.
__host__ void InitGPU_Segments(short int **segment)
Allocate memory for spline segments.
CW: A reduced TF1 class only. Only saves parameters for each TF1 and how many parameters each paramet...
double GetParameter(M3::int_t Parameter) const
Get a parameter value.
int GetSize() const
Get the size.
__host__ void SynchroniseSplines()
Make sure all Cuda threads finished execution.
MaCh3 event-by-event cross-section spline code.