57ETestCmdId = ETestCommandIdentifiers
112 def CloseWindow(self):
135 self.fFitRes = self.fMC.GetPdf().fitTo(self.fData, Save=
True)
137 for it
in self.fSliderMap:
159 if str(self.fMC.GetPdf().ClassName()) ==
"RooSimultaneous":
160 simPdf = self.fMC.GetPdf()
174 it =
ROOT.map(TGTripleHSlider, char).iterator
181 self.fPlot = (self.fMC.GetObservables().first()).frame()
182 self.fData.plotOn(self.fPlot)
187 for it
in self.fSliderMap:
190 param = self.fWS.var(name)
193 "{:s} = {:.3}f [{:.3}f,{:.3}f]".
format(
202 normCount = self.fMC.GetPdf().expectedEvents(self.fMC.GetObservables())
203 self.fMC.GetPdf().plotOn(
209 for it
in self.fSliderMap:
213 normCount = self.fMC.GetPdf().expectedEvents(self.fMC.GetObservables())
214 self.fMC.GetPdf().plotOn(
220 for it
in self.fSliderMap:
224 normCount = self.fMC.GetPdf().expectedEvents(self.fMC.GetObservables())
225 self.fMC.GetPdf().plotOn(
230 self.fCanvas.GetCanvas().Modified()
231 self.fCanvas.GetCanvas().Update()
241 gchannelCat = channelCat
242 for tt
in channelCat:
246 self.fCanvas.GetCanvas().
cd(frameIndex)
251 global ggpdftmp, gobstmp
258 gframeIndex = frameIndex
260 gfPlotList = self.fPlotList
261 self.fPlot = self.fPlotList[frameIndex - 1]
266 self.fPlotList[frameIndex - 1] = self.fPlot
288 for it
in self.fSliderMap:
291 param = self.fWS.var(name)
294 "{:s} = {:.3f} [{:.3f},{:.3f}]".
format(
314 for it
in self.fSliderMap:
317 param = self.fWS.var(name)
320 "{:s} = {:.3f} [{:.3f},{:.3f}]".
format(
340 for it
in self.fSliderMap:
343 param = self.fWS.var(name)
346 "{:s} = {:.3f} [{:.3f},{:.3f}]".
format(
360 gnormCount = normCount
398 self.fCanvas.GetCanvas().Modified()
399 self.fCanvas.GetCanvas().Update()
405 def HandleButtons(self):
418 self.fHslider1.SetConstrained(self.fCheck1.GetState())
421 self.fHslider1.SetRelative(self.fCheck2.GetState())
428 print(
"Exit application...")
429 self.gApplication.Terminate(0)
434 def __init__(self, w, mc, data):
451 self.fSliderMap =
ROOT.std.map(
"TGTripleHSlider *",
" TString ")()
454 self.fLabelMap =
ROOT.std.map(
"TGTripleHSlider*",
"TGLabel *")()
484 if self.fMC.GetPdf().ClassName() ==
"RooSimultaneous":
485 print(f
"Is a simultaneous PDF")
486 simPdf = self.fMC.GetPdf()
488 print(f
" with {channelCat.numTypes()} categories")
491 print(f
"Is not a simultaneous PDF")
500 self.AddFrame(self.fCanvas, self.fLcan)
501 self.fPlotList.resize(numCats)
504 self.fCanvas.GetCanvas().Divide(numCats)
505 for i
in range(numCats):
506 self.fCanvas.GetCanvas().
cd(i + 1).SetBorderMode(0)
507 self.fCanvas.GetCanvas().
cd(i + 1).SetGrid()
516 self.fCheck1.SetToolTipText(
"Pointer position constrained to slider sides")
517 self.fCheck2.SetToolTipText(
"Pointer position relative to slider position")
519 self.fHframe0.Resize(200, 50)
525 self.fFitButton.SetFont(
"Helvetica")
526 self.fFitButton.Connect(
"Clicked()",
"TPyDispatcher", dp_DoFit,
"Dispatch()")
530 self.fExitButton.SetFont(
"Helvetica")
533 self.fExitButton.SetCommand(
'TPython::Exec( "raise SystemExit" )')
540 self.fCheck1.Connect(
"Clicked()",
"TPyDispatcher", dp_HandleButtons,
"Dispatch()")
541 self.fCheck2.Connect(
"Clicked()",
"TPyDispatcher", dp_HandleButtons,
"Dispatch()")
543 self.fHframe2.Resize(100, 25)
553 self.fHframe2.AddFrame(self.fFitButton, self.fBfly2)
554 self.fHframe2.AddFrame(self.fExitButton, self.fBfly3)
556 self.AddFrame(self.fHframe0, self.fBly)
557 self.AddFrame(self.fHframe2, self.fBly)
570 self.fCan.SetContainer(self.fVFrame)
575 for param
in parameters:
597 hsliderk.Connect(
"PointerPositionChanged()",
"TPyDispatcher", dp_DoSlider,
"Dispatch()")
598 hsliderk.Connect(
"PositionChanged()",
"TPyDispatcher", dp_DoSlider,
"Dispatch()")
602 self.fSliderList.
Add(hsliderk)
603 self.fFrameList.
Add(hframek)
610 self.fVFrame.AddFrame(hframek, self.fBly)
612 self.fLabelMap[hsliderk] = hlabel
616 self.SetWindowName(
"RooFit/RooStats Model Inspector")
618 self.Resize(self.GetDefaultSize())
625def ModelInspector(infile="", workspaceName="combined", modelConfigName="ModelConfig", dataName="obsData"):
633 filename =
"results/example_combined_GaussExample_model.root"
638 print(f
"will run standard hist2workspace example")
641 print(f
"\n\n---------------------")
642 print(f
"Done creating example input")
643 print(f
"---------------------\n\n")
652 """using namespace std;
653 using namespace RooFit;
654 using namespace RooStats;
660 Declare(f
'TFile *file = TFile::Open("{filename}");')
666 except ReferenceError:
667 print(
"file wasn't load properly and is a nullptr")
668 print(f
"\nInput file {filename} was not found")
677 ProcessLine(f
'RooWorkspace *w = (RooWorkspace *)file->Get("{workspaceName}");')
681 except ReferenceError:
682 print(f
"Workspace:{workspaceName} wasn't load properly and is a nullptr")
687 ProcessLine(f
'ModelConfig *mc = (ModelConfig *)w->obj("{modelConfigName}");')
692 ProcessLine(f
'RooAbsData *DATA = w->data("{dataName}");')
701 except ReferenceError:
702 print(f
"ModelConfig:{modelConfigName} wasn't load properly and is a nullptr")
706 except ReferenceError:
707 print(f
"data:{dataName} wasn't load properly and is a nullptr")
710 print(
"running ModelInspectorGUI...")
714ModelInspector(infile=
"", workspaceName=
"combined", modelConfigName=
"ModelConfig", dataName=
"obsData")
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.