CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/Configuration/DataProcessing/python/Repack.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 """
00003 _Repack_
00004 
00005 Module that generates standard repack configurations
00006 
00007 """
00008 
00009 import FWCore.ParameterSet.Config as cms
00010 
00011 
00012 def repackProcess(**args):
00013     """
00014     _repackProcess_
00015 
00016     Creates and returns a repack process
00017 
00018     supported options:
00019 
00020     - outputs      : defines output modules
00021 
00022     """
00023     process = cms.Process("REPACK")
00024     process.load("FWCore.MessageLogger.MessageLogger_cfi")
00025 
00026     process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
00027 
00028     process.configurationMetadata = cms.untracked.PSet(
00029         name = cms.untracked.string("repack-config"),
00030         version = cms.untracked.string("none"),
00031         annotation = cms.untracked.string("auto generated configuration")
00032         )
00033 
00034     process.options = cms.untracked.PSet(
00035         Rethrow = cms.untracked.vstring("ProductNotFound","TooManyProducts","TooFewProducts"),
00036         wantSummary = cms.untracked.bool(False)
00037         )
00038 
00039     process.source = cms.Source(
00040         "NewEventStreamFileReader",
00041         fileNames = cms.untracked.vstring()
00042         )
00043 
00044     outputs = args.get('outputs', [])
00045 
00046     if len(outputs) > 0:
00047         process.outputPath = cms.EndPath()
00048 
00049     for output in outputs:
00050 
00051         moduleLabel = output['moduleLabel']
00052         selectEvents = output.get('selectEvents', None)
00053         maxSize = output.get('maxSize', None)
00054 
00055         outputModule = cms.OutputModule(
00056             "PoolOutputModule",
00057             fileName = cms.untracked.string("%s.root" % moduleLabel)
00058             )
00059 
00060         outputModule.dataset = cms.untracked.PSet(dataTier = cms.untracked.string("RAW"))
00061 
00062         if maxSize != None:
00063             outputModule.maxSize = cms.untracked.int32(maxSize)
00064 
00065         if selectEvents != None:
00066             outputModule.SelectEvents = cms.untracked.PSet(
00067                 SelectEvents = cms.vstring(selectEvents)
00068                 )
00069 
00070         setattr(process, moduleLabel, outputModule)
00071 
00072         process.outputPath += outputModule
00073 
00074     return process