CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
optionsL1T.py
Go to the documentation of this file.
1 #
2 # L1T Command Line Options:
3 #
4 # Append this snippet to you cmsDriver.py config file like this:
5 #
6 # cat L1Trigger/L1TCommon/scripts/optionsL1T.py
7 #
8 # to provide support for command-line options such as:
9 #
10 # maxEvents=<n>
11 # skip=<n>
12 # ntuple=<file>
13 # inputFiles="file1.root,file2.root"
14 #
15 # menu (not yet implemented)
16 #
17 import FWCore.ParameterSet.Config as cms
18 import FWCore.ParameterSet.VarParsing as VarParsing
19 import os
20 import sys
21 import commands
22 options = VarParsing.VarParsing ('analysis')
23 options = VarParsing.VarParsing ('analysis')
24 options.register ('ntuple', "", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "The output ntuple file name")
25 options.register ('menu', "", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, "Override the L1 menu with specified XML file")
26 options.register ('skip', "", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int, "The number of events to skip initially")
27 options.ntuple = ''
28 options.menu = ''
29 options.skip = 0
30 print options
31 
32 options.parseArguments()
33 
34 if (not options.menu == ""):
35  print "L1T INFO: menu override in command line not yet implemented..."
36 
37 if (not options.ntuple == ""):
38  print "L1T INFO: using command line option ntuple: ", options.ntuple
39  if (hasattr(process,"TFileService")):
40  process.TFileService.fileName = cms.string(options.ntuple)
41  #print process.TFileService
42 
43 if (hasattr(process,"maxEvents")):
44  print "L1T INFO: using command line option maxEvents: ", options.maxEvents
45  process.maxEvents.input = options.maxEvents
46  #print process.maxEvents
47 
48 if (hasattr(process,"source")):
49  if options.skip > 0:
50  print "L1T INFO: using command line option skip: ", options.skip
51  process.source.skipEvents = cms.untracked.uint32(options.skip)
52  if (not options.inputFiles == []):
53  print "L1T INFO: using command line option inputFiles: ", options.inputFiles
54  process.source.fileNames = cms.untracked.vstring(options.inputFiles)