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(
"Is a simultaneous PDF")
486 simPdf = self.fMC.GetPdf()
488 print(f
" with {channelCat.numTypes()} categories")
491 print(
"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)
524 self.fFitButton.SetFont(
"Helvetica")
525 self.fFitButton.Connect(
"Clicked()", self.DoFit)
528 self.fExitButton.SetFont(
"Helvetica")
531 self.fExitButton.SetCommand(
'TPython::Exec( "raise SystemExit" )')
536 self.fCheck1.Connect(
"Clicked()", self.HandleButtons)
537 self.fCheck2.Connect(
"Clicked()", self.HandleButtons)
539 self.fHframe2.Resize(100, 25)
549 self.fHframe2.AddFrame(self.fFitButton, self.fBfly2)
550 self.fHframe2.AddFrame(self.fExitButton, self.fBfly3)
552 self.AddFrame(self.fHframe0, self.fBly)
553 self.AddFrame(self.fHframe2, self.fBly)
566 self.fCan.SetContainer(self.fVFrame)
576 for param
in parameters:
600 self.fSliderList.
Add(hsliderk)
601 self.fFrameList.
Add(hframek)
614 self.fVFrame.AddFrame(hframek, self.fBly)
616 self.fLabelMap[hsliderk] = hlabel
617 self.fWidgets += [hframek, hlabel, hsliderk]
621 self.SetWindowName(
"RooFit/RooStats Model Inspector")
623 self.Resize(self.GetDefaultSize())
630def ModelInspector(infile="", workspaceName="combined", modelConfigName="ModelConfig", dataName="obsData"):
638 filename =
"results/example_combined_GaussExample_model.root"
643 print(
"will run standard hist2workspace example")
646 print(
"\n\n---------------------")
647 print(
"Done creating example input")
648 print(
"---------------------\n\n")
656 Declare(
"""using namespace std;
657 using namespace RooFit;
658 using namespace RooStats;
663 Declare(f
'TFile *file = TFile::Open("{filename}");')
669 except ReferenceError:
670 print(
"file wasn't load properly and is a nullptr")
671 print(f
"\nInput file {filename} was not found")
680 ProcessLine(f
'RooWorkspace *w = (RooWorkspace *)file->Get("{workspaceName}");')
684 except ReferenceError:
685 print(f
"Workspace:{workspaceName} wasn't load properly and is a nullptr")
690 ProcessLine(f
'ModelConfig *mc = (ModelConfig *)w->obj("{modelConfigName}");')
695 ProcessLine(f
'RooAbsData *DATA = w->data("{dataName}");')
704 except ReferenceError:
705 print(f
"ModelConfig:{modelConfigName} wasn't load properly and is a nullptr")
709 except ReferenceError:
710 print(f
"data:{dataName} wasn't load properly and is a nullptr")
713 print(
"running ModelInspectorGUI...")
717ModelInspector(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.