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()
def printMe(self)
Definition: readConfig.py:48
def __init__(self, fileName)
Definition: readConfig.py:8
options
Definition: Config.py:8
def ConfigSectionMap(config, section)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def read(self)
Definition: readConfig.py:11