Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-27 04:18:03

0001 from __future__ import print_function
0002 #
0003 # L1T Command Line Options:
0004 #
0005 # Append this snippet to you cmsDriver.py config file like this:
0006 #
0007 #   cat L1Trigger/L1TCommon/scripts/optionsL1T.py
0008 #
0009 # to provide support for command-line options such as:
0010 #
0011 #    maxEvents=<n>
0012 #    skip=<n>
0013 #    ntuple=<file>
0014 #    inputFiles="file1.root,file2.root" 
0015 #
0016 #    menu (not yet implemented)
0017 #
0018 import FWCore.ParameterSet.Config as cms
0019 import FWCore.ParameterSet.VarParsing as VarParsing
0020 import os
0021 import sys
0022 options = VarParsing.VarParsing ('analysis')
0023 options = VarParsing.VarParsing ('analysis')
0024 options.register ('ntuple', "",  VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string,  "The output ntuple file name")
0025 options.register ('menu',   "",  VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string,  "Override the L1 menu with specified XML file")
0026 options.register ('skip',   "",  VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.int,     "The number of events to skip initially")
0027 options.ntuple = ''
0028 options.menu = ''
0029 options.skip = 0 
0030 print(options)
0031 
0032 options.parseArguments()
0033 
0034 if (not options.menu == ""):
0035     print("L1T INFO:  menu override in command line not yet implemented...")
0036 
0037 if (not options.ntuple == ""):
0038     print("L1T INFO:  using command line option ntuple:  ", options.ntuple)
0039     if (hasattr(process,"TFileService")):
0040         process.TFileService.fileName = cms.string(options.ntuple)
0041         #print process.TFileService
0042 
0043 if (hasattr(process,"maxEvents")):
0044     print("L1T INFO:  using command line option maxEvents:  ", options.maxEvents)
0045     process.maxEvents.input = options.maxEvents
0046     #print process.maxEvents
0047 
0048 if (hasattr(process,"source")):
0049     if options.skip > 0:
0050         print("L1T INFO:  using command line option skip:  ", options.skip)
0051         process.source.skipEvents = cms.untracked.uint32(options.skip)
0052     if (not options.inputFiles == []):
0053         print("L1T INFO:  using command line option inputFiles:  ", options.inputFiles)
0054         process.source.fileNames = cms.untracked.vstring(options.inputFiles)