/cms:cmsswfrom cms
Helps set up and work inside CMSSW release areas (cmsrel, cmsenv, scram), choose releases/architectures for datasets, run old releases in containers, check out/patch packages with git cms-addpkg/merge-topic, write/build EDAnalyzer/EDProducer/EDFilter modules, debug cmsRun Python configs, and inspect EDM ROOT files with edm* tools.
Ships in cms. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
CMSSW is the CMS software framework: C++ modules plugged into an event loop,
wired together by Python configuration files and run with cmsRun. Releases
are pre-built on CVMFS. A user only creates a lightweight developer area that
points at a release, adds packages to src/, and builds them with scram.
Use this skill for the release/area/build/config mechanics. For dataset lookup
(DAS), grid submission (CRAB) or NanoAOD-level columnar analysis, use the
dedicated skills when they exist instead of driving them through cmsRun.
cmsenv/scram errorsBuildFile.xmlcmsRun configuration| Term | Meaning |
|---|---|
| Release | CMSSW_<major>_<minor>_<patch>, e.g. CMSSW_15_0_21; installed read-only under /cvmfs/cms.cern.ch/ |
SCRAM_ARCH | <os>_<cpu>_<compiler>, e.g. el9_amd64_gcc12; a release exists only for specific archs |
| Developer area | CMSSW_X_Y_Z/ made by cmsrel; your code lives in src/<Subsystem>/<Package>/ |
$CMSSW_BASE | Your developer area; $CMSSW_RELEASE_BASE is the CVMFS release it overlays |
cmsenv | Shell function: eval $(scramv1 runtime -sh); sets PATH, PYTHONPATH, LD_LIBRARY_PATH for the area |
| Process / Path | A config builds one cms.Process; cms.Path lists modules to run in order |
| Module types | EDAnalyzer (read-only), EDProducer (adds products), EDFilter (can stop a Path), Source, Service |
| Product label | module:instance:process, e.g. slimmedMuons::PAT; referenced via cms.InputTag |
_cfg.py/_cfi.py/_cff.py | Top-level config / one module's defaults / a reusable config fragment |
| Data tiers | RAW → RECO → AOD → MiniAOD → NanoAOD (flat ntuple, usually read without CMSSW) |
Energies and momenta in CMS data formats are in GeV.
Never assume a release. Resolve it in this order, and state which one you used:
CMSSW_14_0_15, or shorthand 14_0_15).echo $CMSSW_VERSION $SCRAM_ARCH
(empty if cmsenv has not been run).ls -d CMSSW_*/), its README or CI, or the release that produced the input
data (dasgoclient -query="release dataset=<dataset>").Release numbers in this skill (CMSSW_15_0_21) are only the versions the
examples were tested with. Substitute the chosen release everywhere.
scripts/setup-release.sh creates an area for any
release. It picks SCRAM_ARCH (a host-OS build if one exists, else the
production arch from /cvmfs/cms.cern.ch/releases.map), reports whether a
cmssw-elX container is needed, and can carry code over from an old area:
S=<skill-dir>/scripts/setup-release.sh
$S CMSSW_14_0_15 --list # archs it is built for; production arch marked
$S CMSSW_14_0_15 --dir ~/nobackup/work # create the area (prints KEY=VALUE lines)
$S CMSSW_10_6_30 --dry-run # -> SCRAM_ARCH=slc7_amd64_gcc700, CONTAINER=cmssw-el7
$S CMSSW_15_0_21 --from ../CMSSW_15_0_20 # switch release: new area + copy src/ (no .git)
$S CMSSW_15_0_21 --prod # force the production arch (exact reproduction)
Run the printed ENV_CMD to cmsenv and work in the new area, then
scram b -j 8. Exit codes: 3 means release/arch not found, 4 means the area
already exists. Old areas are never modified, so switching back is just cd
plus cmsenv in the old area.
The same thing by hand, for a host-native release:
source /cvmfs/cms.cern.ch/cmsset_default.sh # defines cmsrel, cmsenv, scram
cmsrel CMSSW_15_0_21 # = scram project CMSSW CMSSW_15_0_21
cd CMSSW_15_0_21/src
cmsenv # re-run in every new shell
cmsrel uses the current SCRAM_ARCH (host default, e.g. el9_amd64_gcc12).
Use scram -a <arch> project CMSSW <release> for another arch, and
scram project -n <dir> CMSSW <release> to choose the directory name.
On an EL9 host, releases built only for slc7_* or el8_* must run in a
container. cmssw-el6/el7/el8/el9 (in /cvmfs/cms.cern.ch/common) start
apptainer. setup-release.sh prints the exact command; by hand:
cmssw-el7 -B /uscms_data -- 'cd ~/nobackup/CMSSW_10_6_30/src \
&& export SCRAM_ARCH=slc7_amd64_gcc700 && cmsenv && scram b -j 4'
cmssw-el7 # or: interactive shell, then set up as usual
On cmslpc, /uscms_data (nobackup) is only visible inside with
-B /uscms_data. See
releases-and-containers.md for the
era → release → arch table and container details.
Run in a fresh, empty src/ before creating your own packages:
git cms-init # one-time: sets up git in src/
git cms-addpkg PhysicsTools/NanoAOD # sparse-checkout just this package
git cms-merge-topic <github-user>:<branch> # or a PR number: git cms-merge-topic 12345
scram b -j 8
Browse code on https://github.com/cms-sw/cmssw on the branch matching your
release cycle (e.g. CMSSW_15_0_X), not master.
mkdir -p Demo && cd Demo
mkedanlzr DemoAnalyzer # also: mkedprod, mkedfltr, mkesprod
cd DemoAnalyzer && scram b -j 8
Read data through tokens registered in the constructor and use
iEvent.get(token). Declare every dependency in plugins/BuildFile.xml.
Define fillDescriptions and scram generates an importable _cfi
(from Demo.DemoAnalyzer.demoAnalyzer_cfi import demoAnalyzer). A complete,
tested analyzer, BuildFile, and config is in
edanalyzer-walkthrough.md.
import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.VarParsing import VarParsing
options = VarParsing("analysis") # gives inputFiles, outputFile, maxEvents
options.parseArguments()
process = cms.Process("Demo")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(options.maxEvents))
process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(options.inputFiles))
process.TFileService = cms.Service("TFileService", fileName=cms.string(options.outputFile))
from Demo.DemoAnalyzer.demoAnalyzer_cfi import demoAnalyzer
process.demo = demoAnalyzer.clone(minPt=10.0)
process.p = cms.Path(process.demo)
python3 demo_cfg.py # syntax check only
edmConfigDump demo_cfg.py > dumped_cfg.py # fully expanded config
cmsRun demo_cfg.py inputFiles=root://cmsxrootd.fnal.gov//store/... maxEvents=1000
cmsRun -n 4 demo_cfg.py ... # 4 threads
Use inputFiles_load=files.txt (one file per line) for long file lists.
edmFileUtil <file> # events, lumis, runs, size
edmDumpEventContent <file> # type / module / instance / process
edmEventSize -v <file> | head -20 # per-branch size, largest first
edmProvDump <file> # configs that produced the file
Details and output examples: edm-file-tools.md.
scram-venv && cmsenv # once per area: creates $CMSSW_BASE/venv
export PYTHONNOUSERSITE=1
pip3 install <pkg> # lands in the area's venv, not ~/.local
scram tool list | grep -i onnx # check first: many packages already ship
cmsenv is per shell. Batch and CRAB jobs, new terminals and
cmssw-elX containers all need source cmsset_default.sh + cmsenv again.not available for arch el9_amd64_gcc12): the release
is not built for your SCRAM_ARCH. Run setup-release.sh <release>, which
picks the arch and container. By hand: ls -d /cvmfs/cms.cern.ch/*/cms/cmssw*/<release>,
export SCRAM_ARCH=..., and use the matching cmssw-elX container.git cms-addpkg fails with "destination path ... already exists": it
needs an empty src/ for git cms-init. Create the area, check out
packages first, then add your own code.~/.local shadows CMSSW Python. Anything installed with
pip install --user for the same Python version overrides CMSSW's packages
and causes errors like cannot import name 'version' from 'packaging'.
Export PYTHONNOUSERSITE=1 and use scram-venv.VarParsing("analysis") renames the output. Setting maxEvents makes
outputFile=hists.root become hists_numEvent1000.root. Glob for it or
register your own option.scram b after touching
.cc, .h or BuildFile.xml. scram b in src/ builds everything; inside
a package it builds only that package.<use name=...> in BuildFile.xml shows up as undefined
symbols at link time or a plugin load failure at runtime.mkedanlzr writes plugins/ plus Catch2 tests in test/. It no
longer writes python/ConfFile_cfg.py, so write the _cfg.py yourself.iEvent.get(token), not getByLabel. Every product must be declared
with consumes<>() in the constructor or the framework throws.one:: modules serialize. edm::one::EDAnalyzer with SharedResources
(needed for TFileService) does not run concurrently. Prefer edm::global
or edm::stream modules for heavy work in multithreaded jobs.CMSSW_7_6_7
(slc6/slc7) and 2016 uses CMSSW_10_6_30 (slc7). Both need
cmssw-el7 on EL9. Long vstring lists are fine in Python 3; the old
255-argument limit no longer applies.TFileService, its BuildFile.xml, a _cfg.py and the run commands, all
tested on CMSSW_15_0_21.--help for options.SCRAM_ARCH for a data era, finding the latest
release or what changed between releases (release notes), or when a release
won't set up on the host OS.git cms-*): https://cms-sw.github.io/tutorial.htmlWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub cms-ml/marketplace --plugin cms10 skills in this plugin
/analysis-spec-builderUse when a user wants to plan, scope or write down a CMS physics analysis or plotting task before coding it: creating or updating an analysis specification, turning a quick request ("plot the dimuon mass in 2016 data vs DY", "find the best trijet in ttbar") into a structured document, listing datasets, triggers, selections, histograms, corrections and statistical treatment, or producing a specification.md for later implementation./awkward-arrayUse when working with jagged or variable-length arrays in Python with Awkward Array 2 (import awkward as ak): reading CMS NanoAOD or other ROOT ntuples into arrays with uproot, building per-object records with ak.zip, selecting objects or events with masks, counting with ak.num or ak.count, pairing objects with ak.combinations or ak.cartesian (dilepton masses, deltaR, jet cleaning), taking the leading object or argmax per event, following NanoAOD index branches such as Jet_muonIdx1, flattening for histograms, writing Parquet or JSON, or debugging awkward errors such as "cannot slice", "index out of range" or None values appearing in results./combineUse when working with CMS Combine (HiggsAnalysis-CombinedLimit): writing or debugging a datacard or physics model, choosing or running a Combine method (AsymptoticLimits, FitDiagnostics, MultiDimFit, HybridNew, Significance, GoodnessOfFit, ChannelCompatibilityCheck, Impacts), interpreting Combine output, explaining a Combine error message or warning, asking how or why Combine does something, or running a Combine command (combine, text2workspace.py, combineCards.py, combineTool.py) to reproduce, diagnose or confirm a result.Other plugins' skills for the same job