40 void AddThrow(std::vector<TH2Poly*> &MCHist, std::vector<TH2Poly*> &W2Hist,
const double LLHPenalty = 0.0,
const double Weight = 1.0,
const int DrawNumber = 0);
42 void AddThrowByMode(std::vector<std::vector<TH2Poly*>> &SampleVector_ByMode);
63 inline void CalcLLH(TH2Poly *
const & Data, TH2Poly *
const & MC, TH2Poly *
const & W2);
68 inline void CalcLLH(TH1D *
const & Data, TH1D *
const & MC, TH1D *
const & W2);
74 inline double GetLLH(TH2Poly *
const & Data, TH2Poly *
const & MC, TH2Poly *
const & W2);
79 inline double GetLLH(TH1D *
const & Data, TH1D *
const & MC, TH1D *
const & W2);
90 inline void MakeCutLLH1D(TH1D *Histogram,
double llh_ref = -999);
103 inline TH1D*
ProjectHist(TH2D* Histogram,
const bool ProjectX);
105 inline TH1D*
ProjectPoly(TH2Poly* Histogram,
const bool ProjectX,
const int selection,
const bool MakeErrorHist =
false);
131 std::unique_ptr<TRandom3>
rnd;
159 std::vector<std::vector<std::unique_ptr<TH1D>>>
w2Hist;
230 std::vector<std::vector<std::unique_ptr<TH1D>>>
BetaHist;
257 std::vector<TDirectory*>
Dir;
TestStatistic
Make an enum of the test statistic that we're using.
Utility functions for statistical interpretations in MaCh3.
KS: Class describing MaCh3 modes used in the analysis, it is being initialised from config.
Class responsible for handling implementation of samples used in analysis, reweighting and returning ...
Class to calculate pvalue produce posterior predictive and many fancy Bayesian stuff .
void AddThrowByMode(std::vector< std::vector< TH2Poly * > > &SampleVector_ByMode)
KS: Add histograms for each mode.
void StudyInformationCriterion(M3::kInfCrit Criterion)
Information Criterion.
std::vector< TH2Poly * > lnLHist_Mode
The LLH distribution in pmu cosmu for using the mode in each bin.
std::vector< double > LLHPenaltyVector
Vector to hold the penalty term.
std::vector< double > llh_data_draw_ProjectX
Projection X (most likely muon momentum) of LLH.
void MakeCutEventRate(TH1D *Histogram, const double DataRate)
Make the 1D Event Rate Hist.
SampleHandlerBase * SampleHandler
Pointer to SampleHandler object, mostly used to get sample names, binning etc.
~SampleSummary()
Destructor.
std::vector< double > llh_predfluc_draw
Fluctuated Predictive vs Draw.
void AddThrow(std::vector< TH2Poly * > &MCHist, std::vector< TH2Poly * > &W2Hist, const double LLHPenalty=0.0, const double Weight=1.0, const int DrawNumber=0)
KS: Add histograms with throws.
std::vector< std::vector< TH2Poly * > > MCVector
Vector of vectors which holds the loaded MC histograms.
std::vector< TH2Poly * > lnLHist_Mean
The LLH distribution in pmu cosmu for using the mean in each bin.
void CalcLLH(TH2Poly *const &Data, TH2Poly *const &MC, TH2Poly *const &W2)
Helper functions to calculate likelihoods using TH2Poly, will modify MC hist tittle to include LLH.
double total_llh_predfluc_pred
Fluctuated Predictive vs Predictive.
double total_llh_drawfluc_draw_ProjectX
Fluctuated Draw vs Draw for projection X (most likely muon momentum)
std::vector< std::vector< TH2Poly * > > W2MCVector
Vector of vectors which holds the loaded W2 histograms.
std::vector< TH2Poly * > W2MeanHist
Pointer to the w2 histograms (for mean values).
double total_llh_data_draw
Data vs Draw.
std::unique_ptr< TH1D > RandomHist
Holds the history of which entries have been drawn in the MCMC file.
double total_llh_rate_predfluc_draw
Fluctuated Predictive vs Draw using Rate.
void MakeChi2Hists()
Make the fluctuated histograms (2D and 1D) for the chi2s Essentially taking the MCMC draws and calcul...
std::vector< double > llh_data_predfluc
Data vs Fluctuated Predictive.
void StudyBIC()
Study Bayesian Information Criterion (BIC) .
std::unique_ptr< TRandom3 > rnd
Random number generator.
std::vector< TH1D * > lnLHist_Mode1D
Holds the bin-by-bin LLH for the mode posterior predictive vs the data.
std::string OutputName
Output filename.
void MakePredictive()
Finalise the distributions from the thrown samples.
std::vector< double > llh_predfluc_pred
Fluctuated Predictive vs Predictive.
std::vector< std::vector< std::unique_ptr< TH1D > > > BetaHist
Distribution of beta parameters in Barlow Beeston formalisms.
int nModelParams
Number of parameters.
std::vector< TH2D * > ViolinHists_ProjectX
Posterior predictive but for X projection but as a violin plot.
bool first_pass
KS: Hacky flag to let us know if this is first toy.
std::vector< TH2Poly * > NominalHist
The nominal histogram for the selection.
std::vector< std::vector< std::unique_ptr< TH1D > > > PosteriorHist
The posterior predictive for the whole selection: this gets built after adding in the toys....
double total_llh_draw_pred
Draw vs Predictive.
std::vector< double > llh_drawfluc_draw
Fluctuated Draw vs Draw.
double total_llh_data_draw_ProjectX
Data vs Draw for projection X (most likely muon momentum)
std::vector< TH2Poly * > MeanHistCorrected
The posterior predictive distribution in pmu cosmu using the mean after applying Barlow-Beeston Corre...
std::vector< double > llh_drawfluc_predfluc
Fluctuated Draw vs Fluctuated Predictive.
MaCh3Modes * Modes
MaCh3 Modes.
std::vector< double > llh_data_draw
Data vs Draw.
double total_llh_data_drawfluc
Data vs Fluctuated Draw.
void AddData(std::vector< TH2Poly * > &DataHist)
KS: Add data histograms.
TH1D * ProjectPoly(TH2Poly *Histogram, const bool ProjectX, const int selection, const bool MakeErrorHist=false)
Helper to project TH2Poly onto axis.
std::unique_ptr< TH1D > lnLHist
The histogram containing the lnL for each throw.
std::vector< TH1D * > lnLHist_Mean1D
Holds the bin-by-bin LLH for the mean posterior predictive vs the data.
TTree * OutputTree
TTree which we save useful information to.
bool DoByModePlots
By mode variables.
std::vector< TH1D * > lnLHist_Mean_ProjectX
The LLH distribution in pmu using the mean in each bin.
void PrepareOutput()
KS: Prepare output tree and necessary variables.
double total_llh_drawfluc_draw
Fluctuated Draw vs Draw.
std::vector< TH2Poly * > DataHist
The data histogram for the selection.
std::vector< double > llh_draw_pred
Draw vs Predictive.
double total_llh_predfluc_draw
Fluctuated Predictive vs Draw.
int Debug
Tells Debug level to save additional histograms.
std::vector< double > llh_drawfluc_draw_ProjectX
bool CheckSamples(const int Length)
Check the length of samples agrees.
std::unique_ptr< TH2D > lnLDrawHist
The 2D lnLhist, showing (draw vs data) and (draw vs fluct), anything above y=x axis is the p-value.
void AddNominal(std::vector< TH2Poly * > &NominalHist, std::vector< TH2Poly * > &W2Nom)
KS: Add prior histograms.
void StudyDIC()
KS: Get the Deviance Information Criterion (DIC) .
std::vector< TH2D * > ViolinHists_ProjectY
Posterior predictive but for Y projection but as a violin plot.
std::vector< double > llh_data_drawfluc
Data vs Fluctuated Draw.
std::vector< TH2Poly * > ModeHist
The posterior predictive distribution in pmu cosmu using the mode.
std::vector< std::string > SampleNames
name for each sample
std::vector< TH2Poly * > W2NomHist
Pointer to the w2 histograms (for nominal values).
double total_llh_drawfluc_pred
Fluctuated Draw vs Predictive.
void StudyWAIC()
KS: Get the Watanabe-Akaike information criterion (WAIC) .
std::vector< TDirectory * > Dir
Directory for each sample.
std::vector< double > llh_rate_predfluc_draw
Fluctuated Predictive vs Draw using rate only.
unsigned int nThrows
Number of throws.
std::vector< TH1D * > lnLHist_Sample_DrawData
The histogram containing the lnL (draw vs data) for each throw for each sample.
std::vector< std::vector< std::unique_ptr< TH1D > > > w2Hist
The posterior predictive for the whole selection: this gets built after adding in the toys....
TH1D **** PosteriorHist_ByMode
Histogram which corresponds to each bin in the sample's th2poly.
std::unique_ptr< TH1D > lnLHist_drawflucdraw
The lnLhist for the draw vs draw fluctuated.
TFile * Outputfile
Output filename.
double llh_total
Total LLH for the posterior predictive distribution.
void Write()
KS: Write results into root file.
std::unique_ptr< TH2D > lnLDrawHistRate
The 2D lnLhist, showing (draw vs data) and (draw vs fluct), using rate, anything above y=x axis is th...
double total_llh_rate_data_draw
Rate Data vs Draw.
std::unique_ptr< TH1D > lnLHist_drawdata
The lnLhist for the draw vs data.
TestStatistic likelihood
Type of likelihood for example Poisson, Barlow-Beeston or Ice Cube.
int nSamples
Number of samples.
void MakeCutLLH()
Make the cut LLH histogram.
std::vector< std::vector< std::vector< TH2Poly * > > > MCVectorByMode
Vector of vectors which holds the loaded MC histograms for each mode.
void SetNModelParams(const int nPars)
Set number of model params used for BIC.
std::vector< double > llh_drawfluc_pred
Fluctuated Draw vs Predictive.
std::vector< std::vector< TH2Poly * > > MeanHist_ByMode
The posterior predictive distribution in pmu cosmu using the mean.
std::vector< double > llh_datafluc_draw
Fluctuated Data vs Draw.
std::vector< TH1D * > DataHist_ProjectX
The data histogram for the selection X projection.
void MakeCutLLH1D(TH1D *Histogram, double llh_ref=-999)
std::vector< TH1D * > DataHist_ProjectY
The data histogram for the selection Y projection.
void PlotBetaParameters()
KS: In Barlow Beeston we have Beta Parameters which scale generated MC.
double GetLLH(TH2Poly *const &Data, TH2Poly *const &MC, TH2Poly *const &W2)
Helper functions to calculate likelihoods using TH2Poly.
std::vector< double > WeightVector
Vector holding weight.
void MakeFluctuatedHistogram(TH1D *FluctHist, TH1D *PolyHist)
Make Poisson fluctuation of TH1D hist.
std::vector< double > llh_rate_data_draw
Data vs Draw using rate only.
bool isPriorPredictive
bool whether we have Prior or Posterior Predictive
bool DoBetaParam
Are we making Beta Histograms.
std::vector< TH2Poly * > W2ModeHist
Pointer to the w2 histograms (for mode values).
std::unique_ptr< TH2D > lnLFlucHist
The 2D lnLHist, showing (draw vs data) and (draw vs draw fluct), anything above y=x axis is the p-val...
bool StandardFluctuation
KS: We have two methods for Poissonian fluctuation.
std::unique_ptr< TH2D > lnLFlucHist_ProjectX
The 2D lnLHist but for ProjectionX histogram (pmu), showing (draw vs data) and (draw vs draw fluct),...
std::unique_ptr< TH1D > lnLHist_drawfluc
The lnLhist for the draw vs MC fluctuated.
bool doShapeOnly
bool whether to normalise each toy to have shape based p-value and pos pred distribution
void SetLikelihood(const TestStatistic TestStat)
KS: Set likelihood type.
std::vector< TH1D * > lnLHist_Sample_PredflucDraw
The histogram containing the lnL (draw vs pred fluct) for each throw for each sample.
double total_llh_data_predfluc
Data vs Fluctuated Predictive.
double llh_penalty
LLH penalty for each throw.
std::vector< TH2Poly * > MeanHist
The posterior predictive distribution in pmu cosmu using the mean.
unsigned int nChainSteps
Number of throws by user.
std::vector< int > maxBins
Max Number of Bins per each sample.
TH1D * ProjectHist(TH2D *Histogram, const bool ProjectX)
Helper to project TH2D onto axis.
double total_llh_drawfluc_predfluc
Fluctuated Draw vs Fluctuated Predictive.
double total_llh_datafluc_draw
Fluctuated Data vs Draw.
void StudyKinematicCorrelations()
KS: Study how correlated are sample or kinematic bins.
std::vector< TH1D * > lnLHist_Sample_DrawflucDraw
The histogram containing the lnL (draw vs draw fluct) for each throw for each sample.
kInfCrit
KS: Different Information Criterion tests mostly based Gelman paper.
@ kWAIC
Watanabe-Akaike information criterion.
@ kInfCrits
This only enumerates.
@ kBIC
Bayesian Information Criterion.
@ kDIC
Deviance Information Criterion.