#if !defined(__CINT__) || defined(__MAKECINT__) #include #include #include #include #include #include #include #endif const double knorm = 1000.; // number of experiments // Function declaration double Decay(int n0,double alpha, double Delt,double timetot); // Decay simulation double poissonian(double xx, double norm, double p); // POISSONIAN density double binomial(double xx, double norm, double ntrials, double prob); // BINOMIAL density void poisson(int n0 = 1000,double alpha = 2.5e-5, double Delt = 1.,double time=100.); //main function /////////////////////////////////////////////////////////////////////////// void poisson(int n0,double alpha, double Delt,double time){ unsigned int seed; cout<<"Insert the seed for random numbers\n"; cin>>seed; gRandom->SetSeed(seed); TString title = Form("Number of deacys in %4.1f s",time); int nbins = static_cast(n0*alpha*time*4); cout<<"numer of bins"<Fill(nodecay); } // SAVE histograms TFile *file = new TFile("poisson.root","recreate"); ndecays->Write(); fteo->Write(); fteo2->Write(); file->Close(); cout<SetLineColor(2); fteo2->SetLineColor(4); fteo->Draw("histc"); new TCanvas(); fteo2->Draw("histc"); new TCanvas(); ndecays->Draw("hist"); fteo->Draw("histcsame"); fteo2->Draw("histcsame"); cout<<"Done - Histohrams are accessibile"<Rndm()(n0init-n0); } /////////////////////////////////////////////////////////////////////////// double poissonian(double xx, double norm, double p){ return norm*(TMath::PoissonI(xx,p)); // return norm*(TMath::Power(param,xx)*TMath::Exp(-param-Gamma(xx+1))); } /////////////////////////////////////////////////////////////////////////// double binomial(double xx, double norm, double ntrials, double prob) { Double_t n = TMath::Binomial(ntrials,xx); n *= TMath::Power(prob,xx)*TMath::Power((1-prob),(ntrials-xx)); n *= norm; return n; }