Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-26 03:55:53

0001 #!/usr/bin/env python3
0002 """
0003 _Repack_
0004 
0005 Module that generates standard repack configurations
0006 
0007 """
0008 import copy
0009 import FWCore.ParameterSet.Config as cms
0010 from Configuration.EventContent.EventContent_cff import RAWEventContent
0011 
0012 
0013 def repackProcess(**args):
0014     """
0015     _repackProcess_
0016 
0017     Creates and returns a repack process
0018 
0019     supported options:
0020 
0021     - outputs      : defines output modules
0022 
0023     """
0024     process = cms.Process("REPACK")
0025     process.load("FWCore.MessageLogger.MessageLogger_cfi")
0026 
0027     process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
0028 
0029     process.configurationMetadata = cms.untracked.PSet(
0030         name = cms.untracked.string("repack-config"),
0031         version = cms.untracked.string("none"),
0032         annotation = cms.untracked.string("auto generated configuration")
0033         )
0034 
0035     process.options = cms.untracked.PSet(
0036         Rethrow = cms.untracked.vstring("ProductNotFound","TooManyProducts","TooFewProducts"),
0037         wantSummary = cms.untracked.bool(False)
0038         )
0039 
0040     process.source = cms.Source(
0041         "NewEventStreamFileReader",
0042         fileNames = cms.untracked.vstring()
0043         )
0044 
0045     outputs = args.get('outputs', [])
0046 
0047     if len(outputs) > 0:
0048         process.outputPath = cms.EndPath()
0049 
0050     for output in outputs:
0051 
0052         moduleLabel = output['moduleLabel']
0053         selectEvents = output.get('selectEvents', None)
0054         maxSize = output.get('maxSize', None)
0055 
0056         outputModule = cms.OutputModule(
0057             "PoolOutputModule",
0058             compressionAlgorithm=copy.copy(RAWEventContent.compressionAlgorithm),
0059             compressionLevel=copy.copy(RAWEventContent.compressionLevel),
0060             fileName = cms.untracked.string("%s.root" % moduleLabel)
0061             )
0062 
0063         outputModule.dataset = cms.untracked.PSet(dataTier = cms.untracked.string("RAW"))
0064 
0065         if maxSize != None:
0066             outputModule.maxSize = cms.untracked.int32(maxSize)
0067 
0068         if selectEvents != None:
0069             outputModule.SelectEvents = cms.untracked.PSet(
0070                 SelectEvents = cms.vstring(selectEvents)
0071                 )
0072 
0073         setattr(process, moduleLabel, outputModule)
0074 
0075         process.outputPath += outputModule
0076 
0077     return process