Hello,
I will be very thankful to get some help for my code:
I have a Gaussian histogram of 4 bins. the code to get the histogram is below:
TH1F *h1 = new TH1F("h1","d=1.2 mm,t=0.4mm",8,0,24);
TF1 f1("f1", "TMath::Abs(1/(TMath::Sqrt(2)*TMath::Sqrt(TMath::Pi())*(1.06)))*TMath::Exp(-((x-6.6)*(x-6.6))/2.2472)", 0, 24);
h1->FillRandom("f1",400);
h1->Draw();
For each bin, I have error given by Poisson distribution. Therefore, I want to plot the same Gaussian histogram having value for each bin randomly selected by the Poisson distribution
But when I do it, the get random function is not selecting all the random values from poisson distribution.
[code]// Define poisson for different bins:
TF1 *f1 = new TF1(“f1”, “TMath::Poisson(x,1)”,0,6);
TF1 *f2 = new TF1(“f2”, “TMath::Poisson(x,120)”,70,180);
TF1 *f3 = new TF1(“f3”, “TMath::Poisson(x,272)”,200,360);
TF1 *f4 = new TF1(“f4”, “TMath::Poisson(x,7)”,0,30);
// To redefine the same histogram with randomly selected values
TH1F *h = new TH1F(“h”, “d=0.8 and t = 0.7mm”, 8, 0, 24);
for (Int_t i=0; i<1000; i++){ h->Fill(1.5, f1->GetRandom()); h->Fill(4.5, f2->GetRandom()); h->Fill(7.5, f3->GetRandom()); h->Fill(10.5, f4->GetRandom()); cout<GetMean()<<endl;}[/code]
Thank you.
Kajal