Skip to content
Snippets Groups Projects
Commit 4ab0bbfe authored by Yizhou Cai's avatar Yizhou Cai
Browse files

Fix typo

parent 367fe520
No related branches found
No related tags found
1 merge request!118Remove RooFormula dependence for ROOT version > 6.29.2
%% Cell type:code id: tags:
```
import ROOT
from quickstats.components.workspaces import XMLWSModifier
ws_orig = ROOT.RooWorkspace('original')
x = ROOT.RooRealVar("x", "x", -10, 10)
y = ROOT.RooRealVar("y", "y", -10, 10)
formula_var = ROOT.RooFormulaVar("formula_var", "x+y", ROOT.RooArgList(x, y))
mean = ROOT.RooRealVar("mean", "Mean of Gaussian", 0, -10, 10)
sigma = ROOT.RooRealVar("sigma", "Width of Gaussian", 1, 0.1, 10)
gauss_pdf = ROOT.RooGaussian("gauss_pdf", "Gaussian PDF", formula_var, mean, sigma)
cate_orig = ROOT.RooCategory("cate_orig", "cate_orig")
cate_orig.defineType("cat")
pdf_orig = ROOT.RooSimultaneous("pdf_orig", "Simultaneous PDF", cate_orig)
pdf_orig.addPdf(gauss_pdf, "cat")
mc_orig = ROOT.RooStats.ModelConfig("ModelConfig", ws_orig)
mc_orig.SetPdf(pdf_orig)
mc_orig.SetNuisanceParameters(ROOT.RooArgSet(mean, sigma, y))
ws_orig.Import(mc_orig)
modifier = XMLWSModifier(source={})
rename_map = {'y': 'y_new'}
ws_orig.Print()
```
%% Output
Welcome to JupyROOT 6.26/08
RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby
Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt
[INFO] Set stack size to unlimited
[INFO] Loaded extension module "RooTwoSidedCBShape"
[INFO] Loaded extension module "ResponseFunction"
RooWorkspace(original) original contents
variables
---------
(cate_orig,mean,sigma,x,y)
p.d.f.s
-------
RooGaussian::gauss_pdf[ x=formula_var mean=mean sigma=sigma ] = 1
RooSimultaneous::pdf_orig[ indexCat=cate_orig cat=gauss_pdf ] = 1
functions
--------
RooFormulaVar::formula_var[ actualVars=(x,y) formula="x+y" ] = 0
named sets
----------
ModelConfig_NuisParams:(mean,sigma,y)
generic objects
---------------
RooStats::ModelConfig::ModelConfig
%% Cell type:code id: tags:
```
ws_final1 = ROOT.RooWorkspace('final1')
modifier.rename_variables(mc_orig, ws_final1, rename_map)
ws_final1.Print()
```
%% Output
[INFO] Renamed variables
y -> y_new
RooWorkspace(final1) final1 contents
variables
---------
(cate_orig,mean,sigma,x,y_new)
p.d.f.s
-------
RooGaussian::gauss_pdf[ x=formula_var mean=mean sigma=sigma ] = 1
RooSimultaneous::pdf_orig[ indexCat=cate_orig cat=gauss_pdf ] = 1
functions
--------
RooFormulaVar::formula_var[ actualVars=(x,y_new) formula="x+y" ] = 0
%% Cell type:code id: tags:
```
ws_final2 = ROOT.RooWorkspace('final')
modifier.correcct_formula(ws_orig, ws_final2, rename_map)
modifier.correct_formula(ws_orig, ws_final2, rename_map)
modifier.rename_variables(mc_orig, ws_final2, rename_map)
ws_final2.Print()
```
%% Output
[INFO] Renamed variables
y -> y_new
RooWorkspace(final) final contents
variables
---------
(cate_orig,mean,sigma,x,y_new)
p.d.f.s
-------
RooGaussian::gauss_pdf[ x=formula_var mean=mean sigma=sigma ] = 1
RooSimultaneous::pdf_orig[ indexCat=cate_orig cat=gauss_pdf ] = 1
functions
--------
RooFormulaVar::formula_var[ actualVars=(x,y_new) formula="@0+@1" ] = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment