import ROOT
import math
 
 
 
 
 
 
 
    if i % 2:
    else:
 
    
    
    if i < 3:
        print(x, y, c)
 
print("")
 
print("")
 
print("")
 
 
print("\n >> d1 has only columns x,c")
 
print("\n >> d2 has only column y")
 
print("\n >> d3 has only the points with y>5.17")
 
print("\n >> d4 has only columns x, for data points with y>5.17")
 
print("\n >> merge d2(y) with d1(x,c) to form d1(x,c,y)")
 
print("\n >> append data points of d3 to d1")
 
 
 
print(">> construct dh (binned) from d(unbinned) but only take the x and y dimensions, ")
print(">> the category 'c' will be projected in the filling process")
 
 
yframe = 
y.frame(Bins=10, Title=
"Operations on binned datasets")
 
 
print(
">> sum of weights in dh   : ", 
dh.sum(
False))
 
print(
">> integral over histogram: ", 
dh.sum(
True))
 
 
print(">> retrieving the properties of the bin enclosing coordinate (x,y) = (0.3,20.5) bin center:")
 
print(">> Creating 1-dimensional projection on y of dh for bins with x>0")
 
dh2.plotOn(yframe, LineColor=
"r", MarkerColor=
"r")
 
 
 
print("\n >> Persisting d via ROOT I/O")
f = 
ROOT.TFile(
"rf402_datahandling.root", 
"RECREATE")
 
 
 
c = 
ROOT.TCanvas(
"rf402_datahandling", 
"rf402_datahandling", 600, 600)
 
 
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 type
 
void Print(GNN_Data &d, std::string txt="")
 
  RooRealVar::x = -10  L(-10 - 10) 
 RooRealVar::y = 0  L(0 - 40) 
 { {"Minus" , -1}, {"Plus" , 1} }
<class cppyy.gbl.RooRealVar at 0x560d45781b90>
RooRealVar::x = -9.98  L(-10 - 10) 
 RooRealVar::y = 1  L(0 - 40) 
 { {"Minus" , -1}, {"Plus" , 1} }
<class cppyy.gbl.RooRealVar at 0x560d45781b90>
RooRealVar::x = -9.96  L(-10 - 10) 
 RooRealVar::y = 1.41421  L(0 - 40) 
 { {"Minus" , -1}, {"Plus" , 1} }
<class cppyy.gbl.RooRealVar at 0x560d45781b90>
DataStore d (d)
  Contains 1000 entries
  Observables: 
    1)  x = 9.98  L(-10 - 10)  "x"
    2)  y = 31.607  L(0 - 40)  "y"
    3)  c = Plus(idx = 1)
  "c"
 
  1) 0x560d45869360 RooRealVar:: x = 9.98  L(-10 - 10)  "x"
  2) 0x560d4589acf0 RooRealVar:: y = 31.607  L(0 - 40)  "y"
  3) 0x560d45eaf480 RooCategory:: c = Plus(idx = 1)
  "c"
 
  1) 0x560d45869360 RooRealVar:: x = 8  L(-10 - 10)  "x"
  2) 0x560d4589acf0 RooRealVar:: y = 30  L(0 - 40)  "y"
  3) 0x560d45eaf480 RooCategory:: c = Minus(idx = -1)
  "c"
 
 
 >> d1 has only columns x,c
DataStore d (d)
  Contains 1000 entries
  Observables: 
    1)  x = 9.98  L(-10 - 10)  "x"
    2)  c = Plus(idx = 1)
  "c"
 
 >> d2 has only column y
DataStore d (d)
  Contains 1000 entries
  Observables: 
    1)  y = 31.607  L(0 - 40)  "y"
 
 >> d3 has only the points with y>5.17
DataStore d (d)
  Contains 973 entries
  Observables: 
    1)  x = 9.98  L(-10 - 10)  "x"
    2)  y = 31.607  L(0 - 40)  "y"
    3)  c = Plus(idx = 1)
  "c"
 
 >> d4 has only columns x, for data points with y>5.17
DataStore d (d)
  Contains 973 entries
  Observables: 
    1)  x = 9.98  L(-10 - 10)  "x"
    2)  c = Plus(idx = 1)
  "c"
 
 >> merge d2(y) with d1(x,c) to form d1(x,c,y)
DataStore d (d)
  Contains 1000 entries
  Observables: 
    1)  x = 9.98  L(-10 - 10)  "x"
    2)  c = Plus(idx = 1)
  "c"
    3)  y = 31.607  L(0 - 40)  "y"
 
 >> append data points of d3 to d1
DataStore d (d)
  Contains 1973 entries
  Observables: 
    1)  x = 9.98  L(-10 - 10)  "x"
    2)  c = Plus(idx = 1)
  "c"
    3)  y = 31.607  L(0 - 40)  "y"
>> construct dh (binned) from d(unbinned) but only take the x and y dimensions, 
>> the category 'c' will be projected in the filling process
DataStore dh (binned version of d)
  Contains 100 entries
  Observables: 
    1)  x = 9  L(-10 - 10) B(10)  "x"
    2)  y = 38  L(0 - 40) B(10)  "y"
Binned Dataset dh (binned version of d)
  Contains 100 bins with a total weight of 1000
  Observables:     1)  x = 9  L(-10 - 10) B(10)  "x"
    2)  y = 38  L(0 - 40) B(10)  "y"
>> number of bins in dh   :  100
>> sum of weights in dh   :  1000.0
>> integral over histogram:  8000.0
>> retrieving the properties of the bin enclosing coordinate (x,y) = (0.3,20.5) bin center:
  1) 0x560d4713edc0 RooRealVar:: x = 1  L(-10 - 10) B(10)  "x"
  2) 0x560d46fbb460 RooRealVar:: y = 22  L(0 - 40) B(10)  "y"
 weight =  76.0
>> Creating 1-dimensional projection on y of dh for bins with x>0
DataStore dh (binned version of d)
  Contains 10 entries
  Observables: 
    1)  y = 38  L(0 - 40) B(10)  "y"
Binned Dataset dh (binned version of d)
  Contains 10 bins with a total weight of 500
  Observables:     1)  y = 38  L(0 - 40) B(10)  "y"
[#1] INFO:Plotting -- RooPlot::updateFitRangeNorm: New event count of 500 will supersede previous event count of 1000 for normalization of PDF projections
 
 >> Persisting d via ROOT I/O
TFile**     rf402_datahandling.root 
 TFile*     rf402_datahandling.root 
  KEY: RooDataSet d;1   d
  KEY: TProcessID ProcessID0;1   8d897752-b923-11f0-be61-0200590abeef