Hugonweb | Cheat Sheet on CMSSW Commands

CMSSWExecutables

CRAB

lxbatch

Setting up a new release with scram shortcuts

To get a release of CMSSW:

$ cmsrel CMSSW_3_2_X

Inside the newly created release's src directory, you can set the runtime variables:

$ cmsenv

Use cvs to get packages:

$ addpkg <subproject>/<package>

Append HEAD or the version (V07-08-29) to get that specific version of the package

Create Templates

These need to be run in the src/ of your release within a subdirectory of that

$ mkskel <name>
$ mkedanlzr [-<template>] <name>
$ mkedprod <name>
$ mkedfltr <name>

The option -list to mkedanlzr lists templates.

Building

$ scramv1 build
#or
$ scramv1 b

Add -jN to use N cores

Running

$ cmsRun <project_cfg>.py

FWLight

FWLight makes using CMSSW like using ROOT

To use, in ROOT:

gSystem->Load("libFWCoreFWLite);
AutoLibraryLoader::enable();

Ready to go!

A nice ROOT style: niceRootStyle

Using Python, ROOT, and FWLite

Similarly,

from PhysicsTools.PythonAnalysis import *
from ROOT import *

gSystem.Load("libFWCoreFWLite.so")
AutoLibraryLoader.enable()

Visualization

To run the normal event visualization software, Fireworks, run:

cmsShow <rootfile.root>

CVS Access

This is the name of the CMSSW CVS server:1

cmssw.cvs.cern.ch:/cvs/CMSSW

You can also access cvs through a web browser at http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/

After you have set up your environment set CVSROOT to this for anonymous access:

export CVSROOT=:pserver:anonymous@cmssw.cvs.cern.ch:/local/reps/CMSSW

You'll need to use cvs login and a password too.

Finding Data

Dataset info: https://twiki.cern.ch/twiki/bin/viewauth/CMS/PVTMain

Use the DBS data discovery page: https://cmsweb.cern.ch/dbs_discovery/ or in a cmsenv'd environment on the command line do:

dbsql "<search terms>"

To find data at UF IHEPA search: find dataset where site = srm.ihepa.ufl.edu

To find your own crab output at UF T2:

lcg-ls -l srm://srmb.ihepa.ufl.edu:8443/srm/v2/server?SFN=/cms/data/store/user/

Just take "/cms/data" off of the front of the filenames to use them in a CMSSW job.

Global Tags

https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideFrontierConditions

Data Formats

RECO Data Formats

This page shows how to access RECO data:

https://twiki.cern.ch/twiki/bin/viewauth/CMS/SWGuideRecoDataTable

Other Data Formats

To find what data and datatypes are accessible, append this to the end of a python config to dump raw events out:

process.FEVT = cms.OutputModule("PoolOutputModule",
        fileName = cms.untracked.string("test.root"),
        outputCommands = cms.untracked.vstring( 
                "keep *"
        )
)

process.outpath = cms.EndPath(process.FEVT)

Running the following command on that output file will print what data is inside:

edmDumpEventContent test.root

List Trigger Algorithms

L1 Trigger Algorithms: https://twiki.cern.ch/twiki/bin/view/CMS/GlobalTriggerAvailableMenus

HLT: https://twiki.cern.ch/twiki/bin/viewauth/CMS/TriggerTables

Config file tricks

To process over multiple runs (Closes Outfiles between every Infile):

process.options = cms.untracked.PSet(
    fileMode = cms.untracked.string('NOMERGE')
)

To suppress the event blah blah blah output

process.load("FWCore.MessageService.MessageLogger_cfi") #You want this always anyway
process.MessageLogger.cerr.threshold = ""
process.MessageLogger.cerr.FwkReport.reportEvery = 1000

To add log message behaviour:2

process.load('FWCore.MessageService.MessageLogger_cfi')
process.MessageLogger.debugModules = ['*']
process.MessageLogger.categories = ['*']
process.MessageLogger.destinations = ['cout']
process.MessageLogger.cout = cms.untracked.PSet(
    threshold = cms.untracked.string('INFO'),
    DEBUG=cms.untracked.PSet(
        limit=cms.untracked.int32(-1)
    ),
    INFO=cms.untracked.PSet(
        limit=cms.untracked.int32(-1)
    ),
    WARNING=cms.untracked.PSet(
        limit=cms.untracked.int32(-1)
    ),
    ERROR=cms.untracked.PSet(
        limit=cms.untracked.int32(-1)
    )
)

For Parallel Generation: cmsswParallelGeneration

For Parallel Analysis: cmsswParallelAnalysis

For Statistics:

process.options = cms.untracked.PSet(
     makeTriggerResults = cms.untracked.bool(True),
     wantSummary = cms.untracked.bool(True)
)

To add more than 255 input file names:34

myfilelist = cms.untracked.vstring()

# add as many files as you wish this way
myfilelist.extend( ['file:myfile1.root','file:myfile2.root'] )
process.source = cms.Source ("PoolSource",
                      fileNames=myfilelist
)

Also, if some files may not be present, this is a file checker for python configs: edmfilechecker

CMSSWEventSetup

Castor Tricks

#To list files:
nsls
#where cms data/mc is stored:
nsls /castor/cern.ch/cms/store/
#to see the path to your home directory:
nsls -d 

It is good to stage in all of your files at once, before an operation. For a single file:

stager_get -M <fullCastorFilename>

Check the staging status with:

stager_qry -M <fullCastorFilename>

You can also use a new line separated list of filenames for both commands with the -f option. If it doesn't work, add the option "-S default"

To use the mega fast XRootD for copying (-R also works for recursive):

xrdcp root://castorcms/castor/cern.ch/<filename> <localFilename>

SE Tricks

cmsLs /store/user/
srmrmdir -recursive srm://srmb.ihepa.ufl.edu:8443/srm/v2/server?SFN=/cms/data/store/user/

Primary Vertices

CMS Sorts the Primary Vertex collections by $\sum (p_{T}^{track})^2$ for tracks associated with that vertex.5 Due to this, the first entry in the collection is most likely the hardest collison.

JSON File Tools

https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideGoodLumiSectionsJSONFile

Printing From lxplus

lp -d <Printer Name> <file to print>

Make sure the file is text/.ps/.pdf

Printer Names

UF HPC

Code must be compiled on the node r11a-s18

A neat link allowing you to change the version of external tools enabled in CMSSW

Location of CMS/CERN Web Resources

DAS Data Aggregation System for searching metadata about datasets, runs, files, blocks, etc.

CMS PREP Website for MC Production Management


  1. https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookComputingConcepts 

  2. https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideMessageLogger 

  3. https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuidePoolInputSources 

  4. https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEDMParametersForModules 

  5. https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideOfflinePrimaryVertexProduction