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
 
 firstRun
 
 firsttree
 
 globalTag
 
 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 16 of file iniparser.py.

Constructor & Destructor Documentation

def iniparser.ConfigData.__init__ (   self)

Definition at line 20 of file iniparser.py.

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

Member Function Documentation

def iniparser.ConfigData.parseConfig (   self,
  path 
)

Definition at line 94 of file iniparser.py.

References cmsPerfStripChart.dict, iniparser.ConfigData.firsttree, iniparser.ConfigData.jobDataPath, iniparser.ConfigData.jobNumber, iniparser.ConfigData.jobTime, join(), iniparser.ConfigData.latexfile, iniparser.ConfigData.limit, genParticles_cff.map, iniparser.ConfigData.outputPath, iniparser.ConfigData.rangemode, iniparser.ConfigData.rangemodeHL, iniparser.ConfigData.samerange, iniparser.ConfigData.samerangeHL, split, iniparser.ConfigData.statboxsize, and ComparisonHelper.zip().

94  def parseConfig(self, path):
95  logger = logging.getLogger("mpsvalidate")
96 
97  # create ConfigParser object
98  parser = ConfigParser.ConfigParser()
99 
100  # read ini file
101  if (parser.read(path) == []):
102  logger.error("Could not open ini-file: {0}".format(path))
103 
104  # collect data and process it
105  try:
106  self.jobNumber = parser.getint("GENERAL", "job")
107  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
108  pass
109 
110  try:
111  self.jobDataPath = parser.get("GENERAL", "jobdatapath")
112  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
113  pass
114 
115  # if jobData path is given
116  if self.jobDataPath != "":
117  self.outputPath = "validation_output"
118 
119  # set jobDataPath if job number is given and if path is not given
120  if self.jobNumber != -1 and self.jobDataPath == "":
121  if self.jobNumber == 0:
122  self.jobDataPath = "jobData/jobm"
123  else:
124  self.jobDataPath = "jobData/jobm{0}".format(self.jobNumber)
125  self.outputPath = os.path.join(self.jobDataPath, "validation_output")
126 
127  # set outputpath
128  try:
129  if parser.get("GENERAL", "outputpath"):
130  self.outputPath = parser.get("GENERAL", "outputpath")
131  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
132  pass
133 
134 
135  # data which could be stored directly
136  try:
137  self.jobTime = parser.getint("GENERAL", "time")
138  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
139  pass
140 
141  try:
142  self.latexfile = parser.get("GENERAL", "latexfile")
143  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
144  pass
145 
146  try:
147  self.limit = parser.get("GENERAL", "limit")
148  self.limit = map(float, "".join(self.limit.split()).split(","))
149  # make a dict to lookup by mode
150  self.limit = dict(zip(["xyz", "rot", "dist"], self.limit))
151  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
152  pass
153 
154  try:
155  self.statboxsize = parser.getfloat("GENERAL", "statboxsize")
156  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
157  pass
158 
159 
160  # MODULEPLOTS
161 
162  # integers
163  for par in ("numberofbins", "defpeak", "widthstddev"):
164  try:
165  setattr(self, par, parser.getint("MODULEPLOTS", par))
166  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
167  pass
168 
169  # booleans
170  try:
171  self.samerange = parser.getboolean("MODULEPLOTS", "samerange")
172  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
173  pass
174 
175  # strings
176  try:
177  self.rangemode = parser.get("MODULEPLOTS", "rangemode")
178  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
179  pass
180 
181  # ranges
182  for r in ("rangexyz", "rangerot", "rangedist"):
183  try:
184  setattr(self, r+"M", parser.get("MODULEPLOTS", r))
185  setattr(self, r+"M",
186  sorted(map(float, "".join(getattr(self, r+"M").split()).split(","))))
187  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
188  pass
189 
190 
191  # HIGHLEVELPLOTS
192 
193  # booleans
194  try:
195  self.samerangeHL = parser.getboolean("HIGHLEVELPLOTS", "samerange")
196  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
197  pass
198 
199  # strings
200  try:
201  self.rangemodeHL = parser.get("HIGHLEVELPLOTS", "rangemode")
202  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
203  pass
204 
205  # ranges
206  for r in ("rangexyz", "rangerot"):
207  try:
208  setattr(self, r+"HL", parser.get("HIGHLEVELPLOTS", r))
209  setattr(self, r+"HL",
210  sorted(map(float, "".join(getattr(self, r+"HL").split()).split(","))))
211  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
212  pass
213 
214 
215  # TIMEPLOTS
216 
217  try:
218  self.firsttree = parser.getint("TIMEPLOTS", "firsttree")
219  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
220  pass
221 
222  # SHOW
223  for boolean in ("showmonitor", "showadditional", "showdump", "showtime",
224  "showhighlevel", "showmodule", "showsubmodule",
225  "showtex", "showbeamer", "showhtml"):
226  try:
227  setattr(self, boolean, parser.getboolean("SHOW", boolean))
228  except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
229  pass
230 
231 
def parseConfig(self, path)
Definition: iniparser.py:94
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
def iniparser.ConfigData.parseParameter (   self,
  args 
)

