Skip to content

Commit 9daa028

Browse files
author
Antonio Linares
committed
Update
1 parent 6ce8551 commit 9daa028

File tree

3 files changed

+67
-29
lines changed

3 files changed

+67
-29
lines changed

Configuration/DataProcessing/python/Repack.py

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"""
88
import copy
99
import FWCore.ParameterSet.Config as cms
10-
10+
import HLTrigger.HLTfilters.hltHighLevel_cfi as hlt
11+
import Configuration.Skimming.RAWSkims_cff as RawSkims
12+
from Configuration.AlCa.GlobalTag import GlobalTag
1113

1214
def repackProcess(**args):
1315
"""
@@ -25,24 +27,24 @@ def repackProcess(**args):
2527
from Configuration.EventContent.EventContent_cff import L1SCOUTEventContent
2628
process = cms.Process("REPACK")
2729
process.load("FWCore.MessageLogger.MessageLogger_cfi")
28-
29-
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
30+
31+
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(-1))
3032

3133
process.configurationMetadata = cms.untracked.PSet(
32-
name = cms.untracked.string("repack-config"),
33-
version = cms.untracked.string("none"),
34-
annotation = cms.untracked.string("auto generated configuration")
35-
)
34+
name=cms.untracked.string("repack-config"),
35+
version=cms.untracked.string("none"),
36+
annotation=cms.untracked.string("auto generated configuration")
37+
)
3638

3739
process.options = cms.untracked.PSet(
38-
Rethrow = cms.untracked.vstring("ProductNotFound","TooManyProducts","TooFewProducts"),
39-
wantSummary = cms.untracked.bool(False)
40-
)
40+
Rethrow=cms.untracked.vstring("ProductNotFound", "TooManyProducts", "TooFewProducts"),
41+
wantSummary=cms.untracked.bool(False)
42+
)
4143

4244
process.source = cms.Source(
4345
"NewEventStreamFileReader",
44-
fileNames = cms.untracked.vstring()
45-
)
46+
fileNames=cms.untracked.vstring()
47+
)
4648

4749
defaultDataTier = "RAW"
4850

@@ -58,36 +60,54 @@ def repackProcess(**args):
5860

5961
if len(outputs) > 0:
6062
process.outputPath = cms.EndPath()
61-
63+
64+
globalTag = args.get('globalTag', None)
65+
if globalTag:
66+
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
67+
process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
68+
6269
for output in outputs:
6370

71+
selectEventsBase = output.get('selectEvents', None)
72+
rawSkim = output.get('rawSkim', None)
73+
if rawSkim:
74+
75+
selectEventsBase = selectEventsBase.replace(":HLT", "")
76+
process.baseSelection = hlt.hltHighLevel.clone(
77+
TriggerResultsTag = "TriggerResults::HLT",
78+
HLTPaths = cms.vstring(selectEventsBase)
79+
)
80+
skim = getattr(RawSkims, rawSkim)
81+
setattr(process, rawSkim, skim)
82+
path = cms.Path(skim + process.baseSelection)
83+
selectEvents = f"{rawSkim}Path"
84+
setattr(process, selectEvents, path)
85+
86+
else:
87+
selectEvents = selectEventsBase
88+
6489
moduleLabel = output['moduleLabel']
65-
selectEvents = output.get('selectEvents', None)
6690
maxSize = output.get('maxSize', None)
6791

6892
outputModule = cms.OutputModule(
6993
"PoolOutputModule",
7094
compressionAlgorithm=copy.copy(eventContent.compressionAlgorithm),
7195
compressionLevel=copy.copy(eventContent.compressionLevel),
72-
fileName = cms.untracked.string("%s.root" % moduleLabel)
73-
)
74-
96+
fileName=cms.untracked.string("%s.root" % moduleLabel)
97+
)
7598

76-
outputModule.dataset = cms.untracked.PSet(dataTier = cms.untracked.string(dataTier))
99+
outputModule.dataset = cms.untracked.PSet(dataTier=cms.untracked.string(dataTier))
77100

78-
if maxSize != None:
101+
if maxSize is not None:
79102
outputModule.maxSize = cms.untracked.int32(maxSize)
80103

81-
if selectEvents != None:
104+
if selectEvents is not None:
82105
outputModule.SelectEvents = cms.untracked.PSet(
83-
SelectEvents = cms.vstring(selectEvents)
84-
)
106+
SelectEvents=cms.vstring(selectEvents)
107+
)
85108

86109
setattr(process, moduleLabel, outputModule)
87110

88111
process.outputPath += outputModule
89112

90113
return process
91-
92-
93-

Configuration/DataProcessing/test/RunRepack.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def __init__(self):
1818
self.selectEvents = None
1919
self.inputLFN = None
2020
self.dataTier = None
21+
self.rawSkim = None
22+
self.globalTag= None
2123

2224
def __call__(self):
2325
if self.inputLFN == None:
@@ -36,9 +38,11 @@ def __call__(self):
3638
if self.selectEvents != None:
3739
outputs[0]['selectEvents'] = self.selectEvents.split(',')
3840
outputs[1]['selectEvents'] = self.selectEvents.split(',')
39-
41+
if self.rawSkim != None:
42+
outputs[0]['rawSkim'] = self.rawSkim
43+
outputs[1]['rawSkim'] = None
4044
try:
41-
process = repackProcess(outputs = outputs, dataTier = self.dataTier)
45+
process = repackProcess(outputs = outputs, globalTag = self.globalTag, dataTier = self.dataTier)
4246
except Exception as ex:
4347
msg = "Error creating process for Repack:\n"
4448
msg += str(ex)
@@ -48,7 +52,7 @@ def __call__(self):
4852

4953
import FWCore.ParameterSet.Config as cms
5054

51-
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) )
55+
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(103) )
5256

5357
psetFile = open("RunRepackCfg.py", "w")
5458
psetFile.write(process.dumpPython())
@@ -60,7 +64,7 @@ def __call__(self):
6064

6165

6266
if __name__ == '__main__':
63-
valid = ["select-events=", "lfn=", "data-tier="]
67+
valid = ["select-events=", "lfn=", "data-tier=", "raw-skim=", "global-tag="]
6468

6569
usage = \
6670
"""
@@ -92,6 +96,10 @@ def __call__(self):
9296
repackinator.inputLFN = arg
9397
if opt == "--data-tier" :
9498
repackinator.dataTier = arg
99+
if opt == "--raw-skim":
100+
repackinator.rawSkim = arg
101+
if opt == "--global-tag":
102+
repackinator.globalTag = arg
95103

96104
repackinator()
97105

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import FWCore.ParameterSet.Config as cms
2+
import HLTrigger.HLTfilters.hltHighLevel_cfi as hlt
3+
4+
ReserveDMu = hlt.hltHighLevel.clone(
5+
TriggerResultsTag = ("TriggerResults", "", "HLT" ),
6+
eventSetupPathsLabel = 'SecondaryDatasetTrigger',
7+
eventSetupPathsKey = 'ReserveDMu',
8+
andOr = True,
9+
throw = False,
10+
)

0 commit comments

Comments
 (0)