Previous page

Overview

This page contains a few instructions on how to do quick analysis with CMSSW

On this page:

Useful links

Setting CMSSW

The CMSSW versions are rapidly evolving, the recommendation is to use the most recent version. To get the full versions list run scram list CMSSW

Create a new empty/template plugin

The following lines will build a new analysis plugin. For more information see WorkBookWriteFrameworkModule.

Create the template:

mkedanlzr DemoAnalyzer
cd DemoAnalyzer
scram b -j

It will create ProtonAnalyzer.cc which is the cpp main code

Add python configuration python folder

import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing

options.parseArguments()
process = cms.Process("Demo")

# import of standard configurations
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.load('Configuration.StandardSequences.Services_cff')
process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(100)

process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) )
process.source = cms.Source("PoolSource",fileNames = cms.untracked.vstring(options.inputFiles))

process.demo = cms.EDAnalyzer('DemoAnalyzer')

process.p = cms.Path(process.demo)

Then you can run the analysis using the following command:

  cmsRun $CMSSW_BASE/src/DemoAnalyzer/python/runMe_example.py

Modifying an existing package

check for the latest release and setup CMSSW

SCRAM_ARCH=slc7_amd64_gcc10
scram list CMSSW
cmsrel CMSSW_12_6_X_2022-11-15-2300

Check out the package you need:

git cms-init
git cms-addpkg /Geometry/VeryForwardGeometryBuilder

Create a new branch:

git checkout -b FixTokenTransition_error

Modify the package and commit the changes to our repository

scram build code-format # to update the code following code-format
git add Geometry/VeryForwardGeometryBuilder/plugins/CTPPSGeometryESModule.cc
git commit -m "Fix the mismatch in transition ID for idealGeo"
git push my-cmssw FixTokenTransition_error

Backport to older release

cmsrel CMSSW_10_6_30_patch1
cd CMSSW_10_6_30_patch1/src
git remote add mine git@github.com:your_account/cmssw.git
Synchronize your fork (10_6_X in that case)
git checkout CMSSW_10_6_X
Modify the package and commit the changes to our repository
git add files
git commit -m "some text"
git push mine CMSSW_10_6_X

Modifying an existing package in git (no CMSSW)

check for the package and switch to your own repository

SCRAM_ARCH=slc7_amd64_gcc10
git clone git@github.com:cms-sw/genproductions.git genproductions
cd genproductions
 git remote add mine git@github.com:your_account/genproductions.git

Create a new branch:

git checkout -b BranchName

Modify the package and commit the changes to our repository

python bin/MadGraph5_aMCatNLO/Utilities/parsing_code/parsing.py bin/MadGraph5_aMCatNLO/cards/production/13TeV/GGToTauTau_Inclusive_M_50GeV_TuneCP5_madgraphLO_reweight/GGToTauTau_Inclusive_M_50GeV_TuneCP5_madgraphLO_reweight
git add files
git commit -m "some text"
git push mine BranchName

Producing output file

It is helpful to inspect the new information added to the file after running a process. Add the following lines to your configuration file:

process.out = cms.OutputModule("PoolOutputModule",
       fileName = cms.untracked.string("test_output.root"),
       outputCommands = cms.untracked.vstring("drop *",
            "keep *_*_*_PROCESSTAG",
	),
	compressionAlgorithm = cms.untracked.string('LZMA'),
	compressionLevel = cms.untracked.int32(4),
	dropMetaData = cms.untracked.string('ALL')
    )
process.anal = cms.EndPath(process.out)	

-- MichaelPitt - 2021-05-09

Edit | Attach | Watch | Print version | History: r10 < r9 < r8 < r7 < r6 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r10 - 2023-01-02 - MichaelPitt
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback