Hi,
I am having a problem implementing a Chi-squared test on both of my unweighted histograms.
I have a log10(x) binning of my nutples and have produced a histogram of the sums of the background versus the signal.
I try to compare these two histograms by using a Chi-squares test. The option that I have used is a unweighted normalized histogram.
I seem to be receiving this error:
Error in TH1F::ChistatTestX: one histogram is empty
Chi2 = 0.000000, Prob = 0, NDF = 59, igood = 0
I do have some bin’s with less than 1 entry in each histogram. Could this be the cause of the error?
I have included my code below.
Cheers,
Mike
OutputCanvasSumNorm->cd(1);
ttX=new TH1F("ttX","Sum of The Backgrounds weighted to Unity Ant Dmin 0-1",60,0,7);
ttX->Add(AntKtDminNoCal_dmin_01_norm1_np0, 1.0);
ttX->Add(AntKtDminNoCal_dmin_01_norm1_np1, 1.0);
ttX->Add(AntKtDminNoCal_dmin_01_norm1_np2, 1.0);
ttX->Add(AntKtDminNoCal_dmin_01_norm1_np3, 1.0);
ttX->SetLineColor(3);
ttX->SetMinimum(1.0e-17);
ttX->GetXaxis()->SetTitle("Log(Dmin) [GeV^{2}]");
ttX->GetYaxis()->SetTitle("1/#sigma d#sigma/dDmin");
Double_t NEntries01 = ttX->GetEntries();
ttX->Scale(1.0/(NEntries01*100000000000));
///Signal
Signal01=new TH1F("Signal01","Sum of The Backgrounds weighted to Unity Ant Dmin 0-1",60,0,7);
Signal01->Add(AntKtDminNoCal_dmin_01_norm1_sig, 1.0);
Signal01->SetLineColor(6);
Double_t S_NEntries01 = Signal01->GetEntries();
Signal01->Scale(1.0/(S_NEntries01*100000000000));
//Draw
ttX->Draw();
Signal01->Draw("sames");
//Chi2-Test
double res01[NEntries01];
Double_t p_value = ttX->Chi2Test(Signal01,"uu norm P",0);