CMS 3D CMS Logo

optionsL1T.py
Go to the documentation of this file.
1 from __future__ import print_function
2 #
3 # L1T Command Line Options:
4 #
5 # Append this snippet to you cmsDriver.py config file like this:
6 #
7 # cat L1Trigger/L1TCommon/scripts/optionsL1T.py
8 #
9 # to provide support for command-line options such as:
10 #
11 # maxEvents=<n>
12 # skip=<n>
13 # ntuple=<file>
14 # inputFiles="file1.root,file2.root"
15 #
16 # menu (not yet implemented)
17 #
18 import FWCore.ParameterSet.Config as cms
19 import FWCore.ParameterSet.VarParsing as VarParsing
20 import os
21 import sys
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)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47