CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
iniparser.ConfigData Class Reference

Public Member Functions

def __init__ (self)
 
def parseConfig (self, path)
 
def parseParameter (self, args)
 

Public Attributes

 defpeak
 
 firsttree
 
 jobDataPath
 
 jobNumber
 
 jobTime
 
 latexfile
 
 limit
 
 message
 
 mpspath
 
 numberofbins
 
 outputList
 
 outputPath
 
 rangedistM
 
 rangemode
 
 rangemodeHL
 
 rangerotHL
 
 rangerotM
 
 rangexyzHL
 
 rangexyzM
 
 samerange
 
 samerangeHL
 
 showadditional
 
 showbeamer
 
 showdump
 
 showhighlevel
 
 showhtml
 
 showmodule
 
 showmonitor
 
 showsubmodule
 
 showtex
 
 showtime
 
 statboxsize
 
 widthstddev
 

Detailed Description

stores the config data of the ini files or the console parameters

Definition at line 15 of file iniparser.py.

Constructor & Destructor Documentation

def iniparser.ConfigData.__init__ (   self)

Definition at line 19 of file iniparser.py.

19  def __init__(self):
20  # get path to modules, defaut ini and templates
21  self.mpspath = os.path.join(os.path.dirname(__file__))
22 
23  # General
24  # jobmX dir
25  self.jobNumber = -1
26  # MillePedeUser_X time
27  self.jobTime = -1
28  # ./jobData/jobmX path
29  self.jobDataPath = ""
30  # base outputpath
31  self.outputPath = ""
32  # latex file name
33  self.latexfile = ""
34  # identification in every plot (e.g. mp1885)
35  self.message = ""
36  # limits for warning dict with keys xyz, rot, dist
37  # arguments must be given in this order
38  self.limit = {}
39  # statboxsize
40  self.statboxsize = -1
41 
42  # what should be created
43  self.showmonitor = -1
44  self.showadditional = -1
45  self.showdump = -1
46  self.showtime = -1
47  self.showhighlevel = -1
48  self.showmodule = -1
49  self.showsubmodule = -1
50  self.showtex = -1
51  self.showbeamer = -1
52  self.showhtml = -1
53 
54  # MODULEPLOTS
55  # number of bins after shrinking
56  self.numberofbins = -1
57  # definition of sharp peak; max_outlier / StdDev > X
58  self.defpeak = -1
59  # new histogram width in units of StdDev
60  self.widthstddev = -1
61  # every parameter (e.g. xyz) with same range
62  self.samerange = -1
63  # rangemode "stddev" = multiple of StdDev, "all" = show all, "given" =
64  # use given ranges
65  self.rangemode = -1
66  # ranges
67  self.rangexyzM = []
68  self.rangerotM = []
69  self.rangedistM = []
70 
71  # HIGHLEVELPLOTS
72  # given ranges
73  self.rangexyzHL = []
74  self.rangerotHL = []
75  # every parameter (e.g. xyz) with same range
76  self.samerangeHL = -1
77  # rangemode "all" = show all, "given" = use given ranges
78  self.rangemodeHL = -1
79 
80  # Time dependent
81  self.firsttree = -1
82 
83  # list with the plots for the output
84  self.outputList = []
85 
def __init__(self)
Definition: iniparser.py:19

Member Function Documentation

def iniparser.ConfigData.parseConfig (   self,
  path 
)

Definition at line 86 of file iniparser.py.

References iniparser.ConfigData.defpeak, cmsPerfStripChart.dict, iniparser.ConfigData.firsttree, objects.autophobj.float, createfilelist.int, iniparser.ConfigData.jobDataPath, iniparser.ConfigData.jobNumber, iniparser.ConfigData.jobTime, iniparser.ConfigData.latexfile, iniparser.ConfigData.limit, genParticles_cff.map, iniparser.ConfigData.numberofbins, iniparser.ConfigData.outputPath, iniparser.ConfigData.rangedistM, iniparser.ConfigData.rangemode, iniparser.ConfigData.rangemodeHL, iniparser.ConfigData.rangerotHL, iniparser.ConfigData.rangerotM, iniparser.ConfigData.rangexyzHL, iniparser.ConfigData.rangexyzM, iniparser.ConfigData.samerange, iniparser.ConfigData.samerangeHL, iniparser.ConfigData.showadditional, iniparser.ConfigData.showbeamer, iniparser.ConfigData.showdump, iniparser.ConfigData.showhighlevel, iniparser.ConfigData.showhtml, iniparser.ConfigData.showmodule, iniparser.ConfigData.showmonitor, iniparser.ConfigData.showsubmodule, iniparser.ConfigData.showtex, iniparser.ConfigData.showtime, split, iniparser.ConfigData.statboxsize, iniparser.ConfigData.widthstddev, and ComparisonHelper.zip().

