本文整理汇总了C++中RooFitResult::correlationMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ RooFitResult::correlationMatrix方法的具体用法?C++ RooFitResult::correlationMatrix怎么用?C++ RooFitResult::correlationMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RooFitResult
的用法示例。
在下文中一共展示了RooFitResult::correlationMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doFit
//.........这里部分代码省略.........
else fin = TFile::Open(fname.c_str());
//-- normalisation in the MC --//
float mc_norm_1ltop = 0;
float mc_norm_tt2l = 0;
float mc_norm_Wjets = 0;
//float mc_norm_rare = 0;
// C r e a t e m o d e l f o r CR1_peak_lowM3b
// -------------------------------------------------------------
// Construct pdfs for 1ltop, tt2l, Wjets and rare
TH1F* histo_1ltop = 0;
TH1F* histo_tt2l = 0;
TH1F* histo_Wjets = 0;
RooHistPdf *pdf_1ltop = GetRooHistPdf(fin,region,PROCESS_NAME_TT_1L,varname,&var,mc_norm_1ltop, histo_1ltop, setup.do_mcstat, DO_NORM, setup.Ndata*setup.rel_norm_1ltop);
RooHistPdf *pdf_tt2l = GetRooHistPdf(fin,region,PROCESS_NAME_TT_2L,varname,&var,mc_norm_tt2l, histo_tt2l, setup.do_mcstat, DO_NORM, setup.Ndata*setup.rel_norm_tt2l);
RooHistPdf *pdf_Wjets = GetRooHistPdf(fin,region,PROCESS_NAME_WJETS,varname,&var,mc_norm_Wjets, histo_Wjets, setup.do_mcstat, DO_NORM, setup.Ndata*setup.rel_norm_Wjets);
//RooHistPdf *pdf_rare = GetRooHistPdf(fin,region,PROCESS_NAME_RARE,varname,&var,mc_norm_rare, setup.do_mcstat);
//cerr<<"TT_1L: "<<mc_norm_1ltop<<endl;
//cerr<<"TT_2l: "<<mc_norm_tt2l<<endl;
//cerr<<"WJets: "<<mc_norm_Wjets<<endl;
//cerr<<"OTHER: "<<mc_norm_rare<<endl;
// normalization factors (RooRealVar)
float val_1ltop = mc_norm_1ltop;
float val_Wjets = mc_norm_Wjets;
if(setup.do_init_uncert)
{
val_1ltop = setup.init_1ltop*mc_norm_1ltop;
val_Wjets = setup.init_Wjets*mc_norm_Wjets;
}
RooRealVar norm_1ltop("norm_1ltop","norm_1ltop",val_1ltop,0.25*mc_norm_1ltop,10.*mc_norm_1ltop);
RooRealVar norm_Wjets("norm_Wjets","norm_Wjets",val_Wjets,0.25*mc_norm_Wjets,10.*mc_norm_Wjets);
RooRealVar norm_tt2l("norm_tt2l","norm_tt2l",mc_norm_tt2l,0.25*mc_norm_tt2l,2*mc_norm_tt2l);
//RooRealVar norm_rare("norm_rare","norm_rare",mc_norm_rare,0.25*mc_norm_rare,2*mc_norm_rare);
// possibility to study a systematic on it
if(setup.do_xs_tt2l_sys) mc_norm_tt2l*=setup.xs_sysfactor;
//if(setup.do_xs_rare_sys) mc_norm_rare*=setup.xs_sysfactor;
//RooConstVar norm_rare("norm_rare","norm_rare",mc_norm_rare);
/*
RooAddPdf model("model","model",
RooArgList(*pdf_1ltop,*pdf_tt2l,*pdf_Wjets,*pdf_rare),
RooArgList(norm_1ltop,norm_tt2l,norm_Wjets,norm_rare)) ;
*/
RooAddPdf model("model","model",
RooArgList(*pdf_1ltop,*pdf_tt2l,*pdf_Wjets),
RooArgList(norm_1ltop,norm_tt2l,norm_Wjets)) ;
//RooDataHist *data_CR1_peak_lowM3b = GetRooData(fin,region,varname,&var);
RooDataHist *data_CR1_peak_lowM3b = GetRooData(histo_1ltop,histo_Wjets, histo_tt2l,&var);
fin->Close();
//-- Constraints on single top and rare --//
float RelUncert = 0.2;
// Construct another Gaussian constraint p.d.f on "rare" bkg
//RooGaussian constr_rare("constr_rare","constr_rare",norm_rare,RooConst(mc_norm_rare),RooConst(RelUncert*mc_norm_rare)) ;
// Construct another Gaussian constraint p.d.f on "tt2l" bkg
RooGaussian constr_tt2l("constr_tt2l","constr_tt2l",norm_tt2l,RooConst(mc_norm_tt2l),RooConst(RelUncert*mc_norm_tt2l)) ;
// P e r f o r m t em p l a t e f i t
// ---------------------------------------------------
//Minimizer(type,algo) -- Choose minimization package and algorithm to use. Default is MINUIT/MIGRAD through the RooMinimizer
// interface, but rare can be specified (through RooMinimizer interface). Select OldMinuit to use
// MINUIT through the old RooMinuit interface
//
// Type Algorithm
// ------ ---------
// OldMinuit migrad, simplex, minimize (=migrad+simplex), migradimproved (=migrad+improve)
// Minuit migrad, simplex, minimize (=migrad+simplex), migradimproved (=migrad+improve)
// Minuit2 migrad, simplex, minimize, scan
// GSLMultiMin conjugatefr, conjugatepr, bfgs, bfgs2, steepestdescent
// GSLSimAn -
// --- Perform simultaneous fit of model to data and model_ctl to data_ctl --//
//RooFitResult* res = model.fitTo(*data_CR1_peak_lowM3b,Save());
//RooFitResult* res = model.fitTo(*data_CR1_peak_lowM3b,ExternalConstraints(constr_rare),ExternalConstraints(constr_tt2l),PrintLevel(-1),Save(),
RooFitResult* res = model.fitTo(*data_CR1_peak_lowM3b,ExternalConstraints(constr_tt2l),PrintLevel(-1),Save(),
Minimizer(setup.type.c_str(),setup.algo.c_str()),Verbose(0));
//--- Writing the results ---///
FitResult fitRes;
fitRes.Reset();
fitRes.norm_1ltop = mc_norm_1ltop;
fitRes.SF_1ltop = GetSF(res,"norm_1ltop");
fitRes.SF_Wjets = GetSF(res,"norm_Wjets");
fitRes.edm = res->edm();
fitRes.correlation = res->correlationMatrix()[0][1];
fitRes.conditions = conditions;
return fitRes;
}