root-project / root

The official repository for ROOT: analyzing, storing and visualizing big data, scientifically
https://root.cern
Other
2.7k stars 1.28k forks source link

`rootls` improvements #8361

Open Axel-Naumann opened 3 years ago

Axel-Naumann commented 3 years ago

Explain what you would like to see improved

We have a proposal for an improved rootls.

After discussion we decided to implement missing features in rootls - for instance to keep it in Python (platform-independent terminal interaction) and to continue to make the code available to the other command line utilities.

In our usage of rootls, what's missing? Let's collect this in comments below.

Optional: share how it could be improved

See comments below

To Reproduce

See comments below

Setup

ROOT master, please - there are some +/- recent changes.

Axel-Naumann commented 3 years ago

Speed

It's actually surprisingly slow, when listing a couple of histograms. time rootls -l -t ~/build/root/master/rwd17/tutorials/hsimple.root takes 0.7s on a fairly fast machine.

Axel-Naumann commented 3 years ago

Details

It'd be nice to show

@guitargeek what's missing for RooFit classes?

mxxo commented 3 years ago

RNTuple "tree" output

e.g. current output just lists them as opaque objects:

$ rootls -t test80X_NANO_rntuple.root 
ROOT::Experimental::RNTuple  May 27 19:09 2021 Events;1           "object title" 
ROOT::Experimental::RNTuple  May 27 19:09 2021 LuminosityBlocks;1 "object title" 
ROOT::Experimental::RNTuple  May 27 19:09 2021 MetaData;1         "object title" 
ROOT::Experimental::RNTuple  May 27 19:09 2021 ParameterSets;1    "object title" 
ROOT::Experimental::RNTuple  May 27 19:09 2021 Runs;1             "object title" 
TObjString                   May 27 19:09 2021 tag;1              "Collectable string class" 
eguiraud commented 3 years ago
/tmp rootls -t f.root
TTree  Jun 07 21:29 2021 t;2 "t" [current cycle]
  x  "x/I"  138
  Cluster INCLUSIVE ranges:
   - # 0: [0, 1]
  The total number of clusters is 1
TTree  Jun 07 21:29 2021 t;1 "t" [backup cycle]
  x  "x/I"  69
  Cluster INCLUSIVE ranges:
   - # 0: [0, 0]
  The total number of clusters is 1

)

vepadulano commented 3 years ago

To give a bit more context, rootls was even more confusing before addressing #7053 since it was printing multiple namecycles of a objects without stating they were multiple namecycles

Example with ROOT 6.22.08

[~]: rootls -l myfile.root 
TProfile  Jun 12 10:00 2021 hprof   "Profile of pz versus px"
TProfile  Jun 12 10:00 2021 hprof   "Profile of pz versus px"
TH1F      Jun 12 10:00 2021 hpx     "This is the px distribution"
TH1F      Jun 12 10:00 2021 hpx     "This is the px distribution"
TH2F      Jun 12 10:00 2021 hpxpy   "py vs px"
TH2F      Jun 12 10:00 2021 hpxpy   "py vs px"
TNtuple   Jun 12 10:00 2021 ntuple  "Demo ntuple"
TNtuple   Jun 12 10:00 2021 ntuple  "Demo ntuple"

Example with ROOT master@fa3677a8e579e14feb72efaef381ac00514dff77

[~]: rootls -l myfile.root 
TProfile  Jun 12 10:00 2021 hprof;2  "Profile of pz versus px" [current cycle]
TProfile  Jun 12 10:00 2021 hprof;1  "Profile of pz versus px" [backup cycle]
TH1F      Jun 12 10:00 2021 hpx;2    "This is the px distribution" [current cycle]
TH1F      Jun 12 10:00 2021 hpx;1    "This is the px distribution" [backup cycle]
TH2F      Jun 12 10:00 2021 hpxpy;2  "py vs px" [current cycle]
TH2F      Jun 12 10:00 2021 hpxpy;1  "py vs px" [backup cycle]
TNtuple   Jun 12 10:00 2021 ntuple;2 "Demo ntuple" [current cycle]
TNtuple   Jun 12 10:00 2021 ntuple;1 "Demo ntuple" [backup cycle]

I have always found that showing namecycles makes the output much more difficult to understand in general (even with TFile::ls at the prompt). At the same time namecycles are a thing and some users might want to see them, so I'd be inclined to add a specific extra option for that such as --namecycles or -n.

Or one could see it from the other side and say that the current -l option is already the correct one to show multiple namecycles since "longListing" should include every extra detail possible about the objects in the file (including namecycles).

If we go for this route though I would still say that the -t option is a bit confusing since it is effectively a -l option but just for trees.

vpadulan@fedorathinkpad-T550 [~]: rootls -h
[...]
  -l, --longListing  Use a long listing format.
  -t, --treeListing  Print tree recursively and use a long listing format.
eguiraud commented 3 years ago

rootls -t also has a problem with long lines. this is what happens with a file with certain branches that have long names:

image