SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Det. Search
Who's who?
Meetings
FAQ
Images
Archive
Systems
Performance
Intern. region
Vertex Tracker
Drift chamber
DIRC
Calorimeter
IFR
LST
Magnet
Electronics
Trigger
Operations
Run Coordination
Contact Experts
Shift Takers Info
Operations Manual
Electronic Logbook
Ops Hypernews
Shift Signup
Check this page for HTML 4.01 Transitional compliance with the
W3C Validator
(More checks...)

HOWTO Load Bhabha Constants

Sanity checks to do BEFORE loading the new constants - UNDER CONSTRUCTION

An important sanity check is done by looking at the E/p distribution for a certain number of runs with the old and new constants. This section describes how this is done.
The area where the current working release is to be found is
   /nfs/farm/babar/emc_offline/BhabhaQA/release22/  (For Run6 data)
   
Usually, the person who calculates the constants (Heiko in the last few months) communicates to the commissioner the run range used to extract the new constants. In the directory workdir, a file, runList.DDMMMYY, has to be created containing a list of about 20 run numbers taken in the same range, picked from the list of colliding-type runs with more than 100000 events created by the command:
   ir2runs -t Colliding -n 100000 6XXXX-6YYYY
   
To process those runs, one needs to stage the xtc files first and then skim out the bhabha events and run the reconstruction (recoBhabhaEvents script). All this is taken care of by the command:
   foreach j ( `cat runList.DDMMMYY` )
     ./submitBhabhaJobs --run $j --cond22boot 
   end
   
The output is saved in the directory log, the files containing the prefiltered bhabha events are stored in
   /nfs/farm/babar/emc_offline/BhabhaQA/bhabha-hist/myElf-*
   
To see the value of E/p as a function of the run number, we need to run a root macro (you can skip this step right now):
   .L macros/bhacomp.C+ 
   bhacomp("bhabhaQA_DDMMMYY.cfg")
   
where bhabhaQA_DDMMMYY.cfg is created using the command:
   foreach j ( `cat runList.DDMMMYY` )
   foreach? echo "$j /nfs/farm/babar/emc_offline/BhabhaQA/bhabha-hist/myElf-cond22boot-$j.root" >> bhabhaQA_DDMMMYY.cfg
   foreach? end
   
At this point we need to reprocess the prefiltered bhabha events using the new constants. To do that, we need to log on a machine running SunOS on the shire cluster and follow the instructions detailed in the next section, with a few changes:
  1. get the new constants! In recent times, they were found in Heiko's area ~jasper/EmcCal/TempConstfiles/bhabha_DDMMMYY_Infinity_Mu.dbconstants; copy this file into workdir.
  2. edit the file workdir/BdbCondLoadEmc.NewCalibConstLoad.tcl and change the line
    bhabhaCalibFile set "./bhabha_DDMMMYY_Infinity_Mu.dbconstants" to suit your needs.
  3. set OO_FD_BOOT to a test federation using setboot (this command should return the message "set OO_FD_BOOT as /nfs/objyserv07/objy/databases/user1/aruland/7480/BaBar.BOOT")
  4. Now load the constants:
    setenv BDBDEBUG1 cout
    BdbCondLoadEmc BdbCondLoadEmc.NewCalibConstLoad.tcl  |& tee  condLoad.log
    unsetenv BDBDEBUG1
    
  5. Make sure that the loading didn't produce any errors, by reading the logfile produced in the above step. For each crate of the EMC you should see a line Bhabha crate 0 stored. No error messages should appear in the log file.
Now you can run the reconstruction again, on linux or sun machines, using setboot to set OO_FD_BOOT, with the command:
   foreach j ( `cat runList.DDMMMYY` )
     ./recoBhabhaEvents --useTestCDB --run $j --queue kanga 
   end
   
Append the list of root files with the output of the reconstruction to the already created bhabhaQA_DDMMMYY.cfg:
   foreach j ( `cat runList.DDMMMYY` )
   foreach? echo "$j /nfs/farm/babar/emc_offline/BhabhaQA/bhabha-hist/myElf-testCDB_NEW-$j.root" >> bhabhaQA_DDMMMYY.cfg
   foreach? end
   
It is now time to run the root macro:
   .L macros/bhacomp.C+ 
   bhacomp("bhabhaQA_DDMMMYY.cfg")
   
that will create a file plots/bhabhaQA_DDMMMYY.eps. If you like what you see, you can move on to the next section!

Loading constants to a database

