![]() |
MaCh3 2.2.1
Reference Guide
|
Bin-by-bin class calculating response for spline parameters. More...
#include <Splines/BinnedSplineHandler.h>
Public Member Functions | |
BinnedSplineHandler (ParameterHandlerGeneric *xsec_, MaCh3Modes *Modes_) | |
Constructor. | |
virtual | ~BinnedSplineHandler () |
Destructor. | |
void | Evaluate () |
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. | |
void | AddSample (const std::string &SampleName, const std::vector< std::string > &OscChanFileNames, const std::vector< std::string > &SplineVarNames) |
add oscillation channel to spline monolith | |
void | TransferToMonolith () |
flatten multidimensional spline array into proper monolith | |
void | cleanUpMemory () |
Remove setup variables not needed for spline evaluations. | |
virtual void | FillSampleArray (std::string SampleName, std::vector< std::string > OscChanFileNames) |
Loads and processes splines from ROOT files for a given sample. | |
std::vector< std::vector< int > > | StripDuplicatedModes (const std::vector< std::vector< int > > &InputVector) |
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. | |
std::vector< std::vector< int > > | GetEventSplines (const std::string &SampleName, int iOscChan, int EventMode, double Var1Val, double Var2Val, double Var3Val) |
Return the splines which affect a given event. | |
std::vector< TAxis * > | FindSplineBinning (const std::string &FileName, const std::string &SampleName) |
Grab histograms with spline binning. | |
int | CountNumberOfLoadedSplines (bool NonFlat=false, int Verbosity=0) |
std::string | getDimLabel (const int BinningOpt, const unsigned int Axis) const |
int | getSampleIndex (const std::string &SampleName) const |
Get index of sample based on name. | |
bool | isValidSplineIndex (const std::string &SampleName, int iSyst, int iOscChan, int iMode, int iVar1, int iVar2, int iVar3) |
Ensure we have spline for a given bin. | |
void | BuildSampleIndexingArray (const std::string &SampleName) |
void | PrepForReweight () |
void | getSplineCoeff_SepMany (int splineindex, M3::float_t *&xArray, M3::float_t *&manyArray) |
void | PrintBinning (TAxis *Axis) const |
void | PrintSampleDetails (const std::string &SampleName) const |
Print info like Sample ID of spline params etc. | |
void | PrintArrayDetails (const std::string &SampleName) const |
const M3::float_t * | retPointer (const int sample, const int oscchan, const int syst, const int mode, const int var1bin, const int var2bin, const int var3bin) const |
get pointer to spline weight based on bin variables | |
![]() | |
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. | |
Protected Types | |
enum | TokenOrdering { kSystToken , kModeToken , kVar1BinToken , kVar2BinToken , kVar3BinToken , kNTokens } |
Protected Member Functions | |
void | CalcSplineWeights () override |
CPU based code which eval weight for each spline. | |
void | ModifyWeights () override |
Calc total event weight, not used by Bin-by-bin splines. | |
virtual std::vector< std::string > | GetTokensFromSplineName (std::string FullSplineName)=0 |
![]() | |
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. | |
Protected Attributes | |
ParameterHandlerGeneric * | xsec |
Pointer to covariance from which we get information about spline params. | |
std::vector< std::string > | SampleNames |
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 |
std::vector< std::vector< std::string > > | SplineFileParPrefixNames |
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. | |
std::vector< std::vector< SplineInterpolation > > | SplineInterpolationTypes |
spline interpolation types for each sample. These vectors are from a call to GetSplineInterpolationFromSampleID() | |
std::vector< std::string > | UniqueSystNames |
name of each spline parameter | |
std::vector< int > | UniqueSystIndices |
Global index of each spline param, it allows us to match spline ordering with global. | |
std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< std::vector< int > > > > > > > | indexvec |
Variables related to determined which modes have splines and which piggy-back of other modes. | |
std::vector< int > | coeffindexvec |
std::vector< int > | uniquecoeffindices |
Unique coefficient indices. | |
std::vector< TSpline3_red * > | splinevec_Monolith |
holds each spline object before stripping into coefficient monolith | |
int | MonolithSize |
int | MonolithIndex |
int | CoeffIndex |
bool * | isflatarray |
Need to keep track of which splines are flat and which aren't. | |
M3::float_t * | xcoeff_arr |
x coefficients for each spline | |
M3::float_t * | manycoeff_arr |
ybcd coefficients for each spline | |
std::vector< M3::float_t > | weightvec_Monolith |
Stores weight from spline evaluation for each single spline. | |
std::vector< int > | uniquesplinevec_Monolith |
Maps single spline object with single parameter. | |
MaCh3Modes * | Modes |
pointer to MaCh3 Mode from which we get spline suffix | |
![]() | |
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. | |
Bin-by-bin class calculating response for spline parameters.
Definition at line 17 of file BinnedSplineHandler.h.
|
protected |
Enumerator | |
---|---|
kSystToken | |
kModeToken | |
kVar1BinToken | |
kVar2BinToken | |
kVar3BinToken | |
kNTokens |
Definition at line 135 of file BinnedSplineHandler.h.
_MaCh3_Safe_Include_Start_ _MaCh3_Safe_Include_End_ BinnedSplineHandler::BinnedSplineHandler | ( | ParameterHandlerGeneric * | xsec_, |
MaCh3Modes * | Modes_ | ||
) |
Constructor.
Definition at line 13 of file BinnedSplineHandler.cpp.
|
virtual |
Destructor.
Definition at line 32 of file BinnedSplineHandler.cpp.
void BinnedSplineHandler::AddSample | ( | const std::string & | SampleName, |
const std::vector< std::string > & | OscChanFileNames, | ||
const std::vector< std::string > & | SplineVarNames | ||
) |
add oscillation channel to spline monolith
Definition at line 63 of file BinnedSplineHandler.cpp.
void BinnedSplineHandler::BuildSampleIndexingArray | ( | const std::string & | SampleName | ) |
Definition at line 268 of file BinnedSplineHandler.cpp.
|
overrideprotectedvirtual |
CPU based code which eval weight for each spline.
Implements SplineBase.
Definition at line 227 of file BinnedSplineHandler.cpp.
void BinnedSplineHandler::cleanUpMemory | ( | ) |
Remove setup variables not needed for spline evaluations.
Definition at line 40 of file BinnedSplineHandler.cpp.
int BinnedSplineHandler::CountNumberOfLoadedSplines | ( | bool | NonFlat = false , |
int | Verbosity = 0 |
||
) |
Definition at line 401 of file BinnedSplineHandler.cpp.
|
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.
Implements SplineBase.
Definition at line 213 of file BinnedSplineHandler.cpp.
|
virtual |
Loads and processes splines from ROOT files for a given sample.
Definition at line 855 of file BinnedSplineHandler.cpp.
std::vector< TAxis * > BinnedSplineHandler::FindSplineBinning | ( | const std::string & | FileName, |
const std::string & | SampleName | ||
) |
Grab histograms with spline binning.
Definition at line 300 of file BinnedSplineHandler.cpp.
std::string BinnedSplineHandler::getDimLabel | ( | const int | BinningOpt, |
const unsigned int | Axis | ||
) | const |
Definition at line 638 of file BinnedSplineHandler.cpp.
std::vector< std::vector< int > > BinnedSplineHandler::GetEventSplines | ( | const std::string & | SampleName, |
int | iOscChan, | ||
int | EventMode, | ||
double | Var1Val, | ||
double | Var2Val, | ||
double | Var3Val | ||
) |
Return the splines which affect a given event.
Definition at line 752 of file BinnedSplineHandler.cpp.
int BinnedSplineHandler::getSampleIndex | ( | const std::string & | SampleName | ) | const |
Get index of sample based on name.
Definition at line 651 of file BinnedSplineHandler.cpp.
void BinnedSplineHandler::getSplineCoeff_SepMany | ( | int | splineindex, |
M3::float_t *& | xArray, | ||
M3::float_t *& | manyArray | ||
) |
Definition at line 602 of file BinnedSplineHandler.cpp.
|
protectedpure virtual |
bool BinnedSplineHandler::isValidSplineIndex | ( | const std::string & | SampleName, |
int | iSyst, | ||
int | iOscChan, | ||
int | iMode, | ||
int | iVar1, | ||
int | iVar2, | ||
int | iVar3 | ||
) |
Ensure we have spline for a given bin.
Definition at line 701 of file BinnedSplineHandler.cpp.
|
inlineoverrideprotectedvirtual |
Calc total event weight, not used by Bin-by-bin splines.
Implements SplineBase.
Definition at line 78 of file BinnedSplineHandler.h.
void BinnedSplineHandler::PrepForReweight | ( | ) |
Definition at line 461 of file BinnedSplineHandler.cpp.
void BinnedSplineHandler::PrintArrayDetails | ( | const std::string & | SampleName | ) | const |
Definition at line 675 of file BinnedSplineHandler.cpp.
void BinnedSplineHandler::PrintBinning | ( | TAxis * | Axis | ) | const |
Definition at line 740 of file BinnedSplineHandler.cpp.
void BinnedSplineHandler::PrintSampleDetails | ( | const std::string & | SampleName | ) | const |
Print info like Sample ID of spline params etc.
Definition at line 663 of file BinnedSplineHandler.cpp.
|
inline |
get pointer to spline weight based on bin variables
Definition at line 68 of file BinnedSplineHandler.h.
std::vector< std::vector< int > > BinnedSplineHandler::StripDuplicatedModes | ( | const std::vector< std::vector< int > > & | InputVector | ) |
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 820 of file BinnedSplineHandler.cpp.
void BinnedSplineHandler::TransferToMonolith | ( | ) |
flatten multidimensional spline array into proper monolith
Definition at line 117 of file BinnedSplineHandler.cpp.
|
protected |
Definition at line 119 of file BinnedSplineHandler.h.
|
protected |
Definition at line 110 of file BinnedSplineHandler.h.
|
protected |
Definition at line 85 of file BinnedSplineHandler.h.
|
protected |
Definition at line 84 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 98 of file BinnedSplineHandler.h.
|
protected |
Variables related to determined which modes have splines and which piggy-back of other modes.
Definition at line 109 of file BinnedSplineHandler.h.
|
protected |
Need to keep track of which splines are flat and which aren't.
Definition at line 122 of file BinnedSplineHandler.h.
|
protected |
ybcd coefficients for each spline
Definition at line 126 of file BinnedSplineHandler.h.
|
protected |
pointer to MaCh3 Mode from which we get spline suffix
Definition at line 134 of file BinnedSplineHandler.h.
|
protected |
Definition at line 118 of file BinnedSplineHandler.h.
|
protected |
Definition at line 117 of file BinnedSplineHandler.h.
|
protected |
Definition at line 87 of file BinnedSplineHandler.h.
|
protected |
Definition at line 86 of file BinnedSplineHandler.h.
|
protected |
Definition at line 83 of file BinnedSplineHandler.h.
|
protected |
Definition at line 89 of file BinnedSplineHandler.h.
|
protected |
Definition at line 90 of file BinnedSplineHandler.h.
|
protected |
spline interpolation types for each sample. These vectors are from a call to GetSplineInterpolationFromSampleID()
Definition at line 101 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 94 of file BinnedSplineHandler.h.
|
protected |
holds each spline object before stripping into coefficient monolith
Definition at line 115 of file BinnedSplineHandler.h.
|
protected |
Unique coefficient indices.
Definition at line 112 of file BinnedSplineHandler.h.
|
protected |
Maps single spline object with single parameter.
Definition at line 131 of file BinnedSplineHandler.h.
|
protected |
Global index of each spline param, it allows us to match spline ordering with global.
Definition at line 106 of file BinnedSplineHandler.h.
|
protected |
name of each spline parameter
Definition at line 104 of file BinnedSplineHandler.h.
|
protected |
Stores weight from spline evaluation for each single spline.
Definition at line 129 of file BinnedSplineHandler.h.
|
protected |
x coefficients for each spline
Definition at line 124 of file BinnedSplineHandler.h.
|
protected |
Pointer to covariance from which we get information about spline params.
Definition at line 80 of file BinnedSplineHandler.h.