![]() |
MaCh3
2.6.0
Reference Guide
|
Bin-by-bin class calculating response for spline parameters. More...
#include <Splines/BinnedSplineHandler.h>
Public Member Functions | |
| BinnedSplineHandler (ParameterHandlerGeneric *ParamHandler, MaCh3Modes *Modes_) | |
| Constructor. More... | |
| virtual | ~BinnedSplineHandler () |
| Destructor. 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... | |
| void | AddSample (const std::string &SampleName, const std::string &SampleTitle, const std::vector< std::string > &OscChanFileNames, const std::vector< std::string > &SplineVarNames) |
| add oscillation channel to spline monolith More... | |
| void | TransferToMonolith () |
| flatten multidimensional spline array into proper monolith More... | |
| void | CleanUpMemory () |
| Remove setup variables not needed for spline evaluations. More... | |
| virtual void | FillSampleArray (const std::string &SampleTitle, const std::vector< std::string > &OscChanFileNames) |
| Loads and processes splines from ROOT files for a given sample. More... | |
| std::vector< SplineIndex > | GetEventSplines (const std::string &SampleTitle, int iOscChan, int EventMode, double Var1Val, double Var2Val, double Var3Val) |
| Return the splines which affect a given event. 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... | |
| int | CountNumberOfLoadedSplines (bool NonFlat=false, int Verbosity=0) const |
| Count how many splines we have. More... | |
| const M3::float_t * | RetPointer (const SplineIndex &Variables) const |
| get pointer to spline weight based on bin variables 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... | |
| virtual std::string | GetName () const |
| Get class name. More... | |
| short int | GetNParams () const |
| Get number of spline parameters. More... | |
Protected Types | |
| enum | TokenOrdering { kSystToken , kModeToken , kVar1BinToken , kVar2BinToken , kVar3BinToken , kNTokens } |
Protected Member Functions | |
| void | CalcSplineWeights () final |
| CPU based code which eval weight for each spline. More... | |
| void | PrepForReweight () |
| Initialise flat structure. More... | |
| void | BuildSampleIndexingArray (const std::string &SampleTitle) |
| Only need 1 indexing array everything else interfaces with this to get binning properties. More... | |
| std::vector< TAxis * > | FindSplineBinning (const std::string &FileName, const std::string &SampleTitle) |
| Grab histograms with spline binning. More... | |
| void | PrintBinning (TAxis *Axis) const |
| Print spline binning. More... | |
| void | PrintSampleDetails (const std::string &SampleTitle) const |
| Print info like Sample ID of spline params etc. More... | |
| void | PrintArrayDetails (const std::string &SampleTitle) const |
| Print info like Sample ID of spline params etc. More... | |
| int | GetSampleIndex (const std::string &SampleTitle) const |
| Get index of sample based on name. More... | |
| bool | isValidSplineIndex (const std::string &SampleTitle, int iSyst, int iOscChan, int iMode, const std::vector< int > &iVar) const |
| Ensure we have spline for a given bin. More... | |
| std::vector< std::vector< int > > | StripDuplicatedModes (const std::vector< std::vector< int > > &InputVector) const |
| Creates an array to be filled with monolith indexes for each sample (allows for indexing between 7D binning and 1D Vector). More... | |
| void | GetSplineCoeff_SepMany (int splineindex, M3::float_t *&xArray, M3::float_t *&manyArray) |
| Rather work with spline coefficients in the splines, let's copy ND and use coefficient arrays. More... | |
| virtual std::vector< std::string > | GetTokensFromSplineName (const std::string &FullSplineName)=0 |
| Extract metadata tokens encoded in a spline name. allows experiment to have different formats of splines. More... | |
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 | |
| ParameterHandlerGeneric * | ParHandler |
| Pointer to covariance from which we get information about spline params. More... | |
| std::vector< std::string > | SampleNames |
| std::vector< std::string > | SampleTitles |
| std::vector< int > | Dimensions |
| std::vector< std::vector< std::string > > | DimensionLabels |
| std::vector< int > | nSplineParams |
| std::vector< int > | nOscChans |
| std::vector< std::vector< std::vector< TAxis * > > > | SplineBinning |
| Holds TAxis for [sample][channel][dimension]. More... | |
| std::vector< std::vector< std::string > > | SplineFileParPrefixNames |
| [Sample][Syst] More... | |
| std::vector< std::vector< std::vector< int > > > | SplineModeVecs |
| std::vector< std::vector< int > > | GlobalSystIndex |
| This holds the global spline index and is used to grab the current parameter value to evaluate splines at. Each internal vector will be of size of the number of spline systematics which affect that sample. More... | |
| std::vector< std::vector< SplineInterpolation > > | SplineInterpolationTypes |
| spline interpolation types for each sample. These vectors are from a call to GetSplineInterpolationFromSampleID() More... | |
| std::vector< std::string > | UniqueSystNames |
| name of each spline parameter More... | |
| std::vector< int > | UniqueSystIndices |
| Global index of each spline param, it allows us to match spline ordering with global. More... | |
| std::vector< SplineIndex > | IndexVect |
| Variables related to determined which modes have splines and which piggy-back of other modes. More... | |
| std::map< std::tuple< int, int, int, int, int, int, int >, int > | IndexVectMap |
| Map between spline origin/properties (iSample, iOscChan, iSyst, iMode, iVar1, iVar2, iVar3) and the index of the spline in IndexVect. More... | |
| std::vector< int > | coeffindexvec |
| Number of coefficients for a single flat (after flattening) More... | |
| std::vector< int > | uniquecoeffindices |
| Unique coefficient indices. More... | |
| std::vector< TSpline3_red * > | splinevec_Monolith |
| holds each spline object before stripping into coefficient monolith More... | |
| int | MonolithSize |
| int | MonolithIndex |
| int | CoeffIndex |
| bool * | isflatarray |
| Need to keep track of which splines are flat and which aren't. More... | |
| M3::float_t * | xcoeff_arr |
| x coefficients for each spline More... | |
| M3::float_t * | manycoeff_arr |
| ybcd coefficients for each spline More... | |
| std::vector< M3::float_t > | weightvec_Monolith |
| Stores weight from spline evaluation for each single spline. More... | |
| std::vector< int > | uniquesplinevec_Monolith |
| Maps single spline object with single parameter. More... | |
| MaCh3Modes * | Modes |
| pointer to MaCh3 Mode from which we get spline suffix 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... | |
Private Member Functions | |
| void | InvestigateMissingSplines () const |
| This function will find missing splines in file. More... | |
| void | LoadSettingsDir (std::unique_ptr< TFile > &SplineFile) |
| KS: Load preprocessed Settings. More... | |
| void | LoadMonolithDir (std::unique_ptr< TFile > &SplineFile) |
| KS: Load preprocessed Monolith. More... | |
| void | LoadIndexDir (std::unique_ptr< TFile > &SplineFile) |
| KS: Load preprocessed Index. More... | |
| void | PrepareSettingsDir (std::unique_ptr< TFile > &SplineFile) const |
| KS: Prepare Settings Info within SplineFile. More... | |
| void | PrepareMonolithDir (std::unique_ptr< TFile > &SplineFile) const |
| KS: Prepare Monolith Info within SplineFile. More... | |
| void | PrepareIndexDir (std::unique_ptr< TFile > &SplineFile) const |
| KS: Prepare Index Info within SplineFile. More... | |
| void | PrepareOtherInfoDir (std::unique_ptr< TFile > &SplineFile) const |
| KS: Prepare Other Info within SplineFile. More... | |
Bin-by-bin class calculating response for spline parameters.
Definition at line 11 of file BinnedSplineHandler.h.
|
protected |
| Enumerator | |
|---|---|
| kSystToken | |
| kModeToken | |
| kVar1BinToken | |
| kVar2BinToken | |
| kVar3BinToken | |
| kNTokens | |
Definition at line 141 of file BinnedSplineHandler.h.
| _MaCh3_Safe_Include_Start_ _MaCh3_Safe_Include_End_ BinnedSplineHandler::BinnedSplineHandler | ( | ParameterHandlerGeneric * | ParamHandler, |
| MaCh3Modes * | Modes_ | ||
| ) |
Constructor.
Definition at line 14 of file BinnedSplineHandler.cpp.
|
virtual |
Destructor.
Definition at line 35 of file BinnedSplineHandler.cpp.
| void BinnedSplineHandler::AddSample | ( | const std::string & | SampleName, |
| const std::string & | SampleTitle, | ||
| const std::vector< std::string > & | OscChanFileNames, | ||
| const std::vector< std::string > & | SplineVarNames | ||
| ) |
add oscillation channel to spline monolith
Definition at line 70 of file BinnedSplineHandler.cpp.
|
protected |
Only need 1 indexing array everything else interfaces with this to get binning properties.
Definition at line 310 of file BinnedSplineHandler.cpp.
|
finalprotectedvirtual |
CPU based code which eval weight for each spline.
Implements SplineBase.
Definition at line 270 of file BinnedSplineHandler.cpp.
| void BinnedSplineHandler::CleanUpMemory | ( | ) |
Remove setup variables not needed for spline evaluations.
Definition at line 44 of file BinnedSplineHandler.cpp.
| int BinnedSplineHandler::CountNumberOfLoadedSplines | ( | bool | NonFlat = false, |
| int | Verbosity = 0 |
||
| ) | const |
Count how many splines we have.
Definition at line 452 of file BinnedSplineHandler.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 259 of file BinnedSplineHandler.cpp.
|
virtual |
Loads and processes splines from ROOT files for a given sample.
Definition at line 802 of file BinnedSplineHandler.cpp.
|
protected |
Grab histograms with spline binning.
Definition at line 344 of file BinnedSplineHandler.cpp.
| std::vector< SplineIndex > BinnedSplineHandler::GetEventSplines | ( | const std::string & | SampleTitle, |
| int | iOscChan, | ||
| int | EventMode, | ||
| double | Var1Val, | ||
| double | Var2Val, | ||
| double | Var3Val | ||
| ) |
Return the splines which affect a given event.
Definition at line 708 of file BinnedSplineHandler.cpp.
|
protected |
Get index of sample based on name.
| SampleTitle | The title of the sample to search for. |
Definition at line 630 of file BinnedSplineHandler.cpp.
|
protected |
Rather work with spline coefficients in the splines, let's copy ND and use coefficient arrays.
Definition at line 593 of file BinnedSplineHandler.cpp.
|
protectedpure virtual |
Extract metadata tokens encoded in a spline name. allows experiment to have different formats of splines.
|
private |
This function will find missing splines in file.
Definition at line 124 of file BinnedSplineHandler.cpp.
|
protected |
Ensure we have spline for a given bin.
Definition at line 673 of file BinnedSplineHandler.cpp.
|
private |
KS: Load preprocessed Index.
| SplineFile | File from which we load new tree |
Definition at line 1054 of file BinnedSplineHandler.cpp.
|
private |
KS: Load preprocessed Monolith.
| SplineFile | File from which we load new tree |
Definition at line 1020 of file BinnedSplineHandler.cpp.
|
private |
KS: Load preprocessed Settings.
| SplineFile | File from which we load new tree |
Definition at line 968 of file BinnedSplineHandler.cpp.
|
finalvirtual |
KS: Load preprocessed spline file.
| FileName | Path to ROOT file with predefined reduced Spline Monolith |
Implements SplineBase.
Definition at line 929 of file BinnedSplineHandler.cpp.
|
private |
KS: Prepare Index Info within SplineFile.
| SplineFile | File from which we load new tree |
Definition at line 1201 of file BinnedSplineHandler.cpp.
|
private |
KS: Prepare Monolith Info within SplineFile.
| SplineFile | File from which we load new tree |
Definition at line 1178 of file BinnedSplineHandler.cpp.
|
private |
KS: Prepare Other Info within SplineFile.
| SplineFile | File from which we load new tree |
Definition at line 1218 of file BinnedSplineHandler.cpp.
|
private |
KS: Prepare Settings Info within SplineFile.
| SplineFile | File from which we load new tree |
Definition at line 1137 of file BinnedSplineHandler.cpp.
|
finalvirtual |
KS: Prepare spline file that can be used for fast loading.
Implements SplineBase.
Definition at line 1110 of file BinnedSplineHandler.cpp.
|
protected |
Initialise flat structure.
Definition at line 504 of file BinnedSplineHandler.cpp.
|
protected |
Print info like Sample ID of spline params etc.
Definition at line 653 of file BinnedSplineHandler.cpp.
|
protected |
|
protected |
Print info like Sample ID of spline params etc.
Definition at line 642 of file BinnedSplineHandler.cpp.
| const M3::float_t * BinnedSplineHandler::RetPointer | ( | const SplineIndex & | Variables | ) | const |
get pointer to spline weight based on bin variables
Definition at line 444 of file BinnedSplineHandler.cpp.
|
protected |
Creates an array to be filled with monolith indexes for each sample (allows for indexing between 7D binning and 1D Vector).
Check if there are any repeated modes. This is used to reduce the number of modes in case many interaction modes get averaged into one spline
Definition at line 767 of file BinnedSplineHandler.cpp.
|
inlinefinalvirtual |
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 40 of file BinnedSplineHandler.h.
| void BinnedSplineHandler::TransferToMonolith | ( | ) |
flatten multidimensional spline array into proper monolith
Definition at line 180 of file BinnedSplineHandler.cpp.
|
protected |
Definition at line 125 of file BinnedSplineHandler.h.
|
protected |
Number of coefficients for a single flat (after flattening)
Definition at line 116 of file BinnedSplineHandler.h.
|
protected |
Definition at line 87 of file BinnedSplineHandler.h.
|
protected |
Definition at line 86 of file BinnedSplineHandler.h.
|
protected |
This holds the global spline index and is used to grab the current parameter value to evaluate splines at. Each internal vector will be of size of the number of spline systematics which affect that sample.
Definition at line 101 of file BinnedSplineHandler.h.
|
protected |
Variables related to determined which modes have splines and which piggy-back of other modes.
Definition at line 112 of file BinnedSplineHandler.h.
|
protected |
Map between spline origin/properties (iSample, iOscChan, iSyst, iMode, iVar1, iVar2, iVar3) and the index of the spline in IndexVect.
Definition at line 114 of file BinnedSplineHandler.h.
|
protected |
Need to keep track of which splines are flat and which aren't.
Definition at line 128 of file BinnedSplineHandler.h.
|
protected |
ybcd coefficients for each spline
Definition at line 132 of file BinnedSplineHandler.h.
|
protected |
pointer to MaCh3 Mode from which we get spline suffix
Definition at line 140 of file BinnedSplineHandler.h.
|
protected |
Definition at line 124 of file BinnedSplineHandler.h.
|
protected |
Definition at line 123 of file BinnedSplineHandler.h.
|
protected |
Definition at line 89 of file BinnedSplineHandler.h.
|
protected |
Definition at line 88 of file BinnedSplineHandler.h.
|
protected |
Pointer to covariance from which we get information about spline params.
Definition at line 81 of file BinnedSplineHandler.h.
|
protected |
Definition at line 84 of file BinnedSplineHandler.h.
|
protected |
Definition at line 85 of file BinnedSplineHandler.h.
|
protected |
Holds TAxis for [sample][channel][dimension].
Definition at line 91 of file BinnedSplineHandler.h.
|
protected |
[Sample][Syst]
Definition at line 93 of file BinnedSplineHandler.h.
|
protected |
spline interpolation types for each sample. These vectors are from a call to GetSplineInterpolationFromSampleID()
Definition at line 104 of file BinnedSplineHandler.h.
|
protected |
A vector of vectors of the spline modes that a systematic applies to This gets compared against the event mode to figure out if a syst should apply to an event or not
Definition at line 97 of file BinnedSplineHandler.h.
|
protected |
holds each spline object before stripping into coefficient monolith
Definition at line 121 of file BinnedSplineHandler.h.
|
protected |
Unique coefficient indices.
Definition at line 118 of file BinnedSplineHandler.h.
|
protected |
Maps single spline object with single parameter.
Definition at line 137 of file BinnedSplineHandler.h.
|
protected |
Global index of each spline param, it allows us to match spline ordering with global.
Definition at line 109 of file BinnedSplineHandler.h.
|
protected |
name of each spline parameter
Definition at line 107 of file BinnedSplineHandler.h.
|
protected |
Stores weight from spline evaluation for each single spline.
Definition at line 135 of file BinnedSplineHandler.h.
|
protected |
x coefficients for each spline
Definition at line 130 of file BinnedSplineHandler.h.