86  def parseConfig(self, path):
87  logger = logging.getLogger("mpsvalidate")
88 
89  # create ConfigParser object
90  parser = ConfigParser.ConfigParser()
91 
92  # read ini file
93  if (parser.read(path) == []):
94  logger.error("Could not open ini-file: {0}".format(path))
95 
96  # buffer object
97  configBuffer = ConfigData()
98 
99  # collect data and process it
100  try:
101  configBuffer.jobNumber = int(parser.get("GENERAL", "job"))
102  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
103  pass
104 
105  try:
106  configBuffer.jobDataPath = parser.get("GENERAL", "jobdatapath")
107  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
108  pass
109 
110  # set jobDataPath if job number is given and if path is not given
111  if (configBuffer.jobNumber != -1 and configBuffer.jobDataPath == ""):
112  self.jobNumber = configBuffer.jobNumber
113  if (self.jobNumber == 0):
114  self.jobDataPath = "jobData/jobm"
115  else:
116  self.jobDataPath = "jobData/jobm{0}".format(self.jobNumber)
117  self.outputPath = os.path.join(self.jobDataPath, "validation_output")
118 
119  # if jobData path is given
120  if (configBuffer.jobDataPath != ""):
121  self.jobDataPath = configBuffer.jobDataPath
122  self.outputPath = "validation_output"
123 
124  # set outputpath
125  try:
126  if (parser.get("GENERAL", "outputpath")):
127  self.outputPath = parser.get("GENERAL", "outputpath")
128  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
129  pass
130 
131 
132  # data which could be stored directly
133  try:
134  self.jobTime = int(parser.get("GENERAL", "time"))
135  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
136  pass
137 
138  try:
139  self.latexfile = parser.get("GENERAL", "latexfile")
140  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
141  pass
142 
143  try:
144  self.limit = parser.get("GENERAL", "limit")
145  self.limit = map(float, self.limit.replace(" ", "").split(","))
146  # make a dict to lookup by mode
147  self.limit = dict(zip(["xyz", "rot", "dist"], self.limit))
148  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
149  pass
150 
151  try:
152  self.statboxsize = float(parser.get("GENERAL", "statboxsize"))
153  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
154  pass
155 
156  # MODULEPLOTS
157 
158  try:
159  self.numberofbins = int(parser.get("MODULEPLOTS", "numberofbins"))
160  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
161  pass
162 
163  try:
164  self.defpeak = int(parser.get("MODULEPLOTS", "defpeak"))
165  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
166  pass
167 
168  try:
169  self.widthstddev = int(parser.get("MODULEPLOTS", "widthstddev"))
170  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
171  pass
172 
173  try:
174  self.samerange = int(parser.get("MODULEPLOTS", "samerange"))
175  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
176  pass
177 
178  try:
179  self.rangemode = parser.get("MODULEPLOTS", "rangemode")
180  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
181  pass
182 
183  try:
184  self.rangexyzM = parser.get("MODULEPLOTS", "rangexyz")
185  self.rangexyzM = sorted(
186  map(float, self.rangexyzM.replace(" ", "").split(",")))
187  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
188  pass
189 
190  try:
191  self.rangerotM = parser.get("MODULEPLOTS", "rangerot")
192  self.rangerotM = sorted(
193  map(float, self.rangerotM.replace(" ", "").split(",")))
194  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
195  pass
196 
197  try:
198  self.rangedistM = parser.get("MODULEPLOTS", "rangedist")
199  self.rangedistM = sorted(
200  map(float, self.rangedistM.replace(" ", "").split(",")))
201  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
202  pass
203 
204  # HIGHLEVELPLOTS
205 
206  try:
207  self.rangexyzHL = parser.get("HIGHLEVELPLOTS", "rangexyz")
208  self.rangexyzHL = sorted(
209  map(float, self.rangexyzHL.replace(" ", "").split(",")))
210  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
211  pass
212 
213  try:
214  self.rangerotHL = parser.get("HIGHLEVELPLOTS", "rangerot")
215  self.rangerotHL = sorted(
216  map(float, self.rangerotHL.replace(" ", "").split(",")))
217  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
218  pass
219 
220  try:
221  self.samerangeHL = int(parser.get("HIGHLEVELPLOTS", "samerange"))
222  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
223  pass
224 
225  try:
226  self.rangemodeHL = parser.get("HIGHLEVELPLOTS", "rangemode")
227  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
228  pass
229 
230  # TIMEPLOTS
231 
232  try:
233  self.firsttree = int(parser.get("TIMEPLOTS", "firsttree"))
234  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
235  pass
236 
237  # SHOW
238 
239  try:
240  self.showmonitor = int(parser.get("SHOW", "showmonitor"))
241  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
242  pass
243 
244  try:
245  self.showadditional = int(parser.get("SHOW", "showadditional"))
246  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
247  pass
248 
249  try:
250  self.showdump = int(parser.get("SHOW", "showdump"))
251  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
252  pass
253 
254  try:
255  self.showtime = int(parser.get("SHOW", "showtime"))
256  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
257  pass
258 
259  try:
260  self.showhighlevel = int(parser.get("SHOW", "showhighlevel"))
261  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
262  pass
263 
264  try:
265  self.showmodule = int(parser.get("SHOW", "showmodule"))
266  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
267  pass
268 
269  try:
270  self.showsubmodule = int(parser.get("SHOW", "showsubmodule"))
271  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
272  pass
273 
274  try:
275  self.showtex = int(parser.get("SHOW", "showtex"))
276  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
277  pass
278 
279  try:
280  self.showbeamer = int(parser.get("SHOW", "showbeamer"))
281  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
282  pass
283 
284  try:
285  self.showhtml = int(parser.get("SHOW", "showhtml"))
286  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
287  pass
288 
def parseConfig(self, path)
Definition: iniparser.py:86
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
double split
Definition: MVATrainer.cc:139
def iniparser.ConfigData.parseParameter (   self,
  args 
)

