74#define NoHistConst_Low "0"
75#define NoHistConst_High "2000"
103 fFileNamePrefix(filePrefix),
114 while(
fRowTitle.find(
"\\ ")!=string::npos){
118 pFile = fopen ((filePrefix+
"_results.table").c_str(),
"a");
133 cout <<
"processing hist " << hist->
GetName() << endl;
135 cout <<
"hist is empty" << endl;
137 string highStr =
"inf";
138 for(
Int_t i=lowBin; i<highBin; ++i){
139 std::stringstream str;
140 std::stringstream range;
143 range<<
"["<<hist->
GetBinContent(i+1) <<
"," << low <<
"," << highStr <<
"]";
145 range<<
"["<< low <<
"," << high <<
"]";
146 cout <<
"for bin N"+str.str() <<
" var " << prefix+str.str()+
" with range " << range.str() << endl;
150 if(! (productPrefix.empty() || systTerm.empty()) )
151 proto->factory((
"prod:"+productPrefix+str.str()+
"("+prefix+str.str()+
","+systTerm+
")").c_str() );
156 proto->defineSet(prefix.c_str(),argset);
165 for(
Int_t i=lowBin; i<highBin; ++i){
166 std::stringstream str;
173 for(
int i=lowBin; i<highBin; ++i){
174 for(
int j=0; j<highBin-lowBin; ++j){
176 Cov(i,j) =
sqrt(mean(i));
184 floating, mean, Cov);
186 proto->import(constraint);
188 likelihoodTermNames.push_back(constraint.
GetName());
194 vector<string> sourceName,
string prefix,
string productPrefix,
string systTerm,
195 int lowBin,
int highBin, vector<string>& likelihoodTermNames){
203 for(
unsigned int j=0; j<lowHist.size(); ++j){
204 std::stringstream str;
209 temp = (
RooRealVar*)
proto->factory((
"alpha_"+sourceName.at(j)+range).c_str());
212 string command=(
"Gaussian::alpha_"+sourceName.at(j)+
"Constraint(alpha_"+sourceName.at(j)+
",nom_"+sourceName.at(j)+
"[0.,-10,10],1.)");
213 cout << command << endl;
214 likelihoodTermNames.push_back(
proto->factory( command.c_str() )->
GetName() );
215 proto->var((
"nom_"+sourceName.at(j)).c_str())->setConstant();
216 const_cast<RooArgSet*
>(
proto->set(
"globalObservables"))->add(*
proto->var((
"nom_"+sourceName.at(j)).c_str()));
225 for(
Int_t i=lowBin; i<highBin; ++i){
226 std::stringstream str;
230 vector<double> low, high;
231 for(
unsigned int j=0; j<lowHist.size(); ++j){
232 low.push_back( lowHist.at(j)->GetBinContent(i+1) );
233 high.push_back( highHist.at(j)->GetBinContent(i+1) );
234 cout <<
"for "+prefix+
" bin "+str.str()+
" creating linear interp of nominal " << nominal->
GetBinContent(i+1)
235 <<
" in parameter " << sourceName.at(j)
236 <<
" between " << low.back() <<
" - " << high.back()
237 <<
" about " << 100.*
fabs(low.back() - high.back() )/nominal->
GetBinContent(i+1) <<
" % error"
245 proto->import(interp);
248 proto->factory((
"prod:"+productPrefix+str.str()+
"("+prefix+str.str()+
","+systTerm+
")").c_str() );
255 string overallNorm_times_sigmaEpsilon ;
257 vector<EstimateSummary::NormFactor> norm=es.
normFactor;
259 for(vector<EstimateSummary::NormFactor>::iterator itr=norm.begin(); itr!=norm.end(); ++itr){
260 cout <<
"making normFactor: " << itr->name << endl;
262 std::stringstream range;
263 range<<
"["<<itr->val<<
","<<itr->low<<
","<<itr->high<<
"]";
267 if(!prodNames.empty()) prodNames+=
",";
269 varname=itr->name+
"_"+channel;
274 proto->factory((varname+range.str()).c_str());
278 cout <<
"WARNING: Const attribute to <NormFactor> tag is deprecated, will ignore."<<
279 " Instead, add \n\t<ParamSetting Const=\"True\">"<<varname<<
"</ParamSetting>\n"<<
280 " to your top-level XML's <Measurment> entry"<< endl;
284 overallNorm_times_sigmaEpsilon = es.
name+
"_"+channel+
"_overallNorm_x_sigma_epsilon";
285 proto->factory((
"prod::"+overallNorm_times_sigmaEpsilon+
"("+prodNames+
","+sigmaEpsilon+
")").c_str());
288 if(!overallNorm_times_sigmaEpsilon.empty())
289 return overallNorm_times_sigmaEpsilon;
296 map<
string,pair<double,double> > systMap,
297 vector<string>& likelihoodTermNames, vector<string>& totSystTermNames){
303 totSystTermNames.push_back(prefix);
306 vector<double> lowVec, highVec;
307 for(map<
string,pair<double,double> >::iterator it=systMap.begin(); it!=systMap.end(); ++it){
311 temp = (
RooRealVar*)
proto->factory((prefix+ it->first +range).c_str());
313 string command=(
"Gaussian::"+prefix+it->first+
"Constraint("+prefix+it->first+
",nom_"+prefix+it->first+
"[0.,-10,10],1.)");
314 cout << command << endl;
315 likelihoodTermNames.push_back(
proto->factory( command.c_str() )->
GetName() );
316 proto->var((
"nom_"+prefix+it->first).c_str())->setConstant();
317 const_cast<RooArgSet*
>(
proto->set(
"globalObservables"))->add(*
proto->var((
"nom_"+prefix+it->first).c_str()));
323 std::stringstream lowhigh;
324 double low = it->second.first;
325 double high = it->second.second;
326 lowVec.push_back(low);
327 highVec.push_back(high);
330 if(systMap.size()>0){
332 LinInterpVar interp( (interpName).c_str(),
"", params, 1., lowVec, highVec);
333 proto->import(interp);
338 proto->import(interp);
345 int lowBin,
int highBin, vector<string>& syst_x_expectedPrefixNames,
346 vector<string>& normByNames){
350 for(
Int_t i=lowBin; i<highBin; ++i){
351 std::stringstream str;
353 string command=
"sum::"+totName+str.str()+
"(";
356 for(
unsigned int j=0; j<syst_x_expectedPrefixNames.size();++j){
357 command+=prepend+normByNames.at(j)+
"*"+syst_x_expectedPrefixNames.at(j)+str.str();
361 cout <<
"function to calculate total: " << command << endl;
362 proto->factory(command.c_str());
367 vector<string>& likelihoodTermNames){
372 for(
Int_t i=lowBin; i<highBin; ++i){
373 std::stringstream str;
376 string command(
"Poisson::"+prefix+str.str()+
"("+obsPrefix+str.str()+
","+expPrefix+str.str()+
",1)");
380 cout <<
"Poisson Term " << command << endl;
384 likelihoodTermNames.push_back( temp->
GetName() );
387 proto->defineSet(prefix.c_str(),Pois);
397 for(
Int_t i=lowBin; i<highBin; ++i){
398 std::stringstream str;
401 cout <<
"expected number of events called: " << expPrefix << endl;
407 cout <<
"setting obs"+str.str()+
" to expected = " <<
exp->getVal() <<
" check: " << obs->
getVal() << endl;
410 obsForTree[i] =
exp->getVal();
411 tree->Branch((obsPrefix+str.str()).c_str(), obsForTree+i ,(obsPrefix+str.str()+
"/D").c_str());
414 cout <<
"problem retrieving obs or exp " << obsPrefix+str.str() << obs <<
" " << expPrefix+str.str() <<
exp << endl;
420 proto->import(*data);
422 obsForTree =
nullptr;
426 cout <<
"in customizations" << endl;
427 string pdfName(pdfNameChar);
428 map<string,string>::iterator it;
429 string edit=
"EDIT::customized("+pdfName+
",";
431 for(it=renameMap.begin(); it!=renameMap.end(); ++it) {
432 cout << it->first +
"=" + it->second << endl;
433 edit+=precede + it->first +
"=" + it->second;
438 proto->factory( edit.c_str() );
445 string pdfName(pdfNameChar);
450 string edit=
"EDIT::newSimPdf("+pdfName+
",";
452 string lastPdf=pdfName;
454 unsigned int numReplacements = 0;
455 unsigned int nskipped = 0;
456 map<string,double>::iterator it;
459 for(it=gammaSyst.begin(); it!=gammaSyst.end(); ++it) {
461 if(!
proto->var((
"alpha_"+it->first).c_str())){
468 double relativeUncertainty = it->second;
469 double scale = 1/
sqrt((1+1/
pow(relativeUncertainty,2)));
472 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
473 proto->factory(
Form(
"y_%s[%f]",it->first.c_str(),1./
pow(relativeUncertainty,2))) ;
474 proto->factory(
Form(
"theta_%s[%f]",it->first.c_str(),
pow(relativeUncertainty,2))) ;
475 proto->factory(
Form(
"Gamma::beta_%sConstraint(beta_%s,sum::k_%s(y_%s,one[1]),theta_%s,zero[0])",
480 it->first.c_str())) ;
496 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{%f,%f})",it->first.c_str(),it->first.c_str(),-1./scale,1./scale));
499 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
500 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
502 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
508 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
511 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
521 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
522 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
526 cout <<
"Going to issue this edit command\n" << edit<< endl;
527 proto->factory( edit.c_str() );
530 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
536 for(it=uniformSyst.begin(); it!=uniformSyst.end(); ++it) {
537 cout <<
"edit for " << it->first <<
"with rel uncert = " << it->second << endl;
538 if(!
proto->var((
"alpha_"+it->first).c_str())){
539 cout <<
"systematic not there" << endl;
546 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
547 proto->factory(
Form(
"Uniform::beta_%sConstraint(beta_%s)",it->first.c_str(),it->first.c_str()));
548 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{-1,1})",it->first.c_str(),it->first.c_str()));
551 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
552 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
554 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
559 cout <<
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint" << endl;
560 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
562 cout <<
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first << endl;
563 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
565 if(
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) &&
proto->var((
"alpha_"+it->first).c_str()) )
566 cout <<
" checked they are there" <<
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) <<
" " <<
proto->var((
"alpha_"+it->first).c_str()) << endl;
568 cout <<
"NOT THERE" << endl;
571 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
572 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
577 proto->factory( edit.c_str() );
580 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
590 for(it=logNormSyst.begin(); it!=logNormSyst.end(); ++it) {
591 cout <<
"edit for " << it->first <<
"with rel uncert = " << it->second << endl;
592 if(!
proto->var((
"alpha_"+it->first).c_str())){
593 cout <<
"systematic not there" << endl;
599 double relativeUncertainty = it->second;
600 double kappa = 1+relativeUncertainty;
604 double scale = relativeUncertainty;
608 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
609 proto->factory(
Form(
"kappa_%s[%f]",it->first.c_str(),kappa));
610 proto->factory(
Form(
"Lognormal::beta_%sConstraint(beta_%s,one[1],kappa_%s)",
613 it->first.c_str())) ;
614 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{%f,%f})",it->first.c_str(),it->first.c_str(),-1./scale,1./scale));
618 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
619 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
621 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
626 cout <<
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint" << endl;
627 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
629 cout <<
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first << endl;
630 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
632 if(
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) &&
proto->var((
"alpha_"+it->first).c_str()) )
633 cout <<
" checked they are there" <<
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) <<
" " <<
proto->var((
"alpha_"+it->first).c_str()) << endl;
635 cout <<
"NOT THERE" << endl;
638 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
639 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
644 proto->factory( edit.c_str() );
647 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
656 edit=
"EDIT::newSimPdf("+lastPdf+
","+editList+
")";
658 proto->factory( edit.c_str() );
663 combined_config->
SetPdf(*newOne);
666 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
672 pFile = fopen ((filename).c_str(),
"w");
683 fprintf(
pFile,
"\\\\ \\hline \n" );
695 fprintf(
pFile,
" \\\\\n");
706 if (summary.empty() ) {
707 Error(
"MakeSingleChannelModel",
"vector of EstimateSummry is empty - return a nullptr");
714 string channel=summary[0].channel;
715 cout <<
"\n\n-------------------\nStarting to process " << channel <<
" channel" << endl;
724 RooArgSet likelihoodTerms(
"likelihoodTerms");
725 vector<string> likelihoodTermNames, totSystTermNames,syst_x_expectedPrefixNames, normalizationNames;
727 string prefix, range;
732 if (summary.at(0).name==
"Data") {
735 cout <<
"Will use expected (\"Asimov\") data set" << endl;
744 std::stringstream lumiStr;
747 proto->factory((
"Lumi"+lumiStr.str()).c_str());
748 cout <<
"lumi str = " << lumiStr.str() << endl;
750 std::stringstream lumiErrorStr;
753 proto->factory((
"Gaussian::lumiConstraint(Lumi,"+lumiErrorStr.str()+
")").c_str());
754 proto->var(
"nominalLumi")->setConstant();
755 proto->defineSet(
"globalObservables",
"nominalLumi");
756 likelihoodTermNames.push_back(
"lumiConstraint");
757 cout <<
"lumi Error str = " << lumiErrorStr.str() << endl;
763 vector<EstimateSummary>::iterator it = summary.begin();
764 for(; it!=summary.end(); ++it){
765 if(it->name==
"Data")
continue;
767 string overallSystName = it->name+
"_"+it->channel+
"_epsilon";
768 string systSourcePrefix =
"alpha_";
771 likelihoodTermNames, totSystTermNames);
775 TH1* nominal = it->nominal;
776 if(it->lowHists.size() == 0){
777 cout << it->name+
"_"+it->channel+
" has no variation histograms " <<endl;
778 string expPrefix=it->name+
"_"+it->channel+
"_expN";
779 string syst_x_expectedPrefix=it->name+
"_"+it->channel+
"_overallSyst_x_Exp";
781 syst_x_expectedPrefixNames.push_back(syst_x_expectedPrefix);
782 }
else if(it->lowHists.size() != it->highHists.size()){
783 cout <<
"problem in "+it->name+
"_"+it->channel
784 <<
" number of low & high variation histograms don't match" << endl;
787 string constraintPrefix = it->name+
"_"+it->channel+
"_Hist_alpha";
788 string syst_x_expectedPrefix = it->name+
"_"+it->channel+
"_overallSyst_x_HistSyst";
790 constraintPrefix, syst_x_expectedPrefix, overallSystName,
792 syst_x_expectedPrefixNames.push_back(syst_x_expectedPrefix);
798 normalizationNames.push_back(
"Lumi" );
800 normalizationNames.push_back( it->normName);
807 syst_x_expectedPrefixNames, normalizationNames);
815 if(summary.at(0).name!=
"Data"){
817 cout <<
" using asimov data" << endl;
820 cout <<
" using input data histogram" << endl;
825 for(
unsigned int i=0; i<systToFix.size(); ++i){
828 else cout <<
"could not find variable " << systToFix.at(i) <<
" could not set it to constant" << endl;
833 for(
unsigned int i=0; i<likelihoodTermNames.size(); ++i){
835 likelihoodTerms.
add(* (
proto->arg(likelihoodTermNames[i].c_str())) );
839 proto->defineSet(
"likelihoodTerms",likelihoodTerms);
842 cout <<
"-----------------------------------------"<<endl;
843 cout <<
"import model into workspace" << endl;
845 "product of Poissons accross bins for a single channel",
849 proto_config->
SetPdf(*model);
853 proto->importClassCode();
875 if (ch_names.empty() || chs.empty() ) {
876 Error(
"MakeCombinedModel",
"Input vectors are empty - return a nullptr");
879 if (chs.size() < ch_names.size() ) {
880 Error(
"MakeCombinedModel",
"Input vector of workspace has an invalid size - return a nullptr");
884 map<string, RooAbsPdf*> pdfMap;
885 vector<RooAbsPdf*> models;
889 for(
unsigned int i = 0; i< ch_names.size(); ++i){
890 string channel_name=ch_names[i];
892 if (ss.str().empty()) ss << channel_name ;
893 else ss <<
',' << channel_name ;
896 RooAbsPdf* model = ch->
pdf((
"model_"+channel_name).c_str());
897 models.push_back(model);
898 globalObs.
add(*ch->
set(
"globalObservables"));
901 pdfMap[channel_name]=model;
905 cout <<
"\n\n------------------\n Entering combination" << endl;
913 combined->
import(globalObs);
914 combined->
defineSet(
"globalObservables",globalObs);
919 cout <<
"-----------------------------------------"<<endl;
920 cout <<
"create toy data for " << ss.str() << endl;
922 const RooArgSet* obsN = chs[0]->set(
"obsN");
926 for(
unsigned int i = 1; i< ch_names.size(); ++i){
929 simData->
append(*simData_ch);
936 cout <<
"\n\n----------------\n Importing combined model" << endl;
939 cout <<
"check pointer " << simPdf << endl;
941 for(
unsigned int i=0; i<
fSystToFix.size(); ++i){
946 cout <<
"setting " <<
fSystToFix.at(i) <<
" constant" << endl;
948 else cout <<
"could not find variable " <<
fSystToFix.at(i) <<
" could not set it to constant" << endl;
956 combined_config->
SetPdf(*simPdf);
958 combined->
import(*combined_config,combined_config->
GetName());
995 cout <<
"\n\n---------------" << endl;
996 cout <<
"---------------- Doing "<< channel <<
" Fit" << endl;
997 cout <<
"---------------\n\n" << endl;
1009 while((params_obj=params_itr->
Next())){
1051 delete frame;
delete c1;
1070 for(
int i=0; i<curve_N; i++){
1071 double f=curve_x[i];
1074 y_arr_nll[i]=nll->
getVal();
1081 delete [] y_arr_nll;
1124 for(vector<string>::iterator itr=names.begin(); itr != names.end(); ++itr){
1125 if( ! path.empty() ) path+=
"/";
1127 ptr=
file->GetDirectory(path.c_str());
1128 if( ! ptr ) ptr=
file->mkdir((*itr).c_str());
1129 file=
file->GetDirectory(path.c_str());
1136 ptr=
file->GetDirectory(
name.c_str());
1137 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 (of arbitrary type) an...
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.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
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
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.
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)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
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