forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepack.py
More file actions
74 lines (50 loc) · 1.92 KB
/
Repack.py
File metadata and controls
74 lines (50 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python3
"""
_Repack_
Module that generates standard repack configurations
"""
import FWCore.ParameterSet.Config as cms
def repackProcess(**args):
"""
_repackProcess_
Creates and returns a repack process
supported options:
- outputs : defines output modules
"""
process = cms.Process("REPACK")
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
process.configurationMetadata = cms.untracked.PSet(
name = cms.untracked.string("repack-config"),
version = cms.untracked.string("none"),
annotation = cms.untracked.string("auto generated configuration")
)
process.options = cms.untracked.PSet(
Rethrow = cms.untracked.vstring("ProductNotFound","TooManyProducts","TooFewProducts"),
wantSummary = cms.untracked.bool(False)
)
process.source = cms.Source(
"NewEventStreamFileReader",
fileNames = cms.untracked.vstring()
)
outputs = args.get('outputs', [])
if len(outputs) > 0:
process.outputPath = cms.EndPath()
for output in outputs:
moduleLabel = output['moduleLabel']
selectEvents = output.get('selectEvents', None)
maxSize = output.get('maxSize', None)
outputModule = cms.OutputModule(
"PoolOutputModule",
fileName = cms.untracked.string("%s.root" % moduleLabel)
)
outputModule.dataset = cms.untracked.PSet(dataTier = cms.untracked.string("RAW"))
if maxSize != None:
outputModule.maxSize = cms.untracked.int32(maxSize)
if selectEvents != None:
outputModule.SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring(selectEvents)
)
setattr(process, moduleLabel, outputModule)
process.outputPath += outputModule
return process