I have written a command line executable that can quickly dump the contents of a root file to the screen w/o having to open a root session. I have placed a tarball of the code in my cern afs space:
One can simply unpack the tarball and issue make and then throw the executable into a bin directory.
Most everything that lsRoot does can be done w/i root cint, I just found some basic things could be done faster on the command line.
i.e. searching for a branch in a ttree w/ lsRoot:
lsRoot -T myfile.root:/someDir/myTree | grep myBranch
or if impatient:
lsRoot -RT myfile.root | grep -i ‘regexp’
(-R recursively search root file, -T TTree::Print(“toponly”))
TH1::GetEntries() on some hist:
lsRoot -N myfile.root:/someDir/*
will print all objects in the specified root directory and include the number of entries. There are many ways to output the information in the root file even user-defined outputs such as:
lsRoot --custom ‘\N\I\A\D\d\h’ -P ‘TPRegexp’ file.root
This last example will print all files that match the regular expression TDirectory/TKey::GetName() specified w/ the -P option and display results as specified w/ the --custom option where in the above example:
This above example can be useful in conjunction w/ the ‘diff’ command to ensure that code cleanup on a large root based project did not affect the output root files.
If the TKey is not of an appropriate class then the above functions simply will not be called. One can also easily print objects in the file (TH1, TCanvas) to a ps(.pdf) file where the user can steer the desired hists w/ the -p/-P rootPath option and further specify how many hists per page. A user can use the --merge option to extract say a set of interesting histograms from a very large root-file and save them into a smaller root file. Where --merge just uses hadd.c code adapted to accept a path to the given hists.
lsRoot --merge keep=mySlimmedFile myLargeFile.root:/dir1/dir2/*
There are many more options available one just needs to start w/ ‘lsRoot --help’ to see all available options. lsRoot supports root recusrion, bash file system traversing, bash file system recursion, does not require root files to end in ‘.root’ (checks the header and ensures file is binary).
To get color formatting and other configurable options copy .lsRoot_colors to $HOME.
Lastly lsRoot will do admittedly silly things such as drawing ascii versions of TH1s and TH2s. This last option was just out of curiosity on my part and is not what I intend lsRoot to be all about.
Hope this can be useful for some.