Usage: The usage is the same as the StandardXxxDemo.C macros. The macro expects a root file containing a workspace with a ModelConfig and a dataset
Drag the sliders to adjust the parameters of the model. the min and max range of the sliders are used to define the upper & lower variation the pointer position of the slider is the central blue curve.
#include <map>
};
using std::map, std::vector, std::cout, std::endl;
private:
public:
void CloseWindow() override;
void DoText(
const char *
text);
void DoSlider();
void DoSlider(const char *);
void DoFit();
void DoExit();
void HandleButtons();
};
{
if (
strcmp(
fMC->GetPdf()->ClassName(),
"RooSimultaneous") == 0) {
cout << "Is a simultaneous PDF" << endl;
cout <<
" with " <<
channelCat->numTypes() <<
" categories" << endl;
} else {
cout << "Is not a simultaneous PDF" << endl;
}
AddFrame(fCanvas,
fLcan);
fCanvas->GetCanvas()->Divide(
numCats);
for (
int i = 0; i <
numCats; ++i) {
fCanvas->GetCanvas()->cd(i + 1)->SetBorderMode(0);
fCanvas->GetCanvas()->cd(i + 1)->SetGrid();
}
}
fCheck1->SetToolTipText(
"Pointer position constrained to slider sides");
fCheck2->SetToolTipText(
"Pointer position relative to slider position");
fFitButton->Connect("Clicked()", "ModelInspectorGUI", this, "DoFit()");
fExitButton->Connect(
"Clicked()",
"ModelInspectorGUI",
this,
"DoExit()");
fCheck1->Connect(
"Clicked()",
"ModelInspectorGUI",
this,
"HandleButtons()");
fCheck2->Connect(
"Clicked()",
"ModelInspectorGUI",
this,
"HandleButtons()");
parameters.
add(*
fMC->GetParametersOfInterest());
parameters.
add(*
fMC->GetNuisanceParameters());
cout << "Adding Slider for " << param->GetName() << endl;
new TGLabel(
hframek,
Form(
"%s = %.3f +%.3f", param->GetName(), param->getVal(), param->getError()));
hsliderk->Connect(
"PointerPositionChanged()",
"ModelInspectorGUI",
this,
"DoSlider()");
hsliderk->Connect(
"PositionChanged()",
"ModelInspectorGUI",
this,
"DoSlider()");
hsliderk->SetRange(param->getMin(), param->getMax());
hsliderk->SetPosition(param->getVal() - param->getError(), param->getVal() + param->getError());
hsliderk->SetPointerPosition(param->getVal());
}
SetWindowName("RooFit/RooStats Model Inspector");
Resize(GetDefaultSize());
MapWindow();
DoSlider();
}
ModelInspectorGUI::~ModelInspectorGUI()
{
Cleanup();
}
void ModelInspectorGUI::CloseWindow()
{
delete this;
}
void ModelInspectorGUI::DoText(const char * )
{
switch (id) {
default: break;
}
DoSlider();
}
void ModelInspectorGUI::DoFit()
{
map<TGTripleHSlider *, const char *>::iterator it;
;
it->first->SetPointerPosition(param->
getVal());
}
DoSlider();
}
void ModelInspectorGUI::DoSlider(
const char *
text)
{
cout <<
"." <<
text << endl;
}
void ModelInspectorGUI::DoSlider()
{
if (
strcmp(
fMC->GetPdf()->ClassName(),
"RooSimultaneous") == 0) {
} else {
}
map<TGTripleHSlider *, const char *>::iterator it;
;
delete fPlot;
fData->plotOn(fPlot);
const char *
name = it->second;
fWS->var(
name)->setVal(it->first->GetMaxPosition());
fLabelMap[it->first]->SetText(
Form(
"%s = %.3f [%.3f,%.3f]", param->
GetName(), it->first->GetPointerPosition(),
it->first->GetMinPosition(), it->first->GetMaxPosition()));
}
const char *
name = it->second;
fWS->var(
name)->setVal(it->first->GetMinPosition());
}
const char *
name = it->second;
fWS->var(
name)->setVal(it->first->GetPointerPosition());
}
fPlot->Draw();
fCanvas->GetCanvas()->Modified();
fCanvas->GetCanvas()->Update();
} else {
if (fPlot)
delete fPlot;
map<TGTripleHSlider *, const char *>::iterator it;
;
const char *
name = it->second;
fWS->var(
name)->setVal(it->first->GetMaxPosition());
it->first->GetPointerPosition(), it->first->GetMinPosition(),
it->first->GetMaxPosition()));
}
const char *
name = it->second;
fWS->var(
name)->setVal(it->first->GetMinPosition());
it->first->GetPointerPosition(), it->first->GetMinPosition(),
it->first->GetMaxPosition()));
}
const char *
name = it->second;
fWS->var(
name)->setVal(it->first->GetPointerPosition());
it->first->GetPointerPosition(), it->first->GetMinPosition(),
it->first->GetMaxPosition()));
}
else {
}
fPlot->Draw();
}
fCanvas->GetCanvas()->Modified();
fCanvas->GetCanvas()->Update();
}
}
void ModelInspectorGUI::HandleButtons()
{
switch (id) {
default: break;
}
}
void ModelInspectorGUI::DoExit()
{
printf(
"Exit application...");
}
{
filename =
"results/example_combined_GaussExample_model.root";
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
if (!file) {
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;
}
}
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
R__EXTERN TApplication * gApplication
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 data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize MapSubwindows
Option_t Option_t TPoint TPoint const char text
R__EXTERN void * gTQSender
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
R__EXTERN TSystem * gSystem
const_iterator begin() const
const_iterator end() const
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
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,...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
static RooMsgService & instance()
Return reference to singleton instance.
Plot frame and a container for graphics objects within that frame.
Variable that can be changed from the outside.
Facilitates simultaneous fitting of multiple PDFs to subsets of a given dataset.
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Persistable container for RooFit projects.
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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.
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
A composite frame that layout their children in horizontal way.
This class handles GUI labels.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
Yield an action as soon as it is clicked.
A TGTextEntry is a one line text input widget.
TripleSlider inherit from DoubleSlider widgets and allow easy selection of a min, max and pointer val...
A composite frame that layout their children in vertical way.
const char * GetName() const override
Returns name of object.
This class creates a TGCanvas in which a TCanvas is created.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
RooCmdArg Save(bool flag=true)
RooCmdArg DataError(Int_t)
RooCmdArg FillColor(Color_t color)
RooCmdArg LineWidth(Width_t width)
RooCmdArg Normalization(double scaleFactor)
RooCmdArg VisualizeError(const RooDataSet ¶mData, double Z=1)
RooCmdArg MarkerSize(Size_t size)
RooCmdArg Cut(const char *cutSpec)
RooCmdArg LineColor(Color_t color)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
MsgLevel
Verbosity level for RooMsgService::StreamConfig in RooMsgService.
Namespace for the RooStats classes.