![]() |
MaCh3
2.6.0
Reference Guide
|
Class responsible for handling implementation of samples used in analysis, reweighting and returning LLH. More...
#include <Samples/SampleHandlerBase.h>
Public Member Functions | |
| SampleHandlerBase (std::string ConfigFileName, ParameterHandlerGeneric *_ParHandler, const std::shared_ptr< OscillationHandler > &OscillatorObj_=nullptr) | |
| Constructor. More... | |
| virtual | ~SampleHandlerBase () |
| destructor More... | |
| int | GetNDim (const int Sample) const final |
| DB Get what dimensionality binning for given sample has. More... | |
| std::string | GetName () const final |
| Get name for Sample Handler. More... | |
| std::string | GetSampleTitle (const int Sample) const final |
| Get fancy title for specified samples. More... | |
| std::string | GetSampleName (const int Sample) const |
| Sample name tag used only for getting relevant uncertainties. More... | |
| std::string | GetKinVarName (const int iSample, const int Dimension) const final |
| Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino_Energy". More... | |
| void | PrintIntegral (const int iSample, const TString &OutputName="/dev/null", const int WeightStyle=0, const TString &OutputCSVName="/dev/null") |
| Computes and prints the integral breakdown of all modes and oscillation channels for a given sample. More... | |
| void | AddData (const int Sample, TH1 *Data) |
| DB: Add data for a given sample from a ROOT histogram. More... | |
| void | AddData (const int Sample, const std::vector< double > &Data_Array) |
| ETA: Add data for a given sample from a raw array. More... | |
| void | PrintRates (const bool DataOnly=false) final |
| Helper function to print rates for the samples with LLH. More... | |
| double | GetLikelihood () const override |
| Return likelihood (-LogL) for all samples. More... | |
| double | GetSampleLikelihood (const int isample) const override |
| Get likelihood (-logL) for a single sample. More... | |
| int | GetSampleIndex (const std::string &SampleTitle) const |
| Get index of sample based on name. More... | |
| const TH1 * | GetDataHist (const int Sample) final |
| Get Data histogram. More... | |
| const TH1 * | GetDataHist (const std::string &Sample) |
| Get Data histogram by sample name. More... | |
| const TH1 * | GetMCHist (const int Sample) final |
| Get MC histogram. More... | |
| const TH1 * | GetMCHist (const std::string &Sample) |
| Get MC histogram by sample title. More... | |
| const TH1 * | GetW2Hist (const int Sample) final |
| Get W2 histogram. More... | |
| const TH1 * | GetW2Hist (const std::string &Sample) |
| Get W2 histogram by sample name. More... | |
| void | Reweight () override |
| main routine modifying MC prediction based on proposed parameter values More... | |
| M3::float_t | GetEventWeight (const int iEvent) |
| Computes the total event weight for a given entry. More... | |
| int | GetNOscChannels (const int iSample) const final |
| Get number of oscillation channels for a single sample. More... | |
| std::string | GetFlavourName (const int iSample, const int iChannel) const final |
| Get the flavour name for a given sample and oscillation channel. More... | |
| std::unique_ptr< TH1 > | Get1DVarHist (const int iSample, const std::string &ProjectionVar, const std::vector< KinematicCut > &EventSelectionVec={}, int WeightStyle=0, const std::vector< KinematicCut > &SubEventSelectionVec={}) final |
| Return 1D projection of MC into given 1D variable (doesn't have to be variable used in the fit) More... | |
| std::unique_ptr< TH2 > | Get2DVarHist (const int iSample, const std::string &ProjectionVarX, const std::string &ProjectionVarY, const std::vector< KinematicCut > &EventSelectionVec={}, int WeightStyle=0, const std::vector< KinematicCut > &SubEventSelectionVec={}) final |
| Build a 2D projection of MC events into specified variables. More... | |
| std::vector< KinematicCut > | BuildModeChannelSelection (const int iSample, const int kModeToFill, const int kChannelToFill) const |
| Construct vector of kinematic cuts that will be applied, on top of default cuts include stuff like cut on mode etc. More... | |
| void | Fill1DSubEventHist (const int iSample, TH1D *_h1DVar, const std::string &ProjectionVar, const std::vector< KinematicCut > &SubEventSelectionVec={}, int WeightStyle=0) |
| Fill projection histogram by looping over all events, and skipping one which doesn't pass specified condition. More... | |
| void | Fill2DSubEventHist (const int iSample, TH2 *_h2DVar, const std::string &ProjectionVarX, const std::string &ProjectionVarY, const std::vector< KinematicCut > &SubEventSelectionVec={}, int WeightStyle=0) |
| Fill projection histogram by looping over all events, and skipping one which doesn't pass specified condition. More... | |
| std::unique_ptr< TH1 > | Get1DVarHistByModeAndChannel (const int iSample, const std::string &ProjectionVar_Str, const int kModeToFill=-1, const int kChannelToFill=-1, const int WeightStyle=0) final |
| Build a 1D histogram for a given variable, optionally filtered by mode and channel. More... | |
| std::unique_ptr< TH2 > | Get2DVarHistByModeAndChannel (const int iSample, const std::string &ProjectionVar_StrX, const std::string &ProjectionVar_StrY, const int kModeToFill=-1, const int kChannelToFill=-1, const int WeightStyle=0) final |
| Build a 2D histogram for given variables, optionally filtered by mode and channel. More... | |
| int | GetRangeForPlotType (const SamplePlotType TypeEnum, const int iSample) const |
| KS: Return range for plot type, for example number of modes, osc channels etc. More... | |
| std::vector< std::unique_ptr< TH1 > > | ReturnHistsBySelection1D (const int iSample, const std::string &KinematicProjection, const SamplePlotType Selection1, const int Selection2=-1, const int WeightStyle=0) |
| std::vector< std::unique_ptr< TH2 > > | ReturnHistsBySelection2D (const int iSample, const std::string &KinematicProjectionX, const std::string &KinematicProjectionY, const SamplePlotType Selection1, const int Selection2=-1, const int WeightStyle=0) |
| std::unique_ptr< THStack > | ReturnStackedHistBySelection1D (const int iSample, const std::string &KinematicProjection, const SamplePlotType Selection1, const int Selection2=-1, const int WeightStyle=0) |
| const TLegend * | ReturnStackHistLegend () const |
| Return the legend used for stacked histograms with sample info. More... | |
| int | ReturnKinematicParameterFromString (const std::string &KinematicStr) const |
| ETA function to generically convert a string from param handler to a kinematic type. More... | |
| std::string | ReturnStringFromKinematicParameter (const int KinematicVariable) const |
| ETA function to generically convert a kinematic type from param handler to a string. More... | |
| void | SaveAdditionalInfo (TDirectory *Dir) final |
| Store additional info in a chain. More... | |
| int | ReturnKinematicVectorFromString (const std::string &KinematicStr) const |
| JM: Convert a kinematic vector name to its corresponding integer ID. More... | |
| std::string | ReturnStringFromKinematicVector (const int KinematicVariable) const |
| JM: Convert a kinematic vector integer ID to its corresponding name as a string. More... | |
| bool | IsSubEventVarString (const std::string &VarStr) const |
| JM: Check if a kinematic parameter string corresponds to a subevent-level variable. More... | |
| unsigned int | GetNEvents () const |
| Return total number of events. More... | |
| auto | GetDataArray () const |
| Return array storing data entries for every bin. More... | |
| auto | GetMCArray () const |
| Return array storing MC entries for every bin. More... | |
| auto | GetW2Array () const |
| Return array storing W2 entries for every bin. More... | |
| std::vector< double > | GetArrayForSample (const int Sample, std::vector< double > const &array) const |
| Return a sub-array for a given sample. More... | |
| std::vector< double > | GetDataArray (const int Sample) const |
| Return array storing data entries for every bin. More... | |
| std::vector< double > | GetMCArray (const int Sample) const |
| Return array storing MC entries for every bin. More... | |
| std::vector< double > | GetW2Array (const int Sample) const |
| Return array storing W2 entries for single sample. More... | |
| void | CheckEmptyBins () const |
| Loop over bins and checks if there are any which have 0 entries. More... | |
Public Member Functions inherited from SampleHandlerInterface | |
| SampleHandlerInterface () | |
| The main constructor. More... | |
| virtual | ~SampleHandlerInterface () |
| destructor More... | |
| virtual M3::int_t | GetNSamples () |
| returns total number of samples More... | |
| virtual void | CleanMemoryBeforeFit ()=0 |
| Allow to clean not used memory before fit starts. More... | |
| virtual void | SaveAdditionalInfo ([[maybe_unused]] TDirectory *Dir) |
| Store additional info in a chain. More... | |
| MaCh3Modes * | GetMaCh3Modes () const |
| Return pointer to MaCh3 modes. More... | |
| double | GetPoissonLLH (const double data, const double mc) const |
| Calculate test statistic for a single bin using Poisson. More... | |
| double | GetTestStatLLH (const double data, const double mc, const double w2) const |
Calculate test statistic for a single bin. Calculation depends on setting of fTestStatistic. Data and mc -> 0 cut-offs are defined in M3::LOW_MC_BOUND. More... | |
| void | SetTestStatistic (TestStatistic testStat) |
| Set the test statistic to be used when calculating the binned likelihoods. More... | |
| TestStatistic | GetTestStatistic () const |
| Get the test statistic used when calculating the binned likelihoods. More... | |
Protected Member Functions | |
| void | InitialiseNuOscillatorObjects () |
| including Dan's magic NuOscillator More... | |
| const M3::float_t * | GetNuOscillatorPointers (const int iEvent) const |
| Get pointer to NuOscillator weight for a given event. More... | |
| void | SetupNuOscillatorPointers () |
| Initialise pointer to oscillation weight to NuOscillator object. More... | |
| void | ReadConfig () |
| Load information about sample handler and corresponding samples from config file. More... | |
| void | LoadSingleSample (const int iSample, const YAML::Node &Settings) |
| Initialise single sample from config file. More... | |
| virtual void | AddAdditionalWeightPointers ()=0 |
| DB Function to determine which weights apply to which types of samples. More... | |
| void | SetupKinematicMap () |
| Ensure Kinematic Map is setup and make sure it is initialised correctly. More... | |
| virtual void | SetupSplines ()=0 |
| initialise your splineXX object and then use InitialiseSplineObject to conveniently setup everything up More... | |
| virtual void | Init ()=0 |
| Initialise any variables that your experiment specific SampleHandler needs. More... | |
| virtual int | SetupExperimentMC ()=0 |
| Experiment specific setup, returns the number of events which were loaded. More... | |
| virtual void | SetupMC ()=0 |
| Function which translates experiment struct into core struct. More... | |
| virtual void | InititialiseData ()=0 |
| Function responsible for loading data from file or loading from file. More... | |
| void | Initialise () |
| Function which does a lot of the lifting regarding the workflow in creating different MC objects. More... | |
| void | SetSplinePointers () |
| Set pointers for each event to appropriate weights, for unbinned based on event number while for binned based on other kinematical properties. More... | |
| std::vector< SplineIndex > | GetSplineBins (int Event, BinnedSplineHandler *BinnedSpline, bool &ThrowCrititcal) const |
| Retrieve the spline bin indices associated with a given event. More... | |
| void | FindNominalBinAndEdges () |
| Functions which find the nominal bin and bin edges. More... | |
| void | SetBinning () |
| set the binning for 2D sample used for the likelihood calculation More... | |
| void | SetupReweightArrays () |
| Initialise data, MC and W2 histograms. More... | |
| virtual void | RegisterFunctionalParameters () |
| HH - a experiment-specific function where the maps to actual functions are set up. More... | |
| virtual void | PrepFunctionalParameters () |
| Update the functional parameter values to the latest proposed values. Needs to be called before every new reweight so is called in fillArray. More... | |
| template<typename EventType , typename SFType > | |
| void | RegisterIndividualFunctionalParameter (std::vector< EventType > &ExptEvents, std::vector< std::string > const &par_names, SFType shift_func) |
| LP - Registration template function for multi-dimensional functional shifts. More... | |
| template<typename EventType , typename SFType > | |
| void | RegisterIndividualFunctionalParameter (std::vector< EventType > &ExptEvents, std::string const &par_name, SFType shift_func) |
| LP - Registration template function for one-dimensional functional shifts. More... | |
| virtual void | ApplyShifts (const int iEvent) |
| ETA - generic function applying shifts. More... | |
| virtual void | ResetShifts ([[maybe_unused]] const int iEvent) |
| HH - reset the shifted values to the original values. More... | |
| virtual void | FinaliseShifts ([[maybe_unused]] const int iEvent) |
| LP - Optionally calculate derived observables after all shifts have been applied. More... | |
| bool | IsEventSelected (const int iSample, const int iEvent) _noexcept_ |
| DB Function which determines if an event is selected based on KinematicCut. More... | |
| bool | IsSubEventSelected (const std::vector< KinematicCut > &SubEventCuts, const int iEvent, unsigned const int iSubEvent, size_t nsubevents) |
| JM Function which determines if a subevent is selected. More... | |
| void | CalcNormsBins (std::vector< std::vector< NormParameter >> &norm_parameters, std::vector< std::vector< int > > &norms_bins) |
| Check whether a normalisation systematic affects an event or not. More... | |
| template<typename ParT > | |
| bool | PassesSelection (const ParT &Par, std::size_t iEvent) |
| M3::float_t | CalcWeightTotal (const EventInfo *_restrict_ MCEvent) const _noexcept_ |
| Calculate the total weight weight for a given event. More... | |
| virtual void | CalcWeightFunc ([[maybe_unused]] const int iEvent) |
| Calculate weights for function parameters. More... | |
| double | ReturnKinematicParameter (const std::string &KinematicParameter, int iEvent) const |
| Return the value of an associated kinematic parameter for an event. More... | |
| virtual double | ReturnKinematicParameter (const int KinematicVariable, const int iEvent) const =0 |
| Return the value of an associated kinematic parameter for an event. More... | |
| std::vector< double > | ReturnKinematicVector (const std::string &KinematicParameter, const int iEvent) const |
| virtual std::vector< double > | ReturnKinematicVector ([[maybe_unused]] const int KinematicVariable, [[maybe_unused]] const int iEvent) const |
| std::vector< double > | ReturnKinematicParameterBinning (const int Sample, const std::string &KinematicParameter) const final |
| Return the binning used to draw a kinematic parameter. More... | |
| const double * | GetPointerToKinematicParameter (const std::string &KinematicParameter, int iEvent) const |
| virtual const double * | GetPointerToKinematicParameter (const int KinematicVariable, const int iEvent) const =0 |
| const double * | GetPointerToOscChannel (const int iEvent) const |
| Get pointer to oscillation channel associated with given event. Osc channel is const. More... | |
| void | SetupNormParameters () |
| Setup the norm parameters by assigning each event with bin. More... | |
| void | SetupOscParameters () |
| Setup the osc parameters. More... | |
| void | FillHist (const int Sample, TH1 *Hist, std::vector< double > &Array) |
| Fill a histogram with the event-level information used in the fit. More... | |
| void | FillArray_MP () |
| DB Nice new multi-threaded function which calculates the event weights and fills the relevant bins of an array. More... | |
| void | FillArray () |
| Function which does the core reweighting, fills the SampleHandlerBase::SampleHandler_array vector with the weight calculated from reweighting. More... | |
| void | ResetHistograms () |
| Helper function to reset histograms. More... | |
| void | InitialiseSplineObject () |
| Setup spline handler (both binned or unbinned) More... | |
| NuPDG | GetInitPDGFromFileName (const std::string &FileName) const |
| Retrieve the initial neutrino PDG code associated with a given input file name. More... | |
| NuPDG | GetFinalPDGFromFileName (const std::string &FileName) const |
| Retrieve the final neutrino PDG code associated with a given input file name. More... | |
Protected Member Functions inherited from SampleHandlerInterface | |
| void | QuietPlease () |
| CW: Redirect std::cout to silence some experiment specific libraries. More... | |
| void | NowTalk () |
| CW: Redirect std::cout to silence some experiment specific libraries. More... | |
| template<typename T > | |
| bool | MatchCondition (const std::vector< T > &allowedValues, const T &value) |
| check if event is affected by following conditions, for example pdg, or modes etc More... | |
Protected Attributes | |
| std::unique_ptr< SplineBase > | SplineHandler |
| Contains all your splines (binned or unbinned) and handles the setup and the returning of weights from spline evaluations. More... | |
| std::shared_ptr< OscillationHandler > | Oscillator |
| Contains oscillator handling calculating oscillation probabilities. More... | |
| std::unique_ptr< BinningHandler > | Binning |
| KS: This stores binning information, in future could be come vector to store binning for every used sample. More... | |
| std::vector< double > | SampleHandler_array |
| DB Array to be filled after reweighting. More... | |
| std::vector< double > | SampleHandler_array_w2 |
| KS Array used for MC stat. More... | |
| std::vector< double > | SampleHandler_data |
| DB Array to be filled in AddData. More... | |
| std::vector< EventInfo > | MCEvents |
| Stores information about every MC event. More... | |
| std::vector< SampleInfo > | SampleDetails |
| Stores info about currently initialised sample. More... | |
| ParameterHandlerGeneric * | ParHandler = nullptr |
| ETA - All experiments will need an xsec, det and osc cov. More... | |
| std::string | SampleHandlerName |
| Identifier of this Sample Handler, mostly used for fancy printing in FitterBase. More... | |
| std::vector< std::vector< KinematicCut > > | StoredSelection |
| DB Vectors to store which kinematic cuts we apply. Gets used in IsEventSelected Read in from sample yaml file. More... | |
| std::vector< std::vector< KinematicCut > > | Selection |
| a way to store selection cuts which you may push back in the get1DVar functions most of the time this is just the same as StoredSelection More... | |
| const std::unordered_map< std::string, int > * | KinematicParameters |
| Mapping between string and kinematic enum. More... | |
| const std::unordered_map< int, std::string > * | ReversedKinematicParameters |
| Mapping between kinematic enum and string. More... | |
| const std::unordered_map< std::string, int > * | KinematicVectors |
| const std::unordered_map< int, std::string > * | ReversedKinematicVectors |
| std::unique_ptr< Manager > | SampleManager |
| The manager object used to read the sample yaml file. More... | |
| std::unordered_map< std::string, double > | _modeNomWeightMap |
| TLegend * | THStackLeg = nullptr |
| DB: Legend associated with stacked histograms produced by this class. More... | |
| bool | FirstTimeW2 |
| KS:Super hacky to update W2 or not. More... | |
| bool | UpdateW2 |
| KS:Super hacky to update W2 or not. More... | |
Protected Attributes inherited from SampleHandlerInterface | |
| TestStatistic | fTestStatistic |
| Test statistic tells what kind of likelihood sample is using. More... | |
| std::streambuf * | buf |
| Keep the cout buffer. More... | |
| std::streambuf * | errbuf |
| Keep the cerr buffer. More... | |
| M3::int_t | nSamples |
| Contains how many samples we've got. More... | |
| std::unique_ptr< MaCh3Modes > | Modes |
| Holds information about used Generator and MaCh3 modes. More... | |
Private Member Functions | |
| std::vector< std::vector< KinematicCut > > | ApplyTemporarySelection (const int iSample, const std::vector< KinematicCut > &ExtraCuts) |
| Temporarily extend Selection for a given sample with additional cuts. Returns the original Selection so the caller can restore it later. More... | |
Private Attributes | |
| std::unordered_map< std::string, NuPDG > | FileToInitPDGMap |
| Mapping from input file names to initial neutrino PDG codes. More... | |
| std::unordered_map< std::string, NuPDG > | FileToFinalPDGMap |
| Mapping from input file names to final neutrino PDG codes. More... | |
| M3::detail::Functional | functional |
| Helper object for storing/updating information related to functional shift parameters. More... | |
| unsigned int | nEvents |
| Number of MC events are there. More... | |
Class responsible for handling implementation of samples used in analysis, reweighting and returning LLH.
This class manages samples used in the analysis. It supports event-by-event reweighting and allows kinematic shifts to be applied at the event level, which may cause migration between analysis bins.
The likelihood calculation is performed in binned space.
Definition at line 35 of file SampleHandlerBase.h.
| SampleHandlerBase::SampleHandlerBase | ( | std::string | ConfigFileName, |
| ParameterHandlerGeneric * | _ParHandler, | ||
| const std::shared_ptr< OscillationHandler > & | OscillatorObj_ = nullptr |
||
| ) |
Constructor.
| ConfigFileName | Name of config to initialise the sample object |
Definition at line 12 of file SampleHandlerBase.cpp.
|
virtual |
destructor
Definition at line 49 of file SampleHandlerBase.cpp.
|
protectedpure virtual |
DB Function to determine which weights apply to which types of samples.
Implemented in PySampleHandlerBase.
| void SampleHandlerBase::AddData | ( | const int | Sample, |
| const std::vector< double > & | Data_Array | ||
| ) |
ETA: Add data for a given sample from a raw array.
| Sample | Index of the sample. |
| Data_Array | Vector containing the data values. |
Definition at line 956 of file SampleHandlerBase.cpp.
| void SampleHandlerBase::AddData | ( | const int | Sample, |
| TH1 * | Data | ||
| ) |
DB: Add data for a given sample from a ROOT histogram.
| Sample | Index of the sample. |
| Data | Pointer to a TH1 containing the data to be stored. |
Definition at line 884 of file SampleHandlerBase.cpp.
|
protectedvirtual |
ETA - generic function applying shifts.
Definition at line 500 of file SampleHandlerBase.cpp.
|
private |
Temporarily extend Selection for a given sample with additional cuts. Returns the original Selection so the caller can restore it later.
Definition at line 1351 of file SampleHandlerBase.cpp.
| std::vector< KinematicCut > SampleHandlerBase::BuildModeChannelSelection | ( | const int | iSample, |
| const int | kModeToFill, | ||
| const int | kChannelToFill | ||
| ) | const |
Construct vector of kinematic cuts that will be applied, on top of default cuts include stuff like cut on mode etc.
| Sample | Index of the sample. |
Definition at line 1684 of file SampleHandlerBase.cpp.
|
protected |
Check whether a normalisation systematic affects an event or not.
| norm_parameters | indexed [sample][param] describe norm params and associated kinematic cuts etc. |
Definition at line 610 of file SampleHandlerBase.cpp.
|
inlineprotectedvirtual |
Calculate weights for function parameters.
First you need to setup additional pointers in you experiment code in SetupWeightPointers Then in this function you can calculate whatever fancy function you want by filling weight to which you have pointer This way func weight shall be used in GetEventWeight
Definition at line 334 of file SampleHandlerBase.h.
|
protected |
Calculate the total weight weight for a given event.
Definition at line 521 of file SampleHandlerBase.cpp.
| void SampleHandlerBase::CheckEmptyBins | ( | ) | const |
Loop over bins and checks if there are any which have 0 entries.
Definition at line 1980 of file SampleHandlerBase.cpp.
| void SampleHandlerBase::Fill1DSubEventHist | ( | const int | iSample, |
| TH1D * | _h1DVar, | ||
| const std::string & | ProjectionVar, | ||
| const std::vector< KinematicCut > & | SubEventSelectionVec = {}, |
||
| int | WeightStyle = 0 |
||
| ) |
Fill projection histogram by looping over all events, and skipping one which doesn't pass specified condition.
Definition at line 1416 of file SampleHandlerBase.cpp.
| void SampleHandlerBase::Fill2DSubEventHist | ( | const int | iSample, |
| TH2 * | _h2DVar, | ||
| const std::string & | ProjectionVarX, | ||
| const std::string & | ProjectionVarY, | ||
| const std::vector< KinematicCut > & | SubEventSelectionVec = {}, |
||
| int | WeightStyle = 0 |
||
| ) |
Fill projection histogram by looping over all events, and skipping one which doesn't pass specified condition.
Definition at line 1500 of file SampleHandlerBase.cpp.
|
protected |
Function which does the core reweighting, fills the SampleHandlerBase::SampleHandler_array vector with the weight calculated from reweighting.
Definition at line 386 of file SampleHandlerBase.cpp.
|
protected |
DB Nice new multi-threaded function which calculates the event weights and fills the relevant bins of an array.
Multithreaded version of fillArray.
Function which does the core reweighting, fills the SampleHandlerBase::SampleHandler_array vector with the weight calculated from reweighting but multithreaded
Definition at line 424 of file SampleHandlerBase.cpp.
|
protected |
Fill a histogram with the event-level information used in the fit.
DB Functions required for reweighting functions DB Replace previous implementation with reading bin contents from SampleHandler_array
Definition at line 274 of file SampleHandlerBase.cpp.
|
inlineprotectedvirtual |
LP - Optionally calculate derived observables after all shifts have been applied.
For example, have shifts that varied lepton energy and hadron energy separately in a subclass implementation of this method you may add the shifted quantities together to build a shifted neutrino energy estimator
Definition at line 314 of file SampleHandlerBase.h.
|
protected |
Functions which find the nominal bin and bin edges.
Definition at line 787 of file SampleHandlerBase.cpp.
|
finalvirtual |
Return 1D projection of MC into given 1D variable (doesn't have to be variable used in the fit)
| iSample | Index of the sample. |
| ProjectionVar | name of variable |
| EventSelectionVec | Vector of additional cuts like cut on interaction mode |
| WeightStyle | Alow to modify weight for example if equal to 1 all weights are set to 1 |
| SubEventSelectionVec | Vector of additional cuts for sub event (particle, ring etc.) |
Implements SampleHandlerInterface.
Definition at line 1373 of file SampleHandlerBase.cpp.
|
finalvirtual |
Build a 1D histogram for a given variable, optionally filtered by mode and channel.
| iSample | Index of the sample. |
| ProjectionVar_Str | Name of the variable to project onto. |
| kModeToFill | Interaction mode to select (-1 means all modes). |
| kChannelToFill | Oscillation channel to select (-1 means all channels). |
| WeightStyle | Weighting scheme (e.g. 0 = nominal weights, 1 = unit weights). |
Implements SampleHandlerInterface.
Definition at line 1735 of file SampleHandlerBase.cpp.
|
finalvirtual |
Build a 2D projection of MC events into specified variables.
| iSample | Index of the sample. |
| ProjectionVarX | Name of the variable for the X axis. |
| ProjectionVarY | Name of the variable for the Y axis. |
| EventSelectionVec | Vector of event-level selection cuts. |
| WeightStyle | Weighting scheme (e.g. 0 = nominal weights, 1 = unit weights). |
| SubEventSelectionVec | Vector of sub-event selection cuts. |
Implements SampleHandlerInterface.
Definition at line 1444 of file SampleHandlerBase.cpp.
|
finalvirtual |
Build a 2D histogram for given variables, optionally filtered by mode and channel.
| iSample | Index of the sample. |
| ProjectionVar_StrX | Name of the variable for the X axis. |
| ProjectionVar_StrY | Name of the variable for the Y axis. |
| kModeToFill | Interaction mode to select (-1 means all modes). |
| kChannelToFill | Oscillation channel to select (-1 means all channels). |
| WeightStyle | Weighting scheme (e.g. 0 = nominal weights, 1 = unit weights). |
Implements SampleHandlerInterface.
Definition at line 1743 of file SampleHandlerBase.cpp.
| std::vector< double > SampleHandlerBase::GetArrayForSample | ( | const int | Sample, |
| std::vector< double > const & | array | ||
| ) | const |
Return a sub-array for a given sample.
Definition at line 2062 of file SampleHandlerBase.cpp.
|
inline |
Return array storing data entries for every bin.
Definition at line 179 of file SampleHandlerBase.h.
|
inline |
Return array storing data entries for every bin.
| Sample | Sample index |
Definition at line 195 of file SampleHandlerBase.h.
|
finalvirtual |
Get Data histogram.
| Sample | Sample enumerator |
Implements SampleHandlerInterface.
Definition at line 867 of file SampleHandlerBase.cpp.
| const TH1 * SampleHandlerBase::GetDataHist | ( | const std::string & | Sample | ) |
Get Data histogram by sample name.
| Sample | Sample title |
Definition at line 877 of file SampleHandlerBase.cpp.
| M3::float_t SampleHandlerBase::GetEventWeight | ( | const int | iEvent | ) |
Computes the total event weight for a given entry.
| iEvent | Event enumerator |
KS:
Definition at line 1122 of file SampleHandlerBase.cpp.
|
inlineprotected |
Retrieve the final neutrino PDG code associated with a given input file name.
Definition at line 458 of file SampleHandlerBase.h.
|
inlinefinalvirtual |
Get the flavour name for a given sample and oscillation channel.
| iSample | Index of the sample. |
| iChannel | Index of the oscillation channel within the sample. |
Implements SampleHandlerInterface.
Definition at line 109 of file SampleHandlerBase.h.
|
inlineprotected |
Retrieve the initial neutrino PDG code associated with a given input file name.
Definition at line 456 of file SampleHandlerBase.h.
|
finalvirtual |
Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino_Energy".
| iSample | Sample index |
| Dimension | Dimension index |
Implements SampleHandlerInterface.
Definition at line 2052 of file SampleHandlerBase.cpp.
|
overridevirtual |
Return likelihood (-LogL) for all samples.
Implements SampleHandlerInterface.
Definition at line 1238 of file SampleHandlerBase.cpp.
|
inline |
Return array storing MC entries for every bin.
Definition at line 183 of file SampleHandlerBase.h.
|
inline |
Return array storing MC entries for every bin.
| Sample | Sample index |
Definition at line 200 of file SampleHandlerBase.h.
|
finalvirtual |
Get MC histogram.
| Sample | Sample enumerator |
Implements SampleHandlerInterface.
Definition at line 849 of file SampleHandlerBase.cpp.
| const TH1 * SampleHandlerBase::GetMCHist | ( | const std::string & | Sample | ) |
Get MC histogram by sample title.
| Sample | Sample name |
Definition at line 860 of file SampleHandlerBase.cpp.
|
finalvirtual |
Get name for Sample Handler.
Implements SampleHandlerInterface.
Definition at line 1109 of file SampleHandlerBase.cpp.
|
inlinefinalvirtual |
DB Get what dimensionality binning for given sample has.
| Sample | Number of sample |
Implements SampleHandlerInterface.
Definition at line 47 of file SampleHandlerBase.h.
|
inline |
|
inlinefinalvirtual |
Get number of oscillation channels for a single sample.
| iSample | Sample enumerator |
Implements SampleHandlerInterface.
Definition at line 107 of file SampleHandlerBase.h.
|
protected |
Get pointer to NuOscillator weight for a given event.
| iEvent | Event enumerator |
Definition at line 1069 of file SampleHandlerBase.cpp.
|
protectedpure virtual |
Implemented in PySampleHandlerBase.
|
inlineprotected |
Definition at line 354 of file SampleHandlerBase.h.
|
protected |
Get pointer to oscillation channel associated with given event. Osc channel is const.
Definition at line 1972 of file SampleHandlerBase.cpp.
| int SampleHandlerBase::GetRangeForPlotType | ( | const SamplePlotType | TypeEnum, |
| const int | iSample | ||
| ) | const |
KS: Return range for plot type, for example number of modes, osc channels etc.
| TypeEnum | Plot type enumerator see SamplePlotType |
| iSample | Sample enumerator |
Definition at line 1895 of file SampleHandlerBase.cpp.
| int SampleHandlerBase::GetSampleIndex | ( | const std::string & | SampleTitle | ) | const |
Get index of sample based on name.
| SampleTitle | The title of the sample to search for. |
Definition at line 819 of file SampleHandlerBase.cpp.
|
overridevirtual |
Get likelihood (-logL) for a single sample.
| iSample | Sample enumerator |
Implements SampleHandlerInterface.
Definition at line 1216 of file SampleHandlerBase.cpp.
|
inline |
Sample name tag used only for getting relevant uncertainties.
| Sample | Index of the sample. |
Definition at line 54 of file SampleHandlerBase.h.
|
inlinefinalvirtual |
Get fancy title for specified samples.
| iSample | Sample enumerator |
Implements SampleHandlerInterface.
Definition at line 51 of file SampleHandlerBase.h.
|
protected |
Retrieve the spline bin indices associated with a given event.
Definition at line 1140 of file SampleHandlerBase.cpp.
|
inline |
Return array storing W2 entries for every bin.
Definition at line 187 of file SampleHandlerBase.h.
|
inline |
Return array storing W2 entries for single sample.
| Sample | Sample index |
Definition at line 205 of file SampleHandlerBase.h.
|
finalvirtual |
Get W2 histogram.
| Sample | Sample enumerator |
Implements SampleHandlerInterface.
Definition at line 831 of file SampleHandlerBase.cpp.
| const TH1 * SampleHandlerBase::GetW2Hist | ( | const std::string & | Sample | ) |
Get W2 histogram by sample name.
| Sample | Sample title |
Definition at line 842 of file SampleHandlerBase.cpp.
|
protectedpure virtual |
Initialise any variables that your experiment specific SampleHandler needs.
Implemented in PySampleHandlerBase.
|
protected |
Function which does a lot of the lifting regarding the workflow in creating different MC objects.
Definition at line 198 of file SampleHandlerBase.cpp.
|
protected |
including Dan's magic NuOscillator
Definition at line 976 of file SampleHandlerBase.cpp.
|
protected |
Setup spline handler (both binned or unbinned)
Definition at line 1303 of file SampleHandlerBase.cpp.
|
protectedpure virtual |
Function responsible for loading data from file or loading from file.
Implemented in PySampleHandlerBase.
|
protected |
DB Function which determines if an event is selected based on KinematicCut.
Definition at line 313 of file SampleHandlerBase.cpp.
|
protected |
JM Function which determines if a subevent is selected.
Definition at line 329 of file SampleHandlerBase.cpp.
| bool SampleHandlerBase::IsSubEventVarString | ( | const std::string & | VarStr | ) | const |
JM: Check if a kinematic parameter string corresponds to a subevent-level variable.
Definition at line 1669 of file SampleHandlerBase.cpp.
|
protected |
Initialise single sample from config file.
Add new sample
Definition at line 114 of file SampleHandlerBase.cpp.
|
protected |
|
inlineprotectedvirtual |
Update the functional parameter values to the latest proposed values. Needs to be called before every new reweight so is called in fillArray.
Definition at line 271 of file SampleHandlerBase.h.
| void SampleHandlerBase::PrintIntegral | ( | const int | iSample, |
| const TString & | OutputName = "/dev/null", |
||
| const int | WeightStyle = 0, |
||
| const TString & | OutputCSVName = "/dev/null" |
||
| ) |
Computes and prints the integral breakdown of all modes and oscillation channels for a given sample.
Definition at line 1752 of file SampleHandlerBase.cpp.
|
finalvirtual |
Helper function to print rates for the samples with LLH.
| DataOnly | whether to print data only rates |
Implements SampleHandlerInterface.
Definition at line 2000 of file SampleHandlerBase.cpp.
|
protected |
Load information about sample handler and corresponding samples from config file.
Definition at line 55 of file SampleHandlerBase.cpp.
|
inlineprotectedvirtual |
HH - a experiment-specific function where the maps to actual functions are set up.
Reimplemented in PySampleHandlerBase.
Definition at line 269 of file SampleHandlerBase.h.
|
protected |
LP - Registration template function for one-dimensional functional shifts.
See above for more details on the call signature and usage.
|
protected |
LP - Registration template function for multi-dimensional functional shifts.
This method is templated over the EventType and the response function type because the response function type is a function of the event type. The implementation checks via static assert that the passed function object has the correct call signature. The experiment class event vector is passed so that the function objects that are used to apply the shifts are able to access the full event information from the experiment class, rather than only being able to respond to event properties defined in Samples/EventInfo.h A vector of input parameter names that should be consumed by the functional shift is also passed. For a 1D version of this method, see below. This function might be used like below:
RegisterIndividualFunctionalParameter(ExptEventInfo, {"par1", "par2"}, [](std::vector<double> const & par_vals, ExptEventType & ev){ constexpr static const double a = 1.2345; ev.property += par_vals[0] * a + par_vals[1]; });
|
protected |
|
inlineprotectedvirtual |
HH - reset the shifted values to the original values.
Definition at line 309 of file SampleHandlerBase.h.
| std::vector< std::unique_ptr< TH1 > > SampleHandlerBase::ReturnHistsBySelection1D | ( | const int | iSample, |
| const std::string & | KinematicProjection, | ||
| const SamplePlotType | Selection1, | ||
| const int | Selection2 = -1, |
||
| const int | WeightStyle = 0 |
||
| ) |
Definition at line 1911 of file SampleHandlerBase.cpp.
| std::vector< std::unique_ptr< TH2 > > SampleHandlerBase::ReturnHistsBySelection2D | ( | const int | iSample, |
| const std::string & | KinematicProjectionX, | ||
| const std::string & | KinematicProjectionY, | ||
| const SamplePlotType | Selection1, | ||
| const int | Selection2 = -1, |
||
| const int | WeightStyle = 0 |
||
| ) |
Definition at line 1939 of file SampleHandlerBase.cpp.
|
protectedpure virtual |
Return the value of an associated kinematic parameter for an event.
Implemented in PySampleHandlerBase.
|
inlineprotected |
Return the value of an associated kinematic parameter for an event.
Definition at line 337 of file SampleHandlerBase.h.
|
finalprotectedvirtual |
Return the binning used to draw a kinematic parameter.
| iSample | Index of the sample. |
| KinematicParameter | name of variable |
Implements SampleHandlerInterface.
Definition at line 1613 of file SampleHandlerBase.cpp.
| int SampleHandlerBase::ReturnKinematicParameterFromString | ( | const std::string & | KinematicStr | ) | const |
ETA function to generically convert a string from param handler to a kinematic type.
Definition at line 1560 of file SampleHandlerBase.cpp.
|
inlineprotectedvirtual |
Definition at line 347 of file SampleHandlerBase.h.
|
inlineprotected |
Definition at line 344 of file SampleHandlerBase.h.
| int SampleHandlerBase::ReturnKinematicVectorFromString | ( | const std::string & | KinematicStr | ) | const |
JM: Convert a kinematic vector name to its corresponding integer ID.
Definition at line 1587 of file SampleHandlerBase.cpp.
| std::unique_ptr< THStack > SampleHandlerBase::ReturnStackedHistBySelection1D | ( | const int | iSample, |
| const std::string & | KinematicProjection, | ||
| const SamplePlotType | Selection1, | ||
| const int | Selection2 = -1, |
||
| const int | WeightStyle = 0 |
||
| ) |
Definition at line 1959 of file SampleHandlerBase.cpp.
|
inline |
Return the legend used for stacked histograms with sample info.
Definition at line 158 of file SampleHandlerBase.h.
| std::string SampleHandlerBase::ReturnStringFromKinematicParameter | ( | const int | KinematicVariable | ) | const |
ETA function to generically convert a kinematic type from param handler to a string.
Definition at line 1572 of file SampleHandlerBase.cpp.
| std::string SampleHandlerBase::ReturnStringFromKinematicVector | ( | const int | KinematicVariable | ) | const |
JM: Convert a kinematic vector integer ID to its corresponding name as a string.
Definition at line 1599 of file SampleHandlerBase.cpp.
|
overridevirtual |
main routine modifying MC prediction based on proposed parameter values
Implements SampleHandlerInterface.
Definition at line 348 of file SampleHandlerBase.cpp.
|
final |
Store additional info in a chain.
| Dir | directory to which we save additional info |
Definition at line 1257 of file SampleHandlerBase.cpp.
|
protected |
set the binning for 2D sample used for the likelihood calculation
Definition at line 686 of file SampleHandlerBase.cpp.
|
protected |
Set pointers for each event to appropriate weights, for unbinned based on event number while for binned based on other kinematical properties.
Definition at line 1174 of file SampleHandlerBase.cpp.
|
protectedpure virtual |
Experiment specific setup, returns the number of events which were loaded.
Implemented in PySampleHandlerBase.
|
protected |
Ensure Kinematic Map is setup and make sure it is initialised correctly.
Definition at line 237 of file SampleHandlerBase.cpp.
|
protectedpure virtual |
Function which translates experiment struct into core struct.
Implemented in PySampleHandlerBase.
|
protected |
Setup the norm parameters by assigning each event with bin.
Definition at line 577 of file SampleHandlerBase.cpp.
|
protected |
Initialise pointer to oscillation weight to NuOscillator object.
Definition at line 1051 of file SampleHandlerBase.cpp.
|
protected |
Setup the osc parameters.
Definition at line 538 of file SampleHandlerBase.cpp.
|
protected |
|
protectedpure virtual |
initialise your splineXX object and then use InitialiseSplineObject to conveniently setup everything up
Implemented in PySampleHandlerBase.
|
protected |
Definition at line 444 of file SampleHandlerBase.h.
|
protected |
KS: This stores binning information, in future could be come vector to store binning for every used sample.
Definition at line 396 of file SampleHandlerBase.h.
|
private |
Mapping from input file names to final neutrino PDG codes.
Definition at line 468 of file SampleHandlerBase.h.
|
private |
Mapping from input file names to initial neutrino PDG codes.
Definition at line 466 of file SampleHandlerBase.h.
|
protected |
KS:Super hacky to update W2 or not.
Definition at line 451 of file SampleHandlerBase.h.
|
private |
Helper object for storing/updating information related to functional shift parameters.
Definition at line 471 of file SampleHandlerBase.h.
|
protected |
Mapping between string and kinematic enum.
Definition at line 432 of file SampleHandlerBase.h.
|
protected |
Definition at line 437 of file SampleHandlerBase.h.
|
protected |
Stores information about every MC event.
Definition at line 407 of file SampleHandlerBase.h.
|
private |
Number of MC events are there.
Definition at line 474 of file SampleHandlerBase.h.
|
protected |
Contains oscillator handling calculating oscillation probabilities.
Definition at line 391 of file SampleHandlerBase.h.
|
protected |
ETA - All experiments will need an xsec, det and osc cov.
Definition at line 415 of file SampleHandlerBase.h.
|
protected |
Mapping between kinematic enum and string.
Definition at line 434 of file SampleHandlerBase.h.
|
protected |
Definition at line 438 of file SampleHandlerBase.h.
|
protected |
Stores info about currently initialised sample.
Definition at line 409 of file SampleHandlerBase.h.
|
protected |
DB Array to be filled after reweighting.
Definition at line 398 of file SampleHandlerBase.h.
|
protected |
KS Array used for MC stat.
Definition at line 400 of file SampleHandlerBase.h.
|
protected |
DB Array to be filled in AddData.
Definition at line 402 of file SampleHandlerBase.h.
|
protected |
Identifier of this Sample Handler, mostly used for fancy printing in FitterBase.
Definition at line 419 of file SampleHandlerBase.h.
|
protected |
The manager object used to read the sample yaml file.
Definition at line 442 of file SampleHandlerBase.h.
|
protected |
a way to store selection cuts which you may push back in the get1DVar functions most of the time this is just the same as StoredSelection
Definition at line 428 of file SampleHandlerBase.h.
|
protected |
Contains all your splines (binned or unbinned) and handles the setup and the returning of weights from spline evaluations.
Definition at line 388 of file SampleHandlerBase.h.
|
protected |
DB Vectors to store which kinematic cuts we apply. Gets used in IsEventSelected Read in from sample yaml file.
Definition at line 425 of file SampleHandlerBase.h.
|
protected |
DB: Legend associated with stacked histograms produced by this class.
Definition at line 448 of file SampleHandlerBase.h.
|
protected |
KS:Super hacky to update W2 or not.
Definition at line 453 of file SampleHandlerBase.h.