3 from helperFunctions
import replaceByMap
4 from TkAlExceptions
import AllInOneError
7 def __init__(self, name, config, runGeomComp = "1"):
9 "TrackerAlignmentErrorExtendedRcd":
10 {
"zeroAPE":{
"connectString": (
"frontier://FrontierProd"
12 "tagName":
"TrackerAlignmentExtendedErr_2009_v2_express_IOVs",
15 section =
"alignment:%s"%name
16 if not config.has_section( section ):
17 raise AllInOneError, (
"section %s not found. Please define the "
19 config.checkInput(section,
20 knownSimpleOptions = [
'globaltag',
'style',
'color',
'title'],
21 knownKeywords = [
'condition'])
23 if config.exists(section,
"title"):
24 self.
title = config.get(section,
"title")
28 msg =
"The characters '|', '\"', and ',' cannot be used in the alignment title!"
33 self.
color = config.get(section,
"color")
34 self.
style = config.get(section,
"style")
38 """Method which checks, if `theShorthand` is a valid shorthand for the
42 - `theRcdName`: String which specifies the database record.
43 - `theShorthand`: String which specifies the shorthand to check.
55 for option
in theConfig.options( theSection ):
56 if option.startswith(
"condition " ):
57 rcdName = option.split(
"condition " )[1]
58 condPars = theConfig.get( theSection, option ).
split(
"," )
59 if len(condPars) == 1:
60 if len(condPars[0])==0:
61 msg = (
"In section [%s]: '%s' is used with too few "
62 "arguments. A connect_string and a tag are "
63 "required!"%(theSection, option))
66 shorthand = condPars[0]
68 self.
condShorts[rcdName][shorthand][
"connectString"],
69 self.
condShorts[rcdName][shorthand][
"tagName"],
70 self.
condShorts[rcdName][shorthand][
"labelName"]]
72 msg = (
"In section [%s]: '%s' is used with '%s', "
73 "which is an unknown shorthand for '%s'. Either "
74 "provide at least a connect_string and a tag or "
75 "use a known shorthand.\n"
76 %(theSection, option, condPars[0], rcdName))
78 msg +=
"Known shorthands for '%s':\n"%(rcdName)
80 knownShorts = [(
"\t"+key+
": "
81 +theShorts[key][
"connectString"]+
","
82 +theShorts[key][
"tagName"]+
","
83 +theShorts[key][
"labelName"]) \
85 msg+=
"\n".
join(knownShorts)
87 msg += (
"There are no known shorthands for '%s'."
90 if len( condPars ) == 2:
93 msg = (
"In section [%s]: '%s' is used with too many "
94 "arguments. A maximum of 3 arguments is allowed."
95 %(theSection, option))
97 conditions.append({
"rcdName": rcdName.strip(),
98 "connectString": condPars[0].strip(),
99 "tagName": condPars[1].strip(),
100 "labelName": condPars[2].strip()})
106 if not dbpath.startswith(
"sqlite_file:"):
107 print "WARNING: could not check existence for",dbpath
109 if not os.path.exists( dbpath.split(
"sqlite_file:")[1] ):
110 raise "could not find file: '%s'"%dbpath.split(
"sqlite_file:")[1]
114 if not restriction ==
None:
115 for mode
in self.
mode:
116 if mode
in restriction:
117 result.append( mode )
132 """This function creates the configuration snippet to override
133 global tag conditions.
136 loadCond = (
"\nimport CalibTracker.Configuration."
137 "Common.PoolDBESSource_cfi\n")
139 if not cond[
"labelName"] ==
"":
140 temp = configTemplates.conditionsTemplate.replace(
141 "tag = cms.string('.oO[tagName]Oo.')",
142 (
"tag = cms.string('.oO[tagName]Oo.'),"
143 "\nlabel = cms.untracked.string('.oO[labelName]Oo.')"))
145 temp = configTemplates.conditionsTemplate
static std::string join(char **cmd)
def replaceByMap
— Helpers —############################