Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12_4_X] Add new functions to AlCaNano.py needed for the T0 replay #38665

Merged
merged 1 commit into from Jul 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
174 changes: 174 additions & 0 deletions Configuration/DataProcessing/python/Impl/AlCaNano.py
Expand Up @@ -65,3 +65,177 @@ def promptReco(self, globalTag, **args):
cb.prepare()

return process

def alcaSkim(self, skims, **args):
"""
_alcaSkim_
AlcaReco processing & skims for proton collisions
"""
step = ""
pclWflws = [x for x in skims if "PromptCalibProd" in x]
skims = [x for x in skims if x not in pclWflws]

if len(pclWflws):
step += 'ALCA:'+('+'.join(pclWflws))

if len(skims) > 0:
if step != "":
step += ","
step += "ALCAOUTPUT:"+('+'.join(skims))

options = Options()
options.__dict__.update(defaultOptions.__dict__)
options.scenario = "pp"
options.step = step
options.conditions = args['globaltag'] if 'globaltag' in args else 'None'
if 'globalTagConnect' in args and args['globalTagConnect'] != '':
options.conditions += ','+args['globalTagConnect']

options.triggerResultsProcess = 'RECO'

process = cms.Process('ALCA', self.eras)
cb = ConfigBuilder(options, process=process)

# Input source
process.source = cms.Source(
"PoolSource",
fileNames=cms.untracked.vstring()
)

cb.prepare()

for wfl in pclWflws:
methodToCall = getattr(process, 'ALCARECOStream'+wfl)
methodToCall.dataset.dataTier = cms.untracked.string('ALCAPROMPT')

return process


def dqmHarvesting(self, datasetName, runNumber, globalTag, **args):
"""
_dqmHarvesting_
Proton collisions data taking DQM Harvesting
"""
options = defaultOptions
options.scenario = "pp"
options.step = "HARVESTING:alcaHarvesting"
options.name = "EDMtoMEConvert"
options.conditions = gtNameAndConnect(globalTag, args)

process = cms.Process("HARVESTING", self.eras)
process.source = dqmIOSource(args)
configBuilder = ConfigBuilder(options, process = process)
configBuilder.prepare()

harvestingMode(process,datasetName,args)

return process

def alcaHarvesting(self, globalTag, datasetName, **args):
"""
_alcaHarvesting_
Proton collisions data taking AlCa Harvesting
"""
skims = []
if 'skims' in args:
skims = args['skims']


if 'alcapromptdataset' in args:
skims.append('@'+args['alcapromptdataset'])

if len(skims) == 0: return None
options = defaultOptions
options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
options.step = "ALCAHARVEST:"+('+'.join(skims))
options.name = "ALCAHARVEST"
options.conditions = gtNameAndConnect(globalTag, args)

process = cms.Process("ALCAHARVEST", self.eras)
process.source = cms.Source("PoolSource")

if 'customs' in args:
options.customisation_file=args['customs']

configBuilder = ConfigBuilder(options, process = process)
configBuilder.prepare()

process.source.processingMode = cms.untracked.string('RunsAndLumis')
process.source.fileNames = cms.untracked(cms.vstring())
process.maxEvents.input = -1
process.dqmSaver.workflow = datasetName

return process

def expressProcessing(self, globalTag, **args):
"""
_expressProcessing_
Proton collision data taking express processing
"""
skims = []
if 'skims' in args:
skims = args['skims']
pclWkflws = [x for x in skims if "PromptCalibProd" in x]
for wfl in pclWkflws:
skims.remove(wfl)

options = Options()
options.__dict__.update(defaultOptions.__dict__)
options.scenario = "pp"
options.step = stepALCAPRODUCER(skims)

if 'outputs' in args:
# the RAW data-tier needs a special treatment since the event-content as defined in release is not good enough
outputs_Raw = [x for x in args['outputs'] if x['dataTier'] == 'RAW']
outputs_noRaw = [x for x in args['outputs'] if x['dataTier'] != 'RAW']
if len(outputs_Raw) == 1:
print('RAW data-tier requested')
options.outputDefinition = outputs_noRaw.__str__()

options.conditions = gtNameAndConnect(globalTag, args)

options.filein = 'tobeoverwritten.xyz'
if 'inputSource' in args:
options.filetype = args['inputSource']
process = cms.Process('RECO', self.eras)

if 'customs' in args:
options.customisation_file=args['customs']

cb = ConfigBuilder(options, process = process, with_output = True, with_input = True)

cb.prepare()

addMonitoring(process)

for output in outputs_Raw:
print(output)
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)
)
outputModule.outputCommands = cms.untracked.vstring('drop *',
'keep *_*_*_HLT')

setattr(process, moduleLabel, outputModule)
# outputModule=getattr(self.process,theModuleLabel)
setattr(process, moduleLabel+'_step', cms.EndPath(outputModule))
path = getattr(process, moduleLabel+'_step')
process.schedule.append(path)

return process