CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
customizeHLTforALL.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 def customizeHLTforAll(process, _customInfo = None):
4 
5  if (_customInfo is not None):
6 
7  _maxEvents = _customInfo['maxEvents']
8  _globalTag = _customInfo['globalTag']
9  _inputFile = _customInfo['inputFile']
10  _realData = _customInfo['realData']
11 
12  import FWCore.ParameterSet.VarParsing as VarParsing
13  cmsRunOptions = VarParsing.VarParsing('python')
14 
15  cmsRunOptions.maxEvents = _maxEvents
16  cmsRunOptions.register('globalTag',_globalTag,cmsRunOptions.multiplicity.singleton,cmsRunOptions.varType.string,"GlobalTag")
17  cmsRunOptions.inputFiles = _inputFile
18  cmsRunOptions.register('realData',_realData,cmsRunOptions.multiplicity.singleton,cmsRunOptions.varType.bool,"Real Data?")
19 
20  cmsRunOptions.parseArguments()
21 
22 # report in log file
23 # print cmsRunOptions
24 
25  _maxEvents = cmsRunOptions.maxEvents
26  _globalTag = cmsRunOptions.globalTag
27  _inputFile = cmsRunOptions.inputFiles
28  _realData = cmsRunOptions.realData
29 
30 # maxEvents
31  if _maxEvents != -2:
32  _maxEvents = cms.untracked.int32( _maxEvents )
33  if hasattr(process,'maxEvents'):
34  process.maxEvents.input = _maxEvents
35  else:
36  process.maxEvents = cms.untracked.PSet( input = _maxEvents )
37 
38 # GlobalTag
39  if _globalTag == "@":
40  _globalTag = _customInfo['globalTags'][_realData]
41  if _globalTag != "":
42  if hasattr(process,'GlobalTag'):
43  from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
44  process.GlobalTag = GlobalTag(process.GlobalTag, _globalTag, '')
45 # process.GlobalTag.snapshotTime = cms.string("9999-12-31 23:59:59.000")
46 
47 # inputFile
48  if _inputFile[0] == "@":
49  _inputFile[0] = _customInfo['inputFiles'][_realData]
50  if _inputFile != "":
51  if hasattr(process,'source'):
52  process.source.fileNames = cms.untracked.vstring( _inputFile )
53 
54 # MC customisation
55  if not _realData:
56  from HLTrigger.Configuration.customizeHLTforMC import customizeHLTforMC
57  process = customizeHLTforMC(process)
58  if _customInfo['menuType'] == "HIon":
59  from HLTrigger.Configuration.CustomConfigs import MassReplaceInputTag
60  process = MassReplaceInputTag(process,"rawDataRepacker","rawDataCollector")
61  else:
62  pass
63 
64 # CMSSW version customisation
65  from HLTrigger.Configuration.customizeHLTforCMSSW import customiseHLTforCMSSW
66  process = customiseHLTforCMSSW(process)
67 
68  return process