Setting Collections -- May 15, 2000


In this example and the ones that follow, we have used the getdata script to produce tcl code which is invoked in the appropriate script, either interactively or hardwired for batch. getdata is an interface to the much-less-user-friendly colldb. Typing getdata -h will show you all the options for this command, but the ones relevant to the tutorial are:
   workdir> getdata -t <type> -b <first_run> -e <last_run> [-v | -l]
In this tutorial, <type> will be either allevents or kanga.

Option -v produces a file named <type>_<first_run>-<last_run>.tcl which contains a snippet of tcl code to access the appropriate file of data.

Option -l produces a file with the same name, which contains only a list of dataset names, but not the full tcl code. This option can be used if you wish only to learn the names of available runs, and you intend to use those names in some other way.

Here's one way to use them: The scripts bdbMicro.tcl and kanga.tcl are written so that a dataset name can be set into an environment variable, which is then used by the script at run time. The names of the variables are BdbInputCollection and RooInputCollection, respectively. Since environment variables set in your shell are propogated to the batch job shell, you can use this mechanism to run the same code on different runs, without having to keep separate versions of the script around.

To see how this works, you can look inside the script bdbMicro.tcl in your BetaUser directory:

   ...
   # define the input collection
   mod talk BdbEventInput
     if [ info exists env(BdbInputCollection) ] {
	 input add $env(BdbInputCollection)
     } else {
	 echo BdbInputCollection not set, not configuring an input collection
     }
     exit
   ...
So to be specific, to analyze run 12125 from the Objectivity database, type:
   setenv BdbInputCollection /groups/isPhysicsEvents/0001/2100/P8.6.1aV00fb/00012125/cb001/allevents
and to to analyze the same run from the kanga database, type:
   setenv RooInputCollection $BFROOT/kanga/EventStore/groups/isPhysicsEvents/0001/2100/P8.6.1aV00fb/00012125/cb001/K8.6.1bV01/allevents
Note that when you copy the Kanga filename from the file kanga_12125-12125.tcl you must change the string "$env(BFROOT)" to "$BFROOT", and you must remove the suffix "-micro.root" if it exists.

If you want to use this feature, be sure to clone it to any beta script that you write.


Back to the Tutorial