![]() |
MaCh3
2.5.1
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 (const int Sample) const override |
| Get the title string for a given sample index. More... | |
| std::string | GetName () const override |
| Get the name of this sample handler. More... | |
| double | GetSampleLikelihood (const int isample) const override |
| Get the likelihood for a specific sub-sample. More... | |
| void | PrintRates (const bool DataOnly=false) override |
| Print event rates (no-op for the NuDock client). More... | |
| int | GetNOscChannels (const int iSample) const override |
| Get the number of oscillation channels for a sample. More... | |
| std::string | GetKinVarName (const int iSample, const int Dimension) const override |
| Return Kinematic Variable name for specified sample and dimension for example "Reconstructed_Neutrino_Energy". More... | |
| const TH1 * | GetDataHist (const int Sample) override |
| Get Data histogram. More... | |
| const TH1 * | GetMCHist (const int Sample) override |
| Get MC histogram. More... | |
| const TH1 * | GetW2Hist (const int Sample) override |
| Get W2 histogram. More... | |
| int | GetNDim (const int Sample) const override |
| DB Function to differentiate 1D or 2D binning. More... | |
| std::string | GetFlavourName (const int iSample, const int iChannel) const override |
| Get the flavour name for a given sample and oscillation channel. More... | |
| std::vector< double > | ReturnKinematicParameterBinning (const int Sample, const std::string &KinematicParameter) const override |
| Return the binning used to draw a kinematic parameter. More... | |
| std::unique_ptr< TH1 > | Get1DVarHistByModeAndChannel (const int iSample, const std::string &ProjectionVar_Str, int kModeToFill=-1, int kChannelToFill=-1, int WeightStyle=0) override |
| 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, int kModeToFill=-1, int kChannelToFill=-1, int WeightStyle=0) override |
| Build a 2D histogram for given variables, optionally filtered by mode and 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={}) 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 (const int iSample, const std::string &ProjectionVarX, const std::string &ProjectionVarY, const std::vector< KinematicCut > &EventSelectionVec={}, int WeightStyle=0, 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 void | SaveAdditionalInfo (TDirectory *Dir) |
| Store additional info in a chain. More... | |
| MaCh3Modes * | GetMaCh3Modes () const |
| Return pointer to MaCh3 modes. More... | |
| unsigned int | GetNEvents () const |
| Return total number of events. 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... | |
| unsigned int | nEvents |
| Number of MC events are there. 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 124 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
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 108 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
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 95 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
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 115 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
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 101 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
Get Data histogram.
Implements SampleHandlerInterface.
Definition at line 82 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
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 90 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
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 79 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.
|
inlineoverridevirtual |
Get MC histogram.
Implements SampleHandlerInterface.
Definition at line 84 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
Get the name of this sample handler.
Implements SampleHandlerInterface.
Definition at line 59 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
DB Function to differentiate 1D or 2D binning.
Implements SampleHandlerInterface.
Definition at line 89 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
Get the number of oscillation channels for a sample.
| iSample | Sample index (unused). |
Implements SampleHandlerInterface.
Definition at line 73 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
Get the likelihood for a specific sub-sample.
| isample | Sub-sample index (unused – delegates to GetLikelihood()). |
Implements SampleHandlerInterface.
Definition at line 64 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
Get the title string for a given sample index.
| Sample | Sample index (unused - always returns "NuDockSample"). |
Implements SampleHandlerInterface.
Definition at line 55 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
Get W2 histogram.
Implements SampleHandlerInterface.
Definition at line 86 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.
|
inlineoverridevirtual |
Print event rates (no-op for the NuDock client).
| DataOnly | Whether to print data-only rates (unused). |
Implements SampleHandlerInterface.
Definition at line 68 of file SampleHandlerNuDockBase.h.
|
inlineoverridevirtual |
Return the binning used to draw a kinematic parameter.
Implements SampleHandlerInterface.
Definition at line 93 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 133 of file SampleHandlerNuDockBase.h.
|
protected |
Cached indices into the ParameterHandler for parameters sent to the server.
Definition at line 142 of file SampleHandlerNuDockBase.h.
|
protected |
Non-owning pointer to the cross-section ParameterHandler.
Definition at line 145 of file SampleHandlerNuDockBase.h.
|
protected |
Manager owning the NuDockClient configuration.
Definition at line 136 of file SampleHandlerNuDockBase.h.
|
protected |
Verbose logging flag, read from the NuDockClient config block.
Definition at line 139 of file SampleHandlerNuDockBase.h.