CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions

validateAlignments::Alignment Class Reference

List of all members.

Public Member Functions

def __init__
def getAPETemplate
def getConditions
def getLoadTemplate
def getRepMap
def restrictTo

Public Attributes

 color
 conditions
 dbpath
 errordbpath
 errortag
 globaltag
 kbdbpath
 kbtag
 kinksAndBows
 mode
 name
 runGeomComp
 style
 tag

Private Member Functions

def __getConditions
def __testDbExist

Detailed Description

Definition at line 150 of file validateAlignments.py.


Constructor & Destructor Documentation

def validateAlignments::Alignment::__init__ (   self,
  name,
  config,
  runGeomComp = "1" 
)

Definition at line 151 of file validateAlignments.py.

00152                                                        :
00153         section = "alignment:%s"%name
00154         if not config.has_section( section ):
00155             raise StandardError, ("section %s not found. Please define the "
00156                                   "alignment!"%section)
00157 
00158         # Check for typos or wrong parameters
00159         knownSimpleParameters = [ 'globaltag', 'style', 'color' ]
00160         knownKeywords = [ 'condition' ]
00161         for option in config.options( section ):
00162             if option in knownSimpleParameters:
00163                 continue
00164             elif option.split()[0] in knownKeywords:
00165                 continue
00166             else:
00167                 raise StandardError, ("Invalid or unknown parameter '%s' in "
00168                                       "section '%s'!")%( option, section )
00169 
00170         self.name = name
00171         self.runGeomComp = runGeomComp
00172         self.globaltag = config.get( section, "globaltag" )
00173         self.conditions = self.__getConditions( config, section )
00174         self.color = config.get(section,"color")
00175         self.style = config.get(section,"style")
00176 
00177         # - removed backward compatibility
00178         # - keep the following lines, until the templates are adjusted
00179         #   to the new syntax
00180         self.dbpath = ""
00181         self.tag = ""
00182         self.errordbpath = "frontier://FrontierProd/CMS_COND_31X_FROM21X"
00183         self.errortag = "TrackerIdealGeometryErrors210_mc"
00184         self.kinksAndBows = ""
00185         self.kbdbpath = ""
00186         self.kbtag = ""
        

Member Function Documentation

def validateAlignments::Alignment::__getConditions (   self,
  theConfig,
  theSection 
) [private]

Definition at line 187 of file validateAlignments.py.

00188                                                       :
00189         conditions = []
00190         for option in theConfig.options( theSection ):
00191             if option.startswith( "condition " ):
00192                 rcdName = option.split( "condition " )[1]
00193                 condParameters = theConfig.get( theSection, option ).split( "," )
00194                 if len( condParameters ) < 2:
00195                     raise StandardError, ("'%s' is used with too few arguments."
00196                                           "A connect_string and a tag are "
00197                                           "required!"%option)
00198                 if len( condParameters ) < 3:
00199                     condParameters.append( "" )
00200                 conditions.append({"rcdName": rcdName.strip(),
00201                                    "connectString": condParameters[0].strip(),
00202                                    "tagName": condParameters[1].strip(),
00203                                    "labelName": condParameters[2].strip()})
00204         return conditions

def validateAlignments::Alignment::__testDbExist (   self,
  dbpath 
) [private]

Definition at line 205 of file validateAlignments.py.

00206                                    :
00207         #FIXME delete return to end train debuging
00208         return
00209         if not dbpath.startswith("sqlite_file:"):
00210             print "WARNING: could not check existence for",dbpath
00211         else:
00212             if not os.path.exists( dbpath.split("sqlite_file:")[1] ):
00213                 raise "could not find file: '%s'"%dbpath.split("sqlite_file:")[1]
 
def validateAlignments::Alignment::getAPETemplate (   self)
This function still exists only for historical reasons.
   Will be removed, when the templates are adjusted.
   

Definition at line 245 of file validateAlignments.py.

00246                             :
00247         """This function still exists only for historical reasons.
00248            Will be removed, when the templates are adjusted.
00249            """
00250         return ""

def validateAlignments::Alignment::getConditions (   self)
This function creates the configuration snippet to override
   global tag conditions.
   

Definition at line 251 of file validateAlignments.py.

00252                            :
00253         """This function creates the configuration snippet to override
00254            global tag conditions.
00255            """
00256         if len( self.conditions ):
00257             loadCond = ("\nimport CalibTracker.Configuration."
00258                         "Common.PoolDBESSource_cfi\n")
00259             for cond in self.conditions:
00260                 if not cond["labelName"] == "":
00261                     temp = configTemplates.conditionsTemplate.replace(
00262                         "tag = cms.string('.oO[tagName]Oo.')",
00263                         ("tag = cms.string('.oO[tagName]Oo.'),"
00264                          "\nlabel = cms.untracked.string('.oO[labelName]Oo.')"))
00265                 else:    
00266                     temp = configTemplates.conditionsTemplate
00267                 loadCond += replaceByMap( temp, cond )
00268         else:
00269             loadCond = ""
00270         return loadCond
00271 

def validateAlignments::Alignment::getLoadTemplate (   self)
This function still exists only for historical reasons.
   Will be removed, when the templates are adjusted.
   

Definition at line 239 of file validateAlignments.py.

00240                              :
00241         """This function still exists only for historical reasons.
00242            Will be removed, when the templates are adjusted.
00243            """
00244         return ""

def validateAlignments::Alignment::getRepMap (   self)

Definition at line 222 of file validateAlignments.py.

00223                          :
00224         result = {
00225             "name": self.name,
00226             "dbpath": self.dbpath,
00227             "errordbpath": self.errordbpath,
00228             "tag": self.tag,
00229             "errortag": self.errortag,
00230             "color": self.color,
00231             "style": self.style,
00232             "runGeomComp": self.runGeomComp,
00233             "kinksAndBows": self.kinksAndBows,
00234             "kbdbpath": self.kbdbpath,
00235             "kbtag": self.kbtag,
00236             "GlobalTag": self.globaltag
00237             }
00238         return result  

def validateAlignments::Alignment::restrictTo (   self,
  restriction 
)

Definition at line 214 of file validateAlignments.py.

00215                                        :
00216         result = []
00217         if not restriction == None:
00218             for mode in self.mode:
00219                 if mode in restriction:
00220                     result.append( mode )
00221             self.mode = result


Member Data Documentation

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 214 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.

Definition at line 151 of file validateAlignments.py.