Hello everyone,
today I’ve got a big problem concerning some manual chi-square calculation.
Briefly, I’m simulating muon-decay times with a double exponential + bkgr distribution:
I generate this distribution using TRandom3::GetRandom(), then I implement an algorithm to find the parameters (which I call tauPrimo and r) that minimize the Chi Square.
Obviously the challenge is not to use any ROOT feature to find the chi2 estimate.
I do 2 main loops: one on the number of events that I generate, and the other on the number of times that I calculate the min chi2.
What I want is to obtain a TH2 showing the value of one of the parameters as a function of the number of events that I have simulated. Everything works except the fact that I simulate the events with tauPrimo=0.88 and r=0.8, but the parameter estimate converges to tauPrimo=0.89 and r=0.81 as the number of events increases.
Acutally I have no clue about the nature of the bias, and here is the part of the code in which I calculate the chi2:
for (int k = 2; k <=150; k++){
x1 = h1->GetXaxis()->GetBinCenter(k);
//cout<<x1<< " " << h1->GetBinWidth(k) <<endl;
Mu1 = h1->GetEntries() * h1->GetBinWidth(k) * TotalDistribution(x1, alpha, tau, r1, tauPrimo1, norm1, minTime, maxTime);
chiSquare1 += (h1->GetBinContent(k) - Mu1) * (h1->GetBinContent(k) - Mu1) / (h1->GetBinContent(k));
}
Mu comes from this definition:
and the chi2 square expression os obtained substituting the sigma square denominator with the number of entries in the bin.
Then x1 represents the time, and total distribution is defined before as the double exponential.
I’m uploading also the .C file that I’m using right now.
Thank you so much for the help!!
Chiara
MonteCarloConsistence2.C (11.5 KB)
p.s. the number of events in the macro starts from 100000.
ROOT Version: 6.17
Platform: UBUNTU 18.04