{ TRandom3 *EG = new TRandom3(0); double npe = 1; double gain = 60; double sig = 6; double xtalk = 0.15; double ped = 100; double sig_ped = 7; int ntot = 1; TH1F* hh[16]; char hname[256], htitle[256]; for(int i = 0; iPoisson(npe); npixel += EG->Poisson((double)npixel*xtalk); double width = sqrt(sig_ped*sig_ped + (double)npixel*sig*sig); double adc_tmp = EG->Gaus(ped+gain*(double)npixel,width); hh[j]->Fill(adc_tmp); adc_sum += adc_tmp; } hh_sum->Fill(adc_sum); if((i+1)%1000 == 0) printf("%d events generated ...\n", i+1); } hh_sum->Draw(); }