Public Member Functions | |
def | __init__ |
def | getConditions |
def | getRepMap |
def | restrictTo |
Public Attributes | |
color | |
conditions | |
condShorts | |
globaltag | |
mode | |
name | |
runGeomComp | |
style | |
Private Member Functions | |
def | __getConditions |
def | __shorthandExists |
def | __testDbExist |
Definition at line 6 of file alignment.py.
def alignment::Alignment::__init__ | ( | self, | |
name, | |||
config, | |||
runGeomComp = "1" |
|||
) |
Definition at line 7 of file alignment.py.
00008 : 00009 self.condShorts = { 00010 "TrackerAlignmentErrorRcd": 00011 {"zeroAPE":{"connectString": ("frontier://FrontierProd" 00012 "/CMS_COND_31X_FROM21X"), 00013 "tagName": "TrackerIdealGeometryErrors210_mc", 00014 "labelName": ""}}} 00015 section = "alignment:%s"%name 00016 if not config.has_section( section ): 00017 raise AllInOneError, ("section %s not found. Please define the " 00018 "alignment!"%section) 00019 config.checkInput(section, 00020 knownSimpleOptions = ['globaltag', 'style', 'color'], 00021 knownKeywords = ['condition']) 00022 self.name = name 00023 self.runGeomComp = runGeomComp 00024 self.globaltag = config.get( section, "globaltag" ) 00025 self.conditions = self.__getConditions( config, section ) 00026 self.color = config.get(section,"color") 00027 self.style = config.get(section,"style") 00028
def alignment::Alignment::__getConditions | ( | self, | |
theConfig, | |||
theSection | |||
) | [private] |
Definition at line 45 of file alignment.py.
00046 : 00047 conditions = [] 00048 for option in theConfig.options( theSection ): 00049 if option.startswith( "condition " ): 00050 rcdName = option.split( "condition " )[1] 00051 condPars = theConfig.get( theSection, option ).split( "," ) 00052 if len(condPars) == 1: 00053 if len(condPars[0])==0: 00054 msg = ("In section [%s]: '%s' is used with too few " 00055 "arguments. A connect_string and a tag are " 00056 "required!"%(theSection, option)) 00057 raise AllInOneError(msg) 00058 elif self.__shorthandExists(rcdName, condPars[0]): 00059 shorthand = condPars[0] 00060 condPars = [ 00061 self.condShorts[rcdName][shorthand]["connectString"], 00062 self.condShorts[rcdName][shorthand]["tagName"], 00063 self.condShorts[rcdName][shorthand]["labelName"]] 00064 else: 00065 msg = ("In section [%s]: '%s' is used with '%s', " 00066 "which is an unknown shorthand for '%s'. Either " 00067 "provide at least a connect_string and a tag or " 00068 "use a known shorthand.\n" 00069 %(theSection, option, condPars[0], rcdName)) 00070 if rcdName in self.condShorts: 00071 msg += "Known shorthands for '%s':\n"%(rcdName) 00072 theShorts = self.condShorts[rcdName] 00073 knownShorts = [("\t"+key+": " 00074 +theShorts[key]["connectString"]+"," 00075 +theShorts[key]["tagName"]+"," 00076 +theShorts[key]["labelName"]) \ 00077 for key in theShorts] 00078 msg+="\n".join(knownShorts) 00079 else: 00080 msg += ("There are no known shorthands for '%s'." 00081 %(rcdName)) 00082 raise AllInOneError(msg) 00083 if len( condPars ) == 2: 00084 condPars.append( "" ) 00085 if len(condPars) > 3: 00086 msg = ("In section [%s]: '%s' is used with too many " 00087 "arguments. A maximum of 3 arguments is allowed." 00088 %(theSection, option)) 00089 raise AllInOneError(msg) 00090 conditions.append({"rcdName": rcdName.strip(), 00091 "connectString": condPars[0].strip(), 00092 "tagName": condPars[1].strip(), 00093 "labelName": condPars[2].strip()}) 00094 return conditions
def alignment::Alignment::__shorthandExists | ( | self, | |
theRcdName, | |||
theShorthand | |||
) | [private] |
Method which checks, if `theShorthand` is a valid shorthand for the given `theRcdName`. Arguments: - `theRcdName`: String which specifies the database record. - `theShorthand`: String which specifies the shorthand to check.
Definition at line 29 of file alignment.py.
00030 : 00031 """Method which checks, if `theShorthand` is a valid shorthand for the 00032 given `theRcdName`. 00033 00034 Arguments: 00035 - `theRcdName`: String which specifies the database record. 00036 - `theShorthand`: String which specifies the shorthand to check. 00037 """ 00038 00039 if (theRcdName in self.condShorts) and \ 00040 (theShorthand in self.condShorts[theRcdName]): 00041 return True 00042 else: 00043 return False 00044
def alignment::Alignment::__testDbExist | ( | self, | |
dbpath | |||
) | [private] |
Definition at line 95 of file alignment.py.
00096 : 00097 #FIXME delete return to end train debuging 00098 return 00099 if not dbpath.startswith("sqlite_file:"): 00100 print "WARNING: could not check existence for",dbpath 00101 else: 00102 if not os.path.exists( dbpath.split("sqlite_file:")[1] ): 00103 raise "could not find file: '%s'"%dbpath.split("sqlite_file:")[1]
def alignment::Alignment::getConditions | ( | self | ) |
This function creates the configuration snippet to override global tag conditions.
Definition at line 122 of file alignment.py.
00123 : 00124 """This function creates the configuration snippet to override 00125 global tag conditions. 00126 """ 00127 if len( self.conditions ): 00128 loadCond = ("\nimport CalibTracker.Configuration." 00129 "Common.PoolDBESSource_cfi\n") 00130 for cond in self.conditions: 00131 if not cond["labelName"] == "": 00132 temp = configTemplates.conditionsTemplate.replace( 00133 "tag = cms.string('.oO[tagName]Oo.')", 00134 ("tag = cms.string('.oO[tagName]Oo.')," 00135 "\nlabel = cms.untracked.string('.oO[labelName]Oo.')")) 00136 else: 00137 temp = configTemplates.conditionsTemplate 00138 loadCond += replaceByMap( temp, cond ) 00139 else: 00140 loadCond = "" 00141 return loadCond
def alignment::Alignment::getRepMap | ( | self | ) |
Definition at line 112 of file alignment.py.
def alignment::Alignment::restrictTo | ( | self, | |
restriction | |||
) |
Definition at line 104 of file alignment.py.
Definition at line 7 of file alignment.py.
Definition at line 7 of file alignment.py.
Definition at line 7 of file alignment.py.
Definition at line 7 of file alignment.py.
Definition at line 104 of file alignment.py.
Definition at line 7 of file alignment.py.
Definition at line 7 of file alignment.py.
Definition at line 7 of file alignment.py.