Loading constants to the conditions database must be done on SunOS, e.g. on one of the machines in the shire cluster.
  1. Check out a recent-ish test release and the package EmcProxy.
  2. gmake EmcProxy.bin
  3. cp ~wgradl/reldir/EMCcalib/workdir/BdbCondLoadEmc.NewCalibConstLoad.tcl workdir/
    and edit this file, so that the bhabhaCalibFile points to the file with the new constants:
    bhabhaCalibFile set path_to_new_file.
  4. Request the loading of constants by filling out a request form at http://www.slac.stanford.edu/~objysrv/pr/loadCondForm.html.
    Coordinate the loading with the PR people, on OPRsos-hn and condmgmt-hn. They should also give you the new start time for the validity of the constants, to use in the file bhabha_DDMMMMYY_Infinity_Mu.dbconstants
  5. Check which boot file to use for PC1: An up-to-date list is kept at /BFROOT/www/Computing/Distributed/Conditions/bootfiles.html Set OO_FD_BOOT to the correct boot file.
    Alternatively, set OO_FD_BOOT to a test federation: setenv OO_FD_BOOT /nfs/objyserv5/objy/databases/tests/pc1/BaBar.BOOT
  6. Check which partition is the currently active one:
    CdbBrowser config "/emc/CalBankT<CalMSNChan>.EmcBhabhaType[0]"
    
      ---------------------------------------------  ---------  --------------  ---------------------
                    VALIDITY INTERVAL                PARTITION  USING REVISION       REVISION-ID
      ---------------------------------------------  ---------  --------------  ---------------------
            -Infinity       : 3155792400.0000000000      -             -                   -          
      3155792400.0000000000 : 3208320000.0000000000     23            Yes        3290969242.0276418960
      3208320000.0000000000 : 3237177600.0000000000     24            Yes              +Infinity      
      3237177600.0000000000 : 3284697600.0000000000     23            Yes        3290969242.0276418960
      3284697600.0000000000 :       +Infinity           22            Yes              +Infinity      
      ---------------------------------------------  ----------  --------------  ---------------------
    
    The last line shows the currently open partition, in this case 22.
  7. Create a revision for the current constants:
    CdbManager create_revision "/emc/CalBankT<CalMSNChan>.EmcBhabhaType[0]" REVISION "Emc Bhabha Constants" PARTITION
    
    where PARTITION is the partition number of the previous step, and REVISION is something like "before_May_12_2005".
    Repeat this command for each condition /emc/CalBankT<CalMSNChan>.EmcBhabhaType[0] ... /emc/CalBankT<CalMSNChan>.EmcBhabhaType[9]
  8. Now load the constants:
    setenv BDBDEBUG1 cout
    BdbCondLoadEmc BdbCondLoadEmc.NewCalibConstLoad.tcl  |& tee  condLoad.log
    unsetenv BDBDEBUG1
    
  9. Make sure that the loading didn't produce any errors, by reading the logfile produced in the above step. For each crate of the EMC you should see a line Bhabha crate 0 stored. No error messages should appear in the log file.
  10. Create a revision for the fresh constants (see above; use a different, unique revision name)

Verifying integrity of constants

All these instructions are valid for SLAC. I don't know (yet?) if/how things can be verified at a remote site.
  1. Load constants to a test federation as described above (you may omit the creation of revisions, but it doesn't hurt). Currently, a test federation is available via
    setenv OO_FD_BOOT /nfs/objyserv5/objy/databases/tests/pc1/BaBar.BOOT
    If that's not alive, ask Igor Gapenko nicely to set one up, or import a new Conditions DB yourself following the instructions given in HOWTO/HOWTO-database-importing and on the CDB web.
  2. Stage a recent XTC file: tcstage 0054346-001. The XTC file will end up in /nfs/farm/babar/tcfiles/.
  3. Create a minimal tcl snippet myElf.tcl with this contents:
    set ElfConfigPatchSet        Run2
    set ElfHistoFileName         myElf.hbook
    set ElfOutputCollection /work/users/wgradl/test/myelf-collection
    sourceFoundFile  Elf/ElfProduction.tcl
    
  4. Run ElfUserXtcApp over the XTC file:
    ElfUserXtcApp -n 5 -f /nfs/farm/babar/tcfiles/babar-0054346-001.xtc myElf.tcl
    The output should contain no errors and end with a line telling you
    terminating normally after 5 Level 1 Accepts read.

Wolfgang Gradl
Last modified: Thu Mar 2 13:26:31 PST 2006 Gradl