Definition at line 232 of file iniparser.py.

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

232  def parseParameter(self, args):
233  logger = logging.getLogger("mpsvalidate")
234 
235  # check if parameter is given and override the config data
236  if args.time != -1:
237  self.jobTime = args.time
238 
239  if args.job != -1:
240  self.jobNumber = args.job
241 
242  # set jobDataPath
243  if self.jobNumber == 0:
244  self.jobDataPath = "jobData/jobm"
245  else:
246  self.jobDataPath = "jobData/jobm{0}".format(self.jobNumber)
247  self.outputPath = os.path.join(self.jobDataPath, "validation_output")
248 
249  if args.jobdatapath != "":
250  self.jobDataPath = args.jobdatapath
251 
252  if args.message != "":
253  self.message = args.message
254 
255  # if path is given put the output in the current directory
256  if args.jobdatapath:
257  self.outputPath = "validation_output"
258 
259  if args.outputpath:
260  self.outputPath = args.outputpath
261 

Member Data Documentation

iniparser.ConfigData.defpeak

Definition at line 66 of file iniparser.py.

iniparser.ConfigData.firstRun

Definition at line 48 of file iniparser.py.

iniparser.ConfigData.firsttree

Definition at line 89 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.globalTag

Definition at line 46 of file iniparser.py.

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

Definition at line 37 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.limit

Definition at line 42 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.mpspath

Definition at line 22 of file iniparser.py.

iniparser.ConfigData.numberofbins

Definition at line 64 of file iniparser.py.

iniparser.ConfigData.outputList

Definition at line 92 of file iniparser.py.

iniparser.ConfigData.outputPath
iniparser.ConfigData.rangedistM

Definition at line 77 of file iniparser.py.

iniparser.ConfigData.rangemode

Definition at line 73 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.rangemodeHL

Definition at line 86 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.rangerotHL

Definition at line 82 of file iniparser.py.

iniparser.ConfigData.rangerotM

Definition at line 76 of file iniparser.py.

iniparser.ConfigData.rangexyzHL

Definition at line 81 of file iniparser.py.

iniparser.ConfigData.rangexyzM

Definition at line 75 of file iniparser.py.

iniparser.ConfigData.samerange

Definition at line 70 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.samerangeHL

Definition at line 84 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.showadditional

Definition at line 52 of file iniparser.py.

iniparser.ConfigData.showbeamer

Definition at line 59 of file iniparser.py.

iniparser.ConfigData.showdump

Definition at line 53 of file iniparser.py.

iniparser.ConfigData.showhighlevel

Definition at line 55 of file iniparser.py.

iniparser.ConfigData.showhtml

Definition at line 60 of file iniparser.py.

iniparser.ConfigData.showmodule

Definition at line 56 of file iniparser.py.

iniparser.ConfigData.showmonitor

Definition at line 51 of file iniparser.py.

iniparser.ConfigData.showsubmodule

Definition at line 57 of file iniparser.py.

iniparser.ConfigData.showtex

Definition at line 58 of file iniparser.py.

iniparser.ConfigData.showtime

Definition at line 54 of file iniparser.py.

iniparser.ConfigData.statboxsize

Definition at line 44 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig().

iniparser.ConfigData.widthstddev

Definition at line 68 of file iniparser.py.