110 likes | 115 Views
CMSSW Configuration Using python. JTERM II Tutorial Rick Wilkinson. Why python?. Nice, readable syntax Easy to learn Popular Interfaces easily to C++ Through boost::python. Why change?. Job configurations are getting big and complex
E N D
CMSSW Configuration Using python JTERM II Tutorial Rick Wilkinson
Why python? • Nice, readable syntax • Easy to learn • Popular • Interfaces easily to C++ • Through boost::python
Why change? • Job configurations are getting big and complex • Need to easily edit configurations, both by users and by scripts in GRID jobs • In old system, every “replace” functionality had to be coded by hand • Some still missing, such as random access to vectors • We’ve already had to write two systems to convert configurations to python and back.
Downsides? • It doesn’t yet have all the “security features” the old system had, which prevented: • Modifying a variable more than once • Modifying uncloned modules
How are we going to change? • CMSSW_1_9_0 is a closed release • All cfi’s, cff’s, and cfg’s in CVS will be translated to python • Then, during the 2_0_0 cycle, users can switch over
How different is the syntax? • Not very different. It’s based on the old system • process DIGI = { • hcalDigis = HcalDigiProducer { • bool doNoise = true • } • … • Import FWCore.ParameterSet.Config as cms • Process = cms.Process(“DIGI”) • Process.hcalDigis = cms.EDProducer(“HcalDigiProducer”, • doNoise = cms.bool(True) • )
Translation Tools • A tool exists that will translate your file, and automatically translate any files you include.
Sample • The process is the basic object representing the configuration. • import FWCore.ParameterSet.Config as cms • process = cms.Process(“SIM”) • # Input source • process.source = cms.Source("PoolSource", • fileNames = cms.untracked.vstring('file:gen.root') • ) • # Modules • process.load(“Configuration.StandardSequences.VtxSmearedGauss_cff”) • process.load(“SimG4Core.Application.g4SimHits_cfi”) • process.g4SimHits.UseMagneticField = False • # Output • process.load(“Configuration.EventContent.EventContent_cff”) • process.FEVT = cms.OutputModule("PoolOutputModule", • process.FEVTSIMEventContent, • fileName = cms.untracked.string('sim.root') • ) • # Execution paths • process.p1 = cms.Path(process.VtxSmeared+process.g4SimHits)
Modules • Cms.EDFilter, cms.EDProducer, cms.EDAnalyzer, cms.ESSource, cms.Service, cms.ESProducer
Execution Paths • Cms.Sequence, cms.Path, cms.Endpath, cms.Schedule
Including python files • A bit awkward here. Files are included differently, depending on whether you’re in a final configuration file, or a file to be included by others • In your final configuration file, the file that defines the process, other files are included by saying: • process.load(“FWCore.MessageService.MessageLogger_cfi”) • In _cfi.py and _cff.py files, you need to say: • from FWCore.MessageService.MessageLogger_cfi import *