CMSSW Tutorial


Grayson Williams
OSU Department of Physics
grayson@mps.ohio-state.edu

CMSSW Basics

  1. Installing

    As a preliminary step, we make sure our environment variables are set, as in the following .cshrc file:

    setenv SCRAM_ARCH slc3_ia32_gcc323
    setenv GROUP_DIR /afs/cern.ch/group/zh
    setenv CMS_SYS i386_linux24
    source /afs/cern.ch/cms/sw/cmsset_default.csh
    source $GROUP_DIR/group_env.csh
    setenv CVSROOT :pserver:anonymous@cmscvs.cern.ch:/cvs_server/repositories/CMSSW
    setenv ROOTSYS /cern/root
    set path=($ROOTSYS/bin $path)
    setenv LD_LIBRARY_PATH /cern/root/lib

    We then set up a new project area:

    $ scramv1 project CMSSW CMSSW_1_1_0
    Creating a developer area based on project CMSSW, version CMSSW_1_1_0
    Getting project release area....
    Checking SCRAM version....

    ...

    Installation procedure complete.
    Developer area located at:

    /home/grayson/CMSSW_1_1_0

    $

    Then we check out the relevant modules:

    $ cd CMSSW_1_1_0/src
    $ cvs co RecoLocalMuon
    cvs checkout: Updating RecoLocalMuon
    cvs checkout: Updating RecoLocalMuon/.admin
    U RecoLocalMuon/.admin/NewLeaf

    ...

    cvs checkout: Updating RecoLocalMuon/doc/html
    U RecoLocalMuon/doc/html/index.html
    U RecoLocalMuon/doc/html/overview.html
    $

    To check out modules from different releases:

    $ cd CMSSW_1_1_0/src
    $ cvs co -r CMSSW_1_0_0 RecoLocalMuon
    cvs checkout: Updating RecoLocalMuon
    cvs checkout: Updating RecoLocalMuon/.admin
    U RecoLocalMuon/.admin/NewLeaf

    ...

    cvs checkout: Updating RecoLocalMuon/doc/html
    U RecoLocalMuon/doc/html/index.html
    U RecoLocalMuon/doc/html/overview.html
    $

    Copy over necessary libraries:
    These can be found at:
    http://cmsdoc.cern.ch/cms/CSC/CERN/dbc_library/ (copy: libcondbc.so)
    http://cmsdoc.cern.ch/CSC/CERN/cscmap_library/ (copy: libcscmap.so)

    These must be placed in the CMSSW_1_1_0/lib/slc3_ia32_gcc323/ area (replace 1_1_0 with your version number).

  2. Compiling and Running Modules

    Change to relevant directory and set environment:

    The "relevant directory" is the one containing BuildFile. It's usually found in either the project directory itself (ie CSCSegment), or in a subdirectory called test/

    $ cd /home/grayson/CMSSW_1_1_0/src/RecoLocalMuon/CSCSegment/
    $

    Compiling:
    Note: if you are on a 64-bit machine (ie cmsosu001), you must do this:

    $ cp ~/64Hack ~/CMSSW_1_1_0/config/Buildfile
    $ scramv1 b -r
    Resetting caches
    Parsing BuildFiles
    ..............

    Entering Package RecoLocalMuon/CSCSegment

    ...

    Copying tmp/slc3_ia32_gcc323/src/RecoLocalMuon/CSCStandAlone/test/libtestRecHitComp.so to productstore area:
    @@@@ Checking shared library for missing symbols:
    @@@@ ----> OK, shared library FULLY-BOUND (no missing symbols)
    @@@@ Checking SEAL plugin:
    @@@@ ----> OK, SEAL plugin loaded successfully --
    --- Registered SEAL capabilities plugin testRecHitComp
    87.390u 37.830s 2:19.36 89.8% 0+0k 0+0io 823088pf+0w
    $


    For a 32-bit machine, the following procedure applies:

    $ scramv1 b
    Resetting caches
    Parsing BuildFiles
    ..............

    Entering Package RecoLocalMuon/CSCSegment

    ...

    Copying tmp/slc3_ia32_gcc323/src/RecoLocalMuon/CSCStandAlone/test/libtestRecHitComp.so to productstore area:
    @@@@ Checking shared library for missing symbols:
    @@@@ ----> OK, shared library FULLY-BOUND (no missing symbols)
    @@@@ Checking SEAL plugin:
    @@@@ ----> OK, SEAL plugin loaded successfully --
    --- Registered SEAL capabilities plugin testRecHitComp
    87.390u 37.830s 2:19.36 89.8% 0+0k 0+0io 823088pf+0w
    $

    Running:

    Special instructions for running a module, if necessary, can be found in a file entitled README in the directory containing the relevant .cfg file. The configuration file has the extension .cfg and can be found in the test/ directory.

    $ eval `scramv1 runtime -csh` $ cmsRun nicole.cfg >& nicole.out
    $

    Development Under CMSSW

    1. Adding a new module

      We assume that the source file already exists, and add it to the BuildFile:

      ----- add this part -----

      <library file=Sample.cc name=Sample>
      <flags SEAL_PLUGIN_NAME="Sample">
      </library>

      ----- end of addition -----

      Note: the source file must include a line like the following at the end:

      DEFINE_FWK_MODULE(Sample)

      We now write a configuration file which will actually serve as the argument to execute the module. This contains parameters used by the module.

      ----- begin configuration file -----

      process TEST = {
      source = PoolConvert {
      untracked vstring fileNames ={"file:/home/ippolito/globaldaq/00000282_FilterUnitFramework_0_2.root"}
      untracked int32 maxEvents = 500
      }


      module Sample=Sample{ }



      path p = {Sample}
      }

      ----- end configuration file -----

      The PoolConvert section contains parameters that are accessed from the code as follows:
      ----- code snippet -----

      string theMappingFile = pset.getParameter<std::string>("theMappingFile");

      ----- end of code snippet -----

    Troubleshooting CMSSW and Miscellany

    1. Steps to fix errors

      CMSSW includes several commands to help fix itself, such as the following:

      $ scramv1 b clean
      $

      If the above did not work, then the next option is to attempt to clean up manually:

      $ cd ~/CMSSW_1_1_0/tmp/slc3_ia32_gcc323
      $ rm -r src/
      $

      Finally, if all else fails, downloading/compiling/installing a newer or stable release of CMSSW may resolve your issues.

    2. Accessing CASTOR

      CASTOR is CERN's protocol for remote file access, similar to rcp.
      To list directory contents:

      $ rfdir /castor/cern.ch/cms/store/unmerged/RelVal/2006/7/18/
      $

      To copy remote files:

      $ rfcp /castor/cern.ch/cms/store/unmerged/RelVal/2006/7/18/RelVal080Higgs-ZZ-4E/GEN-SIM-DIGI-RECO/0005/00CE7FF5-8216-DB11-9AA1-0030485618DE.root reco.root
      $

      To access CASTOR files from .cfg files (note the single quotes):

      untracked vstring fileNames = {'castor:/castor/cern.ch/cms/MTCC/data/00004047/A/mtcc.00004047.A.testStorageManager_0.60.root'}

    3. Useful Links

      Jeremy Mans' CMSSW Tutorial (PDF): http://jmans.web.cern.ch/jmans/cms/CMSSW_Tutorial_0_4_1.pdf
      Further CMSSW Tutorials: http://indico.cern.ch/conferenceDisplay.py?confId=a057880
      Jason Gilmore's homepage: http://www.physics.ohio-state.edu/~gilmore/mylinks.html
      MTCC File listing @FNAL: http://nippon.fnal.gov/lpc1/cmsroc/MTCC/check_mtcc/
      CMS Runs summary: http://www.uscms.org/LPC/lpc_roc/cms_runs.html
      July 2006 CMS Week Tutorials: https://twiki.cern.ch/twiki/bin/view/CMS/July06CMSweekTutorials
      CMSSW Documentation/Class Listing: http://cmsdoc.cern.ch/cms/sw/slc3_ia32_gcc323/cms/cmssw/CMSSW_1_1_0_pre4/doc/html/classes.html
      CMSSW CVS browser: http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/?cvsroot=CMSSW