Skip to content

Commit

Permalink
groot/{rdict,rhist,rvers}: add initial read support for TF1 and TFormula
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastien Binet <binet@cern.ch>
  • Loading branch information
sbinet committed Jan 31, 2022
1 parent d8d3eb5 commit fa6827e
Show file tree
Hide file tree
Showing 11 changed files with 1,543 additions and 0 deletions.
3 changes: 3 additions & 0 deletions groot/gen.rboot.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ var (

// rhist
"TAxis",
"TF1",
"TF1AbsComposition", "TF1Convolution", "TF1NormSum", "TF1Parameters",
"TFormula",
"TGraph", "TGraphErrors", "TGraphAsymmErrors",
"TH1", "TH1C", "TH1D", "TH1F", "TH1I", "TH1K", "TH1S",
"TH2", "TH2C", "TH2D", "TH2F", "TH2I", "TH2Poly", "TH2PolyBin", "TH2S",
Expand Down
10 changes: 10 additions & 0 deletions groot/rcmd/dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,16 @@ func TestDump(t *testing.T) {
name: "../testdata/ndim-slice.root",
want: loadRef("testdata/ndim-slice.root.txt"),
},
{
name: "../testdata/tformula.root",
want: `key[000]: func1;1 "[0] + [1]*x" (TF1) => "TF1{Formula: TFormula{[p0]+[p1]*x}}"
key[001]: func2;1 "func2" (TF1) => "TF1{Params: TF1Parameters{Values: [10 20], Names: [p0 p1]}}"
key[002]: func3;1 "func3" (TF1) => "TF1{Params: TF1Parameters{Values: [1 -0.3 0 1], Names: [p0 p1 p2 p3]}}"
key[003]: func4;1 "func4" (TF1) => "TF1{Params: TF1Parameters{Values: [0 0 0 0 0 0], Names: [p0 p1 p2 p3 p4 p5]}}"
key[004]: fconv;1 "" (TF1Convolution) => "TF1Convolution{Func1: TF1{Formula: TFormula{exp([Constant]+[Slope]*x)}}, Func2: TF1{Formula: TFormula{[Constant]*exp(-0.5*((x-[Mean])/[Sigma])*((x-[Mean])/[Sigma]))}}}"
key[005]: fnorm;1 "" (TF1NormSum) => "TF1Convolution{Funcs: []{TF1{Formula: TFormula{[p0]+[p1]*x}}, TF1{Params: TF1Parameters{Values: [10 20], Names: [p0 p1]}}}, Coeffs: [10 20]}"
`,
},
} {
t.Run(tc.name, func(t *testing.T) {
got := new(strings.Builder)
Expand Down
Loading

0 comments on commit fa6827e

Please sign in to comment.