Open mmikhasenko opened 7 months ago
@cburgard @Cornelius-G it took me 40' to figure out how to produce the simplest HS3 file with root Consider including examples somewhere in this repository or elsewhere. I believe, It will speed up the adoption
Leaving notes for anyone trying to look at hs3
go to lxplus
, set up the env to the latest root, open root
ssh lxplus.cern.ch
source /cvmfs/sft.cern.ch/lcg/views/dev3/latest/x86_64-el9-gcc13-opt/setup.sh
root -l
Create and write a gaussian PDF
// create a pdf
RooRealVar x("x","x",-10,10) ;
RooRealVar mean("mean","mean of gaussian", 1,-10,10) ;
RooRealVar sigma("sigma","width of gaussian", 1,0.1,10) ;
RooGaussian gauss("gauss","gaussian PDF", x,mean,sigma) ;
// put it to a workspace RooWorkspace w("ws"); w.import(gauss);
// export with RooJSONFactoryWSTool tool = RooJSONFactoryWSTool(w); auto tool = RooJSONFactoryWSTool(w); tool.exportJSON("test.json")
3. Check the result,
```json
{
"distributions": [
{
"mean": "mean",
"name": "gauss",
"sigma": "sigma",
"type": "gaussian_dist",
"x": "x"
}
],
"domains": [
{
"axes": [
{ "max": 10.0, "min": -10.0, "name": "mean" },
{ "max": 10.0, "min": 0.1, "name": "sigma" },
{ "max": 10.0, "min": -10.0, "name": "x" }
],
"name": "default_domain",
"type": "product_domain"
}
],
"metadata": {
"hs3_version": "0.2",
"packages": [{ "name": "ROOT", "version": "6.33.01" }]
},
"parameter_points": [
{
"name": "default_values",
"parameters": [
{ "name": "x", "value": 0.0 },
{ "name": "mean", "value": 1.0 },
{ "name": "sigma", "value": 1.0 }
]
}
]
}
RooWorkspace.import
page 15 of intro slidesRelated to #4
Hi Misha! Sorry for the inconvenience, and you are absolutely right, we should put an example like this in the top-level of our repo! I'll copy & paste your instructions to a README in the next days (you can do it yourself also if you want to take credit, which you are welcome to do) and merge it to master!
Please provide examples of the complete serialized files, building from a simple to more sophisticated case. It will improve adoption
You can have CI running and saving some root PDFs to examples that can be viewed
"functions"
into a pdf,"analyses"
"likelihoods"