Skip to content

Commit

Permalink
Merge pull request #44380 from haozturk/new-data-tier-for-repack
Browse files Browse the repository at this point in the history
Make repack process be able to generate new data tiers: L1SCOUT, HLTSCOUT
  • Loading branch information
cmsbuild authored Mar 16, 2024
2 parents d6052f1 + 66c303a commit 374b268
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 9 deletions.
23 changes: 19 additions & 4 deletions Configuration/DataProcessing/python/Repack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def repackProcess(**args):
"""
from Configuration.EventContent.EventContent_cff import RAWEventContent
from Configuration.EventContent.EventContent_cff import HLTSCOUTEventContent
from Configuration.EventContent.EventContent_cff import L1SCOUTEventContent
process = cms.Process("REPACK")
process.load("FWCore.MessageLogger.MessageLogger_cfi")

Expand All @@ -42,6 +44,16 @@ def repackProcess(**args):
fileNames = cms.untracked.vstring()
)

defaultDataTier = "RAW"

# Should we default to something if dataTier arg isn't provided?
dataTier = args.get('dataTier', defaultDataTier)
eventContent = RAWEventContent
if dataTier == "HLTSCOUT":
eventContent = HLTSCOUTEventContent
elif dataTier == "L1SCOUT":
eventContent = L1SCOUTEventContent

outputs = args.get('outputs', [])

if len(outputs) > 0:
Expand All @@ -55,12 +67,13 @@ def repackProcess(**args):

outputModule = cms.OutputModule(
"PoolOutputModule",
compressionAlgorithm=copy.copy(RAWEventContent.compressionAlgorithm),
compressionLevel=copy.copy(RAWEventContent.compressionLevel),
compressionAlgorithm=copy.copy(eventContent.compressionAlgorithm),
compressionLevel=copy.copy(eventContent.compressionLevel),
fileName = cms.untracked.string("%s.root" % moduleLabel)
)

outputModule.dataset = cms.untracked.PSet(dataTier = cms.untracked.string("RAW"))

outputModule.dataset = cms.untracked.PSet(dataTier = cms.untracked.string(dataTier))

if maxSize != None:
outputModule.maxSize = cms.untracked.int32(maxSize)
Expand All @@ -74,4 +87,6 @@ def repackProcess(**args):

process.outputPath += outputModule

return process
return process


21 changes: 16 additions & 5 deletions Configuration/DataProcessing/test/RunRepack.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,28 @@ class RunRepack:
def __init__(self):
self.selectEvents = None
self.inputLFN = None
self.dataTier = None

def __call__(self):
if self.inputLFN == None:
msg = "No --lfn specified"
raise RuntimeError(msg)
allowedDataTiers = ["RAW", "HLTSCOUT", "L1SCOUT"]
if self.dataTier == None:
self.dataTier = "RAW"
elif self.dataTier not in allowedDataTiers:
msg = f"{self.dataTier} isn't an allowed datatier for repacking. Allowed data tiers: {allowedDataTiers}"
raise RuntimeError(msg)

outputs = []
outputs.append( { 'moduleLabel' : "write_PrimDS1_RAW" } )
outputs.append( { 'moduleLabel' : "write_PrimDS2_RAW" } )
outputs.append( { 'moduleLabel' : f"write_PrimDS1_{self.dataTier}" } )
outputs.append( { 'moduleLabel' : f"write_PrimDS2_{self.dataTier}" } )
if self.selectEvents != None:
outputs[0]['selectEvents'] = self.selectEvents.split(',')
outputs[1]['selectEvents'] = self.selectEvents.split(',')

try:
process = repackProcess(outputs = outputs)
process = repackProcess(outputs = outputs, dataTier = self.dataTier)
except Exception as ex:
msg = "Error creating process for Repack:\n"
msg += str(ex)
Expand All @@ -54,7 +61,7 @@ def __call__(self):


if __name__ == '__main__':
valid = ["select-events=", "lfn="]
valid = ["select-events=", "lfn=", "data-tier="]

usage = \
"""
Expand All @@ -63,9 +70,10 @@ def __call__(self):
Where options are:
--select-events (option, event selection based on trigger paths)
--lfn=/store/input/lfn
--data-tier=RAW|HLTSCOUT|L1SCOUT
Example:
python RunRepack.py --select-events HLT:path1,HLT:path2 --lfn /store/whatever
python RunRepack.py --select-events HLT:path1,HLT:path2 --lfn /store/whatever --data-tier RAW|HLTSCOUT|L1SCOUT
"""
try:
Expand All @@ -83,5 +91,8 @@ def __call__(self):
repackinator.selectEvents = arg
if opt == "--lfn" :
repackinator.inputLFN = arg
if opt == "--data-tier" :
repackinator.dataTier = arg

repackinator()

24 changes: 24 additions & 0 deletions Configuration/EventContent/python/EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,30 @@ def SwapKeepAndDrop(l):
'keep DetIds_hltSiStripRawToDigi_*_*'
])

#
# HLTSCOUT Data Tier definition
#
#
HLTSCOUTEventContent = cms.PSet(
outputCommands = cms.untracked.vstring('drop *'),
splitLevel = cms.untracked.int32(0),
compressionAlgorithm=cms.untracked.string("LZMA"),
compressionLevel=cms.untracked.int32(4)
)
HLTSCOUTEventContent.outputCommands.extend(HLTriggerRAW.outputCommands)

#
# L1SCOUT Data Tier definition
#
#
L1SCOUTEventContent = cms.PSet(
outputCommands = cms.untracked.vstring('drop *'),
splitLevel = cms.untracked.int32(0),
compressionAlgorithm=cms.untracked.string("LZMA"),
compressionLevel=cms.untracked.int32(4)
)
L1SCOUTEventContent.outputCommands.extend(L1TriggerRAW.outputCommands)

#
#
# HLTONLY Data Tier definition
Expand Down

0 comments on commit 374b268

Please sign in to comment.