SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo CM2 logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews

Using KanCollUtil

The KanCollUtil command allows for simple inspection of the contents of CM2 data collections.

You should find it as part of the release. For example, if your test release is based on 14.3.1:
   myrel/workdir> which KanCollUtil

   /afs/slac.stanford.edu/g/babar/dist/releases/14.3.1/bin/Linux24RH72_i386_gcc2953/KanCollUtil

   myrel/workdir>
otherwise, you can make it by checking out the KanUtils package and linking it.

Usage

   myrel/workdir> KanCollUtil options collection1 collection2 ... collectionN

Available Options for KanCollUtil:
    Default   -L   -P   -e   -f   -h


Usage options

Default behavior

With no options, KanCollUtil returns the number of events in the specified collection(s):
   myrel/workdir> KanCollUtil /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)

Option: -L

The -L option gives the list of 'logical' filenames corresponding to the given collections. For example:
   myrel/workdir> KanCollUtil -L /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)
      LFN 000  /store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.01.root (owned)
      LFN 001  /store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00.02E.root (owned)
Files can be either 'owned' or 'borrowed'. For example, pointer skims will borrow files corresponding to their aod and esd components.

Option: -P

The -P option gives the list of 'physical' filenames corresponding to the given collections. For example:
   myrel/workdir> KanCollUtil -P /store/PR/R12/AllEvents/0002/14/12.3.4e/AllEvents_00021439_12.3.4eV00_C14.2.0bV00

      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
You see that the files for this collection are accessed via xrootd.

Option: -e

The -e option prints the event id for each event in the specified collections. Related options are '-n' and '-s', which specify how many events to print and how many events to skip before printing. For example
   myrel/workdir> KanCollUtil -e -n 10 -s 100 /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)
      EVT 000101  7f:7fffff:1e4e1e/f8ecdce7:G  21439  1052
      EVT 000102  7f:7fffff:1e4e1e/f91e8cbf:J  21439  1052
      EVT 000103  7f:7fffff:1e4e1e/fbc41671:V  21439  1052
      EVT 000104  7f:7fffff:1e4e1e/fbc0b20f:S  21439  1052
      EVT 000105  7f:7fffff:1e4e1e/fcf04f6f:X  21439  1052
      EVT 000106  7f:7fffff:1e4e1f/028b37db:R  21439  1052
      EVT 000107  7f:7fffff:1e4e1f/0ce8fdc3:W  21439  1052
      EVT 000108  7f:7fffff:1e4e1f/0ee41d53:Y  21439  1052
      EVT 000109  7f:7fffff:1e4e1f/111383b3:Q  21439  1052
      EVT 000110  7f:7fffff:1e4e1f/111aadeb:T  21439  1052
gives the usual event id (eg 7f:7fffff:1e4e1f/111aadeb:T), the run number (21439) and the config key (To add: reference to doc of what the config key is)

Option: -f

The -f option gives the collection component information for each event. That is, it gives the LFN for each component for each event. The '-n' and '-s options give the number of events to print and the number of events to skip in this case.
   myrel/workdir> KanCollUtil -f -n 10 -s 1000 /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)
      EVT 001001  hdr=000:1000 tag=000:1000 cnd=000:1000 aod=000:1000 esd=001:1000 
      EVT 001002  hdr=000:1001 tag=000:1001 cnd=000:1001 aod=000:1001 esd=001:1001 
      EVT 001003  hdr=000:1002 tag=000:1002 cnd=000:1002 aod=000:1002 esd=001:1002 
      EVT 001004  hdr=000:1003 tag=000:1003 cnd=000:1003 aod=000:1003 esd=001:1003 
      EVT 001005  hdr=000:1004 tag=000:1004 cnd=000:1004 aod=000:1004 esd=001:1004 
      EVT 001006  hdr=000:1005 tag=000:1005 cnd=000:1005 aod=000:1005 esd=001:1005 
      EVT 001007  hdr=000:1006 tag=000:1006 cnd=000:1006 aod=000:1006 esd=001:1006 
      EVT 001008  hdr=000:1007 tag=000:1007 cnd=000:1007 aod=000:1007 esd=001:1007 
      EVT 001009  hdr=000:1008 tag=000:1008 cnd=000:1008 aod=000:1008 esd=001:1008 
      EVT 001010  hdr=000:1009 tag=000:1009 cnd=000:1009 aod=000:1009 esd=001:1009 
shows that LFN 000 owns the hdr, tag, cnd, and aod components and that LFN 001 owns the esd.

Option: -h

There is also command line help available to see the most up to date set of options. Type 'KanCollUtil -h' to see what it prints.

Adding KanCollUtil 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, you will see
   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.KanCollUtil

   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.KanCollUtil:   (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 KanCollUtil.cc [KanCollUtil.o] [cc-3]
   Linking KanCollUtil 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 KanCollUtil

   ./bin/Linux24RH72_i386_gcc2953/KanCollUtil

   myrel/workdir>