alice-rs icon indicating copy to clipboard operation
alice-rs copied to clipboard

Not able to inspect ROOT files

Open marromlam opened this issue 2 years ago • 1 comments

I am trying to read some ROOT files with root-ls but all of them panic. I can inspect your simple.root and some other alice-open-data tuples, but I cannot read mine.

I just for example use uproot to create the following simple tuple

import uproot3 as uproot
import numpy as np

arrs = {
  "var": np.int32([1,1,1,2,2,3])
}

with uproot.recreate("test.root") as rf:
    rf["tree"] = uproot.newtree({k: v.dtype.name for k,v in arrs.items()})
    rf["tree"].extend({k: v for k,v in arrs.items()})

Then I just run

RUST_BACKTRACE=full root-ls test.root inspect

and I get

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(([0, 1], Eof))', /Users/loremorm/.cargo/registry/src/github.com-1ecc6299db9ec823/root-io-0.3.0/src/core/tkey.rs:80:39
stack backtrace:
   0:        0x10a85ebe1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0d1bc6b9a6cb5b34
   1:        0x10a88159b - core::fmt::write::h64ddbe43c958ac83
   2:        0x10a84ffb6 - std::io::Write::write_fmt::h7e453fd0bb915ce8
   3:        0x10a85ad47 - std::panicking::default_hook::{{closure}}::hc0a95f88628ea979
   4:        0x10a85a98c - std::panicking::default_hook::hf67658777aa79be9
   5:        0x10a85b2ec - std::panicking::rust_panic_with_hook::h59a745e8579c1996
   6:        0x10a85f50e - std::panicking::begin_panic_handler::{{closure}}::h77c7cdc59f5a8e41
   7:        0x10a85ed07 - std::sys_common::backtrace::__rust_end_short_backtrace::hc399a88e87a79fbd
   8:        0x10a85ade3 - _rust_begin_unwind
   9:        0x10a89f68f - core::panicking::panic_fmt::h0686ac972197ca01
  10:        0x10a89f765 - core::result::unwrap_failed::hf19da9b6244b79be
  11:        0x10a40f659 - root_io::core::tkey::tkey::hbf501c62fbfd28c1
  12:        0x10a3fc463 - root_ls::main::{{closure}}::hd5c9b0f5a15d2482
  13:        0x10a3e3df4 - tokio::runtime::thread_pool::ThreadPool::block_on::h9ce30a0c020264be
  14:        0x10a3e7201 - tokio::runtime::context::enter::h07a823b06ca40c0c
  15:        0x10a3dbc49 - tokio::runtime::handle::Handle::enter::h4df402bf47480fa2
  16:        0x10a3dc93c - root_ls::main::h010c1be3c80bf1c7
  17:        0x10a3e3ef6 - std::sys_common::backtrace::__rust_begin_short_backtrace::hdb35734b6e8e6c56
  18:        0x10a3f76ac - std::rt::lang_start::{{closure}}::hf40730a20f9f7039
  19:        0x10a84aeb5 - std::rt::lang_start_internal::ha766b113f2bd4ad1
  20:        0x10a3de549 - _main

Are there any special requirements for the ROOT files root-ls can open?

marromlam avatar Jun 27 '22 19:06 marromlam

The ROOT file format is unfortunately quite undocumented. This project was primarily aimed at parsing ALICE's public ESD files which were created with a fairly old ROOT version. It can well be that more recent schemata of ROOT files are incompatible.

cbourjau avatar May 13 '23 09:05 cbourjau