![]() |
MaCh3 2.2.1
Reference Guide
|
Even-by-event class calculating response for spline parameters. It is possible to use GPU acceleration. More...
#include <Splines/SplineMonolith.h>
Public Member Functions | |
SMonolith (std::vector< std::vector< TResponseFunction_red * > > &MasterSpline, const std::vector< RespFuncType > &SplineType, const bool SaveFlatTree=false) | |
Constructor. | |
SMonolith (const std::string &FileName) | |
Constructor where you pass path to preprocessed root FileName. | |
virtual | ~SMonolith () |
Destructor for SMonolith class. | |
void | Evaluate () override |
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. | |
std::string | GetName () const |
Get class name. | |
void | SynchroniseMemTransfer () |
KS: After calculations are done on GPU we copy memory to CPU. This operation is asynchronous meaning while memory is being copied some operations are being carried. Memory must be copied before actual reweight. This function make sure all has been copied. | |
const float * | retPointer (const int event) |
KS: Get pointer to total weight to make fit faster wrooom! | |
void | setSplinePointers (std::vector< const double * > spline_ParsPointers) |
KS: Set pointers to spline params. | |
![]() | |
SplineBase () | |
Constructor. | |
virtual | ~SplineBase () |
Destructor. | |
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. | |
virtual std::string | GetName () const |
Get class name. | |
short int | GetNParams () const |
Get number of spline parameters. | |
Public Attributes | |
float * | cpu_weights |
The returned gpu weights, read by the GPU. | |
float * | cpu_total_weights |
KS: This holds the total CPU weights that gets read in samplePDFND. | |
Private Member Functions | |
void | Initialise () |
KS: Set everything to null etc. | |
void | ScanMasterSpline (std::vector< std::vector< TResponseFunction_red * > > &MasterSpline, unsigned int &nEvents, short int &MaxPoints, short int &numParams, int &nSplines, unsigned int &NSplinesValid, unsigned int &numKnots, unsigned int &nTF1Valid, unsigned int &nTF1_coeff, const std::vector< RespFuncType > &SplineType) |
CW: Function to scan through the MasterSpline of TSpline3. | |
void | PrepareForGPU (std::vector< std::vector< TResponseFunction_red * > > &MasterSpline, const std::vector< RespFuncType > &SplineType) |
CW: Prepare the TSpline3_red objects for the GPU. | |
void | MoveToGPU () |
CW: The shared initialiser from constructors of TResponseFunction_red. | |
void | PrintInitialsiation () |
KS: Print info about how much knots etc has been initialised. | |
void | getSplineCoeff_SepMany (TSpline3_red *&spl, int &nPoints, float *&xArray, float *&manyArray) |
CW: This loads up coefficients into two arrays: one x array and one yabcd array. | |
void | CalcSplineWeights () override |
CPU based code which eval weight for each spline. | |
void | ModifyWeights () override |
Calc total event weight. | |
void | ModifyWeights_GPU () |
Conversion from valid splines to all. | |
void | PrepareSplineFile () |
KS: Prepare spline file that can be used for fast loading. | |
void | LoadSplineFile (std::string FileName) |
KS: Load preprocessed spline file. | |
Private Attributes | |
std::vector< const double * > | splineParsPointer |
This holds pointer to parameter position which we later copy paste it to GPU. | |
unsigned int | NEvents |
Number of events. | |
short int | _max_knots |
Max knots for production. | |
std::vector< int > | index_spline_cpu |
holds the index for good splines; don't do unsigned since starts with negative value! | |
std::vector< int > | index_TF1_cpu |
holds the index for good TF1; don't do unsigned since starts with negative value! | |
unsigned int | NSplines_valid |
Number of valid splines. | |
unsigned int | NTF1_valid |
Number of valid TF1. | |
unsigned int | NSplines_total_large |
Number of total splines if each event had every parameter's spline. | |
unsigned int | nKnots |
Sum of all knots over all splines. | |
unsigned int | nTF1coeff |
Sum of all coefficients over all TF1. | |
float * | cpu_weights_spline_var |
CPU arrays to hold weight for each spline. | |
float * | cpu_weights_tf1_var |
CPU arrays to hold weight for each TF1. | |
std::vector< unsigned int > | cpu_nParamPerEvent |
KS: CPU map keeping track how many parameters applies to each event, we keep two numbers here {number of splines per event, index where splines start for a given event}. | |
std::vector< unsigned int > | cpu_nParamPerEvent_tf1 |
KS: CPU map keeping track how many parameters applies to each event, we keep two numbers here {number of TF1 per event, index where TF1 start for a given event}. | |
SplineMonoStruct * | cpu_spline_handler |
KS: Store info about Spline monolith, this allow to obtain better step time. As all necessary information for spline weight calculation are here meaning better cache hits. | |
SMonolithGPU * | gpu_spline_handler |
KS: Store info about Spline monolith, this allow to obtain better step time. As all necessary information for spline weight calculation are here meaning better cache hits. | |
std::vector< float > | cpu_coeff_TF1_many |
CPU arrays to hold TF1 coefficients. | |
std::vector< short int > | cpu_nPoints_arr |
CPU arrays to hold number of points. | |
std::vector< short int > | cpu_paramNo_TF1_arr |
CW: CPU array with the number of points per spline (not per spline point!) | |
bool | SaveSplineFile |
Flag telling whether we are saving spline monolith into handy root file. | |
Additional Inherited Members | |
![]() | |
void | FindSplineSegment () |
CW:Code used in step by step reweighting, Find Spline Segment for each param. | |
virtual void | CalcSplineWeights ()=0 |
CPU based code which eval weight for each spline. | |
virtual void | ModifyWeights ()=0 |
Calc total event weight. | |
void | getTF1Coeff (TF1_red *&spl, int &nPoints, float *&coeffs) |
CW: Gets the polynomial coefficients for TF1. | |
![]() | |
std::vector< FastSplineInfo > | SplineInfoArray |
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 GPU. | |
short int | nParams |
Number of parameters that have splines. | |
Even-by-event class calculating response for spline parameters. It is possible to use GPU acceleration.
Definition at line 12 of file SplineMonolith.h.
SMonolith::SMonolith | ( | std::vector< std::vector< TResponseFunction_red * > > & | MasterSpline, |
const std::vector< RespFuncType > & | SplineType, | ||
const bool | SaveFlatTree = false |
||
) |
Constructor.
MasterSpline | Vector of TSpline3 pointers which we strip back |
SplineType | Whether object is TSpline3 or TF1 |
SaveFlatTree | Whether we want to save monolith into speedy flat tree |
Definition at line 38 of file SplineMonolith.cpp.
SMonolith::SMonolith | ( | const std::string & | FileName | ) |
Constructor where you pass path to preprocessed root FileName.
FileName | path to pre-processed root file containing stripped monolith info |
Definition at line 502 of file SplineMonolith.cpp.
|
virtual |
Destructor for SMonolith class.
Definition at line 725 of file SplineMonolith.cpp.
|
inlineoverrideprivatevirtual |
CPU based code which eval weight for each spline.
Implements SplineBase.
Definition at line 847 of file SplineMonolith.cpp.
|
overridevirtual |
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.
Implements SplineBase.
Definition at line 832 of file SplineMonolith.cpp.
|
inlinevirtual |
Get class name.
Reimplemented from SplineBase.
Definition at line 31 of file SplineMonolith.h.
|
inlineprivate |
CW: This loads up coefficients into two arrays: one x array and one yabcd array.
CW: This should maximize our cache hits!
spl | pointer to TSpline3_red |
nPoints | number of knots |
xArray | array X value for each knot |
manyArray | Array holding coefficients for each knot |
Definition at line 755 of file SplineMonolith.cpp.
|
inlineprivate |
KS: Set everything to null etc.
Definition at line 12 of file SplineMonolith.cpp.
|
inlineprivate |
KS: Load preprocessed spline file.
FileName | Path to ROOT file with predefined reduced Spline Monolith |
Definition at line 513 of file SplineMonolith.cpp.
|
inlineoverrideprivatevirtual |
Calc total event weight.
Implements SplineBase.
Definition at line 912 of file SplineMonolith.cpp.
|
inlineprivate |
Conversion from valid splines to all.
Definition at line 959 of file SplineMonolith.cpp.
|
inlineprivate |
CW: The shared initialiser from constructors of TResponseFunction_red.
Definition at line 304 of file SplineMonolith.cpp.
|
inlineprivate |
CW: Prepare the TSpline3_red objects for the GPU.
MasterSpline | Vector of TResponseFunction_red pointers which we strip back |
Definition at line 53 of file SplineMonolith.cpp.
|
inlineprivate |
KS: Prepare spline file that can be used for fast loading.
Definition at line 628 of file SplineMonolith.cpp.
|
inlineprivate |
KS: Print info about how much knots etc has been initialised.
Definition at line 980 of file SplineMonolith.cpp.
|
inline |
KS: Get pointer to total weight to make fit faster wrooom!
event | Name event number in used MC |
Definition at line 39 of file SplineMonolith.h.
|
inlineprivate |
CW: Function to scan through the MasterSpline of TSpline3.
MasterSpline | Vector of TSpline3_red pointers which we strip back |
NEvents | Number of MC events |
MaxPoints | Maximal number of knots per splines |
numParams | Total number of parameters |
numKnots | Total number of knots, which is sum of individual knots per each spline |
nTF1_coeff | Number of TF1 coefficients in all TF1 objects |
SplineType | Whether object is TSpline3 or TF1 |
NSplinesValid | Total number of valid (not null) TSpline3 |
nTF1Valid | Total number of valid (not null) TF1 |
Definition at line 376 of file SplineMonolith.cpp.
|
inline |
KS: Set pointers to spline params.
spline_ParsPointers | Vector of pointers to spline params |
Definition at line 43 of file SplineMonolith.h.
void SMonolith::SynchroniseMemTransfer | ( | ) |
KS: After calculations are done on GPU we copy memory to CPU. This operation is asynchronous meaning while memory is being copied some operations are being carried. Memory must be copied before actual reweight. This function make sure all has been copied.
Definition at line 997 of file SplineMonolith.cpp.
|
private |
Max knots for production.
Definition at line 112 of file SplineMonolith.h.
|
private |
CPU arrays to hold TF1 coefficients.
Definition at line 149 of file SplineMonolith.h.
|
private |
KS: CPU map keeping track how many parameters applies to each event, we keep two numbers here {number of splines per event, index where splines start for a given event}.
Definition at line 137 of file SplineMonolith.h.
|
private |
KS: CPU map keeping track how many parameters applies to each event, we keep two numbers here {number of TF1 per event, index where TF1 start for a given event}.
Definition at line 140 of file SplineMonolith.h.
|
private |
CPU arrays to hold number of points.
Definition at line 152 of file SplineMonolith.h.
|
private |
CW: CPU array with the number of points per spline (not per spline point!)
Definition at line 155 of file SplineMonolith.h.
|
private |
KS: Store info about Spline monolith, this allow to obtain better step time. As all necessary information for spline weight calculation are here meaning better cache hits.
Definition at line 143 of file SplineMonolith.h.
float* SMonolith::cpu_total_weights |
KS: This holds the total CPU weights that gets read in samplePDFND.
Definition at line 51 of file SplineMonolith.h.
float* SMonolith::cpu_weights |
The returned gpu weights, read by the GPU.
Definition at line 49 of file SplineMonolith.h.
|
private |
CPU arrays to hold weight for each spline.
Definition at line 132 of file SplineMonolith.h.
|
private |
CPU arrays to hold weight for each TF1.
Definition at line 134 of file SplineMonolith.h.
|
private |
KS: Store info about Spline monolith, this allow to obtain better step time. As all necessary information for spline weight calculation are here meaning better cache hits.
Definition at line 146 of file SplineMonolith.h.
|
private |
holds the index for good splines; don't do unsigned since starts with negative value!
Definition at line 114 of file SplineMonolith.h.
|
private |
holds the index for good TF1; don't do unsigned since starts with negative value!
Definition at line 116 of file SplineMonolith.h.
|
private |
Number of events.
Definition at line 110 of file SplineMonolith.h.
|
private |
Sum of all knots over all splines.
Definition at line 127 of file SplineMonolith.h.
|
private |
Number of total splines if each event had every parameter's spline.
Definition at line 124 of file SplineMonolith.h.
|
private |
Number of valid splines.
Definition at line 119 of file SplineMonolith.h.
|
private |
Number of valid TF1.
Definition at line 121 of file SplineMonolith.h.
|
private |
Sum of all coefficients over all TF1.
Definition at line 129 of file SplineMonolith.h.
|
private |
Flag telling whether we are saving spline monolith into handy root file.
Definition at line 158 of file SplineMonolith.h.
|
private |
This holds pointer to parameter position which we later copy paste it to GPU.
Definition at line 107 of file SplineMonolith.h.