![]() |
MaCh3
2.6.0
Reference Guide
|
A SampleHandlerInterface class that acts as a client to an external NuDock server. More...
#include <NuDock/SampleHandlerNuDockBase.h>
Public Member Functions | |
| SampleHandlerNuDockBase (std::string configFile, ParameterHandlerGeneric *xsec_cov) | |
| Construct the NuDock client sample handler. More... | |
| virtual | ~SampleHandlerNuDockBase () |
| Destructor. More... | |
| void | Reweight () override |
| Send current parameter values to the NuDock server. More... | |
| double | GetLikelihood () const override |
| Retrieve the log-likelihood from the NuDock server. More... | |
| std::string | GetSampleTitle ([[maybe_unused]] const int Sample) const override |
| Get fancy title for specified samples. More... | |
| std::string | GetName () const override |
| Get name for Sample Handler. More... | |
| double | GetSampleLikelihood ([[maybe_unused]] const int isample) const override |
| Get the likelihood for a specific sub-sample. More... | |
| void | PrintRates ([[maybe_unused]] const bool DataOnly=false) override |
| Print event rates (no-op for the NuDock client). More... | |
| int | GetNOscChannels ([[maybe_unused]] const int iSample) const override |
| Get the number of oscillation channels for a sample. More... | |
| std::string | GetKinVarName ([[maybe_unused]] const int iSample, [[maybe_unused]] const int Dimension) const override |
| Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino_Energy". More... | |
| const TH1 * | GetDataHist ([[maybe_unused]] const int Sample) override |
| Get Data histogram. More... | |
| const TH1 * | GetMCHist ([[maybe_unused]] const int Sample) override |
| Get MC histogram. More... | |
| const TH1 * | GetW2Hist ([[maybe_unused]] const int Sample) override |
| Get W2 histogram. More... | |
| int | GetNDim ([[maybe_unused]] const int Sample) const override |
| DB Get what dimensionality binning for given sample has. More... | |
| std::string | GetFlavourName ([[maybe_unused]] const int iSample, [[maybe_unused]] const int iChannel) const override |
| Get the flavour name for a given sample and oscillation channel. More... | |
| std::vector< double > | ReturnKinematicParameterBinning ([[maybe_unused]] const int Sample, [[maybe_unused]] const std::string &KinematicParameter) const override |
| Return the binning used to draw a kinematic parameter. More... | |
| std::unique_ptr< TH1 > | Get1DVarHistByModeAndChannel ([[maybe_unused]] const int iSample, [[maybe_unused]] const std::string &ProjectionVar_Str, [[maybe_unused]] int kModeToFill=-1, [[maybe_unused]] int kChannelToFill=-1, [[maybe_unused]] int WeightStyle=0) override |
| Build a 1D histogram for a given variable, optionally filtered by mode and channel. More... | |
| std::unique_ptr< TH2 > | Get2DVarHistByModeAndChannel ([[maybe_unused]] const int iSample, [[maybe_unused]] const std::string &ProjectionVar_StrX, [[maybe_unused]] const std::string &ProjectionVar_StrY, [[maybe_unused]] int kModeToFill=-1, [[maybe_unused]] int kChannelToFill=-1, [[maybe_unused]] int WeightStyle=0) override |
| Build a 2D histogram for given variables, optionally filtered by mode and channel. More... | |
| std::unique_ptr< TH1 > | Get1DVarHist ([[maybe_unused]] const int iSample, [[maybe_unused]] const std::string &ProjectionVar, [[maybe_unused]] const std::vector< KinematicCut > &EventSelectionVec={}, [[maybe_unused]] int WeightStyle=0, [[maybe_unused]] const std::vector< KinematicCut > &SubEventSelectionVec={}) override |
| 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 ([[maybe_unused]] const int iSample, [[maybe_unused]] const std::string &ProjectionVarX, [[maybe_unused]] const std::string &ProjectionVarY, [[maybe_unused]] const std::vector< KinematicCut > &EventSelectionVec={}, [[maybe_unused]] int WeightStyle=0, [[maybe_unused]] const std::vector< KinematicCut > &SubEventSelectionVec={}) override |
| Build a 2D projection of MC events into specified variables. 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 std::string | GetSampleTitle (const int iSample) const =0 |
| Get fancy title for specified samples. More... | |
| virtual double | GetSampleLikelihood (const int iSample) const =0 |
| Get likelihood (-logL) for a single sample. More... | |
| virtual void | SaveAdditionalInfo ([[maybe_unused]] TDirectory *Dir) |
| Store additional info in a chain. More... | |
| MaCh3Modes * | GetMaCh3Modes () const |
| Return pointer to MaCh3 modes. More... | |
| virtual void | PrintRates (const bool DataOnly=false)=0 |
| Helper function to print rates for the samples with LLH. More... | |
| virtual int | GetNOscChannels (const int iSample) const =0 |
| Get number of oscillation channels for a single sample. More... | |
| virtual std::string | GetKinVarName (const int iSample, const int Dimension) const =0 |
| Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino_Energy". More... | |
| virtual const TH1 * | GetDataHist (const int Sample)=0 |
| Get Data histogram. More... | |
| virtual const TH1 * | GetMCHist (const int Sample)=0 |
| Get MC histogram. More... | |
| virtual const TH1 * | GetW2Hist (const int Sample)=0 |
| Get W2 histogram. More... | |
| virtual int | GetNDim (const int Sample) const =0 |
| DB Get what dimensionality binning for given sample has. More... | |
| virtual std::string | GetFlavourName (const int iSample, const int iChannel) const =0 |
| Get the flavour name for a given sample and oscillation channel. More... | |
| virtual std::vector< double > | ReturnKinematicParameterBinning (const int Sample, const std::string &KinematicParameter) const =0 |
| Return the binning used to draw a kinematic parameter. More... | |
| virtual 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)=0 |
| Build a 1D histogram for a given variable, optionally filtered by mode and channel. More... | |
| virtual std::unique_ptr< TH2 > | Get2DVarHistByModeAndChannel (const int iSample, const std::string &ProjectionVar_StrX, const std::string &ProjectionVar_StrY, int kModeToFill=-1, const int kChannelToFill=-1, const int WeightStyle=0)=0 |
| Build a 2D histogram for given variables, optionally filtered by mode and channel. More... | |
| virtual 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={})=0 |
| Return 1D projection of MC into given 1D variable (doesn't have to be variable used in the fit) More... | |
| virtual std::unique_ptr< TH2 > | Get2DVarHist (const int iSample, const std::string &ProjectionVarX, const std::string &ProjectionVarY, const std::vector< KinematicCut > &EventSelectionVec={}, const int WeightStyle=0, const std::vector< KinematicCut > &SubEventSelectionVec={})=0 |
| Build a 2D projection of MC events into specified variables. 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 | CleanMemoryBeforeFit () override |
| No-op – memory cleanup is handled by the NuDock server. More... | |
| void | Init () |
| Initialise the NuDock client connection and cache parameter indices. 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< NuDock > | nudock_ptr |
| Pointer to the NuDock client communication object. More... | |
| std::unique_ptr< Manager > | SampleManager |
| Manager owning the NuDockClient configuration. More... | |
| bool | verbose |
| Verbose logging flag, read from the NuDockClient config block. More... | |
| std::vector< int > | nudockParamInds |
| Cached indices into the ParameterHandler for parameters sent to the server. More... | |
| ParameterHandlerGeneric * | ParHandler |
| Non-owning pointer to the cross-section ParameterHandler. 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... | |
A SampleHandlerInterface class that acts as a client to an external NuDock server.
Instead of performing local event reweighting and likelihood calculation, this sample forwards the current parameter values to an external NuDock server via JSON requests and retrieves the computed likelihood.
Definition at line 20 of file SampleHandlerNuDockBase.h.
| SampleHandlerNuDockBase::SampleHandlerNuDockBase | ( | std::string | configFile, |
| ParameterHandlerGeneric * | xsec_cov | ||
| ) |
Construct the NuDock client sample handler.
Construct the NuDock client sample handler.
Reads the NuDockClient configuration from configFile, initialises the NuDock communication object, and caches the parameter indices that must be forwarded to the server on each reweight call.
| configFile | Path to a YAML configuration file containing the NuDockClient block. |
| xsec_cov | Pointer to the cross-section parameter handler from which current parameter values are read. |
Reads the NuDockClient configuration from configFile, initialises the NuDock communication object, and caches the parameter indices that must be forwarded to the server on each reweight call.
| configFile | Path to a YAML configuration file containing the NuDockClient block. |
| xsec_cov | Pointer to the cross-section parameter handler from which current parameter values are read. |
Definition at line 8 of file SampleHandlerNuDockBase.cpp.
|
virtual |
|
inlineoverrideprotectedvirtual |
No-op – memory cleanup is handled by the NuDock server.
Implements SampleHandlerInterface.
Definition at line 110 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
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.) |
Definition at line 100 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
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). |
Definition at line 92 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
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. |
Definition at line 104 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
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). |
Definition at line 96 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
Get Data histogram.
| Sample | Sample enumerator |
Definition at line 78 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
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. |
Definition at line 87 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino_Energy".
| iSample | Sample index |
| Dimension | Dimension index |
Definition at line 75 of file SampleHandlerNuDockBase.h.
|
overridevirtual |
Retrieve the log-likelihood from the NuDock server.
Retrieve the log-likelihood from the NuDock server.
Sends a "/log_likelihood" request and converts the returned 2NLL value to MaCh3's NLL convention by dividing by 2.
Sends a "/log_likelihood" request and converts the returned 2NLL value to MaCh3's NLL convention by dividing by 2.
Implements SampleHandlerInterface.
Definition at line 90 of file SampleHandlerNuDockBase.cpp.
|
inlineoverride |
Get MC histogram.
| Sample | Sample enumerator |
Definition at line 80 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
Get name for Sample Handler.
Implements SampleHandlerInterface.
Definition at line 56 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
DB Get what dimensionality binning for given sample has.
| Sample | Number of sample |
Definition at line 85 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
Get the number of oscillation channels for a sample.
| iSample | Sample index (unused). |
Definition at line 70 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
Get the likelihood for a specific sub-sample.
| isample | Sub-sample index (unused – delegates to GetLikelihood()). |
Definition at line 61 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
Get fancy title for specified samples.
| iSample | Sample enumerator |
Definition at line 53 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
Get W2 histogram.
| Sample | Sample enumerator |
Definition at line 82 of file SampleHandlerNuDockBase.h.
|
protected |
Initialise the NuDock client connection and cache parameter indices.
Initialise the NuDock client connection and cache parameter indices.
Calls InitialiseNuDockObj() and then gathers system parameter indices (kFunc, kNorm, kSpline) tagged with sample "NuDock" from the ParameterHandler.
Calls InitialiseNuDockObj() and then gathers system parameter indices (kFunc, kNorm, kSpline) tagged with sample "NuDock" from the ParameterHandler.
Definition at line 30 of file SampleHandlerNuDockBase.cpp.
|
inlineoverride |
Print event rates (no-op for the NuDock client).
| DataOnly | Whether to print data-only rates (unused). |
Definition at line 65 of file SampleHandlerNuDockBase.h.
|
inlineoverride |
Return the binning used to draw a kinematic parameter.
| iSample | Index of the sample. |
| KinematicParameter | name of variable |
Definition at line 90 of file SampleHandlerNuDockBase.h.
|
overridevirtual |
Send current parameter values to the NuDock server.
Send current parameter values to the NuDock server.
Collects oscillation and systematic parameter values from the ParameterHandlerGeneric, converts oscillation parameters from MaCh3 to NuDock convention, and sends a "/set_parameters" request.
Collects oscillation and systematic parameter values from the ParameterHandlerGeneric, converts oscillation parameters from MaCh3 to NuDock convention, and sends a "/set_parameters" request.
Implements SampleHandlerInterface.
Definition at line 49 of file SampleHandlerNuDockBase.cpp.
|
protected |
Pointer to the NuDock client communication object.
Definition at line 119 of file SampleHandlerNuDockBase.h.
|
protected |
Cached indices into the ParameterHandler for parameters sent to the server.
Definition at line 128 of file SampleHandlerNuDockBase.h.
|
protected |
Non-owning pointer to the cross-section ParameterHandler.
Definition at line 131 of file SampleHandlerNuDockBase.h.
|
protected |
Manager owning the NuDockClient configuration.
Definition at line 122 of file SampleHandlerNuDockBase.h.
|
protected |
Verbose logging flag, read from the NuDockClient config block.
Definition at line 125 of file SampleHandlerNuDockBase.h.