57using std::cout, std::endl;
59void StandardHistFactoryPlotsWithCategories(
const char *infile =
"",
const char *workspaceName =
"combined",
60 const char *modelConfigName =
"ModelConfig",
61 const char *dataName =
"obsData")
64 double nSigmaToVary = 5.;
72 if (!strcmp(infile,
"")) {
73 filename =
"results/example_combined_GaussExample_model.root";
78 cout <<
"will run standard hist2workspace example" << endl;
79 gROOT->ProcessLine(
".! prepareHistFactory .");
80 gROOT->ProcessLine(
".! hist2workspace config/example.xml");
81 cout <<
"\n\n---------------------" << endl;
82 cout <<
"Done creating example input" << endl;
83 cout <<
"---------------------\n\n" << endl;
94 cout <<
"StandardRooStatsDemoMacro: Input file " <<
filename <<
" is not found" << endl;
105 cout <<
"workspace not found" << endl;
118 cout <<
"data or ModelConfig was not found" << endl;
139 int nPlotsMax = 1000;
140 cout <<
" check expectedData by category" << endl;
144 cout <<
"Is a simultaneous PDF" << endl;
147 cout <<
"Is not a simultaneous PDF" << endl;
152 auto const& catName = channelCat->
begin()->first;
157 cout <<
Form(
"%s==%s::%s", channelCat->
GetName(), channelCat->
GetName(), catName.c_str()) << endl;
158 cout << catName <<
" " << channelCat->
getLabel() << endl;
191 for (
auto const&
tt : *channelCat) {
193 if (nPlots == nPlotsMax) {
197 auto const& catName =
tt.first;
199 cout <<
"on type " << catName <<
" " << endl;
217 cout <<
Form(
"%s==%s::%s", channelCat->GetName(), channelCat->GetName(), catName.c_str()) << endl;
218 cout << catName <<
" " << channelCat->getLabel() << endl;
220 Cut(
Form(
"%s==%s::%s", channelCat->GetName(), channelCat->GetName(), catName.c_str())),
224 data->sumEntries(
Form(
"%s==%s::%s", channelCat->GetName(), channelCat->GetName(), catName.c_str()));
226 if (strcmp(var->
GetName(),
"Lumi") == 0) {
227 cout <<
"working on lumi" << endl;
228 var->
setVal(
w->var(
"nominalLumi")->getVal());
241 if (strcmp(var->
GetName(),
"Lumi") == 0) {
242 cout <<
"working on lumi" << endl;
243 var->
setVal(
w->var(
"nominalLumi")->getVal() + 0.05);
246 var->
setVal(nSigmaToVary);
255 if (strcmp(var->
GetName(),
"Lumi") == 0) {
256 cout <<
"working on lumi" << endl;
257 var->
setVal(
w->var(
"nominalLumi")->getVal() - 0.05);
260 var->
setVal(-nSigmaToVary);
270 if (strcmp(var->
GetName(),
"Lumi") == 0) {
271 cout <<
"working on lumi" << endl;
272 var->
setVal(
w->var(
"nominalLumi")->getVal());
294 if (list->GetSize() > 4) {
295 double n = list->GetSize();
301 c1->Divide(list->GetSize());
302 for (
int i = 0;
i < list->GetSize(); ++
i) {
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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 R__DEPRECATED(6
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.
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.
virtual double expectedEvents(const RooArgSet *nset) const
Return expected number of events to be used in calculation of extended likelihood.
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.
Container class to hold unbinned data.
Plot frame and a container for graphics objects within that frame.
void Draw(Option_t *options=nullptr) override
Draw this plot and all of the elements it contains.
void SetYTitle(const char *title)
Use the constructor that doesn t take the name and and then call SetName() and SetTitle() on the RooPlot.")
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
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.
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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.
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
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...
RooStats::ModelConfig ModelConfig
Namespace for the RooStats classes.
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).