CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
customizeHLTforALL Namespace Reference

Functions

def customizeHLTforAll
 

Function Documentation

def customizeHLTforALL.customizeHLTforAll (   process,
  menuType = "GRun",
  _customInfo = None 
)

Definition at line 3 of file customizeHLTforALL.py.

3 
4 def customizeHLTforAll(process, menuType = "GRun", _customInfo = None):
5 
6  # rename "HLTSchedule" to "schedule":
7  # CMSSW policy is to have at most 1 schedule
8  # in the cms.Process, named "schedule"
9  if hasattr(process, 'HLTSchedule'):
10  if process.schedule_() != None:
11  raise Exception('process.schedule already exists')
12  process.setSchedule_(process.HLTSchedule)
13  del process.HLTSchedule
14 
15  if (_customInfo is not None):
16 
17  _maxEvents = _customInfo['maxEvents']
18  _globalTag = _customInfo['globalTag']
19  _inputFile = _customInfo['inputFile']
20  _realData = _customInfo['realData']
21 
22  import FWCore.ParameterSet.VarParsing as VarParsing
23  cmsRunOptions = VarParsing.VarParsing('python')
24 
25  cmsRunOptions.maxEvents = _maxEvents
26  cmsRunOptions.register('globalTag',_globalTag,cmsRunOptions.multiplicity.singleton,cmsRunOptions.varType.string,"GlobalTag")
27  cmsRunOptions.inputFiles = _inputFile
28  cmsRunOptions.register('realData',_realData,cmsRunOptions.multiplicity.singleton,cmsRunOptions.varType.bool,"Real Data?")
29 
30  cmsRunOptions.parseArguments()
31 
32 # report in log file
33 # print cmsRunOptions
34 
35  _maxEvents = cmsRunOptions.maxEvents
36  _globalTag = cmsRunOptions.globalTag
37  _inputFile = cmsRunOptions.inputFiles
38  _realData = cmsRunOptions.realData
39 
40 # maxEvents
41  if _maxEvents != -2:
42  _maxEvents = cms.untracked.int32( _maxEvents )
43  if hasattr(process,'maxEvents'):
44  process.maxEvents.input = _maxEvents
45  else:
46  process.maxEvents = cms.untracked.PSet( input = _maxEvents )
47 
48 # GlobalTag
49  if _globalTag == "@":
50  _globalTag = _customInfo['globalTags'][_realData]
51  if _globalTag != "":
52  if hasattr(process,'GlobalTag'):
53  from Configuration.AlCa.GlobalTag import GlobalTag
54  process.GlobalTag = GlobalTag(process.GlobalTag, _globalTag, '')
55 # process.GlobalTag.snapshotTime = cms.string("9999-12-31 23:59:59.000")
56 
57 # inputFile
58  if _inputFile[0] == "@":
59  _inputFile[0] = _customInfo['inputFiles'][_realData]
60  if _inputFile != "":
61  if hasattr(process,'source'):
62  process.source.fileNames = cms.untracked.vstring( _inputFile )
63 
64  if _realData:
65 # Real-Data customisation
66  if menuType == "HIon":
67 # fix "Unrunnable schedule" exception
68  from HLTrigger.Configuration.CustomConfigs import MassReplaceInputTag
69  process = MassReplaceInputTag(process,"rawDataRepacker","rawDataCollector") #,"rawDataRepacker::@skipCurrentProcess")
70  else:
71 # Monte-Carlo customisation
72  from HLTrigger.Configuration.customizeHLTforMC import customizeHLTforMC
73  process = customizeHLTforMC(process)
74  if menuType == "HIon":
75  from HLTrigger.Configuration.CustomConfigs import MassReplaceInputTag
76  process = MassReplaceInputTag(process,"rawDataRepacker","rawDataCollector")
77 
78  else:
79  pass
80 
81  return process