本文整理汇总了C++中RooDataSet::merge方法的典型用法代码示例。如果您正苦于以下问题:C++ RooDataSet::merge方法的具体用法?C++ RooDataSet::merge怎么用?C++ RooDataSet::merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RooDataSet
的用法示例。
在下文中一共展示了RooDataSet::merge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate_toy
void AnalyzeToy::generate_toy()
{
RooDataSet *toySignal;
toySignal = ws->pdf("model_signal_mass")->generate(*genSpec_sig_mass);
toySignal->merge(ws->pdf("model_signal0_cosT")->generate(*cosT,nSignal_gen,AutoBinned(false)));
RooDataSet *toyBkg;
toyBkg= ws->pdf("model_bkg_mass")->generate(*genSpec_bkg_mass);
toyBkg->merge(ws->pdf("model_bkg_cosT")->generate(*genSpec_bkg_cosT));
toyData = new RooDataSet("toyData","",RooArgSet(*mass, *cosT));
toyData->append(*toySignal);
toyData->append(*toyBkg);
delete toySignal;
delete toyBkg;
}
示例2: main
int main (int argc, char **argv)
{
const char* chInFile = "ws.root";
const char* chOutFile = "ws_gen.root";
int numSignal = 10000;
int numBkg = 100000;
char option_char;
while ( (option_char = getopt(argc,argv, "i:o:s:b:")) != EOF )
switch (option_char)
{
case 'i': chInFile = optarg; break;
case 'o': chOutFile = optarg; break;
case 's': numSignal = atoi(optarg); break;
case 'b': numBkg = atoi(optarg); break;
case '?': fprintf (stderr,
"usage: %s [i<input file> o<output file>]\n", argv[0]);
}
cout << "In File = " << chInFile << endl;
cout << "Out File = " << chOutFile << endl;
cout << "Signal Events = " << numSignal << endl;
cout << "Bkg Events = " << numBkg << endl;
TFile inFile(chInFile,"READ");
RooWorkspace* ws = (RooWorkspace*) inFile.Get("rws");
TFile outFile(chOutFile,"RECREATE");
/*
ws->var("tau")->setVal(1.417);
ws->var("DG")->setVal(0.151);
ws->var("beta")->setVal(0.25);
ws->var("A02")->setVal(0.553);
ws->var("A1")->setVal(0.487);
ws->var("delta_l")->setVal(3.15);
ws->var("fs")->setVal(0.147);
*/
// ws->var("delta_l")->setConstant(kTRUE);
// ws->var("delta_p")->setConstant(kTRUE);
// ws->var("Dm")->setConstant(kTRUE);
//*ws->var("xs") = numSignal/(numSignal+numBkg);
// int numSignal = numEvents * ws->var("xs")->getVal();
// int numBkg = numEvents - numSignal;
ws->factory("Gaussian::dilutionGauss(d,0,0.276)");
//ws->factory("SUM::dSignalPDF(xds[0.109]*dilutionGauss,TruthModel(d))");
//ws->factory("SUM::dBkgPDF(xdb[0.109]*dilutionGauss,TruthModel(d))");
ws->factory("SUM::dSignalPDF(xds[1]*dilutionGauss,TruthModel(d))");
ws->factory("SUM::dBkgPDF(xdb[1]*dilutionGauss,TruthModel(d))");
/*
ws->factory("GaussModel::xetGaussianS(et,meanGaussEtS,sigmaGaussEtS)");
ws->factory("Decay::xerrorSignal(et,tauEtS,xetGaussianS,SingleSided]");
ws->factory("PROD::xsignalTimeAngle(timeAngle|et,xerrorSignal");
ws->factory("PROD::xsignal(massSignal,xsignalTimeAngle,DmConstraint)");
*/
RooDataSet* dSignalData = ws->pdf("dSignalPDF")->generate(RooArgSet(*ws->var("d")),numSignal);
RooDataSet *dataSignal = ws->pdf("signal")->generate(RooArgSet(*ws->var("m"),*ws->var("t"),*ws->var("et"),*ws->var("cpsi"),*ws->var("ctheta"),*ws->var("phi")), RooFit::ProtoData(*dSignalData));
ws->factory("GaussModel::xetGaussianPR(et,meanGaussEtPR,sigmaGaussEtPR)");
ws->factory("Decay::xerrBkgPR(et,tauEtPR,xetGaussianPR,SingleSided]");
ws->factory("GaussModel::xetGaussianNP(et,meanGaussEtNP,sigmaGaussEtNP)");
ws->factory("Decay::xerrBkgNP(et,tauEtNP,xetGaussianNP,SingleSided]");
/* Time */
ws->factory("GaussModel::xresolution(t,0,scale,et)");
ws->factory("Decay::xnegativeDecay(t,tauNeg,xresolution,Flipped)");
ws->factory("Decay::xpositiveDecay(t,tauPos,xresolution,SingleSided)");
ws->factory("Decay::xpositiveLongDecay(t,tauLngPos,xresolution,SingleSided)");
ws->factory("RSUM::xtBkgNP(xn*xnegativeDecay,xp*xpositiveDecay,xpositiveLongDecay");
/* Promt and Non-Prompt */
ws->factory("PROD::xtimeBkgNP(xtBkgNP|et,xerrBkgNP)");
ws->factory("PROD::xtimeBkgPR(xresolution|et,xerrBkgPR)");
ws->factory("PROD::xPrompt(massBkgPR,xtimeBkgPR,anglePR)");
ws->factory("PROD::xNonPrompt(massBkgNP,xtimeBkgNP,angleNP)");
ws->factory("SUM::xbackground(xprompt*xPrompt,xNonPrompt)");
RooDataSet* dBkgData = ws->pdf("dBkgPDF")->generate(RooArgSet(*ws->var("d")),numBkg);
RooDataSet* dataBkg = ws->pdf("xbackground")->generate(RooArgSet(*ws->var("m"),*ws->var("t"),*ws->var("et"),*ws->var("cpsi"),*ws->var("ctheta"),*ws->var("phi")), numBkg);
dataBkg->merge(dBkgData);
dataSignal->SetName("dataGenSignal");
dataBkg->SetName("dataGenBkg");
ws->import(*dataSignal);
ws->import(*dataBkg);
////ws->import(*dataBkg,RooFit::Rename("dataGenBkg"));
dataSignal->append(*dataBkg);
//.........这里部分代码省略.........