Definition at line 289 of file iniparser.py.

References iniparser.ConfigData.jobDataPath, iniparser.ConfigData.jobNumber, iniparser.ConfigData.jobTime, iniparser.ConfigData.message, and iniparser.ConfigData.outputPath.

289  def parseParameter(self, args):
290  logger = logging.getLogger("mpsvalidate")
291 
292  # check if parameter is given and override the config data
293  if (args.time != -1):
294  self.jobTime = args.time
295 
296  if (args.job != -1):
297  self.jobNumber = args.job
298 
299  # set jobDataPath
300  if (self.jobNumber == 0):
301  self.jobDataPath = "jobData/jobm"
302  else:
303  self.jobDataPath = "jobData/jobm{0}".format(self.jobNumber)
304  self.outputPath = os.path.join(self.jobDataPath, "validation_output")
305 
306  if (args.jobdatapath != ""):
307  self.jobDataPath = args.jobdatapath
308 
309  if (args.message != ""):
310  self.message = args.message
311 
312  # if path is given put the output in the current directory
313  if (args.jobdatapath):
314  self.outputPath = "validation_output"
315 
316  if (args.outputpath):
317  self.outputPath = args.outputpath
318 

Member Data Documentation

iniparser.ConfigData.defpeak

Definition at line 58 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.firsttree

Definition at line 81 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.jobDataPath
iniparser.ConfigData.jobNumber
iniparser.ConfigData.jobTime
iniparser.ConfigData.latexfile

Definition at line 33 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.limit

Definition at line 38 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.mpspath

Definition at line 21 of file iniparser.py.

iniparser.ConfigData.numberofbins

Definition at line 56 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.outputList

Definition at line 84 of file iniparser.py.

iniparser.ConfigData.outputPath
iniparser.ConfigData.rangedistM

Definition at line 69 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.rangemode

Definition at line 65 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.rangemodeHL

Definition at line 78 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.rangerotHL

Definition at line 74 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.rangerotM

Definition at line 68 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.rangexyzHL

Definition at line 73 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.rangexyzM

Definition at line 67 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.samerange

Definition at line 62 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.samerangeHL

Definition at line 76 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showadditional

Definition at line 44 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showbeamer

Definition at line 51 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showdump

Definition at line 45 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showhighlevel

Definition at line 47 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showhtml

Definition at line 52 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showmodule

Definition at line 48 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showmonitor

Definition at line 43 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showsubmodule

Definition at line 49 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showtex

Definition at line 50 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showtime

Definition at line 46 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.statboxsize

Definition at line 40 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.widthstddev

Definition at line 60 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().