Hello,
I am beginning research at my university and part of it requires me to use data in a root file. I’m using Windows 10, and I’ve heard that you cannot run Root on a windows machine. Or if there is, then the tutorials I’ve tried have failed.
That being said, how can I extract the data from the root file so that I can use it in say, python, without actually having to install root itself.
Here is the file with the data I need;
skimmed_Cf252_06062014_132_Hitside_eq_zero.root (2.1 MB)
Thank you!
sbinet
November 13, 2018, 3:54pm
2
you have a few options:
use uproot , a pip-installable, pure-python ROOT file reader/writer
use groot , a pure-Go ROOT file reader/writer (disclaimer: I am one of the authors of GoHEP/groot
)
here is what I get, using root-ls
from groot
:
$> root-ls -t /home/binet/Downloads/skimmed_Cf252_06062014_132_Hitside_eq_zero.root
=== [/home/binet/Downloads/skimmed_Cf252_06062014_132_Hitside_eq_zero.root] ===
version: 53400
TTree data data (entries=3166)
event_number "event_number/I" TBranch
raw_event_number "raw_event_number/I" TBranch
npoints "npoints/I" TBranch
time_range "time_range/I" TBranch
time_bin "time_bin[npoints]/I" TBranch
column "column[npoints]/I" TBranch
row "row[npoints]/I" TBranch
tot "tot[npoints]/I" TBranch
sum_tot "sum_tot/I" TBranch
trigger_time "trigger_time/D" TBranch
timestmp_start "timestamp_start[2]/D" TBranch
timestmp_stop "timestamp_stop[2]/D" TBranch
x "x[npoints]/F" TBranch
y "y[npoints]/F" TBranch
z "z[npoints]/F" TBranch
length "length/F" TBranch
energy "energy/F" TBranch
p_energy "p_energy[npoints]/F" TBranch
hitside "hitside/I" TBranch
nedges "nedges/I" TBranch
frac_nhits_edge "frac_nhits_edge/F" TBranch
chi2_ndf "chi2_ndf/F" TBranch
pars "pars[5]/D" TBranch
errs "errs[5]/D" TBranch
impact_pars "impact_pars[4]/F" TBranch
theta "theta/F" TBranch
phi "phi/F" TBranch
theta_fold_90 "theta_fold_90/F" TBranch
phi_fold_90 "phi_fold_90/F" TBranch
and with root-dump
(still from groot
):
$> root-dump /home/binet/Downloads/skimmed_Cf252_06062014_132_Hitside_eq_zero.root | head
>>> file[/home/binet/Downloads/skimmed_Cf252_06062014_132_Hitside_eq_zero.root]
key[000]: data;1 "data" (TTree)
[000][event_number]: 1319
[000][raw_event_number]: 1318
[000][npoints]: 320
[000][time_range]: 5
[000][time_bin]: [4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9]
[000][column]: [46 46 46 46 46 46 46 46 47 46 46 46 46 46 46 47 47 46 47 47 47 47 47 44 44 44 44 45 45 44 44 45 45 44 44 45 45 44 44 45 45 44 44 45 45 44 44 45 45 44 44 45 45 45 43 43 43 43 42 42 43 43 43 43 43 43 43 43 48 48 48 48 48 48 48 48 49 48 48 49 49 48 48 49 49 48 48 49 49 48 48 49 49 48 48 49 49 48 48 49 49 46 46 46 46 46 47 47 47 47 47 47 47 47 47 47 47 46 46 46 46 47 47 46 46 47 47 46 47 44 44 44 45 45 45 45 45 44 44 44 44 45 45 45 45 45 45 43 43 42 42 43 43 42 42 42 42 42 42 42 42 42 43 43 43 43 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 48 48 48 48 48 49 49 49 49 49 49 49 48 48 49 49 48 49 49 46 46 47 47 47 47 46 46 47 47 44 44 45 44 45 45 44 44 44 45 45 45 45 42 43 43 43 42 42 42 42 42 42 43 43 41 41 41 41 50 50 50 50 51 51 51 51 51 51 51 51 51 51 50 50 50 48 48 48 49 49 49 48 48 49 49 48 46 46 47 47 46 47 47 44 44 45 44 45 42 43 43 42 42 43 41 41 41 41 41 41 41 41 41 50 51 51 51 51 51 51 51 51 50 49 49 46 46 47 45 44 43 42 51 51 51 47]
[000][row]: [143 144 145 146 147 148 149 150 149 151 152 153 154 155 156 154 155 157 156 157 158 159 160 139 140 141 142 141 142 143 144 143 144 145 146 145 146 147 148 147 148 149 150 149 150 151 152 151 152 153 154 153 154 155 141 142 143 144 145 146 145 146 147 148 149 150 151 152 145 146 147 148 149 150 151 152 151 153 154 152 153 155 156 154 155 157 158 156 157 159 160 158 159 161 162 160 161 163 164 162 163 138 139 140 141 142 142 143 144 145 146 147 148 150 151 152 153 158 159 160 161 161 162 162 163 163 164 164 165 136 137 138 136 137 138 139 140 155 156 157 158 156 157 158 159 160 161 137 138 139 140 139 140 141 142 143 144 147 148 149 150 151 153 154 155 156 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 140 141 142 143 144 144 145 146 147 148 149 150 165 166 164 165 167 166 167 136 137 138 139 140 141 165 166 166 167 133 134 133 135 134 135 159 160 161 162 163 164 165 135 134 135 136 136 137 138 152 153 154 157 158 144 145 146 147 144 145 146 147 149 156 157 158 159 160 161 162 163 164 166 167 168 137 138 139 141 142 143 168 169 168 169 170 134 135 136 137 167 168 169 131 132 132 162 166 134 132 133 155 156 159 137 138 139 140 141 142 143 148 149 143 148 150 151 152 153 154 155 165 169 140 170 133 168 170 131 163 131 133 146 147 166 135]
[000][tot]: [13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 11 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 11 13 13 13 11 11 12 12 10 9 12 12 12 12 12 12 11 10 10 11 12 13 13 13 13 13 12 13 13 12 13 13 13 13 12 13 13 13 13 13 12 13 12 11 11 12 10 11 10 11 10 9 10 11 11 12 11 12 12 13 13 13 13 13 13 13 13 13 12 11 10 12 11 9 8 10 9 7 8 9 9 10 8 9 10 12 11 10 9 8 8 11 11 9 9 9 9 8 8 6 7 9 9 7 7 8 8 8 7 7 6 6 9 7 7 6 7 7 8 9 9 10 9 8 9 9 8 8 8 8 7 7 7 6 6 7 7 8 9 7 7 8 9 9 10 11 8 6 8 7 6 6 6 6 7 6 7 8 9 6 5 6 5 5 6 5 7 5 6 6 6 5 7 6 5 4 4 5 6 6 4 5 5 4 4 3 5 4 3 3 3 3 4 5 5 6 4 5 5 5 5 5 4 4 4 4 5 4 3 3 4 4 4 5 5 4 3 4 3 2 3 4 4 4 3 4 3 3 4 3 3 3 3 3 4 2 1 2 1 1 2 2 2 2 2 2 2 2 3 3 4 4 4 4 4 2 2 2 1 1 1 1 1 1 1 0 1 2 1 1]
hth,
-s
PS: groot
is installable and tested on Windows.
1 Like
And BTW, you can use ROOT 6 on Windows…