69#define NoHistConst_Low "0"
70#define NoHistConst_High "2000"
98 fFileNamePrefix(filePrefix),
109 while(
fRowTitle.find(
"\\ ")!=string::npos){
113 pFile = fopen ((filePrefix+
"_results.table").c_str(),
"a");
128 cout <<
"processing hist " << hist->
GetName() << endl;
130 cout <<
"hist is empty" << endl;
132 string highStr =
"inf";
133 for(
Int_t i=lowBin; i<highBin; ++i){
134 std::stringstream str;
135 std::stringstream range;
138 range<<
"["<<hist->
GetBinContent(i+1) <<
"," << low <<
"," << highStr <<
"]";
140 range<<
"["<< low <<
"," << high <<
"]";
141 cout <<
"for bin N"+str.str() <<
" var " << prefix+str.str()+
" with range " << range.str() << endl;
145 if(! (productPrefix.empty() || systTerm.empty()) )
146 proto->factory((
"prod:"+productPrefix+str.str()+
"("+prefix+str.str()+
","+systTerm+
")").c_str() );
151 proto->defineSet(prefix.c_str(),argset);
160 for(
Int_t i=lowBin; i<highBin; ++i){
161 std::stringstream str;
168 for(
int i=lowBin; i<highBin; ++i){
169 for(
int j=0; j<highBin-lowBin; ++j){
171 Cov(i,j) =
sqrt(mean(i));
179 floating, mean, Cov);
181 proto->import(constraint);
183 likelihoodTermNames.push_back(constraint.
GetName());
189 vector<string> sourceName,
string prefix,
string productPrefix,
string systTerm,
190 int lowBin,
int highBin, vector<string>& likelihoodTermNames){
198 for(
unsigned int j=0; j<lowHist.size(); ++j){
199 std::stringstream str;
204 temp = (
RooRealVar*)
proto->factory((
"alpha_"+sourceName.at(j)+range).c_str());
207 string command=(
"Gaussian::alpha_"+sourceName.at(j)+
"Constraint(alpha_"+sourceName.at(j)+
",nom_"+sourceName.at(j)+
"[0.,-10,10],1.)");
208 cout << command << endl;
209 likelihoodTermNames.push_back(
proto->factory( command.c_str() )->
GetName() );
210 proto->var((
"nom_"+sourceName.at(j)).c_str())->setConstant();
211 const_cast<RooArgSet*
>(
proto->set(
"globalObservables"))->add(*
proto->var((
"nom_"+sourceName.at(j)).c_str()));
220 for(
Int_t i=lowBin; i<highBin; ++i){
221 std::stringstream str;
225 vector<double> low, high;
226 for(
unsigned int j=0; j<lowHist.size(); ++j){
227 low.push_back( lowHist.at(j)->GetBinContent(i+1) );
228 high.push_back( highHist.at(j)->GetBinContent(i+1) );
229 cout <<
"for "+prefix+
" bin "+str.str()+
" creating linear interp of nominal " << nominal->
GetBinContent(i+1)
230 <<
" in parameter " << sourceName.at(j)
231 <<
" between " << low.back() <<
" - " << high.back()
232 <<
" about " << 100.*fabs(low.back() - high.back() )/nominal->
GetBinContent(i+1) <<
" % error"
240 proto->import(interp);
243 proto->factory((
"prod:"+productPrefix+str.str()+
"("+prefix+str.str()+
","+systTerm+
")").c_str() );
250 string overallNorm_times_sigmaEpsilon ;
252 vector<EstimateSummary::NormFactor> norm=es.
normFactor;
254 for(vector<EstimateSummary::NormFactor>::iterator itr=norm.begin(); itr!=norm.end(); ++itr){
255 cout <<
"making normFactor: " << itr->name << endl;
257 std::stringstream range;
258 range<<
"["<<itr->val<<
","<<itr->low<<
","<<itr->high<<
"]";
262 if(!prodNames.empty()) prodNames+=
",";
264 varname=itr->name+
"_"+channel;
269 proto->factory((varname+range.str()).c_str());
273 cout <<
"WARNING: Const attribute to <NormFactor> tag is deprecated, will ignore."<<
274 " Instead, add \n\t<ParamSetting Const=\"True\">"<<varname<<
"</ParamSetting>\n"<<
275 " to your top-level XML's <Measurment> entry"<< endl;
279 overallNorm_times_sigmaEpsilon = es.
name+
"_"+channel+
"_overallNorm_x_sigma_epsilon";
280 proto->factory((
"prod::"+overallNorm_times_sigmaEpsilon+
"("+prodNames+
","+sigmaEpsilon+
")").c_str());
283 if(!overallNorm_times_sigmaEpsilon.empty())
284 return overallNorm_times_sigmaEpsilon;
291 map<
string,pair<double,double> > systMap,
292 vector<string>& likelihoodTermNames, vector<string>& totSystTermNames){
298 totSystTermNames.push_back(prefix);
301 vector<double> lowVec, highVec;
302 for(map<
string,pair<double,double> >::iterator it=systMap.begin(); it!=systMap.end(); ++it){
306 temp = (
RooRealVar*)
proto->factory((prefix+ it->first +range).c_str());
308 string command=(
"Gaussian::"+prefix+it->first+
"Constraint("+prefix+it->first+
",nom_"+prefix+it->first+
"[0.,-10,10],1.)");
309 cout << command << endl;
310 likelihoodTermNames.push_back(
proto->factory( command.c_str() )->
GetName() );
311 proto->var((
"nom_"+prefix+it->first).c_str())->setConstant();
312 const_cast<RooArgSet*
>(
proto->set(
"globalObservables"))->add(*
proto->var((
"nom_"+prefix+it->first).c_str()));
318 std::stringstream lowhigh;
319 double low = it->second.first;
320 double high = it->second.second;
321 lowVec.push_back(low);
322 highVec.push_back(high);
325 if(systMap.size()>0){
327 LinInterpVar interp( (interpName).c_str(),
"", params, 1., lowVec, highVec);
328 proto->import(interp);
333 proto->import(interp);
340 int lowBin,
int highBin, vector<string>& syst_x_expectedPrefixNames,
341 vector<string>& normByNames){
345 for(
Int_t i=lowBin; i<highBin; ++i){
346 std::stringstream str;
348 string command=
"sum::"+totName+str.str()+
"(";
351 for(
unsigned int j=0; j<syst_x_expectedPrefixNames.size();++j){
352 command+=prepend+normByNames.at(j)+
"*"+syst_x_expectedPrefixNames.at(j)+str.str();
356 cout <<
"function to calculate total: " << command << endl;
357 proto->factory(command.c_str());
362 vector<string>& likelihoodTermNames){
367 for(
Int_t i=lowBin; i<highBin; ++i){
368 std::stringstream str;
371 string command(
"Poisson::"+prefix+str.str()+
"("+obsPrefix+str.str()+
","+expPrefix+str.str()+
",1)");
375 cout <<
"Poisson Term " << command << endl;
379 likelihoodTermNames.push_back( temp->
GetName() );
382 proto->defineSet(prefix.c_str(),Pois);
392 for(
Int_t i=lowBin; i<highBin; ++i){
393 std::stringstream str;
396 cout <<
"expected number of events called: " << expPrefix << endl;
402 cout <<
"setting obs"+str.str()+
" to expected = " <<
exp->getVal() <<
" check: " << obs->
getVal() << endl;
405 obsForTree[i] =
exp->getVal();
406 tree->Branch((obsPrefix+str.str()).c_str(), obsForTree+i ,(obsPrefix+str.str()+
"/D").c_str());
409 cout <<
"problem retrieving obs or exp " << obsPrefix+str.str() << obs <<
" " << expPrefix+str.str() <<
exp << endl;
415 proto->import(*data);
417 obsForTree =
nullptr;
421 cout <<
"in customizations" << endl;
422 string pdfName(pdfNameChar);
423 map<string,string>::iterator it;
424 string edit=
"EDIT::customized("+pdfName+
",";
426 for(it=renameMap.begin(); it!=renameMap.end(); ++it) {
427 cout << it->first +
"=" + it->second << endl;
428 edit+=precede + it->first +
"=" + it->second;
433 proto->factory( edit.c_str() );
440 string pdfName(pdfNameChar);
445 string edit=
"EDIT::newSimPdf("+pdfName+
",";
447 string lastPdf=pdfName;
449 unsigned int numReplacements = 0;
450 unsigned int nskipped = 0;
451 map<string,double>::iterator it;
454 for(it=gammaSyst.begin(); it!=gammaSyst.end(); ++it) {
456 if(!
proto->var((
"alpha_"+it->first).c_str())){
463 double relativeUncertainty = it->second;
464 double scale = 1/
sqrt((1+1/
pow(relativeUncertainty,2)));
467 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
468 proto->factory(
Form(
"y_%s[%f]",it->first.c_str(),1./
pow(relativeUncertainty,2))) ;
469 proto->factory(
Form(
"theta_%s[%f]",it->first.c_str(),
pow(relativeUncertainty,2))) ;
470 proto->factory(
Form(
"Gamma::beta_%sConstraint(beta_%s,sum::k_%s(y_%s,one[1]),theta_%s,zero[0])",
475 it->first.c_str())) ;
491 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{%f,%f})",it->first.c_str(),it->first.c_str(),-1./scale,1./scale));
494 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
495 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
497 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
503 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
506 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
516 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
517 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
521 cout <<
"Going to issue this edit command\n" << edit<< endl;
522 proto->factory( edit.c_str() );
525 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
531 for(it=uniformSyst.begin(); it!=uniformSyst.end(); ++it) {
532 cout <<
"edit for " << it->first <<
"with rel uncert = " << it->second << endl;
533 if(!
proto->var((
"alpha_"+it->first).c_str())){
534 cout <<
"systematic not there" << endl;
541 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
542 proto->factory(
Form(
"Uniform::beta_%sConstraint(beta_%s)",it->first.c_str(),it->first.c_str()));
543 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{-1,1})",it->first.c_str(),it->first.c_str()));
546 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
547 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
549 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
554 cout <<
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint" << endl;
555 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
557 cout <<
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first << endl;
558 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
560 if(
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) &&
proto->var((
"alpha_"+it->first).c_str()) )
561 cout <<
" checked they are there" <<
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) <<
" " <<
proto->var((
"alpha_"+it->first).c_str()) << endl;
563 cout <<
"NOT THERE" << endl;
566 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
567 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
572 proto->factory( edit.c_str() );
575 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
585 for(it=logNormSyst.begin(); it!=logNormSyst.end(); ++it) {
586 cout <<
"edit for " << it->first <<
"with rel uncert = " << it->second << endl;
587 if(!
proto->var((
"alpha_"+it->first).c_str())){
588 cout <<
"systematic not there" << endl;
594 double relativeUncertainty = it->second;
595 double kappa = 1+relativeUncertainty;
599 double scale = relativeUncertainty;
603 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
604 proto->factory(
Form(
"kappa_%s[%f]",it->first.c_str(),kappa));
605 proto->factory(
Form(
"Lognormal::beta_%sConstraint(beta_%s,one[1],kappa_%s)",
608 it->first.c_str())) ;
609 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{%f,%f})",it->first.c_str(),it->first.c_str(),-1./scale,1./scale));
613 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
614 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
616 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
621 cout <<
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint" << endl;
622 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
624 cout <<
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first << endl;
625 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
627 if(
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) &&
proto->var((
"alpha_"+it->first).c_str()) )
628 cout <<
" checked they are there" <<
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) <<
" " <<
proto->var((
"alpha_"+it->first).c_str()) << endl;
630 cout <<
"NOT THERE" << endl;
633 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
634 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
639 proto->factory( edit.c_str() );
642 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
651 edit=
"EDIT::newSimPdf("+lastPdf+
","+editList+
")";
653 proto->factory( edit.c_str() );
658 combined_config->
SetPdf(*newOne);
661 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
667 pFile = fopen ((filename).c_str(),
"w");
678 fprintf(
pFile,
"\\\\ \\hline \n" );
690 fprintf(
pFile,
" \\\\\n");
701 if (summary.empty() ) {
702 Error(
"MakeSingleChannelModel",
"vector of EstimateSummry is empty - return a nullptr");
709 string channel=summary[0].channel;
710 cout <<
"\n\n-------------------\nStarting to process " << channel <<
" channel" << endl;
719 RooArgSet likelihoodTerms(
"likelihoodTerms");
720 vector<string> likelihoodTermNames, totSystTermNames,syst_x_expectedPrefixNames, normalizationNames;
722 string prefix, range;
727 if (summary.at(0).name==
"Data") {
730 cout <<
"Will use expected (\"Asimov\") data set" << endl;
739 std::stringstream lumiStr;
742 proto->factory((
"Lumi"+lumiStr.str()).c_str());
743 cout <<
"lumi str = " << lumiStr.str() << endl;
745 std::stringstream lumiErrorStr;
748 proto->factory((
"Gaussian::lumiConstraint(Lumi,"+lumiErrorStr.str()+
")").c_str());
749 proto->var(
"nominalLumi")->setConstant();
750 proto->defineSet(
"globalObservables",
"nominalLumi");
751 likelihoodTermNames.push_back(
"lumiConstraint");
752 cout <<
"lumi Error str = " << lumiErrorStr.str() << endl;
758 vector<EstimateSummary>::iterator it = summary.begin();
759 for(; it!=summary.end(); ++it){
760 if(it->name==
"Data")
continue;
762 string overallSystName = it->name+
"_"+it->channel+
"_epsilon";
763 string systSourcePrefix =
"alpha_";
766 likelihoodTermNames, totSystTermNames);
770 TH1* nominal = it->nominal;
771 if(it->lowHists.size() == 0){
772 cout << it->name+
"_"+it->channel+
" has no variation histograms " <<endl;
773 string expPrefix=it->name+
"_"+it->channel+
"_expN";
774 string syst_x_expectedPrefix=it->name+
"_"+it->channel+
"_overallSyst_x_Exp";
776 syst_x_expectedPrefixNames.push_back(syst_x_expectedPrefix);
777 }
else if(it->lowHists.size() != it->highHists.size()){
778 cout <<
"problem in "+it->name+
"_"+it->channel
779 <<
" number of low & high variation histograms don't match" << endl;
782 string constraintPrefix = it->name+
"_"+it->channel+
"_Hist_alpha";
783 string syst_x_expectedPrefix = it->name+
"_"+it->channel+
"_overallSyst_x_HistSyst";
785 constraintPrefix, syst_x_expectedPrefix, overallSystName,
787 syst_x_expectedPrefixNames.push_back(syst_x_expectedPrefix);
793 normalizationNames.push_back(
"Lumi" );
795 normalizationNames.push_back( it->normName);
802 syst_x_expectedPrefixNames, normalizationNames);
810 if(summary.at(0).name!=
"Data"){
812 cout <<
" using asimov data" << endl;
815 cout <<
" using input data histogram" << endl;
820 for(
unsigned int i=0; i<systToFix.size(); ++i){
823 else cout <<
"could not find variable " << systToFix.at(i) <<
" could not set it to constant" << endl;
828 for(
unsigned int i=0; i<likelihoodTermNames.size(); ++i){
830 likelihoodTerms.
add(* (
proto->arg(likelihoodTermNames[i].c_str())) );
834 proto->defineSet(
"likelihoodTerms",likelihoodTerms);
837 cout <<
"-----------------------------------------"<<endl;
838 cout <<
"import model into workspace" << endl;
840 "product of Poissons accross bins for a single channel",
844 proto_config->
SetPdf(*model);
848 proto->importClassCode();
870 if (ch_names.empty() || chs.empty() ) {
871 Error(
"MakeCombinedModel",
"Input vectors are empty - return a nullptr");
874 if (chs.size() < ch_names.size() ) {
875 Error(
"MakeCombinedModel",
"Input vector of workspace has an invalid size - return a nullptr");
879 map<string, RooAbsPdf*> pdfMap;
880 vector<RooAbsPdf*> models;
884 for(
unsigned int i = 0; i< ch_names.size(); ++i){
885 string channel_name=ch_names[i];
887 if (ss.str().empty()) ss << channel_name ;
888 else ss <<
',' << channel_name ;
891 RooAbsPdf* model = ch->
pdf((
"model_"+channel_name).c_str());
892 models.push_back(model);
893 globalObs.
add(*ch->
set(
"globalObservables"));
896 pdfMap[channel_name]=model;
900 cout <<
"\n\n------------------\n Entering combination" << endl;
908 combined->
import(globalObs);
909 combined->
defineSet(
"globalObservables",globalObs);
914 cout <<
"-----------------------------------------"<<endl;
915 cout <<
"create toy data for " << ss.str() << endl;
917 const RooArgSet* obsN = chs[0]->set(
"obsN");
921 for(
unsigned int i = 1; i< ch_names.size(); ++i){
924 simData->
append(*simData_ch);
931 cout <<
"\n\n----------------\n Importing combined model" << endl;
934 cout <<
"check pointer " << simPdf << endl;
936 for(
unsigned int i=0; i<
fSystToFix.size(); ++i){
941 cout <<
"setting " <<
fSystToFix.at(i) <<
" constant" << endl;
943 else cout <<
"could not find variable " <<
fSystToFix.at(i) <<
" could not set it to constant" << endl;
951 combined_config->
SetPdf(*simPdf);
953 combined->
import(*combined_config,combined_config->
GetName());
990 cout <<
"\n\n---------------" << endl;
991 cout <<
"---------------- Doing "<< channel <<
" Fit" << endl;
992 cout <<
"---------------\n\n" << endl;
1004 while((params_obj=params_itr->
Next())){
1046 delete frame;
delete c1;
1065 for(
int i=0; i<curve_N; i++){
1066 double f=curve_x[i];
1069 y_arr_nll[i]=nll->
getVal();
1076 delete [] y_arr_nll;
1119 for(vector<string>::iterator itr=names.begin(); itr != names.end(); ++itr){
1120 if( ! path.empty() ) path+=
"/";
1122 ptr=
file->GetDirectory(path.c_str());
1123 if( ! ptr ) ptr=
file->mkdir((*itr).c_str());
1124 file=
file->GetDirectory(path.c_str());
1131 ptr=
file->GetDirectory(
name.c_str());
1132 if( ! ptr ) ptr=
file->mkdir(
name.c_str());
double pow(double, double)
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 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.
virtual RooAbsReal * createProfile(const RooArgSet ¶msOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function.
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.
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
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 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.
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.
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 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/...".
virtual Bool_t cd(const char *path=nullptr)
Change current directory to "this" directory.
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
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