In [115]:
import matplotlib.pyplot as plt
import pandas as pd
import ROOT

import comptools

%matplotlib inline

In [86]:
f = ROOT.TFile('/home/jbourbeau/datachallenge/capitals/Austin.root')

In [87]:
tree = f.Get('tinyTree')

In [113]:
for i, entry in enumerate(tree):  
    if i > 10: continue
    print(entry.qtot)


356.584742248
5200.75459255
3707.03822652
14337.8226836
3670.35376042
501.93676228
324.81745515
311.172662534
170.087406494
476.674317218
356.258686781

In [76]:
for event in tree:
    s125 = event.GetBranch("s125")
    for x in s125:
        print(x)



TypeErrorTraceback (most recent call last)
<ipython-input-76-6f6f8abe88f1> in <module>()
      1 for event in tree:
      2     s125 = event.GetBranch("s125")
----> 3     for x in s125:
      4         print(x)

TypeError: 'TBranch' object is not iterable

In [39]:
branches = tree.GetListOfBranches()

In [45]:
branches.GetEntries()


Out[45]:
36

In [48]:
for branch in branches:
    print(branch)


<ROOT.TBranch object ("s125") at 0x3c069c0>
<ROOT.TBranch object ("s70") at 0x3c14870>
<ROOT.TBranch object ("s150") at 0x3c14ed0>
<ROOT.TBranch object ("beta") at 0x3c15530>
<ROOT.TBranch object ("zenith") at 0x3c15b90>
<ROOT.TBranch object ("azimuth") at 0x3c16210>
<ROOT.TBranch object ("x") at 0x3c16870>
<ROOT.TBranch object ("y") at 0x3c16ed0>
<ROOT.TBranch object ("z") at 0x3c17530>
<ROOT.TBranch object ("itsiz") at 0x3c17b90>
<ROOT.TBranch object ("iisiz") at 0x3c181f0>
<ROOT.TBranch object ("eloss_1500") at 0x3c18850>
<ROOT.TBranch object ("eloss_1800") at 0x3c18ee0>
<ROOT.TBranch object ("eloss_2100") at 0x3c19570>
<ROOT.TBranch object ("eloss_2400") at 0x3c19c00>
<ROOT.TBranch object ("stoch_energy") at 0x3c1a290>
<ROOT.TBranch object ("rel_stoch_energy") at 0x3c1a920>
<ROOT.TBranch object ("chi2") at 0x3c1b040>
<ROOT.TBranch object ("chi2_red") at 0x3c1b6a0>
<ROOT.TBranch object ("stoch_depth") at 0x3c1bd30>
<ROOT.TBranch object ("n_he_stoch") at 0x3c1c3c0>
<ROOT.TBranch object ("fit_status") at 0x3c1d7e0>
<ROOT.TBranch object ("time_start_mjd_sec") at 0x3c1dd30>
<ROOT.TBranch object ("time_start_mjd_ns") at 0x3c1e340>
<ROOT.TBranch object ("time_start_mjd_day") at 0x3c1ea60>
<ROOT.TBranch object ("eloss_1500_red") at 0x3c1f070>
<ROOT.TBranch object ("stoch_energy2") at 0x3c1f700>
<ROOT.TBranch object ("rel_stoch_energy2") at 0x3c1fd90>
<ROOT.TBranch object ("chi2_red2") at 0x3c204b0>
<ROOT.TBranch object ("stoch_depth2") at 0x3c20b40>
<ROOT.TBranch object ("n_he_stoch2") at 0x3c211d0>
<ROOT.TBranch object ("fit_status2") at 0x3c21750>
<ROOT.TBranch object ("eloss_1500_red2") at 0x3c21cd0>
<ROOT.TBranch object ("mc_weight") at 0x3c223c0>
<ROOT.TBranch object ("nch") at 0x3c22a50>
<ROOT.TBranch object ("qtot") at 0x3c22fa0>

In [49]:
s125 = tree.GetBranch("s125")

In [70]:
entries = s125.GetEntries()

In [71]:
entries


Out[71]:
79601L

In [119]:
with pd.HDFStore('Austin.hdf') as store:
    df = store['dataframe']
    print(df['eloss_1500'])


0          10.189508
1         100.219352
2          56.107415
3         118.855038
4         106.997481
5          11.719190
6           7.191623
7          11.704896
8           9.268654
9          24.702419
10         23.963756
11         59.234973
12         15.261914
13          5.974693
14          2.959281
15          7.683626
16         36.193535
17          9.171871
18         20.949944
19          4.445178
20          8.382910
21         20.556247
22          8.829039
23        328.498698
24         80.497537
25         24.733308
26         44.444235
27         40.748660
28         43.975991
29        192.664639
            ...     
79571     352.651419
79572     371.835915
79573     444.304456
79574     438.955752
79575     996.210312
79576     765.365379
79577    2522.453677
79578    1306.619466
79579    3039.137123
79580     111.189924
79581     101.372015
79582     128.697339
79583     621.518575
79584     273.252798
79585     486.016494
79586     503.254654
79587     829.797833
79588    1477.368119
79589    1434.897960
79590      46.729799
79591      61.274992
79592      55.672644
79593     136.338062
79594     124.381959
79595     161.762882
79596     132.877938
79597     151.873957
79598     268.061723
79599     327.000059
79600     390.025232
Name: eloss_1500, dtype: float64

In [ ]: