Using KanFileUtil
The KanFileUtil program can be used to determine properies of
CM2 eventstore root files. Logical file names (LFNs) and
physical file names (PFNs) associated with a particular
collection can be determined using KanCollUtil.
You should find KanFileUtil as part of the release. For
example if your test release is based on 14.3.1
myrel/workdir> which KanFileUtil
/afs/slac.stanford.edu/g/babar/dist/releases/14.3.1/bin/Linux24RH72_i386_gcc2953/KanFileUtil
myrel/workdir>
otherwise, you can make KanFileUtil by checking out the
KanUtils package and linking it.
Usage
KanFileUtil file1 ... fileN
Available Options for KanFileUtil:
    Default  
-L  
-u  
-x  
-k  
-s  
-p  
-m  
-t  
-d  
-h
Usage options
Default behavior
From a collection name, we can derive the list of associated
PFNs using KanCollUtil
myrel/workdir> KanCollUtil -P /store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00
/store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00 (286908 events)
PFN 000 root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
PFN 001 root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.02E.root
PFNs are used by default by KanFileUtil. With no options, KanFileUtil only returns the
PFN that you specified:
myrel/workdir> KanFileUtil root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
Option: -L
If you wish to specify LFNs instead of PFNs when calling KanFileUtil, use the -L option along with the other options specified.
Option: -u
To determine the UUID from a PFN, use the -u option.
myrel/workdir> KanFileUtil -u root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
UUID 16540fba-3265-11d8-8274-8b129b5fb06c
UUID is short for universally unique identifier.
Option: -x
To determine the expected file name extension, use the -x option:
myrel/workdir> KanFileUtil -x root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
EXT .01
(Need to explain this logic..)
Option: -k
The -k option lists the data components present in the specified file
myrel/workdir> KanFileUtil -k root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
COMP HBCA
where, the components are coded as follows:
- H ::: hdr
- U ::: usr
- B ::: tag
- C ::: cnd
- A ::: aod
- T ::: tru
- E ::: esd
- S ::: sim
- R ::: raw
Option: -s
To find out the size of the file, use the -s option
myrel/workdir> KanFileUtil -s root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
SIZE 798090061 bytes
Option: -p
To find out detailed information about the trees present in the specified
files, use the -p option.
myrel/workdir> KanFileUtil -s root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
.......output suppressed
TREE tag tid= 2 cycle= 3 entries= 286908
******************************************************************************
*Tree :tag : BaBar ROOT tree *
*Entries : 286908 : Total = 277762661 bytes File Size = 78191893 *
* : : Tree compression factor = 3.55 *
******************************************************************************
*Br 0 :tag__MetaID : tag__MetaID/i *
*Entries : 286908 : Total Size= 1254037 bytes File Size = 109559 *
*Baskets : 1205 : Basket Size= 1024 bytes Compression= 11.23 *
*............................................................................*
*Br 1 :tag__Eid : *
*Entries : 286908 : Total Size= 29924962 bytes File Size = 4572746 *
*Baskets : 950 : Basket Size= 32768 bytes Compression= 6.54 *
*............................................................................*
*Br 2 :Tag : *
*Entries : 286908 : Total Size= 246583266 bytes File Size = 73422296 *
*Baskets : 7754 : Basket Size= 32768 bytes Compression= 3.36 *
*............................................................................*
......output suppressed
Here, KanFileUtil returns the usual root TTree::Print() printout for each
tree.
Option: -m
To see a printout of the meta-data (reference for details?), use
the -m option.
myrel/workdir> KanFileUtil -m root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
TREE aod tid= 4 cycle= 50 entries= 286908
******************************************************************************
*Tree :aod__Meta : BaBar ROOT tree__Meta *
*Entries : 1 : Total = 294 bytes File Size = 200 *
* : : Tree compression factor = 1.00 *
******************************************************************************
TREE aod__Meta tid= 4 cycle= 2 entries= 1
******************************************************************************
*Tree :aod__Meta : BaBar ROOT tree__Meta *
*Entries : 1 : Total = 294 bytes File Size = 200 *
* : : Tree compression factor = 1.00 *
******************************************************************************
TREE cnd tid= 3 cycle= 14 entries= 286908
******************************************************************************
*Tree :cnd__Meta : BaBar ROOT tree__Meta *
*Entries : 14 : Total = 18071 bytes File Size = 1033 *
* : : Tree compression factor = 1.00 *
******************************************************************************
*Br 0 :Bta_Blocks_NAMES : *
*Entries : 14 : Total Size= 17698 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32768 bytes Compression= 1.00 *
*............................................................................*
TREE cnd__Meta tid= 3 cycle= 15 entries= 14
******************************************************************************
*Tree :cnd__Meta : BaBar ROOT tree__Meta *
*Entries : 14 : Total = 18071 bytes File Size = 1033 *
* : : Tree compression factor = 1.00 *
******************************************************************************
*Br 0 :Bta_Blocks_NAMES : *
*Entries : 14 : Total Size= 17698 bytes One basket in memory *
*Baskets : 0 : Basket Size= 32768 bytes Compression= 1.00 *
*............................................................................*
..... output suppressed
Here again the output is the usual TTree->Print() output, this time
for the meta-data blocks.
Option: -t
For each data component in the file, summary information is available using
the -t option. This option tags either a component name, or 'all' for all
components.
myrel/workdir> KanFileUtil -t aod root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
root://kanolb-a:1094///store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root
TREE aod tid= 4 cycle= 50 entries= 286908
(what is tid?)
Option: -d
To get debug printouts, use the -d option along with any other options.
Option: -h
There is also command line help available to see the most up to date set
of options.
myrel/workdir> KanFileUtil -h
Adding KanFileUtil to your test release
From your test release, check out the KanUtils package. For
example if your test release is based on 14.3.1
myrel> addpkg KanUtils
Offline Release 14.3.1 uses KanUtils version V00-03-09, will check that out
cvs checkout: Updating KanUtils
U KanUtils/GNUmakefile
U KanUtils/KanAccess.cc
U KanUtils/KanBbrRoot.cc
U KanUtils/KanBbrRoot.hh
U KanUtils/KanBkgrConverter.tcl
U KanUtils/KanCollUtil.cc
U KanUtils/KanCopyUtil.cc
U KanUtils/KanFileUtil.cc
U KanUtils/KanFrameApp.cc
U KanUtils/KanFromBdbConverter.tcl
U KanUtils/KanMergeCollections.tcl
U KanUtils/KanRepairFromBdb.tcl
U KanUtils/KanUtils.cc
U KanUtils/KanUtils.hh
U KanUtils/KanUtilsProcs.tcl
U KanUtils/README
U KanUtils/bin_KanAccess.mk
U KanUtils/bin_KanCollUtil.mk
U KanUtils/bin_KanCopyUtil.mk
U KanUtils/bin_KanFileUtil.mk
U KanUtils/bin_KanFrameApp.mk
U KanUtils/bin_KanUtils.mk
U KanUtils/binlist
U KanUtils/link_KanUtils.mk
U KanUtils/mergeExample.tcl
U KanUtils/mergePRExample.tcl
GNU Make version 3.79.1,
Build OPTIONS = Linux24RH72_i386_gcc2953-Debug-native-Objy-Optimize-Fastbuild-Ldlink2-SkipSlaclog-Static-Lstatic
Linux noric11 2.4.20-28slac2.7smp #1 SMP Wed Jan 21 23:01:23 PST 2004 i686 unknown [uname -a]
-> installdirs:
myrel>
Then build the executable
myrel> gmake KanUtils.KanFileUtil
GNU Make version 3.79.1,
Build OPTIONS = Linux24RH72_i386_gcc2953-Debug-native-Objy-Optimize-Fastbuild-Ldlink2-SkipSlaclog-Static-Lstatic
Linux noric11 2.4.20-28slac2.7smp #1 SMP Wed Jan 21 23:01:23 PST 2004 i686 unknown [uname -a]
-> KanUtils.KanFileUtil: (Sat Feb 7 10:13:35 PST 2004)
Making KanUtils.d [cc1]
Making KanBbrRoot.d [cc1]
Making KanFrameApp.d [cc3]
Making KanAccess.d [cc3]
Making KanCopyUtil.d [cc3]
Making KanCollUtil.d [cc3]
Making KanFileUtil.d [cc3]
Compiling KanBbrRoot.cc [libKanUtils.a] [cc-1]
Compiling KanUtils.cc [libKanUtils.a] [cc-1]
Compiling KanFileUtil.cc [KanFileUtil.o] [cc-3]
Linking KanFileUtil in KanUtils [link-1]
/afs/.slac.stanford.edu/package/gcc/i386_linux22/gcc-2.95.3/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/libg2c.a(open.o): In function `f_open':
/u/sf/bartelt/RWPackage/gcc/build/gcc-2.95.3/i686-pc-linux-gnu/libf2c/libI77/../../../../../src/gcc-2.95.3/libf2c/libI77/open.c:213: the use of `tempnam' is dangerous, better use `mkstemp'
myrel>
then you should see it under your bin directory
myrel/workdir> which KanFileUtil
./bin/Linux24RH72_i386_gcc2953/KanFileUtil
myrel/workdir>