本文整理汇总了C++中TRandom3::PoissonD方法的典型用法代码示例。如果您正苦于以下问题:C++ TRandom3::PoissonD方法的具体用法?C++ TRandom3::PoissonD怎么用?C++ TRandom3::PoissonD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRandom3
的用法示例。
在下文中一共展示了TRandom3::PoissonD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: genHistFromModelPdf
RooDataHist * genHistFromModelPdf(const char * name, RooAbsPdf *model, RooRealVar *var, double ScaleLumi, int range, int rebin, int seed ) {
double genEvents = model->expectedEvents(*var);
TRandom3 *rndm = new TRandom3();
rndm->SetSeed(seed);
double nEvt = rndm->PoissonD( genEvents) ;
int intEvt = ( (nEvt- (int)nEvt) >= 0.5) ? (int)nEvt +1 : int(nEvt);
RooDataSet * data = model->generate(*var , intEvt );
cout<< " expected events for " << name << " = "<< genEvents << endl;
cout<< " data->numEntries() for name " << name << " == " << data->numEntries()<< endl;
// cout<< " nEvt from PoissonD for" << name << " == " << nEvt<< endl;
//cout<< " cast of nEvt for" << name << " == " << intEvt<< endl;
RooAbsData *binned_data = data->binnedClone();
TH1 * toy_hist = binned_data->createHistogram( name, *var, Binning(range/rebin ) );
for(int i = 1; i <= toy_hist->GetNbinsX(); ++i) {
toy_hist->SetBinError( i, sqrt( toy_hist->GetBinContent(i)) );
if(toy_hist->GetBinContent(i) == 0.00) {
cout<< " WARNING: histo " << name << " has 0 enter in bin number " << i << endl;
}
if(toy_hist->GetBinContent(i) < 0.1) {
toy_hist->SetBinContent(i, 0.0);
toy_hist->SetBinError(i, 0.0);
cout<< " WARNING: setting value 0.0 to histo " << name << " for bin number " << i << endl;
}
}
RooDataHist * toy_rooHist = new RooDataHist(name, name , RooArgList(*var), toy_hist );
return toy_rooHist;
}