CMS 3D CMS Logo

readConfig.py
Go to the documentation of this file.
1 from __future__ import print_function
2 # set up variables
3 #def readConfig(fileName)
4 import FWCore.ParameterSet.Config as cms
6 
7 class fileINI:
8  def __init__(self, fileName):
9  self.fileName=fileName
10 
11  def read(self):
12  Config.optionxform = str
13  Config.read(self.fileName)
14  self.processname=ConfigSectionMap("config")["processname"]
15  self.CMSSWVER=ConfigSectionMap("config")["cmsswver"]
16  self.jets=ConfigSectionMap("config")["hltjets"]
17  files=ConfigSectionMap("config")["files"]
18  self.maxEvents=ConfigSectionMap("config")["maxevents"]
19 # self.denominatorTriggerPath=ConfigSectionMap("config")["denominatorTriggerPath"]
20 
21  files=files.splitlines()
22  self.files=[x for x in files if len(x)>0]
23 
24  self.btag_modules=cms.VInputTag()
25  self.btag_pathes=cms.vstring()
26  self.btag_modules_string=cms.vstring()
27  for path in Config.options("btag"):
28  print(path)
29  modules=Config.get("btag",path)
30  modules=modules.splitlines()
31  for module in modules:
32  if(module!="" and path!=""):
33  self.btag_modules.extend([cms.InputTag(module)])
34  self.btag_modules_string.extend([module])
35  self.btag_pathes.extend([path])
36 
37  self.vertex_modules=cms.VInputTag()
38  self.vertex_pathes=cms.vstring()
39  for path in Config.options("vertex"):
40  print(path)
41  modules=Config.get("vertex",path)
42  modules=modules.splitlines()
43  for module in modules:
44  if(module!="" and path!=""):
45  self.vertex_modules.extend([cms.InputTag(module)])
46  self.vertex_pathes.extend([path])
47 
48 def printMe(self):
49  print()
50  print("Reading ", self.fileName)
51  print()
52  print("denominatorTriggerPath = ",self.denominatorTriggerPath)
53  print("maxEvents = ",self.maxEvents)
54  print("CMSSWVER = ",self.CMSSWVER)
55  print("processname = ",self.processname)
56  print("jets (for matching) = ",self.jets)
57  print("files = ",self.files)
58  print("btag_modules ",self.btag_modules)
59  print("btag_pathes ",self.btag_pathes)
60  print("vertex_modules ",self.vertex_modules)
61  print("vertex_pathes ",self.vertex_pathes)
62  print()
readConfig.fileINI.maxEvents
maxEvents
Definition: readConfig.py:18
readConfig.fileINI.fileName
fileName
Definition: readConfig.py:9
readConfig.fileINI.processname
processname
Definition: readConfig.py:14
readConfig.fileINI.vertex_modules
vertex_modules
Definition: readConfig.py:37
readConfig.printMe
def printMe(self)
Definition: readConfig.py:48
readConfig.fileINI.btag_pathes
btag_pathes
Definition: readConfig.py:25
readConfig.fileINI.jets
jets
Definition: readConfig.py:16
readConfig.fileINI.read
def read(self)
Definition: readConfig.py:11
readConfig.fileINI.vertex_pathes
vertex_pathes
Definition: readConfig.py:38
readConfig.fileINI
Definition: readConfig.py:7
readConfig.fileINI.files
files
Definition: readConfig.py:22
helper
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
helper.ConfigSectionMap
def ConfigSectionMap(section)
Definition: helper.py:12
readConfig.fileINI.__init__
def __init__(self, fileName)
Definition: readConfig.py:8
readConfig.fileINI.btag_modules_string
btag_modules_string
Definition: readConfig.py:26
readConfig.fileINI.CMSSWVER
CMSSWVER
Definition: readConfig.py:15
readConfig.fileINI.btag_modules
btag_modules
Definition: readConfig.py:24
Config.options
options
Definition: Config.py:9