Skip to content

Commit 1654964

Browse files
authored
Merge pull request #47596 from LinaresToine/backport-raw-skims-14-1-X
backport Raw Skims to CMSSW_14_1_X
2 parents 9a42572 + a03583e commit 1654964

File tree

3 files changed

+72
-29
lines changed

3 files changed

+72
-29
lines changed

Diff for: Configuration/DataProcessing/python/Repack.py

+53-25
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
"""
@@ -18,31 +20,37 @@ def repackProcess(**args):
1820
supported options:
1921
2022
- outputs : defines output modules
23+
- globalTag : contains trigger paths for the selected raw skims in outputs
24+
25+
Additional comments:
26+
27+
The selectEvents parameter within the outputs option is of type list, provided by T0.
28+
The paths in the list have an added ":HLT" to the string, which needs to be removed for propper use of the raw skim machinery.
2129
2230
"""
2331
from Configuration.EventContent.EventContent_cff import RAWEventContent
2432
from Configuration.EventContent.EventContent_cff import HLTSCOUTEventContent
2533
from Configuration.EventContent.EventContent_cff import L1SCOUTEventContent
2634
process = cms.Process("REPACK")
2735
process.load("FWCore.MessageLogger.MessageLogger_cfi")
28-
29-
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
36+
37+
process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(-1))
3038

3139
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-
)
40+
name=cms.untracked.string("repack-config"),
41+
version=cms.untracked.string("none"),
42+
annotation=cms.untracked.string("auto generated configuration")
43+
)
3644

3745
process.options = cms.untracked.PSet(
38-
Rethrow = cms.untracked.vstring("ProductNotFound","TooManyProducts","TooFewProducts"),
39-
wantSummary = cms.untracked.bool(False)
40-
)
46+
Rethrow=cms.untracked.vstring("ProductNotFound", "TooManyProducts", "TooFewProducts"),
47+
wantSummary=cms.untracked.bool(False)
48+
)
4149

4250
process.source = cms.Source(
4351
"NewEventStreamFileReader",
44-
fileNames = cms.untracked.vstring()
45-
)
52+
fileNames=cms.untracked.vstring()
53+
)
4654

4755
defaultDataTier = "RAW"
4856

@@ -58,36 +66,56 @@ def repackProcess(**args):
5866

5967
if len(outputs) > 0:
6068
process.outputPath = cms.EndPath()
61-
69+
70+
globalTag = args.get('globalTag', None)
71+
if globalTag:
72+
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
73+
process.GlobalTag = GlobalTag(process.GlobalTag, globalTag, '')
74+
6275
for output in outputs:
6376

77+
selectEventsBase = output.get('selectEvents', None)
78+
rawSkim = output.get('rawSkim', None)
79+
80+
if rawSkim:
81+
82+
selectEventsBase = [item.replace(":HLT", "") for item in selectEventsBase]
83+
84+
process.baseSelection = hlt.hltHighLevel.clone(
85+
TriggerResultsTag = "TriggerResults::HLT",
86+
HLTPaths = cms.vstring(selectEventsBase)
87+
)
88+
skim = getattr(RawSkims, rawSkim)
89+
setattr(process, rawSkim, skim)
90+
path = cms.Path(skim + process.baseSelection)
91+
selectEvents = f"{rawSkim}Path"
92+
setattr(process, selectEvents, path)
93+
94+
else:
95+
selectEvents = selectEventsBase
96+
6497
moduleLabel = output['moduleLabel']
65-
selectEvents = output.get('selectEvents', None)
6698
maxSize = output.get('maxSize', None)
6799

68100
outputModule = cms.OutputModule(
69101
"PoolOutputModule",
70102
compressionAlgorithm=copy.copy(eventContent.compressionAlgorithm),
71103
compressionLevel=copy.copy(eventContent.compressionLevel),
72-
fileName = cms.untracked.string("%s.root" % moduleLabel)
73-
)
74-
104+
fileName=cms.untracked.string("%s.root" % moduleLabel)
105+
)
75106

76-
outputModule.dataset = cms.untracked.PSet(dataTier = cms.untracked.string(dataTier))
107+
outputModule.dataset = cms.untracked.PSet(dataTier=cms.untracked.string(dataTier))
77108

78-
if maxSize != None:
109+
if maxSize is not None:
79110
outputModule.maxSize = cms.untracked.int32(maxSize)
80111

81-
if selectEvents != None:
112+
if selectEvents is not None:
82113
outputModule.SelectEvents = cms.untracked.PSet(
83-
SelectEvents = cms.vstring(selectEvents)
84-
)
114+
SelectEvents=cms.vstring(selectEvents)
115+
)
85116

86117
setattr(process, moduleLabel, outputModule)
87118

88119
process.outputPath += outputModule
89120

90121
return process
91-
92-
93-

Diff for: Configuration/DataProcessing/test/RunRepack.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Test/Debugging harness for the repack configuration builder
66
77
"""
8-
from __future__ import print_function
98

109
import sys
1110
import getopt
@@ -19,6 +18,8 @@ def __init__(self):
1918
self.selectEvents = None
2019
self.inputLFN = None
2120
self.dataTier = None
21+
self.rawSkim = None
22+
self.globalTag= None
2223

2324
def __call__(self):
2425
if self.inputLFN == None:
@@ -37,9 +38,11 @@ def __call__(self):
3738
if self.selectEvents != None:
3839
outputs[0]['selectEvents'] = self.selectEvents.split(',')
3940
outputs[1]['selectEvents'] = self.selectEvents.split(',')
40-
41+
if self.rawSkim != None:
42+
outputs[0]['rawSkim'] = self.rawSkim
43+
outputs[1]['rawSkim'] = None
4144
try:
42-
process = repackProcess(outputs = outputs, dataTier = self.dataTier)
45+
process = repackProcess(outputs = outputs, globalTag = self.globalTag, dataTier = self.dataTier)
4346
except Exception as ex:
4447
msg = "Error creating process for Repack:\n"
4548
msg += str(ex)
@@ -61,7 +64,7 @@ def __call__(self):
6164

6265

6366
if __name__ == '__main__':
64-
valid = ["select-events=", "lfn=", "data-tier="]
67+
valid = ["select-events=", "lfn=", "data-tier=", "raw-skim=", "global-tag="]
6568

6669
usage = \
6770
"""
@@ -93,6 +96,10 @@ def __call__(self):
9396
repackinator.inputLFN = arg
9497
if opt == "--data-tier" :
9598
repackinator.dataTier = arg
99+
if opt == "--raw-skim":
100+
repackinator.rawSkim = arg
101+
if opt == "--global-tag":
102+
repackinator.globalTag = arg
96103

97104
repackinator()
98105

Diff for: Configuration/Skimming/python/RAWSkims_cff.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import FWCore.ParameterSet.Config as cms
2+
import HLTrigger.HLTfilters.hltHighLevel_cfi as hlt
3+
4+
# ReserveDMu raw skim already exists, so we import it
5+
from Configuration.Skimming.PDWG_ReserveDMu_SD_cff import ReserveDMu
6+
7+
# Define here another raw skim if desired
8+

0 commit comments

Comments
 (0)