68#define NoHistConst_Low "0"
69#define NoHistConst_High "2000"
97 fFileNamePrefix(filePrefix),
108 while(
fRowTitle.find(
"\\ ")!=string::npos){
112 pFile = fopen ((filePrefix+
"_results.table").c_str(),
"a");
127 cout <<
"processing hist " << hist->
GetName() << endl;
129 cout <<
"hist is empty" << endl;
131 string highStr =
"inf";
132 for(
Int_t i=lowBin; i<highBin; ++i){
133 std::stringstream str;
134 std::stringstream range;
137 range<<
"["<<hist->
GetBinContent(i+1) <<
"," << low <<
"," << highStr <<
"]";
139 range<<
"["<< low <<
"," << high <<
"]";
140 cout <<
"for bin N"+str.str() <<
" var " << prefix+str.str()+
" with range " << range.str() << endl;
144 if(! (productPrefix.empty() || systTerm.empty()) )
145 proto->factory((
"prod:"+productPrefix+str.str()+
"("+prefix+str.str()+
","+systTerm+
")").c_str() );
150 proto->defineSet(prefix.c_str(),argset);
159 for(
Int_t i=lowBin; i<highBin; ++i){
160 std::stringstream str;
167 for(
int i=lowBin; i<highBin; ++i){
168 for(
int j=0; j<highBin-lowBin; ++j){
170 Cov(i,j) = sqrt(mean(i));
178 floating, mean, Cov);
180 proto->import(constraint);
182 likelihoodTermNames.push_back(constraint.
GetName());
188 vector<string> sourceName,
string prefix,
string productPrefix,
string systTerm,
189 int lowBin,
int highBin, vector<string>& likelihoodTermNames){
197 for(
unsigned int j=0; j<lowHist.size(); ++j){
198 std::stringstream str;
203 temp = (
RooRealVar*)
proto->factory((
"alpha_"+sourceName.at(j)+range).c_str());
206 string command=(
"Gaussian::alpha_"+sourceName.at(j)+
"Constraint(alpha_"+sourceName.at(j)+
",nom_"+sourceName.at(j)+
"[0.,-10,10],1.)");
207 cout << command << endl;
208 likelihoodTermNames.push_back(
proto->factory( command.c_str() )->
GetName() );
209 proto->var((
"nom_"+sourceName.at(j)).c_str())->setConstant();
210 const_cast<RooArgSet*
>(
proto->set(
"globalObservables"))->add(*
proto->var((
"nom_"+sourceName.at(j)).c_str()));
219 for(
Int_t i=lowBin; i<highBin; ++i){
220 std::stringstream str;
224 vector<double> low, high;
225 for(
unsigned int j=0; j<lowHist.size(); ++j){
226 low.push_back( lowHist.at(j)->GetBinContent(i+1) );
227 high.push_back( highHist.at(j)->GetBinContent(i+1) );
228 cout <<
"for "+prefix+
" bin "+str.str()+
" creating linear interp of nominal " << nominal->
GetBinContent(i+1)
229 <<
" in parameter " << sourceName.at(j)
230 <<
" between " << low.back() <<
" - " << high.back()
231 <<
" about " << 100.*fabs(low.back() - high.back() )/nominal->
GetBinContent(i+1) <<
" % error"
239 proto->import(interp);
242 proto->factory((
"prod:"+productPrefix+str.str()+
"("+prefix+str.str()+
","+systTerm+
")").c_str() );
249 string overallNorm_times_sigmaEpsilon ;
251 vector<EstimateSummary::NormFactor> norm=es.
normFactor;
253 for(vector<EstimateSummary::NormFactor>::iterator itr=norm.begin(); itr!=norm.end(); ++itr){
254 cout <<
"making normFactor: " << itr->name << endl;
256 std::stringstream range;
257 range<<
"["<<itr->val<<
","<<itr->low<<
","<<itr->high<<
"]";
261 if(!prodNames.empty()) prodNames+=
",";
263 varname=itr->name+
"_"+channel;
268 proto->factory((varname+range.str()).c_str());
272 cout <<
"WARNING: Const attribute to <NormFactor> tag is deprecated, will ignore."<<
273 " Instead, add \n\t<ParamSetting Const=\"True\">"<<varname<<
"</ParamSetting>\n"<<
274 " to your top-level XML's <Measurment> entry"<< endl;
278 overallNorm_times_sigmaEpsilon = es.
name+
"_"+channel+
"_overallNorm_x_sigma_epsilon";
279 proto->factory((
"prod::"+overallNorm_times_sigmaEpsilon+
"("+prodNames+
","+sigmaEpsilon+
")").c_str());
282 if(!overallNorm_times_sigmaEpsilon.empty())
283 return overallNorm_times_sigmaEpsilon;
290 map<
string,pair<double,double> > systMap,
291 vector<string>& likelihoodTermNames, vector<string>& totSystTermNames){
297 totSystTermNames.push_back(prefix);
300 vector<double> lowVec, highVec;
301 for(map<
string,pair<double,double> >::iterator it=systMap.begin(); it!=systMap.end(); ++it){
305 temp = (
RooRealVar*)
proto->factory((prefix+ it->first +range).c_str());
307 string command=(
"Gaussian::"+prefix+it->first+
"Constraint("+prefix+it->first+
",nom_"+prefix+it->first+
"[0.,-10,10],1.)");
308 cout << command << endl;
309 likelihoodTermNames.push_back(
proto->factory( command.c_str() )->
GetName() );
310 proto->var((
"nom_"+prefix+it->first).c_str())->setConstant();
311 const_cast<RooArgSet*
>(
proto->set(
"globalObservables"))->add(*
proto->var((
"nom_"+prefix+it->first).c_str()));
317 std::stringstream lowhigh;
318 double low = it->second.first;
319 double high = it->second.second;
320 lowVec.push_back(low);
321 highVec.push_back(high);
324 if(systMap.size()>0){
326 LinInterpVar interp( (interpName).c_str(),
"", params, 1., lowVec, highVec);
327 proto->import(interp);
332 proto->import(interp);
339 int lowBin,
int highBin, vector<string>& syst_x_expectedPrefixNames,
340 vector<string>& normByNames){
344 for(
Int_t i=lowBin; i<highBin; ++i){
345 std::stringstream str;
347 string command=
"sum::"+totName+str.str()+
"(";
350 for(
unsigned int j=0; j<syst_x_expectedPrefixNames.size();++j){
351 command+=prepend+normByNames.at(j)+
"*"+syst_x_expectedPrefixNames.at(j)+str.str();
355 cout <<
"function to calculate total: " << command << endl;
356 proto->factory(command.c_str());
361 vector<string>& likelihoodTermNames){
366 for(
Int_t i=lowBin; i<highBin; ++i){
367 std::stringstream str;
370 string command(
"Poisson::"+prefix+str.str()+
"("+obsPrefix+str.str()+
","+expPrefix+str.str()+
",1)");
374 cout <<
"Poisson Term " << command << endl;
378 likelihoodTermNames.push_back( temp->
GetName() );
381 proto->defineSet(prefix.c_str(),Pois);
391 for(
Int_t i=lowBin; i<highBin; ++i){
392 std::stringstream str;
395 cout <<
"expected number of events called: " << expPrefix << endl;
401 cout <<
"setting obs"+str.str()+
" to expected = " << exp->
getVal() <<
" check: " << obs->
getVal() << endl;
404 obsForTree[i] = exp->
getVal();
405 tree->Branch((obsPrefix+str.str()).c_str(), obsForTree+i ,(obsPrefix+str.str()+
"/D").c_str());
408 cout <<
"problem retrieving obs or exp " << obsPrefix+str.str() << obs <<
" " << expPrefix+str.str() << exp << endl;
414 proto->import(*data);
416 obsForTree =
nullptr;
420 cout <<
"in customizations" << endl;
421 string pdfName(pdfNameChar);
422 map<string,string>::iterator it;
423 string edit=
"EDIT::customized("+pdfName+
",";
425 for(it=renameMap.begin(); it!=renameMap.end(); ++it) {
426 cout << it->first +
"=" + it->second << endl;
427 edit+=precede + it->first +
"=" + it->second;
432 proto->factory( edit.c_str() );
439 string pdfName(pdfNameChar);
444 string edit=
"EDIT::newSimPdf("+pdfName+
",";
446 string lastPdf=pdfName;
448 unsigned int numReplacements = 0;
449 unsigned int nskipped = 0;
450 map<string,double>::iterator it;
453 for(it=gammaSyst.begin(); it!=gammaSyst.end(); ++it) {
455 if(!
proto->var((
"alpha_"+it->first).c_str())){
462 double relativeUncertainty = it->second;
463 double scale = 1/sqrt((1+1/pow(relativeUncertainty,2)));
466 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
467 proto->factory(
Form(
"y_%s[%f]",it->first.c_str(),1./pow(relativeUncertainty,2))) ;
468 proto->factory(
Form(
"theta_%s[%f]",it->first.c_str(),pow(relativeUncertainty,2))) ;
469 proto->factory(
Form(
"Gamma::beta_%sConstraint(beta_%s,sum::k_%s(y_%s,one[1]),theta_%s,zero[0])",
474 it->first.c_str())) ;
490 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{%f,%f})",it->first.c_str(),it->first.c_str(),-1./scale,1./scale));
493 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
494 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
496 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
502 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
505 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
515 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
516 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
520 cout <<
"Going to issue this edit command\n" << edit<< endl;
521 proto->factory( edit.c_str() );
524 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
530 for(it=uniformSyst.begin(); it!=uniformSyst.end(); ++it) {
531 cout <<
"edit for " << it->first <<
"with rel uncert = " << it->second << endl;
532 if(!
proto->var((
"alpha_"+it->first).c_str())){
533 cout <<
"systematic not there" << endl;
540 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
541 proto->factory(
Form(
"Uniform::beta_%sConstraint(beta_%s)",it->first.c_str(),it->first.c_str()));
542 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{-1,1})",it->first.c_str(),it->first.c_str()));
545 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
546 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
548 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
553 cout <<
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint" << endl;
554 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
556 cout <<
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first << endl;
557 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
559 if(
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) &&
proto->var((
"alpha_"+it->first).c_str()) )
560 cout <<
" checked they are there" <<
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) <<
" " <<
proto->var((
"alpha_"+it->first).c_str()) << endl;
562 cout <<
"NOT THERE" << endl;
565 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
566 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
571 proto->factory( edit.c_str() );
574 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
584 for(it=logNormSyst.begin(); it!=logNormSyst.end(); ++it) {
585 cout <<
"edit for " << it->first <<
"with rel uncert = " << it->second << endl;
586 if(!
proto->var((
"alpha_"+it->first).c_str())){
587 cout <<
"systematic not there" << endl;
593 double relativeUncertainty = it->second;
594 double kappa = 1+relativeUncertainty;
598 double scale = relativeUncertainty;
602 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
603 proto->factory(
Form(
"kappa_%s[%f]",it->first.c_str(),kappa));
604 proto->factory(
Form(
"Lognormal::beta_%sConstraint(beta_%s,one[1],kappa_%s)",
607 it->first.c_str())) ;
608 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{%f,%f})",it->first.c_str(),it->first.c_str(),-1./scale,1./scale));
612 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
613 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
615 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
620 cout <<
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint" << endl;
621 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
623 cout <<
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first << endl;
624 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
626 if(
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) &&
proto->var((
"alpha_"+it->first).c_str()) )
627 cout <<
" checked they are there" <<
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) <<
" " <<
proto->var((
"alpha_"+it->first).c_str()) << endl;
629 cout <<
"NOT THERE" << endl;
632 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
633 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
638 proto->factory( edit.c_str() );
641 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
650 edit=
"EDIT::newSimPdf("+lastPdf+
","+editList+
")";
652 proto->factory( edit.c_str() );
657 combined_config->
SetPdf(*newOne);
660 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
666 pFile = fopen ((filename).c_str(),
"w");
677 fprintf(
pFile,
"\\\\ \\hline \n" );
689 fprintf(
pFile,
" \\\\\n");
700 if (summary.empty() ) {
701 Error(
"MakeSingleChannelModel",
"vector of EstimateSummry is empty - return a nullptr");
708 string channel=summary[0].channel;
709 cout <<
"\n\n-------------------\nStarting to process " << channel <<
" channel" << endl;
718 RooArgSet likelihoodTerms(
"likelihoodTerms");
719 vector<string> likelihoodTermNames, totSystTermNames,syst_x_expectedPrefixNames, normalizationNames;
721 string prefix, range;
726 if (summary.at(0).name==
"Data") {
729 cout <<
"Will use expected (\"Asimov\") data set" << endl;
738 std::stringstream lumiStr;
741 proto->factory((
"Lumi"+lumiStr.str()).c_str());
742 cout <<
"lumi str = " << lumiStr.str() << endl;
744 std::stringstream lumiErrorStr;
747 proto->factory((
"Gaussian::lumiConstraint(Lumi,"+lumiErrorStr.str()+
")").c_str());
748 proto->var(
"nominalLumi")->setConstant();
749 proto->defineSet(
"globalObservables",
"nominalLumi");
750 likelihoodTermNames.push_back(
"lumiConstraint");
751 cout <<
"lumi Error str = " << lumiErrorStr.str() << endl;
757 vector<EstimateSummary>::iterator it = summary.begin();
758 for(; it!=summary.end(); ++it){
759 if(it->name==
"Data")
continue;
761 string overallSystName = it->name+
"_"+it->channel+
"_epsilon";
762 string systSourcePrefix =
"alpha_";
765 likelihoodTermNames, totSystTermNames);
769 TH1* nominal = it->nominal;
770 if(it->lowHists.size() == 0){
771 cout << it->name+
"_"+it->channel+
" has no variation histograms " <<endl;
772 string expPrefix=it->name+
"_"+it->channel+
"_expN";
773 string syst_x_expectedPrefix=it->name+
"_"+it->channel+
"_overallSyst_x_Exp";
775 syst_x_expectedPrefixNames.push_back(syst_x_expectedPrefix);
776 }
else if(it->lowHists.size() != it->highHists.size()){
777 cout <<
"problem in "+it->name+
"_"+it->channel
778 <<
" number of low & high variation histograms don't match" << endl;
781 string constraintPrefix = it->name+
"_"+it->channel+
"_Hist_alpha";
782 string syst_x_expectedPrefix = it->name+
"_"+it->channel+
"_overallSyst_x_HistSyst";
784 constraintPrefix, syst_x_expectedPrefix, overallSystName,
786 syst_x_expectedPrefixNames.push_back(syst_x_expectedPrefix);
792 normalizationNames.push_back(
"Lumi" );
794 normalizationNames.push_back( it->normName);
801 syst_x_expectedPrefixNames, normalizationNames);
809 if(summary.at(0).name!=
"Data"){
811 cout <<
" using asimov data" << endl;
814 cout <<
" using input data histogram" << endl;
819 for(
unsigned int i=0; i<systToFix.size(); ++i){
822 else cout <<
"could not find variable " << systToFix.at(i) <<
" could not set it to constant" << endl;
827 for(
unsigned int i=0; i<likelihoodTermNames.size(); ++i){
829 likelihoodTerms.
add(* (
proto->arg(likelihoodTermNames[i].c_str())) );
833 proto->defineSet(
"likelihoodTerms",likelihoodTerms);
836 cout <<
"-----------------------------------------"<<endl;
837 cout <<
"import model into workspace" << endl;
839 "product of Poissons accross bins for a single channel",
843 proto_config->
SetPdf(*model);
847 proto->importClassCode();
869 if (ch_names.empty() || chs.empty() ) {
870 Error(
"MakeCombinedModel",
"Input vectors are empty - return a nullptr");
873 if (chs.size() < ch_names.size() ) {
874 Error(
"MakeCombinedModel",
"Input vector of workspace has an invalid size - return a nullptr");
878 map<string, RooAbsPdf*> pdfMap;
879 vector<RooAbsPdf*> models;
883 for(
unsigned int i = 0; i< ch_names.size(); ++i){
884 string channel_name=ch_names[i];
886 if (ss.str().empty()) ss << channel_name ;
887 else ss <<
',' << channel_name ;
890 RooAbsPdf* model = ch->
pdf((
"model_"+channel_name).c_str());
891 models.push_back(model);
892 globalObs.
add(*ch->
set(
"globalObservables"));
895 pdfMap[channel_name]=model;
899 cout <<
"\n\n------------------\n Entering combination" << endl;
907 combined->
import(globalObs);
908 combined->
defineSet(
"globalObservables",globalObs);
913 cout <<
"-----------------------------------------"<<endl;
914 cout <<
"create toy data for " << ss.str() << endl;
916 const RooArgSet* obsN = chs[0]->set(
"obsN");
920 for(
unsigned int i = 1; i< ch_names.size(); ++i){
923 simData->
append(*simData_ch);
930 cout <<
"\n\n----------------\n Importing combined model" << endl;
933 cout <<
"check pointer " << simPdf << endl;
935 for(
unsigned int i=0; i<
fSystToFix.size(); ++i){
940 cout <<
"setting " <<
fSystToFix.at(i) <<
" constant" << endl;
942 else cout <<
"could not find variable " <<
fSystToFix.at(i) <<
" could not set it to constant" << endl;
950 combined_config->
SetPdf(*simPdf);
952 combined->
import(*combined_config,combined_config->
GetName());
989 cout <<
"\n\n---------------" << endl;
990 cout <<
"---------------- Doing "<< channel <<
" Fit" << endl;
991 cout <<
"---------------\n\n" << endl;
1003 while((params_obj=params_itr->
Next())){
1009 cerr <<
"found no POI" << endl;
1050 delete frame;
delete c1;
1057 for(
int i=0; i<curve_N; i++){
1058 double f=curve_x[i];
1061 y_arr_nll[i]=nll->
getVal();
1068 delete [] y_arr_nll;
1111 for(vector<string>::iterator itr=names.begin(); itr != names.end(); ++itr){
1112 if( ! path.empty() ) path+=
"/";
1114 ptr=
file->GetDirectory(path.c_str());
1115 if( ! ptr ) ptr=
file->mkdir((*itr).c_str());
1116 file=
file->GetDirectory(path.c_str());
1123 ptr=
file->GetDirectory(
name.c_str());
1124 if( ! ptr ) ptr=
file->mkdir(
name.c_str());
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Bool_t isConstant() const
Check if the "Constant" attribute is set.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
virtual RooAbsReal * createNLL(RooAbsData &data, const RooLinkedList &cmdList)
Construct representation of -log(L) of PDFwith given dataset.
virtual RooFitResult * fitTo(RooAbsData &data, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none())
Fit PDF to given dataset.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
void setConstant(Bool_t value=kTRUE)
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual RooAbsReal * createProfile(const RooArgSet ¶msOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function.
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCategory is an object to represent discrete states.
RooConstVar represent a constant real-valued object.
A RooCurve is a one-dimensional graphical representation of a real-valued function.
RooDataSet is a container class to hold unbinned data.
void append(RooDataSet &data)
Add all data points of given data set to this data set.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Double_t correlation(const RooAbsArg &par1, const RooAbsArg &par2) const
Return correlation between par1 and par2.
Multivariate Gaussian p.d.f.
A RooPlot is a plot frame and a container for graphics objects within that frame.
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
RooAbsRealLValue * getPlotVar() const
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
RooCurve * getCurve(const char *name=0) const
Return a RooCurve pointer of the named object in this plot, or zero if the named object does not exis...
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
RooRealVar represents a variable that can be changed from the outside.
Double_t getErrorHi() const
Double_t getErrorLo() const
virtual void setVal(Double_t value)
Set value of variable to 'value'.
RooSimultaneous facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
std::string FilePrefixStr(std::string)
TDirectory * Mkdir(TDirectory *file, std::string name)
void SetObsToExpected(RooWorkspace *proto, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin)
void EditSyst(RooWorkspace *proto, const char *pdfNameChar, std::map< std::string, double > gammaSyst, std::map< std::string, double > uniformSyst, std::map< std::string, double > logNormSyst)
cout << "in edit, gammamap.size = " << gammaSyst.size() << ", unimap.size = " << uniformSyst....
void FormatFrameForLikelihood(RooPlot *frame, std::string XTitle=std::string("#sigma / #sigma_{SM}"), std::string YTitle=std::string("-log likelihood"))
void AddPoissonTerms(RooWorkspace *proto, std::string prefix, std::string obsPrefix, std::string expPrefix, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
std::string AddNormFactor(RooWorkspace *, std::string &, std::string &, EstimateSummary &, bool)
virtual ~HistoToWorkspaceFactory()
void Customize(RooWorkspace *proto, const char *pdfNameChar, std::map< std::string, std::string > renameMap)
void MakeTotalExpected(RooWorkspace *proto, std::string totName, std::string, std::string, int lowBin, int highBin, std::vector< std::string > &syst_x_expectedPrefixNames, std::vector< std::string > &normByNames)
void PrintCovarianceMatrix(RooFitResult *result, RooArgSet *params, std::string filename)
std::stringstream fResultsPrefixStr
void AddMultiVarGaussConstraint(RooWorkspace *proto, std::string prefix, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
void FitModel(RooWorkspace *, std::string, std::string, std::string, bool=false)
void LinInterpWithConstraint(RooWorkspace *proto, TH1 *nominal, std::vector< TH1 * > lowHist, std::vector< TH1 * > highHist, std::vector< std::string > sourceName, std::string prefix, std::string productPrefix, std::string systTerm, int lowBin, int highBin, std::vector< std::string > &likelihoodTermNames)
HistoToWorkspaceFactory()
RooWorkspace * MakeCombinedModel(std::vector< std::string >, std::vector< RooWorkspace * >)
std::vector< std::string > fSystToFix
std::string fFileNamePrefix
void ProcessExpectedHisto(TH1 *hist, RooWorkspace *proto, std::string prefix, std::string productPrefix, std::string systTerm, double low, double high, int lowBin, int highBin)
RooWorkspace * MakeSingleChannelModel(std::vector< RooStats::HistFactory::EstimateSummary > summary, std::vector< std::string > systToFix, bool doRatio=false)
TDirectory * Makedirs(TDirectory *file, std::vector< std::string > names)
void AddEfficiencyTerms(RooWorkspace *proto, std::string prefix, std::string interpName, std::map< std::string, std::pair< double, double > > systMap, std::vector< std::string > &likelihoodTermNames, std::vector< std::string > &totSystTermNames)
RooAbsReal that does piecewise-linear interpolations.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
virtual void SetWorkspace(RooWorkspace &ws)
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
virtual void SetGlobalObservables(const RooArgSet &set)
Specify the global observables.
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
virtual void SetPdf(const RooAbsPdf &pdf)
Set the Pdf, add to the the workspace if not already there.
The RooWorkspace is a persistable container for RooFit projects.
Bool_t import(const RooAbsArg &arg, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg())
Import a RooAbsArg object, e.g.
Bool_t importClassCode(const char *pat="*", Bool_t doReplace=kFALSE)
Inport code of all classes in the workspace that have a class name that matches pattern 'pat' and whi...
Bool_t defineSet(const char *name, const RooArgSet &aset, Bool_t importMissing=kFALSE)
Define a named RooArgSet with given constituents.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
RooFactoryWSTool & factory()
Return instance to factory tool.
const RooArgSet * set(const char *name)
Return pointer to previously defined named set with given nmame If no such set is found a null pointe...
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE) override
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
Describe directory structure in memory.
virtual Bool_t cd()
Change current directory to "this" directory.
virtual TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE)
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
A TGraph is an object made of two arrays X and Y with npoints each.
TH1 is the base class of all histogram classes in ROOT.
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
Iterator abstract base class.
virtual TObject * Next()=0
Use the TLine constructor to create a simple line.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void SetPadBorderMode(Int_t mode=1)
void SetFrameFillColor(Color_t color=1)
void SetCanvasColor(Color_t color=19)
void SetCanvasBorderMode(Int_t mode=1)
void SetTitleFillColor(Color_t color=1)
void SetStatColor(Color_t color=19)
void SetPadColor(Color_t color=19)
A TTree represents a columnar dataset.
RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE)
RooCmdArg Index(RooCategory &icat)
RooCmdArg Import(const char *state, TH1 &histo)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg Minos(Bool_t flag=kTRUE)
RooCmdArg LineColor(Color_t color)
RooCmdArg LineStyle(Style_t style)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.
std::vector< NormFactor > normFactor