CMS 3D CMS Logo

hltScouting.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 """
3 _hltScouting_
4 
5 Scenario supporting proton collisions with input HLT scouting data
6 
7 """
8 
9 from __future__ import print_function
10 
11 import os
12 import sys
13 
15 from Configuration.DataProcessing.Utils import stepSKIMPRODUCER, addMonitoring, dictIO, nanoFlavours, gtNameAndConnect
16 import FWCore.ParameterSet.Config as cms
17 
18 import warnings
19 
21  def __init__(self):
22  Scenario.__init__(self)
23  self.recoSeq = ''
24  self.cbSc = 'pp'
25  self.isRepacked = False
26  self.promptCustoms = ['Configuration/DataProcessing/RecoTLR.customisePrompt']
27  self.promptModifiers = cms.ModifierChain()
28  """
29  _hltScouting_
30 
31  Implement configuration building for data processing for proton
32  collision data taking with input HLT scouting data
33  """
34 
35  def promptReco(self, globalTag, **args):
36  """
37  _promptReco_
38 
39  Proton collision data taking prompt reco with input HLT scouting data
40 
41  """
42 
43  options = Options()
44  options.__dict__.update(defaultOptions.__dict__)
45  options.scenario = self.cbSc
46 
47  if 'nThreads' in args:
48  options.nThreads = args['nThreads']
49 
50  PhysicsSkimStep = ''
51  if 'PhysicsSkims' in args:
52  PhysicsSkimStep = stepSKIMPRODUCER(args['PhysicsSkims'])
53 
54  miniAODStep = ''
55  nanoAODStep = ''
56 
57  if 'outputs' in args:
58  outputs = []
59  for a in args['outputs']:
60  if a['dataTier'] in ['NANOAOD', 'NANOEDMAOD']:
61  if 'nanoFlavours' in args:
62  for nanoFlavour in args['nanoFlavours']:
63  if nanoFlavour != '@Scout':
64  warnings.warn('nanoFlavour: ' + nanoFlavour + 'is currently not supported and will be removed from outputs. Only supported nanoFlavour is @Scout')
65  args['nanoFlavours'] = ['@Scout']
66  nanoAODStep = ',NANO' + nanoFlavours(args['nanoFlavours'])
67  else:
68  nanoAODStep = ',NANO:@Scout' # default to Scouting NANO
69  outputs.append(a)
70  else:
71  warnings.warn('dataTier:' + str(a['dataTier']) + ' is currently not supported and will be removed from outputs')
72  if {output['dataTier'] for output in outputs} != {a['dataTier'] for a in args['outputs']}:
73  warnings.warn('The outputs will be changed from ' + str(args['outputs']) + ' to' + str(outputs))
74  args['outputs'] = outputs
75 
76  if not 'customs' in args:
77  args['customs'] = []
78 
79  for c in self.promptCustoms:
80  args['customs'].append(c)
81  options.customisation_file = args['customs']
82 
83  options.isRepacked = args.get('repacked', self.isRepacked)
84 
85  options.step = ''
86  options.step += self.recoSeq + PhysicsSkimStep
87  options.step += miniAODStep + nanoAODStep
88 
89  dictIO(options, args)
90  options.conditions = gtNameAndConnect(globalTag, args)
91 
92  process = cms.Process('HLTSCOUT', cms.ModifierChain(self.eras, self.promptModifiers))
93  cb = ConfigBuilder(options, process = process, with_output = True)
94 
95  # Input source
96  process.source = cms.Source("PoolSource",
97  fileNames = cms.untracked.vstring()
98  )
99 
100  cb.prepare()
101 
102  addMonitoring(process)
103 
104  return process
def stepSKIMPRODUCER(PhysicsSkims)
Definition: Utils.py:24
def gtNameAndConnect(globalTag, args)
Definition: Utils.py:149
def nanoFlavours(flavours)
Definition: Utils.py:135
def dictIO(options, args)
Definition: Utils.py:121
def addMonitoring(process)
Definition: Utils.py:38
def promptReco(self, globalTag, args)
Definition: hltScouting.py:35
#define str(s)