Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-28 23:10:44

0001 #!/usr/bin/env python3
0002 """
0003 _hltScouting_
0004 
0005 Scenario supporting proton collisions with input HLT scouting data
0006 
0007 """
0008 
0009 
0010 import os
0011 import sys
0012 
0013 from Configuration.DataProcessing.Scenario import *
0014 from Configuration.DataProcessing.Utils import stepSKIMPRODUCER, addMonitoring, dictIO, nanoFlavours, gtNameAndConnect
0015 import FWCore.ParameterSet.Config as cms
0016 
0017 import warnings
0018 
0019 class hltScouting(Scenario):
0020     def __init__(self):
0021         Scenario.__init__(self)
0022         self.recoSeq = ''
0023         self.cbSc = 'pp'
0024         self.isRepacked = False
0025         self.promptCustoms = ['Configuration/DataProcessing/RecoTLR.customisePrompt']
0026         self.promptModifiers = cms.ModifierChain()
0027     """
0028     _hltScouting_
0029 
0030     Implement configuration building for data processing for proton
0031     collision data taking with input HLT scouting data
0032     """
0033 
0034     def promptReco(self, globalTag, **args):
0035         """
0036         _promptReco_
0037 
0038         Proton collision data taking prompt reco with input HLT scouting data
0039 
0040         """
0041 
0042         options = Options()
0043         options.__dict__.update(defaultOptions.__dict__)
0044         options.scenario = self.cbSc
0045         
0046         if 'nThreads' in args:
0047             options.nThreads = args['nThreads']
0048 
0049         PhysicsSkimStep = ''
0050         if 'PhysicsSkims' in args:
0051             PhysicsSkimStep = stepSKIMPRODUCER(args['PhysicsSkims'])
0052 
0053         miniAODStep = ''
0054         nanoAODStep = ''
0055         
0056         if 'outputs' in args:
0057             outputs = []
0058             for a in args['outputs']:
0059                 if a['dataTier'] in ['NANOAOD', 'NANOEDMAOD']:
0060                     if 'nanoFlavours' in args:
0061                         for nanoFlavour in args['nanoFlavours']:
0062                             if nanoFlavour != '@Scout':
0063                                 warnings.warn('nanoFlavour: ' + nanoFlavour + 'is currently not supported and will be removed from outputs. Only supported nanoFlavour is @Scout')
0064                         args['nanoFlavours'] = ['@Scout']
0065                         nanoAODStep = ',NANO' + nanoFlavours(args['nanoFlavours'])
0066                     else:
0067                         nanoAODStep = ',NANO:@Scout' # default to Scouting NANO
0068                     outputs.append(a)
0069                 else:
0070                     warnings.warn('dataTier:' + str(a['dataTier']) + ' is currently not supported and will be removed from outputs')
0071             if {output['dataTier'] for output in outputs} != {a['dataTier'] for a in args['outputs']}:
0072                 warnings.warn('The outputs will be changed from ' + str(args['outputs']) + ' to' + str(outputs))
0073                 args['outputs'] = outputs
0074 
0075         if not 'customs' in args:
0076             args['customs'] = []
0077 
0078         for c in self.promptCustoms:
0079             args['customs'].append(c)
0080         options.customisation_file = args['customs']
0081         
0082         options.isRepacked = args.get('repacked', self.isRepacked)
0083         
0084         options.step = ''
0085         options.step += self.recoSeq + PhysicsSkimStep
0086         options.step += miniAODStep + nanoAODStep
0087 
0088         dictIO(options, args)
0089         options.conditions = gtNameAndConnect(globalTag, args)
0090         
0091         process = cms.Process('HLTSCOUT', cms.ModifierChain(self.eras, self.promptModifiers))
0092         cb = ConfigBuilder(options, process = process, with_output = True)
0093 
0094         # Input source
0095         process.source = cms.Source("PoolSource",
0096             fileNames = cms.untracked.vstring()
0097         )
0098 
0099         cb.prepare()
0100 
0101         addMonitoring(process)
0102         
0103         return process