Chi-square test between two histograms

Try:

h2->Chi2Test(hIs, "p")

and see the printed “Chi2” and “NDF” (note: “p_value = TMath::Prob(Chi2, NDF)”).

BTW. Try also your code with “nEventi = 2000” (so that the “Chi2” is of the same order as the “NDF”).