75#define NoHistConst_Low "0"
76#define NoHistConst_High "2000"
104 fFileNamePrefix(filePrefix),
115 while(
fRowTitle.find(
"\\ ")!=string::npos){
119 pFile = fopen ((filePrefix+
"_results.table").c_str(),
"a");
134 cout <<
"processing hist " << hist->
GetName() << endl;
136 cout <<
"hist is empty" << endl;
138 string highStr =
"inf";
139 for(
Int_t i=lowBin; i<highBin; ++i){
140 std::stringstream str;
141 std::stringstream range;
144 range<<
"["<<hist->
GetBinContent(i+1) <<
"," << low <<
"," << highStr <<
"]";
146 range<<
"["<< low <<
"," << high <<
"]";
147 cout <<
"for bin N"+str.str() <<
" var " << prefix+str.str()+
" with range " << range.str() << endl;
151 if(! (productPrefix.empty() || systTerm.empty()) )
152 proto->factory((
"prod:"+productPrefix+str.str()+
"("+prefix+str.str()+
","+systTerm+
")").c_str() );
157 proto->defineSet(prefix.c_str(),argset);
166 for(
Int_t i=lowBin; i<highBin; ++i){
167 std::stringstream str;
174 for(
int i=lowBin; i<highBin; ++i){
175 for(
int j=0; j<highBin-lowBin; ++j){
177 Cov(i,j) =
sqrt(mean(i));
185 floating, mean, Cov);
187 proto->import(constraint);
189 likelihoodTermNames.push_back(constraint.
GetName());
195 vector<string> sourceName,
string prefix,
string productPrefix,
string systTerm,
196 int lowBin,
int highBin, vector<string>& likelihoodTermNames){
204 for(
unsigned int j=0; j<lowHist.size(); ++j){
205 std::stringstream str;
210 temp = (
RooRealVar*)
proto->factory((
"alpha_"+sourceName.at(j)+range).c_str());
213 string command=(
"Gaussian::alpha_"+sourceName.at(j)+
"Constraint(alpha_"+sourceName.at(j)+
",nom_"+sourceName.at(j)+
"[0.,-10,10],1.)");
214 cout << command << endl;
215 likelihoodTermNames.push_back(
proto->factory( command.c_str() )->
GetName() );
216 proto->var((
"nom_"+sourceName.at(j)).c_str())->setConstant();
217 const_cast<RooArgSet*
>(
proto->set(
"globalObservables"))->add(*
proto->var((
"nom_"+sourceName.at(j)).c_str()));
226 for(
Int_t i=lowBin; i<highBin; ++i){
227 std::stringstream str;
231 vector<double> low, high;
232 for(
unsigned int j=0; j<lowHist.size(); ++j){
233 low.push_back( lowHist.at(j)->GetBinContent(i+1) );
234 high.push_back( highHist.at(j)->GetBinContent(i+1) );
235 cout <<
"for "+prefix+
" bin "+str.str()+
" creating linear interp of nominal " << nominal->
GetBinContent(i+1)
236 <<
" in parameter " << sourceName.at(j)
237 <<
" between " << low.back() <<
" - " << high.back()
238 <<
" about " << 100.*
fabs(low.back() - high.back() )/nominal->
GetBinContent(i+1) <<
" % error"
246 proto->import(interp);
249 proto->factory((
"prod:"+productPrefix+str.str()+
"("+prefix+str.str()+
","+systTerm+
")").c_str() );
256 string overallNorm_times_sigmaEpsilon ;
258 vector<EstimateSummary::NormFactor> norm=es.
normFactor;
260 for(vector<EstimateSummary::NormFactor>::iterator itr=norm.begin(); itr!=norm.end(); ++itr){
261 cout <<
"making normFactor: " << itr->name << endl;
263 std::stringstream range;
264 range<<
"["<<itr->val<<
","<<itr->low<<
","<<itr->high<<
"]";
268 if(!prodNames.empty()) prodNames+=
",";
270 varname=itr->name+
"_"+channel;
275 proto->factory((varname+range.str()).c_str());
279 cout <<
"WARNING: Const attribute to <NormFactor> tag is deprecated, will ignore."<<
280 " Instead, add \n\t<ParamSetting Const=\"True\">"<<varname<<
"</ParamSetting>\n"<<
281 " to your top-level XML's <Measurment> entry"<< endl;
285 overallNorm_times_sigmaEpsilon = es.
name+
"_"+channel+
"_overallNorm_x_sigma_epsilon";
286 proto->factory((
"prod::"+overallNorm_times_sigmaEpsilon+
"("+prodNames+
","+sigmaEpsilon+
")").c_str());
289 if(!overallNorm_times_sigmaEpsilon.empty())
290 return overallNorm_times_sigmaEpsilon;
297 map<
string,pair<double,double> > systMap,
298 vector<string>& likelihoodTermNames, vector<string>& totSystTermNames){
304 totSystTermNames.push_back(prefix);
307 vector<double> lowVec, highVec;
308 for(map<
string,pair<double,double> >::iterator it=systMap.begin(); it!=systMap.end(); ++it){
312 temp = (
RooRealVar*)
proto->factory((prefix+ it->first +range).c_str());
314 string command=(
"Gaussian::"+prefix+it->first+
"Constraint("+prefix+it->first+
",nom_"+prefix+it->first+
"[0.,-10,10],1.)");
315 cout << command << endl;
316 likelihoodTermNames.push_back(
proto->factory( command.c_str() )->
GetName() );
317 proto->var((
"nom_"+prefix+it->first).c_str())->setConstant();
318 const_cast<RooArgSet*
>(
proto->set(
"globalObservables"))->add(*
proto->var((
"nom_"+prefix+it->first).c_str()));
324 std::stringstream lowhigh;
325 double low = it->second.first;
326 double high = it->second.second;
327 lowVec.push_back(low);
328 highVec.push_back(high);
331 if(systMap.size()>0){
333 LinInterpVar interp( (interpName).c_str(),
"", params, 1., lowVec, highVec);
334 proto->import(interp);
339 proto->import(interp);
346 int lowBin,
int highBin, vector<string>& syst_x_expectedPrefixNames,
347 vector<string>& normByNames){
351 for(
Int_t i=lowBin; i<highBin; ++i){
352 std::stringstream str;
354 string command=
"sum::"+totName+str.str()+
"(";
357 for(
unsigned int j=0; j<syst_x_expectedPrefixNames.size();++j){
358 command+=prepend+normByNames.at(j)+
"*"+syst_x_expectedPrefixNames.at(j)+str.str();
362 cout <<
"function to calculate total: " << command << endl;
363 proto->factory(command.c_str());
368 vector<string>& likelihoodTermNames){
373 for(
Int_t i=lowBin; i<highBin; ++i){
374 std::stringstream str;
377 string command(
"Poisson::"+prefix+str.str()+
"("+obsPrefix+str.str()+
","+expPrefix+str.str()+
",1)");
381 cout <<
"Poisson Term " << command << endl;
385 likelihoodTermNames.push_back( temp->
GetName() );
388 proto->defineSet(prefix.c_str(),Pois);
398 for(
Int_t i=lowBin; i<highBin; ++i){
399 std::stringstream str;
402 cout <<
"expected number of events called: " << expPrefix << endl;
408 cout <<
"setting obs"+str.str()+
" to expected = " <<
exp->getVal() <<
" check: " << obs->
getVal() << endl;
411 obsForTree[i] =
exp->getVal();
412 tree->Branch((obsPrefix+str.str()).c_str(), obsForTree+i ,(obsPrefix+str.str()+
"/D").c_str());
415 cout <<
"problem retrieving obs or exp " << obsPrefix+str.str() << obs <<
" " << expPrefix+str.str() <<
exp << endl;
421 proto->import(*data);
423 obsForTree =
nullptr;
427 cout <<
"in customizations" << endl;
428 string pdfName(pdfNameChar);
429 map<string,string>::iterator it;
430 string edit=
"EDIT::customized("+pdfName+
",";
432 for(it=renameMap.begin(); it!=renameMap.end(); ++it) {
433 cout << it->first +
"=" + it->second << endl;
434 edit+=precede + it->first +
"=" + it->second;
439 proto->factory( edit.c_str() );
446 string pdfName(pdfNameChar);
451 string edit=
"EDIT::newSimPdf("+pdfName+
",";
453 string lastPdf=pdfName;
455 unsigned int numReplacements = 0;
456 unsigned int nskipped = 0;
457 map<string,double>::iterator it;
460 for(it=gammaSyst.begin(); it!=gammaSyst.end(); ++it) {
462 if(!
proto->var((
"alpha_"+it->first).c_str())){
469 double relativeUncertainty = it->second;
470 double scale = 1/
sqrt((1+1/
pow(relativeUncertainty,2)));
473 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
474 proto->factory(
Form(
"y_%s[%f]",it->first.c_str(),1./
pow(relativeUncertainty,2))) ;
475 proto->factory(
Form(
"theta_%s[%f]",it->first.c_str(),
pow(relativeUncertainty,2))) ;
476 proto->factory(
Form(
"Gamma::beta_%sConstraint(beta_%s,sum::k_%s(y_%s,one[1]),theta_%s,zero[0])",
481 it->first.c_str())) ;
497 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{%f,%f})",it->first.c_str(),it->first.c_str(),-1./scale,1./scale));
500 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
501 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
503 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
509 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
512 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
522 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
523 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
527 cout <<
"Going to issue this edit command\n" << edit<< endl;
528 proto->factory( edit.c_str() );
531 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
537 for(it=uniformSyst.begin(); it!=uniformSyst.end(); ++it) {
538 cout <<
"edit for " << it->first <<
"with rel uncert = " << it->second << endl;
539 if(!
proto->var((
"alpha_"+it->first).c_str())){
540 cout <<
"systematic not there" << endl;
547 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
548 proto->factory(
Form(
"Uniform::beta_%sConstraint(beta_%s)",it->first.c_str(),it->first.c_str()));
549 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{-1,1})",it->first.c_str(),it->first.c_str()));
552 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
553 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
555 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
560 cout <<
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint" << endl;
561 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
563 cout <<
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first << endl;
564 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
566 if(
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) &&
proto->var((
"alpha_"+it->first).c_str()) )
567 cout <<
" checked they are there" <<
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) <<
" " <<
proto->var((
"alpha_"+it->first).c_str()) << endl;
569 cout <<
"NOT THERE" << endl;
572 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
573 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
578 proto->factory( edit.c_str() );
581 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
591 for(it=logNormSyst.begin(); it!=logNormSyst.end(); ++it) {
592 cout <<
"edit for " << it->first <<
"with rel uncert = " << it->second << endl;
593 if(!
proto->var((
"alpha_"+it->first).c_str())){
594 cout <<
"systematic not there" << endl;
600 double relativeUncertainty = it->second;
601 double kappa = 1+relativeUncertainty;
605 double scale = relativeUncertainty;
609 proto->factory(
Form(
"beta_%s[1,0,10]",it->first.c_str()));
610 proto->factory(
Form(
"kappa_%s[%f]",it->first.c_str(),kappa));
611 proto->factory(
Form(
"Lognormal::beta_%sConstraint(beta_%s,one[1],kappa_%s)",
614 it->first.c_str())) ;
615 proto->factory(
Form(
"PolyVar::alphaOfBeta_%s(beta_%s,{%f,%f})",it->first.c_str(),it->first.c_str(),-1./scale,1./scale));
619 if(
proto->var(
Form(
"alpha_%s",it->first.c_str()))->isConstant())
620 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
true);
622 proto->var(
Form(
"beta_%s",it->first.c_str()))->setConstant(
false);
627 cout <<
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint" << endl;
628 editList+=precede +
"alpha_"+it->first+
"Constraint=beta_" + it->first+
"Constraint";
630 cout <<
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first << endl;
631 editList+=precede +
"alpha_"+it->first+
"=alphaOfBeta_"+ it->first;
633 if(
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) &&
proto->var((
"alpha_"+it->first).c_str()) )
634 cout <<
" checked they are there" <<
proto->pdf((
"alpha_"+it->first+
"Constraint").c_str()) <<
" " <<
proto->var((
"alpha_"+it->first).c_str()) << endl;
636 cout <<
"NOT THERE" << endl;
639 if(numReplacements%10 == 0 && numReplacements+nskipped!=gammaSyst.size()){
640 edit=
"EDIT::"+lastPdf+
"_("+lastPdf+
","+editList+
")";
645 proto->factory( edit.c_str() );
648 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
657 edit=
"EDIT::newSimPdf("+lastPdf+
","+editList+
")";
659 proto->factory( edit.c_str() );
664 combined_config->
SetPdf(*newOne);
667 cout <<
"\n\n ---------------------\n WARNING: failed to make EDIT\n\n" << endl;
673 pFile = fopen ((filename).c_str(),
"w");
684 fprintf(
pFile,
"\\\\ \\hline \n" );
696 fprintf(
pFile,
" \\\\\n");
707 if (summary.empty() ) {
708 Error(
"MakeSingleChannelModel",
"vector of EstimateSummry is empty - return a nullptr");
715 string channel=summary[0].channel;
716 cout <<
"\n\n-------------------\nStarting to process " << channel <<
" channel" << endl;
725 RooArgSet likelihoodTerms(
"likelihoodTerms");
726 vector<string> likelihoodTermNames, totSystTermNames,syst_x_expectedPrefixNames, normalizationNames;
728 string prefix, range;
733 if (summary.at(0).name==
"Data") {
736 cout <<
"Will use expected (\"Asimov\") data set" << endl;
745 std::stringstream lumiStr;
748 proto->factory((
"Lumi"+lumiStr.str()).c_str());
749 cout <<
"lumi str = " << lumiStr.str() << endl;
751 std::stringstream lumiErrorStr;
754 proto->factory((
"Gaussian::lumiConstraint(Lumi,"+lumiErrorStr.str()+
")").c_str());
755 proto->var(
"nominalLumi")->setConstant();
756 proto->defineSet(
"globalObservables",
"nominalLumi");
757 likelihoodTermNames.push_back(
"lumiConstraint");
758 cout <<
"lumi Error str = " << lumiErrorStr.str() << endl;
764 vector<EstimateSummary>::iterator it = summary.begin();
765 for(; it!=summary.end(); ++it){
766 if(it->name==
"Data")
continue;
768 string overallSystName = it->name+
"_"+it->channel+
"_epsilon";
769 string systSourcePrefix =
"alpha_";
772 likelihoodTermNames, totSystTermNames);
776 TH1* nominal = it->nominal;
777 if(it->lowHists.size() == 0){
778 cout << it->name+
"_"+it->channel+
" has no variation histograms " <<endl;
779 string expPrefix=it->name+
"_"+it->channel+
"_expN";
780 string syst_x_expectedPrefix=it->name+
"_"+it->channel+
"_overallSyst_x_Exp";
782 syst_x_expectedPrefixNames.push_back(syst_x_expectedPrefix);
783 }
else if(it->lowHists.size() != it->highHists.size()){
784 cout <<
"problem in "+it->name+
"_"+it->channel
785 <<
" number of low & high variation histograms don't match" << endl;
788 string constraintPrefix = it->name+
"_"+it->channel+
"_Hist_alpha";
789 string syst_x_expectedPrefix = it->name+
"_"+it->channel+
"_overallSyst_x_HistSyst";
791 constraintPrefix, syst_x_expectedPrefix, overallSystName,
793 syst_x_expectedPrefixNames.push_back(syst_x_expectedPrefix);
799 normalizationNames.push_back(
"Lumi" );
801 normalizationNames.push_back( it->normName);
808 syst_x_expectedPrefixNames, normalizationNames);
816 if(summary.at(0).name!=
"Data"){
818 cout <<
" using asimov data" << endl;
821 cout <<
" using input data histogram" << endl;
826 for(
unsigned int i=0; i<systToFix.size(); ++i){
829 else cout <<
"could not find variable " << systToFix.at(i) <<
" could not set it to constant" << endl;
834 for(
unsigned int i=0; i<likelihoodTermNames.size(); ++i){
836 likelihoodTerms.
add(* (
proto->arg(likelihoodTermNames[i].c_str())) );
840 proto->defineSet(
"likelihoodTerms",likelihoodTerms);
843 cout <<
"-----------------------------------------"<<endl;
844 cout <<
"import model into workspace" << endl;
846 "product of Poissons accross bins for a single channel",
850 proto_config->
SetPdf(*model);
854 proto->importClassCode();
876 if (ch_names.empty() || chs.empty() ) {
877 Error(
"MakeCombinedModel",
"Input vectors are empty - return a nullptr");
880 if (chs.size() < ch_names.size() ) {
881 Error(
"MakeCombinedModel",
"Input vector of workspace has an invalid size - return a nullptr");
885 map<string, RooAbsPdf*> pdfMap;
886 vector<RooAbsPdf*> models;
890 for(
unsigned int i = 0; i< ch_names.size(); ++i){
891 string channel_name=ch_names[i];
893 if (ss.str().empty()) ss << channel_name ;
894 else ss <<
',' << channel_name ;
897 RooAbsPdf* model = ch->
pdf((
"model_"+channel_name).c_str());
898 models.push_back(model);
899 globalObs.
add(*ch->
set(
"globalObservables"));
902 pdfMap[channel_name]=model;
906 cout <<
"\n\n------------------\n Entering combination" << endl;
914 combined->
import(globalObs);
915 combined->
defineSet(
"globalObservables",globalObs);
920 cout <<
"-----------------------------------------"<<endl;
921 cout <<
"create toy data for " << ss.str() << endl;
923 const RooArgSet* obsN = chs[0]->set(
"obsN");
927 for(
unsigned int i = 1; i< ch_names.size(); ++i){
930 simData->
append(*simData_ch);
937 cout <<
"\n\n----------------\n Importing combined model" << endl;
940 cout <<
"check pointer " << simPdf << endl;
942 for(
unsigned int i=0; i<
fSystToFix.size(); ++i){
947 cout <<
"setting " <<
fSystToFix.at(i) <<
" constant" << endl;
949 else cout <<
"could not find variable " <<
fSystToFix.at(i) <<
" could not set it to constant" << endl;
957 combined_config->
SetPdf(*simPdf);
959 combined->
import(*combined_config,combined_config->
GetName());
996 cout <<
"\n\n---------------" << endl;
997 cout <<
"---------------- Doing "<< channel <<
" Fit" << endl;
998 cout <<
"---------------\n\n" << endl;
1010 while((params_obj=params_itr->
Next())){
1052 delete frame;
delete c1;
1071 for(
int i=0; i<curve_N; i++){
1072 double f=curve_x[i];
1075 y_arr_nll[i]=nll->
getVal();
1082 delete [] y_arr_nll;
1125 for(vector<string>::iterator itr=names.begin(); itr != names.end(); ++itr){
1126 if( ! path.empty() ) path+=
"/";
1128 ptr=
file->GetDirectory(path.c_str());
1129 if( ! ptr ) ptr=
file->mkdir((*itr).c_str());
1130 file=
file->GetDirectory(path.c_str());
1137 ptr=
file->GetDirectory(
name.c_str());
1138 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
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
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 represents a fundamental (non-derived) discrete value object.
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 Graph is a graphics 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.
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...
RooCmdArg RecycleConflictNodes(Bool_t flag=kTRUE)
RooCmdArg Index(RooCategory &icat)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg Import(const char *state, TH1 &histo)
RooCmdArg LineColor(Color_t color)
RooCmdArg LineStyle(Style_t style)
RooCmdArg Minos(Bool_t flag=kTRUE)
Namespace for the RooStats classes.
std::vector< NormFactor > normFactor