23x = ROOT.RooRealVar(
"x",
"x", -10, 10)
24y = ROOT.RooRealVar(
"y",
"y", 0, 40)
25c = ROOT.RooCategory(
"c",
"c")
26c.defineType(
"Plus", +1)
27c.defineType(
"Minus", -1)
34d = ROOT.RooDataSet(
"d",
"d", {x, y, c})
43 y.setVal(math.sqrt(1.0 * i))
76print(
"\n >> d1 has only columns x,c")
80print(
"\n >> d2 has only column y")
84print(
"\n >> d3 has only the points with y>5.17")
85d3 = d.reduce(
"y>5.17")
88print(
"\n >> d4 has only columns x, for data points with y>5.17")
89d4 = d.reduce({x, c},
"y>5.17")
93print(
"\n >> merge d2(y) with d1(x,c) to form d1(x,c,y)")
98print(
"\n >> append data points of d3 to d1")
108print(
">> construct dh (binned) from d(unbinned) but only take the x and y dimensions, ")
109print(
">> the category 'c' will be projected in the filling process")
117dh = ROOT.RooDataHist(
"dh",
"binned version of d", {x, y}, d)
120yframe = y.frame(Bins=10, Title=
"Operations on binned datasets")
124print(
">> number of bins in dh : ", dh.numEntries())
125print(
">> sum of weights in dh : ", dh.sum(
False))
127print(
">> integral over histogram: ", dh.sum(
True))
132print(
">> retrieving the properties of the bin enclosing coordinate (x,y) = (0.3,20.5) bin center:")
134dh.get({x, y}).
Print(
"v")
135print(
" weight = ", dh.weight())
142print(
">> Creating 1-dimensional projection on y of dh for bins with x>0")
143dh2 = dh.reduce({y},
"x>0")
147dh2.plotOn(yframe, LineColor=
"r", MarkerColor=
"r")
153print(
"\n >> Persisting d via ROOT I/O")
154f = ROOT.TFile(
"rf402_datahandling.root",
"RECREATE")
162c = ROOT.TCanvas(
"rf402_datahandling",
"rf402_datahandling", 600, 600)
163ROOT.gPad.SetLeftMargin(0.15)
164yframe.GetYaxis().SetTitleOffset(1.4)
167c.SaveAs(
"rf402_datahandling.png")
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 type
void Print(GNN_Data &d, std::string txt="")