CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
iniparser.ConfigData Class Reference

Public Member Functions

def __init__
 
def parseConfig
 
def parseParameter
 

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

Member Function Documentation

def iniparser.ConfigData.parseConfig (   self,
  path 
)

Definition at line 94 of file iniparser.py.

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

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

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

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

Definition at line 33 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig(), and iniparser.ConfigData.parseParameter().

iniparser.ConfigData.jobNumber

Definition at line 29 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig(), and iniparser.ConfigData.parseParameter().

iniparser.ConfigData.jobTime

Definition at line 31 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig(), and iniparser.ConfigData.parseParameter().

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.message

Definition at line 39 of file iniparser.py.

Referenced by util.rrapi.RRApiError.__str__(), rrapi.RRApiError.__str__(), and iniparser.ConfigData.parseParameter().

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

Definition at line 35 of file iniparser.py.

Referenced by iniparser.ConfigData.parseConfig(), and iniparser.ConfigData.parseParameter().

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.