![]() |
MaCh3
2.5.0
Reference Guide
|
Even-by-event class calculating response for spline parameters. It is possible to use GPU acceleration. More...
#include <Splines/UnbinnedSplineHandler.h>
Public Member Functions | |
| UnbinnedSplineHandler (std::vector< std::vector< TResponseFunction_red * > > &MasterSpline, const std::vector< RespFuncType > &SplineType, const bool SaveFlatTree=false, const std::string &_FastSplineName="SplineFile.root") | |
| Constructor. More... | |
| UnbinnedSplineHandler (const std::string &FileName) | |
| Constructor where you pass path to preprocessed root FileName. More... | |
| virtual | ~UnbinnedSplineHandler () |
| Destructor for UnbinnedSplineHandler class. More... | |
| void | Evaluate () final |
| 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... | |
| std::string | GetName () const override |
| Get class name. More... | |
| void | SynchroniseMemTransfer () const final |
| 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. More... | |
| const M3::float_t * | RetPointer (const int event) const |
| KS: Get pointer to total weight to make fit faster wrooom! More... | |
| void | setSplinePointers (std::vector< const M3::float_t * > spline_ParsPointers) |
| KS: Set pointers to spline params. More... | |
| void | PrepareSplineFile (std::string FileName) final |
| KS: Prepare spline file that can be used for fast loading. More... | |
| void | LoadSplineFile (std::string FileName) final |
| KS: Load preprocessed spline file. More... | |
Public Member Functions inherited from SplineBase | |
| SplineBase () | |
| Constructor. More... | |
| virtual | ~SplineBase () |
| Destructor. More... | |
| short int | GetNParams () const |
| Get number of spline parameters. More... | |
Private Member Functions | |
| void | Initialise () |
| KS: Set everything to null etc. More... | |
| 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. More... | |
| void | PrepareForGPU (std::vector< std::vector< TResponseFunction_red * > > &MasterSpline, const std::vector< RespFuncType > &SplineType) |
| CW: Prepare the TSpline3_red objects for the GPU. More... | |
| void | MoveToGPU () |
| CW: The shared initialiser from constructors of TResponseFunction_red. More... | |
| void | SetupSegments () |
| void | PrintInitialsiation () const |
| KS: Print info about how much knots etc has been initialised. More... | |
| void | GetSplineCoeff_SepMany (TSpline3_red *&spl, int &nPoints, float *&xArray, float *&manyArray) const |
| CW: This loads up coefficients into two arrays: one x array and one yabcd array. More... | |
| void | CalcSplineWeights () final |
| CPU based code which eval weight for each spline. More... | |
| void | CalcTotalEventWeight () |
| Calc total event weight. More... | |
Private Attributes | |
| unsigned int | NEvents |
| Number of events. More... | |
| short int | _max_knots |
| Max knots for production. More... | |
| unsigned int | NSplines_valid |
| Number of valid splines. More... | |
| unsigned int | NTF1_valid |
| Number of valid TF1. More... | |
| unsigned int | nKnots |
| Sum of all knots over all splines. More... | |
| unsigned int | nTF1coeff |
| Sum of all coefficients over all TF1. More... | |
| float * | cpu_weights_spline_var |
| CPU arrays to hold weight for each spline. More... | |
| float * | cpu_weights_tf1_var |
| CPU arrays to hold weight for each TF1. More... | |
| M3::float_t * | cpu_total_weights |
| KS: This holds the total CPU weights that gets read in SampleHandler. More... | |
| 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}. More... | |
| 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}. More... | |
| 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. More... | |
| SplineMonolithGPU * | 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. More... | |
| std::vector< float > | cpu_coeff_TF1_many |
| CPU arrays to hold TF1 coefficients. More... | |
| std::vector< short int > | cpu_nPoints_arr |
| CPU arrays to hold number of points. More... | |
| std::vector< short int > | cpu_paramNo_TF1_arr |
| CW: CPU array with the number of points per spline (not per spline point!) More... | |
| bool | SaveSplineFile |
| Flag telling whether we are saving spline monolith into handy root file. More... | |
| std::string | FastSplineName |
| Name of Fast Spline to which will be saved. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from SplineBase | |
| void | FindSplineSegment () |
| CW:Code used in step by step reweighting, Find Spline Segment for each param. More... | |
| void | PrepareFastSplineInfoDir (std::unique_ptr< TFile > &SplineFile) const |
| KS: Prepare Fast Spline Info within SplineFile. More... | |
| void | LoadFastSplineInfoDir (std::unique_ptr< TFile > &SplineFile) |
| KS: Load preprocessed FastSplineInfo. More... | |
| void | GetTF1Coeff (TF1_red *&spl, int &nPoints, float *&coeffs) const |
| CW: Gets the polynomial coefficients for TF1. More... | |
Protected Attributes inherited from SplineBase | |
| 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. More... | |
| short int | nParams |
| Number of parameters that have splines. More... | |
Even-by-event class calculating response for spline parameters. It is possible to use GPU acceleration.
Definition at line 11 of file UnbinnedSplineHandler.h.
| UnbinnedSplineHandler::UnbinnedSplineHandler | ( | std::vector< std::vector< TResponseFunction_red * > > & | MasterSpline, |
| const std::vector< RespFuncType > & | SplineType, | ||
| const bool | SaveFlatTree = false, |
||
| const std::string & | _FastSplineName = "SplineFile.root" |
||
| ) |
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 |
| _FastSplineName | Name to which spline file will be saved |
Definition at line 36 of file UnbinnedSplineHandler.cpp.
| UnbinnedSplineHandler::UnbinnedSplineHandler | ( | 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 429 of file UnbinnedSplineHandler.cpp.
|
virtual |
Destructor for UnbinnedSplineHandler class.
Definition at line 616 of file UnbinnedSplineHandler.cpp.
|
finalprivatevirtual |
CPU based code which eval weight for each spline.
Implements SplineBase.
Definition at line 720 of file UnbinnedSplineHandler.cpp.
|
private |
Calc total event weight.
Definition at line 785 of file UnbinnedSplineHandler.cpp.
|
finalvirtual |
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 705 of file UnbinnedSplineHandler.cpp.
|
inlineoverridevirtual |
Get class name.
Reimplemented from SplineBase.
Definition at line 32 of file UnbinnedSplineHandler.h.
|
private |
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 638 of file UnbinnedSplineHandler.cpp.
|
private |
KS: Set everything to null etc.
Definition at line 12 of file UnbinnedSplineHandler.cpp.
|
finalvirtual |
KS: Load preprocessed spline file.
| FileName | Path to ROOT file with predefined reduced Spline Monolith |
Implements SplineBase.
Definition at line 440 of file UnbinnedSplineHandler.cpp.
|
private |
CW: The shared initialiser from constructors of TResponseFunction_red.
Definition at line 240 of file UnbinnedSplineHandler.cpp.
|
private |
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 UnbinnedSplineHandler.cpp.
|
finalvirtual |
KS: Prepare spline file that can be used for fast loading.
Implements SplineBase.
Definition at line 541 of file UnbinnedSplineHandler.cpp.
|
private |
KS: Print info about how much knots etc has been initialised.
Definition at line 827 of file UnbinnedSplineHandler.cpp.
|
inline |
KS: Get pointer to total weight to make fit faster wrooom!
| event | Name event number in used MC |
Definition at line 40 of file UnbinnedSplineHandler.h.
|
private |
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 304 of file UnbinnedSplineHandler.cpp.
|
inline |
KS: Set pointers to spline params.
| spline_ParsPointers | Vector of pointers to spline params |
Definition at line 44 of file UnbinnedSplineHandler.h.
|
private |
Definition at line 522 of file UnbinnedSplineHandler.cpp.
|
finalvirtual |
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.
Implements SplineBase.
Definition at line 844 of file UnbinnedSplineHandler.cpp.
|
private |
Max knots for production.
Definition at line 102 of file UnbinnedSplineHandler.h.
|
private |
CPU arrays to hold TF1 coefficients.
Definition at line 134 of file UnbinnedSplineHandler.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 122 of file UnbinnedSplineHandler.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 125 of file UnbinnedSplineHandler.h.
|
private |
CPU arrays to hold number of points.
Definition at line 137 of file UnbinnedSplineHandler.h.
|
private |
CW: CPU array with the number of points per spline (not per spline point!)
Definition at line 140 of file UnbinnedSplineHandler.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 128 of file UnbinnedSplineHandler.h.
|
private |
KS: This holds the total CPU weights that gets read in SampleHandler.
Definition at line 119 of file UnbinnedSplineHandler.h.
|
private |
CPU arrays to hold weight for each spline.
Definition at line 115 of file UnbinnedSplineHandler.h.
|
private |
CPU arrays to hold weight for each TF1.
Definition at line 117 of file UnbinnedSplineHandler.h.
|
private |
Name of Fast Spline to which will be saved.
Definition at line 146 of file UnbinnedSplineHandler.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 131 of file UnbinnedSplineHandler.h.
|
private |
Number of events.
Definition at line 100 of file UnbinnedSplineHandler.h.
|
private |
Sum of all knots over all splines.
Definition at line 110 of file UnbinnedSplineHandler.h.
|
private |
Number of valid splines.
Definition at line 105 of file UnbinnedSplineHandler.h.
|
private |
Number of valid TF1.
Definition at line 107 of file UnbinnedSplineHandler.h.
|
private |
Sum of all coefficients over all TF1.
Definition at line 112 of file UnbinnedSplineHandler.h.
|
private |
Flag telling whether we are saving spline monolith into handy root file.
Definition at line 143 of file UnbinnedSplineHandler.h.