It is a part of a big python program. I’ll try to paste relevant parts:

```
fg = ROOT.TFile("gains.root", "recreate")
tg = ROOT.TTree("tscurves", "SCurves, SPE Spectrum, etc.")
g = ROOT.TGraph()
(pix_x, pix_y, pix, spe_val, spe_p) = (np.zeros(1, dtype=np.int32) for x in xrange(5))
tg.Branch("SCurve", "TGraph", g, 32000, 0)
tg.Branch("first_der", "TGraph", g, 32000, 0)
tg.Branch("sec_der", "TGraph", g, 32000, 0)
tg.Branch("pix_x", pix_x, "pix_x/I")
tg.Branch("pix_y", pix_y, "pix_y/I")
tg.Branch("pix", pix, "pix/I")
tg.Branch("spe_valley", spe_val, "spe_valley/I")
tg.Branch("spe_peak", spe_p, "spe_peak/I")
# Loop through all pixels - different loops depending on shape (type of tree)
for index,val in np.ndenumerate(self.pcd):
[...]
g = ROOT.TGraph(data.size, threshold.astype(np.float64), data.astype(np.float64))
g1 = ROOT.TGraph(first_derivative.size, threshold.astype(np.float64), first_derivative.astype(np.float64))
g2 = ROOT.TGraph(second_derivative.size, threshold.astype(np.float64), second_derivative.astype(np.float64))
tg.SetBranchAddress("SCurve", g)
tg.SetBranchAddress("first_der", g1)
tg.SetBranchAddress("sec_der", g2)
[...]
spe_valley[index] = threshold[ext_flexes[i+1]]
spe_peak[index] = threshold[ext_flexes[i+2]]
spe_val[0] = np.int(spe_valley[index])
spe_p[0] = np.int(spe_peak[index])
print spe_val[0],index,pix_x[0],pix_y[0]
tg.Fill()
fg.Write()
fg.Close()
```

the interesting thing is, that I can read those graphs in Cint.