![]() |
MaCh3
2.2.3
Reference Guide
|
Functions | |
virtual M3::int_t | SampleHandlerBase::GetNsamples () |
virtual std::string | SampleHandlerBase::GetTitle () const |
virtual std::string | SampleHandlerBase::GetSampleName (int Sample) const =0 |
virtual double | SampleHandlerBase::GetSampleLikelihood (const int isample) |
MaCh3Modes * | SampleHandlerBase::GetMaCh3Modes () const |
Return pointer to MaCh3 modes. More... | |
virtual double | SampleHandlerBase::GetLikelihood ()=0 |
unsigned int | SampleHandlerBase::GetNEvents () const |
virtual int | SampleHandlerBase::GetNOscChannels () |
double | SampleHandlerBase::GetPoissonLLH (const double data, const double mc) const |
Calculate test statistic for a single bin using Poisson. More... | |
double | SampleHandlerBase::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 | SampleHandlerBase::SetTestStatistic (TestStatistic testStat) |
Set the test statistic to be used when calculating the binned likelihoods. More... | |
int | SampleHandlerFD::GetNDim () const |
DB Function to differentiate 1D or 2D binning. More... | |
std::string | SampleHandlerFD::GetSampleName (int iSample=0) const override |
std::string | SampleHandlerFD::GetTitle () const override |
std::string | SampleHandlerFD::GetXBinVarName () const |
std::string | SampleHandlerFD::GetYBinVarName () const |
TH1 * | SampleHandlerFD::GetMCHist (const int Dimension) |
Get MC histogram. More... | |
TH1 * | SampleHandlerFD::GetW2Hist (const int Dimension) |
Get W2 histogram. More... | |
TH1 * | SampleHandlerFD::GetDataHist (const int Dimension) |
Get Data histogram. More... | |
int | SampleHandlerFD::GetNOscChannels () override |
std::string | SampleHandlerFD::GetFlavourName (const int iChannel) |
TH1 * | SampleHandlerFD::Get1DVarHist (const std::string &ProjectionVar, const std::vector< KinematicCut > &EventSelectionVec=std::vector< KinematicCut >(), int WeightStyle=0, TAxis *Axis=nullptr, const std::vector< KinematicCut > &SubEventSelectionVec=std::vector< KinematicCut >()) |
void | SampleHandlerFD::Fill1DSubEventHist (TH1D *_h1DVar, const std::string &ProjectionVar, const std::vector< KinematicCut > &SubEventSelectionVec=std::vector< KinematicCut >(), int WeightStyle=0) |
TH1 * | SampleHandlerFD::Get1DVarHistByModeAndChannel (const std::string &ProjectionVar_Str, int kModeToFill=-1, int kChannelToFill=-1, int WeightStyle=0, TAxis *Axis=nullptr) |
TH2 * | SampleHandlerFD::Get2DVarHistByModeAndChannel (const std::string &ProjectionVar_StrX, const std::string &ProjectionVar_StrY, int kModeToFill=-1, int kChannelToFill=-1, int WeightStyle=0, TAxis *AxisX=nullptr, TAxis *AxisY=nullptr) |
TH1 * | SampleHandlerFD::GetModeHist1D (int s, int m, int style=0) |
TH2 * | SampleHandlerFD::GetModeHist2D (int s, int m, int style=0) |
std::vector< TH1 * > | SampleHandlerFD::ReturnHistsBySelection1D (std::string KinematicProjection, int Selection1, int Selection2=-1, int WeightStyle=0, TAxis *Axis=0) |
std::vector< TH2 * > | SampleHandlerFD::ReturnHistsBySelection2D (std::string KinematicProjectionX, std::string KinematicProjectionY, int Selection1, int Selection2=-1, int WeightStyle=0, TAxis *XAxis=0, TAxis *YAxis=0) |
THStack * | SampleHandlerFD::ReturnStackedHistBySelection1D (std::string KinematicProjection, int Selection1, int Selection2=-1, int WeightStyle=0, TAxis *Axis=0) |
TLegend * | SampleHandlerFD::ReturnStackHistLegend () |
int | SampleHandlerFD::ReturnKinematicParameterFromString (const std::string &KinematicStr) const |
ETA function to generically convert a string from xsec cov to a kinematic type. More... | |
std::string | SampleHandlerFD::ReturnStringFromKinematicParameter (const int KinematicVariable) const |
ETA function to generically convert a kinematic type from xsec cov to a string. More... | |
Group of functions to get various parameters, names, and values.
void SampleHandlerFD::Fill1DSubEventHist | ( | TH1D * | _h1DVar, |
const std::string & | ProjectionVar, | ||
const std::vector< KinematicCut > & | SubEventSelectionVec = std::vector< KinematicCut >() , |
||
int | WeightStyle = 0 |
||
) |
Definition at line 1491 of file SampleHandlerFD.cpp.
TH1 * SampleHandlerFD::Get1DVarHist | ( | const std::string & | ProjectionVar, |
const std::vector< KinematicCut > & | EventSelectionVec = std::vector< KinematicCut >() , |
||
int | WeightStyle = 0 , |
||
TAxis * | Axis = nullptr , |
||
const std::vector< KinematicCut > & | SubEventSelectionVec = std::vector< KinematicCut >() |
||
) |
Definition at line 1437 of file SampleHandlerFD.cpp.
TH1 * SampleHandlerFD::Get1DVarHistByModeAndChannel | ( | const std::string & | ProjectionVar_Str, |
int | kModeToFill = -1 , |
||
int | kChannelToFill = -1 , |
||
int | WeightStyle = 0 , |
||
TAxis * | Axis = nullptr |
||
) |
Definition at line 1728 of file SampleHandlerFD.cpp.
TH2 * SampleHandlerFD::Get2DVarHistByModeAndChannel | ( | const std::string & | ProjectionVar_StrX, |
const std::string & | ProjectionVar_StrY, | ||
int | kModeToFill = -1 , |
||
int | kChannelToFill = -1 , |
||
int | WeightStyle = 0 , |
||
TAxis * | AxisX = nullptr , |
||
TAxis * | AxisY = nullptr |
||
) |
Definition at line 1778 of file SampleHandlerFD.cpp.
TH1 * SampleHandlerFD::GetDataHist | ( | const int | Dimension | ) |
Get Data histogram.
Definition at line 1049 of file SampleHandlerFD.cpp.
|
inline |
Definition at line 83 of file SampleHandlerFD.h.
|
pure virtual |
Implemented in SampleHandlerFD, and PySampleHandlerBase.
|
inline |
TH1 * SampleHandlerFD::GetMCHist | ( | const int | Dimension | ) |
Get MC histogram.
Definition at line 1034 of file SampleHandlerFD.cpp.
|
inline |
Definition at line 111 of file SampleHandlerFD.h.
|
inline |
Definition at line 115 of file SampleHandlerFD.h.
|
inline |
DB Function to differentiate 1D or 2D binning.
Definition at line 31 of file SampleHandlerFD.h.
|
inline |
Definition at line 60 of file SampleHandlerBase.h.
|
inlinevirtual |
Reimplemented in SampleHandlerFD.
Definition at line 62 of file SampleHandlerBase.h.
|
inlineoverridevirtual |
|
inlinevirtual |
Definition at line 40 of file SampleHandlerBase.h.
double SampleHandlerBase::GetPoissonLLH | ( | const double | data, |
const double | mc | ||
) | const |
Calculate test statistic for a single bin using Poisson.
data | is data |
mc | is mc |
Definition at line 18 of file SampleHandlerBase.cpp.
|
inlinevirtual |
Definition at line 46 of file SampleHandlerBase.h.
|
overridevirtual |
Implements SampleHandlerBase.
Definition at line 1273 of file SampleHandlerFD.cpp.
|
pure virtual |
Implemented in SampleHandlerFD, and PySampleHandlerBase.
double SampleHandlerBase::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.
Standard Poisson log-likelihood (Stirling approximation) [2]
\[ - \log \mathcal{L}_\mathrm{Poisson} = \sum_i N_i^\mathrm{MC} - N_i^\mathrm{data} + N_i^\mathrm{data} \ln \frac{N_i^\mathrm{data}}{N_i^\mathrm{MC}}, \]
Standard Pearson likelihood [24] (assumes Gaussian approximation of bin counts):
\[ - \log \mathcal{L}_\mathrm{Pearson} = \sum_i \frac{(N_i^\mathrm{data} - N_i^\mathrm{MC})^2}{2 \, N_i^\mathrm{MC}} \]
Based on [3] and following Conway approximation ([5]) The generation of MC is a stochastic process, so even identical settings can lead to different outputs (assuming that the seeds of the random number generator are different). This introduces uncertainty in MC distributions, especially in bins with low statistics.
\[ - \log \mathcal{L}_\mathrm{BB} = - \log \mathcal{L}_\mathrm{Poisson} - \log \mathcal{L}_\mathrm{MC_{stat}} = \sum_i \Biggl[ N_i^\mathrm{MC}(\vec{\theta}) - N_i^\mathrm{data} + N_i^\mathrm{data} \ln \frac{N_i^\mathrm{data}}{N_i^\mathrm{MC}(\vec{\theta})} + \frac{(\beta_i - 1)^2}{2 \sigma_{\beta_i}^2} \Biggr], \]
where \(\beta_i\) is a scaling parameter between ideal ("true") and generated MC in a bin ( \(N^\mathrm{true}_{\mathrm{MC},i} = \beta_i N_i^\mathrm{MC}\)), and \(\sigma^2_{\beta_i} = \frac{\sum_i w_i^2}{N_i^\mathrm{MC}}\), with \(\sum_i w_i^2\) being the sum of the squares of weights in bin \(i\). Assuming \(\beta_i\) follows a Gaussian, its mean can be found by solving the quadratic equation derived by Conway:
\[ \beta_i^2 + (N_i^\mathrm{MC} \sigma_{\beta_i}^2 - 1)\beta_i - N_i^\mathrm{data} \sigma_{\beta_i}^2 = 0 \]
Alternative treatment of MC statistical uncertainty following Hans Dembinski and Ahmed Abdelmotteleb [6]
This approach extends the Barlow-Beeston method. For each bin:
\[ - \log \mathcal{L}_\mathrm{DA} = (N_i^{\mathrm{MC},\prime} - N_i^\mathrm{data} + N_i^\mathrm{data} \ln \frac{N_i^\mathrm{data}}{N_i^{\mathrm{MC},\prime}}) + k \beta - k + k \ln \frac{k}{k \beta} \]
where
\[ k = \frac{(N_i^\mathrm{MC})^2}{\sum_i w_i^2} \]
and
\[ \beta = \frac{N_i^\mathrm{data} + k}{N_i^\mathrm{MC} + k}, \quad N_i^{\mathrm{MC},\prime} = N_i^\mathrm{MC} \cdot \beta \]
Alternative likelihood definition described by the IceCube collaboration [1]
\[ - \log \mathcal{L} = - \sum_i \Biggl( a_i \log(b_i) + \log[\Gamma(N_i^{\mathrm{data}}+a_i)] - (N_i^{\mathrm{data}}+a_i)\log(b_i+1) - \log[\Gamma(a_i)] \Biggr), \]
where the auxiliary variables are
\[ a_i = N^{\mathrm{gen}}_{\mathrm{MC},i} \, b_i + 1, \quad b_i = \frac{N^{\mathrm{gen}}_{\mathrm{MC},i}}{\sum_i w_i^2}. \]
Implemented fTestStatistic are kPoisson
(with Stirling's approx.), kBarlowBeeston
(arXiv:1103.0354), kDembinskiAbdelmotteleb
(arXiv:2206.12346), kIceCube
(arxiv:1901.04645), and kPearson
. Test statistics require mc > 0, therefore low mc and data values are treated with cut-offs based on M3::LOW_MC_BOUND = .00001 by default. For kPoisson
, kBarlowBeeston
, kDembinskiAbdelmotteleb
, kPearson:
data > LOW_MC_BOUND & mc <= LOW_MC_BOUND: returns GetTestStatLLH(data, LOW_MC_BOUND, w2), with Poisson(data,LOW_MC_BOUND) limit for mc->0, w2->0. mc < data <= LOW_MC_BOUND: returns 0 (as if any data <= LOW_MC_BOUND were effectively consistent with 0 data count), with a limit of 0 for mc->0. data = 0: returns mc (or mc/2. for kPearson
), with a limit of 0 for mc->0. For kIceCube:
mc < data returns the lower of IceCube(data,mc,w2) and Poisson(data,mc) penalties, with a Poisson(data,LOW_MC_BOUND) limit for mc->0, w2->0.
data | is data |
mc | is mc |
w2 | is \(\sum_{i} w_{i}^2\) (sum of weights squared), which is \(\sigma^2_{\text{MC stats}}\) |
Definition at line 36 of file SampleHandlerBase.cpp.
|
inlinevirtual |
Reimplemented in SampleHandlerFD.
Definition at line 42 of file SampleHandlerBase.h.
|
inlineoverridevirtual |
Reimplemented from SampleHandlerBase.
Definition at line 35 of file SampleHandlerFD.h.
TH1 * SampleHandlerFD::GetW2Hist | ( | const int | Dimension | ) |
Get W2 histogram.
Definition at line 996 of file SampleHandlerFD.cpp.
|
inline |
Definition at line 38 of file SampleHandlerFD.h.
|
inline |
Definition at line 40 of file SampleHandlerFD.h.
std::vector< TH1 * > SampleHandlerFD::ReturnHistsBySelection1D | ( | std::string | KinematicProjection, |
int | Selection1, | ||
int | Selection2 = -1 , |
||
int | WeightStyle = 0 , |
||
TAxis * | Axis = 0 |
||
) |
Definition at line 1970 of file SampleHandlerFD.cpp.
std::vector< TH2 * > SampleHandlerFD::ReturnHistsBySelection2D | ( | std::string | KinematicProjectionX, |
std::string | KinematicProjectionY, | ||
int | Selection1, | ||
int | Selection2 = -1 , |
||
int | WeightStyle = 0 , |
||
TAxis * | XAxis = 0 , |
||
TAxis * | YAxis = 0 |
||
) |
Definition at line 2006 of file SampleHandlerFD.cpp.
int SampleHandlerFD::ReturnKinematicParameterFromString | ( | const std::string & | KinematicStr | ) | const |
ETA function to generically convert a string from xsec cov to a kinematic type.
Definition at line 1627 of file SampleHandlerFD.cpp.
THStack * SampleHandlerFD::ReturnStackedHistBySelection1D | ( | std::string | KinematicProjection, |
int | Selection1, | ||
int | Selection2 = -1 , |
||
int | WeightStyle = 0 , |
||
TAxis * | Axis = 0 |
||
) |
Definition at line 2036 of file SampleHandlerFD.cpp.
|
inline |
Definition at line 126 of file SampleHandlerFD.h.
std::string SampleHandlerFD::ReturnStringFromKinematicParameter | ( | const int | KinematicVariable | ) | const |
ETA function to generically convert a kinematic type from xsec cov to a string.
Definition at line 1639 of file SampleHandlerFD.cpp.
|
inline |
Set the test statistic to be used when calculating the binned likelihoods.
testStat | The test statistic to use. |
Definition at line 172 of file SampleHandlerBase.h.