本文整理汇总了C++中RooDataSet::split方法的典型用法代码示例。如果您正苦于以下问题:C++ RooDataSet::split方法的具体用法?C++ RooDataSet::split怎么用?C++ RooDataSet::split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RooDataSet
的用法示例。
在下文中一共展示了RooDataSet::split方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitws
void splitws(string inFolderName, double mass, string channel) {
cout << "Splitting workspace in " << channel << endl;
int flatInterpCode = 4;
int shapeInterpCode = 4;
bool do2011 = 0;
if (inFolderName.find("2011") != string::npos) do2011 = 1;
bool conditionalAsimov = 0;
bool doData = 1;
//if (inFolderName.find("_blind_") != string::npos) {
//conditionalAsimov = 0;
//}
//else {
//conditionalAsimov = 1;
//}
set<string> channelNames;
if (channel == "01j") {
channelNames.insert("em_signalLike1_0j"+string(!do2011?"_2012":""));
channelNames.insert("em_signalLike2_0j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike1_0j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike2_0j"+string(!do2011?"_2012":""));
channelNames.insert("SF_AfrecSR_0j"+string(!do2011?"_2012":""));
channelNames.insert("SF_ASR_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_AfrecSR_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_ASR_0j"+string(!do2011?"_2012":""));
channelNames.insert("SF_CfrecZpeak_0j"+string(!do2011?"_2012":""));
channelNames.insert("SF_CZpeak_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_CfrecZpeak_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_CZpeak_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_mainControl_0j"+string(!do2011?"_2012":""));
channelNames.insert("em_signalLike1_1j"+string(!do2011?"_2012":""));
channelNames.insert("em_signalLike2_1j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike1_1j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike2_1j"+string(!do2011?"_2012":""));
channelNames.insert("SF_AfrecSR_1j"+string(!do2011?"_2012":""));
channelNames.insert("SF_ASR_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_AfrecSR_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_ASR_1j"+string(!do2011?"_2012":""));
channelNames.insert("SF_CfrecZpeak_1j"+string(!do2011?"_2012":""));
channelNames.insert("SF_CZpeak_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_CfrecZpeak_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_CZpeak_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_mainControl_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_topbox_1j"+string(!do2011?"_2012":""));
}
else if (channel == "0j") {
channelNames.insert("em_signalLike1_0j"+string(!do2011?"_2012":""));
channelNames.insert("em_signalLike2_0j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike1_0j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike2_0j"+string(!do2011?"_2012":""));
channelNames.insert("SF_AfrecSR_0j"+string(!do2011?"_2012":""));
channelNames.insert("SF_ASR_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_AfrecSR_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_ASR_0j"+string(!do2011?"_2012":""));
channelNames.insert("SF_CfrecZpeak_0j"+string(!do2011?"_2012":""));
channelNames.insert("SF_CZpeak_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_CfrecZpeak_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_CZpeak_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_mainControl_0j"+string(!do2011?"_2012":""));
}
else if (channel == "1j") {
channelNames.insert("em_signalLike1_1j"+string(!do2011?"_2012":""));
channelNames.insert("em_signalLike2_1j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike1_1j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike2_1j"+string(!do2011?"_2012":""));
channelNames.insert("SF_AfrecSR_1j"+string(!do2011?"_2012":""));
channelNames.insert("SF_ASR_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_AfrecSR_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_ASR_1j"+string(!do2011?"_2012":""));
channelNames.insert("SF_CfrecZpeak_1j"+string(!do2011?"_2012":""));
channelNames.insert("SF_CZpeak_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_CfrecZpeak_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_CZpeak_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_mainControl_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_topbox_1j"+string(!do2011?"_2012":""));
}
else if (channel == "OF01j") {
channelNames.insert("em_signalLike1_0j"+string(!do2011?"_2012":""));
channelNames.insert("em_signalLike2_0j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike1_0j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike2_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_mainControl_0j"+string(!do2011?"_2012":""));
channelNames.insert("OF_sscr_0j"+string(!do2011?"_2012":""));
channelNames.insert("em_signalLike1_1j"+string(!do2011?"_2012":""));
channelNames.insert("em_signalLike2_1j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike1_1j"+string(!do2011?"_2012":""));
channelNames.insert("me_signalLike2_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_mainControl_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_topbox_1j"+string(!do2011?"_2012":""));
channelNames.insert("OF_sscr_1j"+string(!do2011?"_2012":""));
}
else if (channel == "OF0j") {
channelNames.insert("em_signalLike1_0j"+string(!do2011?"_2012":""));
//.........这里部分代码省略.........
示例2: ptBestFit
void ptBestFit(float BIN_SIZE=5.0,bool BLIND=false,TString MASS,TString NAME)
{
gROOT->ProcessLine(".x ../../common/styleCMSTDR.C");
gSystem->Load("libHiggsAnalysisCombinedLimit.so");
gROOT->ForceStyle();
gStyle->SetOptStat(0);
gStyle->SetOptTitle(0);
gROOT->SetBatch(1);
gStyle->SetPadRightMargin(0.04);
gStyle->SetPadLeftMargin(0.16);
gStyle->SetPadTopMargin(0.06);
gStyle->SetPadBottomMargin(0.10);
gStyle->SetTitleFont(42,"XY");
gStyle->SetTitleSize(0.0475,"XY");
gStyle->SetTitleOffset(0.9,"X");
gStyle->SetTitleOffset(1.5,"Y");
gStyle->SetLabelSize(0.0375,"XY");
RooMsgService::instance().setSilentMode(kTRUE);
for(int i=0;i<2;i++) {
RooMsgService::instance().setStreamStatus(i,kFALSE);
}
float XMIN = 80;
float XMAX = 200;
TFile *f1 = TFile::Open("datacards/datacard_m"+MASS+"_"+NAME+".root");
TFile *f2 = TFile::Open("combine/mlfit.vbfHbb_"+NAME+"_mH"+MASS+".root");
TFile *f3 = TFile::Open("root/sig_shapes_workspace_B80-200.root");
TFile *f4 = TFile::Open("root/data_shapes_workspace_"+NAME+".root");
RooWorkspace *w = (RooWorkspace*)f1->Get("w");
//w->Print();
RooAbsPdf *bkg_model = (RooAbsPdf*)w->pdf("model_s");
RooFitResult *res_s = (RooFitResult*)f2->Get("fit_s");
RooFitResult *res_b = (RooFitResult*)f2->Get("fit_b");
RooRealVar *rFit = dynamic_cast<RooRealVar *>(res_s->floatParsFinal()).find("r");
RooDataSet *data = (RooDataSet*)w->data("data_obs");
int nparS=0,nparB=0;
cout << res_s->floatParsFinal().getSize() << endl;
cout << res_b->floatParsFinal().getSize() << endl;
nparS = res_s->floatParsFinal().getSize();
nparB = res_b->floatParsFinal().getSize();
float chi2sumS = 0.;
float chi2sumB = 0.;
int nparsum = 0;
// if (BLIND) {
// res_b->Print();
// }
// else {
// res_s->Print();
// }
w->allVars().assignValueOnly(res_s->floatParsFinal());
// w->Print();
// w->allVars()->Print();
RooWorkspace *wSig = (RooWorkspace*)f3->Get("w");
RooWorkspace *wDat = (RooWorkspace*)f4->Get("w");
const RooSimultaneous *sim = dynamic_cast<const RooSimultaneous *> (bkg_model);
const RooAbsCategoryLValue &cat = (RooAbsCategoryLValue &) sim->indexCat();
TList *datasets = data->split(cat,true);
TIter next(datasets);
//int count = 0;
for(RooAbsData *ds = (RooAbsData*)next();ds != 0; ds = (RooAbsData*)next()) {
//if (count > 0) return 0;
//count++;
RooAbsPdf *pdfi = sim->getPdf(ds->GetName());
RooArgSet *obs = (RooArgSet*)pdfi->getObservables(ds);
RooRealVar *x = dynamic_cast<RooRealVar *>(obs->first());
RooRealVar *yield_vbf = (RooRealVar*)wSig->var("yield_signalVBF_mass"+MASS+"_"+TString(ds->GetName()));
RooRealVar *yield_gf = (RooRealVar*)wSig->var("yield_signalGF_mass"+MASS+"_"+TString(ds->GetName()));
TString ds_name(ds->GetName());
//----- get the QCD normalization -----------
RooRealVar *qcd_norm_final = dynamic_cast<RooRealVar *>(res_s->floatParsFinal()).find("CMS_vbfbb_qcd_norm_"+ds_name);
RooRealVar *qcd_yield = (RooRealVar*)wDat->var("yield_data_"+ds_name);
float Nqcd = exp(log(1.5)*qcd_norm_final->getVal())*qcd_yield->getVal();
float eNqcd = log(1.5)*qcd_norm_final->getError()*Nqcd;
cout<<"QCD normalization = "<<Nqcd<<" +/- "<<eNqcd<<endl;
TH1 *hCoarse = (TH1*)ds->createHistogram("coarseHisto_"+ds_name,*x);
float norm = hCoarse->Integral();
int rebin = BIN_SIZE/hCoarse->GetBinWidth(1);
hCoarse->Rebin(rebin);
float MIN_VAL = TMath::Max(0.9*hCoarse->GetBinContent(hCoarse->GetMinimumBin()),1.0);
float MAX_VAL = 1.3*hCoarse->GetBinContent(hCoarse->GetMaximumBin());
RooDataHist ds_coarse("ds_coarse_"+ds_name,"ds_coarse_"+ds_name,*x,hCoarse);
TH1F *hBlind = (TH1F*)hCoarse->Clone("blindHisto_"+ds_name);
for(int i=0;i<hBlind->GetNbinsX();i++) {
double x0 = hBlind->GetBinCenter(i+1);
if (x0 > 100 && x0 < 150) {
hBlind->SetBinContent(i+1,0);
hBlind->SetBinError(i+1,0);
}
//.........这里部分代码省略.........