root-project / root

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

rootls does not seem to print the cycle number information #7053

Closed pcanal closed 3 years ago

pcanal commented 3 years ago

On a hsimple.root with 2 cycles per element we get:

root.exe -b -l copy.root -e 'gFile->ls()' -q

Attaching file copy.root as _file0...
(TFile *) 0x55f09c1bbc50
TFile**         copy.root
 TFile*         copy.root
  KEY: TH1F     hpx;2   This is the px distribution [current cycle]
  KEY: TH1F     hpx;1   This is the px distribution [backup cycle]
  KEY: TH2F     hpxpy;2 py vs px [current cycle]
  KEY: TH2F     hpxpy;1 py vs px [backup cycle]
  KEY: TProfile hprof;2 Profile of pz versus px [current cycle]
  KEY: TProfile hprof;1 Profile of pz versus px [backup cycle]
  KEY: TNtuple  ntuple;1        Demo ntuple

but we get the confusing:

rootls -l copy.root 
TProfile  Jan 15 16:28 2021 hprof   "Profile of pz versus px"
TProfile  Jan 15 16:28 2021 hprof   "Profile of pz versus px"
TH1F      Jan 15 16:28 2021 hpx     "This is the px distribution"
TH1F      Jan 15 16:28 2021 hpx     "This is the px distribution"
TH2F      Jan 15 16:28 2021 hpxpy   "py vs px"
TH2F      Jan 15 16:28 2021 hpxpy   "py vs px"
TNtuple   Jan 15 16:28 2021 ntuple  "Demo ntuple"

It should at least distinguish the [current cycle] vs [backup cycle]

vepadulano commented 3 years ago

I tried to address this in the linked draft PR. The output with the original hsimple.root is

vpadulan@fedorathinkpad-T550 [~/Programs/rootproject/rootinstall/devrelease]: rootls -l tutorials/hsimple.root
TProfile  Mar 16 01:34 2021 hprof;1  "Profile of pz versus px"
TH1F      Mar 16 01:34 2021 hpx;1    "This is the px distribution"
TH2F      Mar 16 01:34 2021 hpxpy;1  "py vs px"
TNtuple   Mar 16 01:34 2021 ntuple;1 "Demo ntuple"

And with the copied hsimple.root with 2 cycles per key

vpadulan@fedorathinkpad-T550 [~/Programs/rootproject/rootinstall/devrelease]: rootls -l copy.root                           
TProfile  Apr 14 16:21 2021 hprof;2  "Profile of pz versus px" [current cycle]
TProfile  Apr 14 16:20 2021 hprof;1  "Profile of pz versus px" [backup cycle]
TH1F      Apr 14 16:21 2021 hpx;2    "This is the px distribution" [current cycle]
TH1F      Apr 14 16:20 2021 hpx;1    "This is the px distribution" [backup cycle]
TH2F      Apr 14 16:21 2021 hpxpy;2  "py vs px" [current cycle]
TH2F      Apr 14 16:20 2021 hpxpy;1  "py vs px" [backup cycle]
TNtuple   Apr 14 16:21 2021 ntuple;2 "Demo ntuple" [current cycle]
TNtuple   Apr 14 16:20 2021 ntuple;1 "Demo ntuple" [backup cycle]

I'm not sure I addressed all possible cases, I'll do some more tests with other files.

vepadulano commented 3 years ago

Let me add here another output from the patched rootls of the linked PR:

vpadulan@fedorathinkpad-T550 [~]: rootls -l https://root.cern/files/tutorials/hsimple.root
TProfile  Apr 14 17:47 2021 hprof;1  "Profile of pz versus px"  
TH1F      Apr 14 17:47 2021 hpx;1    "This is the px distribution"  
TH2F      Apr 14 17:47 2021 hpxpy;1  "py vs px"  
TNtuple   Apr 14 17:47 2021 ntuple;1 "Demo ntuple"  
vpadulan@fedorathinkpad-T550 [~]: rootcp -r https://root.cern/files/tutorials/hsimple.root hsimplecopy.root
vpadulan@fedorathinkpad-T550 [~]: rootcp -r https://root.cern/files/tutorials/hsimple.root hsimplecopy.root
vpadulan@fedorathinkpad-T550 [~]: rootcp -r https://root.cern/files/tutorials/hsimple.root hsimplecopy.root
vpadulan@fedorathinkpad-T550 [~]: rootls -l hsimplecopy.root
TProfile  Apr 17 10:00 2021 hprof;3  "Profile of pz versus px" [current cycle]
TProfile  Apr 17 10:00 2021 hprof;2  "Profile of pz versus px" [backup cycle]
TProfile  Apr 17 10:00 2021 hprof;1  "Profile of pz versus px" [backup cycle]
TH1F      Apr 17 10:00 2021 hpx;3    "This is the px distribution" [current cycle]
TH1F      Apr 17 10:00 2021 hpx;2    "This is the px distribution" [backup cycle]
TH1F      Apr 17 10:00 2021 hpx;1    "This is the px distribution" [backup cycle]
TH2F      Apr 17 10:00 2021 hpxpy;3  "py vs px" [current cycle]
TH2F      Apr 17 10:00 2021 hpxpy;2  "py vs px" [backup cycle]
TH2F      Apr 17 10:00 2021 hpxpy;1  "py vs px" [backup cycle]
TNtuple   Apr 17 10:00 2021 ntuple;3 "Demo ntuple" [current cycle]
TNtuple   Apr 17 10:00 2021 ntuple;2 "Demo ntuple" [backup cycle]
TNtuple   Apr 17 10:00 2021 ntuple;1 "Demo ntuple" [backup cycle]