With default parameters the macro will attempt to run the standard hist2workspace example and read the ROOT file that it produces.
The macro will scan through all the categories in a simPdf find the corresponding observable. For each category, it will loop through each of the nuisance parameters and plot
You can specify how many sigma to vary by changing nSigmaToVary. You can also change the signal rate by changing muVal.
1) 0x565013e1c230 RooRealVar:: alpha_syst2 = 0 +/- 1 L(-5 - 5) "alpha_syst2"
2) 0x565014b53ab0 RooRealVar:: alpha_syst3 = 0 +/- 1 L(-5 - 5) "alpha_syst3"
3) 0x565014b23540 RooRealVar:: gamma_stat_channel1_bin_0 = 1 +/- 0.05 L(0 - 1.25) "gamma_stat_channel1_bin_0"
4) 0x565014b420e0 RooRealVar:: gamma_stat_channel1_bin_1 = 1 +/- 0.1 L(0 - 1.5) "gamma_stat_channel1_bin_1"
check expectedData by category
Is a simultaneous PDF
on type channel1
channelCat==channelCat::channel1
channel1 channel1
[#1] INFO:Plotting -- RooTreeData::plotOn: plotting 234 events out of 234 total events
[#1] INFO:InputArguments -- The formula select claims to use the variables (obs_x_channel1,channelCat) but only (channelCat) seem to be in use.
inputs: channelCat==channelCat::channel1
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
channelCat==channelCat::channel1
channel1 channel1
[#1] INFO:Plotting -- RooTreeData::plotOn: plotting 234 events out of 234 total events
[#1] INFO:InputArguments -- The formula select claims to use the variables (obs_x_channel1,channelCat) but only (channelCat) seem to be in use.
inputs: channelCat==channelCat::channel1
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
channelCat==channelCat::channel1
channel1 channel1
[#1] INFO:Plotting -- RooTreeData::plotOn: plotting 234 events out of 234 total events
[#1] INFO:InputArguments -- The formula select claims to use the variables (obs_x_channel1,channelCat) but only (channelCat) seem to be in use.
inputs: channelCat==channelCat::channel1
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
channelCat==channelCat::channel1
channel1 channel1
[#1] INFO:Plotting -- RooTreeData::plotOn: plotting 234 events out of 234 total events
[#1] INFO:InputArguments -- The formula select claims to use the variables (obs_x_channel1,channelCat) but only (channelCat) seem to be in use.
inputs: channelCat==channelCat::channel1
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
[#1] INFO:NumericIntegration -- RooRealIntegral::init(channel1_model_Int[obs_x_channel1]) using numeric integrator RooBinIntegrator to calculate Int(obs_x_channel1)
using namespace std;
void StandardHistFactoryPlotsWithCategories(const char *infile = "", const char *workspaceName = "combined",
const char *modelConfigName = "ModelConfig",
const char *dataName = "obsData")
{
double nSigmaToVary = 5.;
double muVal = 0;
bool doFit = false;
if (!strcmp(infile, "")) {
filename =
"results/example_combined_GaussExample_model.root";
if (!fileExist) {
cout << "will run standard hist2workspace example" << endl;
gROOT->ProcessLine(
".! prepareHistFactory .");
gROOT->ProcessLine(
".! hist2workspace config/example.xml");
cout << "\n\n---------------------" << endl;
cout << "Done creating example input" << endl;
cout << "---------------------\n\n" << endl;
}
} else
cout <<
"StandardRooStatsDemoMacro: Input file " <<
filename <<
" is not found" << endl;
return;
}
cout << "workspace not found" << endl;
return;
}
cout << "data or ModelConfig was not found" << endl;
return;
}
if (doFit) {
}
int nPlotsMax = 1000;
cout << " check expectedData by category" << endl;
cout << "Is a simultaneous PDF" << endl;
} else {
cout << "Is not a simultaneous PDF" << endl;
}
if (doFit) {
auto const& catName = channelCat->
begin()->first;
cout <<
Form(
"%s==%s::%s", channelCat->
GetName(), channelCat->
GetName(), catName.c_str()) << endl;
cout << catName <<
" " << channelCat->
getLabel() << endl;
return;
}
int nPlots = 0;
if (!simPdf) {
}
} else {
for (
auto const&
tt : *channelCat) {
if (nPlots == nPlotsMax) {
break;
}
auto const& catName =
tt.first;
cout << "on type " << catName << " " << endl;
cout <<
Form(
"%s==%s::%s", channelCat->
GetName(), channelCat->
GetName(), catName.c_str()) << endl;
cout << catName <<
" " << channelCat->
getLabel() << endl;
if (strcmp(var->
GetName(),
"Lumi") == 0) {
cout << "working on lumi" << endl;
var->
setVal(
w->var(
"nominalLumi")->getVal());
} else {
}
if (strcmp(var->
GetName(),
"Lumi") == 0) {
cout << "working on lumi" << endl;
var->
setVal(
w->var(
"nominalLumi")->getVal() + 0.05);
} else {
}
if (strcmp(var->
GetName(),
"Lumi") == 0) {
cout << "working on lumi" << endl;
var->
setVal(
w->var(
"nominalLumi")->getVal() - 0.05);
} else {
}
if (strcmp(var->
GetName(),
"Lumi") == 0) {
cout << "working on lumi" << endl;
var->
setVal(
w->var(
"nominalLumi")->getVal());
} else {
}
++nPlots;
}
}
}
} else
for (
int i = 0; i < list->
GetSize(); ++i) {
}
}
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
void Print(Option_t *options=nullptr) const override
Print the object to the defaultPrintStream().
RooFit::OwningPtr< RooArgSet > getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
const char * getLabel() const
Retrieve current label. Use getCurrentLabel() for more clarity.
std::map< std::string, value_type >::const_iterator begin() const
Iterator for category state names. Points to pairs of index and name.
RooAbsArg * first() const
TIterator * createIterator(bool dir=kIterForward) const
TIterator-style iteration over contained elements.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}, const RooCmdArg &arg9={}, const RooCmdArg &arg10={}) const override
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
RooFit::OwningPtr< RooFitResult > fitTo(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Fit PDF to given dataset.
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
Object to represent discrete states.
RooDataSet is a container class to hold unbinned data.
A RooPlot is a plot frame and a container for graphics objects within that frame.
void SetName(const char *name) override
Set the name of the RooPlot to 'name'.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
void SetYTitle(const char *title)
RooRealVar represents a variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
RooAbsPdf * getPdf(RooStringView catName) const
Return the p.d.f associated with the given index category name.
const RooAbsCategoryLValue & indexCat() const
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return nullptr if not existing)
const RooArgSet * GetObservables() const
get RooArgSet for observables (return nullptr if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return nullptr if pdf has not been specified or does not exist)
Persistable container for RooFit projects.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
void Add(TObject *obj) override
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
RooCmdArg DataError(Int_t)
RooCmdArg LineWidth(Width_t width)
RooCmdArg Normalization(double scaleFactor)
RooCmdArg MarkerSize(Size_t size)
RooCmdArg Cut(const char *cutSpec)
RooCmdArg LineColor(Color_t color)
RooCmdArg LineStyle(Style_t style)
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(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.
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).