CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Repack.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """
3 _Repack_
4 
5 Module that generates standard repack configurations
6 
7 """
8 
9 import FWCore.ParameterSet.Config as cms
10 
11 
12 def repackProcess(**args):
13  """
14  _repackProcess_
15 
16  Creates and returns a repack process
17 
18  supported options:
19 
20  - outputs : defines output modules
21 
22  """
23  process = cms.Process("REPACK")
24  process.load("FWCore.MessageLogger.MessageLogger_cfi")
25 
26  process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
27 
28  process.configurationMetadata = cms.untracked.PSet(
29  name = cms.untracked.string("repack-config"),
30  version = cms.untracked.string("none"),
31  annotation = cms.untracked.string("auto generated configuration")
32  )
33 
34  process.options = cms.untracked.PSet(
35  Rethrow = cms.untracked.vstring("ProductNotFound","TooManyProducts","TooFewProducts"),
36  wantSummary = cms.untracked.bool(False)
37  )
38 
39  process.source = cms.Source(
40  "NewEventStreamFileReader",
41  fileNames = cms.untracked.vstring()
42  )
43 
44  outputs = args.get('outputs', [])
45 
46  if len(outputs) > 0:
47  process.outputPath = cms.EndPath()
48 
49  for output in outputs:
50 
51  moduleLabel = output['moduleLabel']
52  selectEvents = output.get('selectEvents', None)
53  maxSize = output.get('maxSize', None)
54 
55  outputModule = cms.OutputModule(
56  "PoolOutputModule",
57  fileName = cms.untracked.string("%s.root" % moduleLabel)
58  )
59 
60  outputModule.dataset = cms.untracked.PSet(dataTier = cms.untracked.string("RAW"))
61 
62  if maxSize != None:
63  outputModule.maxSize = cms.untracked.int32(maxSize)
64 
65  if selectEvents != None:
66  outputModule.SelectEvents = cms.untracked.PSet(
67  SelectEvents = cms.vstring(selectEvents)
68  )
69 
70  setattr(process, moduleLabel, outputModule)
71 
72  process.outputPath += outputModule
73 
74  return process
def repackProcess
Definition: Repack.py:12