CMS 3D CMS Logo

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

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
 

Detailed Description

Definition at line 6 of file alignment.py.

Constructor & Destructor Documentation

def alignment.Alignment.__init__ (   self,
  name,
  config,
  runGeomComp = "1" 
)

Definition at line 7 of file alignment.py.

7 
8  def __init__(self, name, config, runGeomComp = "1"):
9  self.condShorts = {
10  "TrackerAlignmentErrorRcd":
11  {"zeroAPE":{"connectString": ("frontier://FrontierProd"
12  "/CMS_COND_31X_FROM21X"),
13  "tagName": "TrackerIdealGeometryErrors210_mc",
14  "labelName": ""}}}
15  section = "alignment:%s"%name
16  if not config.has_section( section ):
17  raise AllInOneError, ("section %s not found. Please define the "
18  "alignment!"%section)
19  config.checkInput(section,
20  knownSimpleOptions = ['globaltag', 'style', 'color'],
21  knownKeywords = ['condition'])
22  self.name = name
23  self.runGeomComp = runGeomComp
24  self.globaltag = config.get( section, "globaltag" )
25  self.conditions = self.__getConditions( config, section )
26  self.color = config.get(section,"color")
27  self.style = config.get(section,"style")
28 

Member Function Documentation

def alignment.Alignment.__getConditions (   self,
  theConfig,
  theSection 
)
private

Definition at line 45 of file alignment.py.

References alignment.Alignment.__shorthandExists(), alignment.Alignment.condShorts, join(), and split.

45 
46  def __getConditions( self, theConfig, theSection ):
47  conditions = []
48  for option in theConfig.options( theSection ):
49  if option.startswith( "condition " ):
50  rcdName = option.split( "condition " )[1]
51  condPars = theConfig.get( theSection, option ).split( "," )
52  if len(condPars) == 1:
53  if len(condPars[0])==0:
54  msg = ("In section [%s]: '%s' is used with too few "
55  "arguments. A connect_string and a tag are "
56  "required!"%(theSection, option))
57  raise AllInOneError(msg)
58  elif self.__shorthandExists(rcdName, condPars[0]):
59  shorthand = condPars[0]
60  condPars = [
61  self.condShorts[rcdName][shorthand]["connectString"],
62  self.condShorts[rcdName][shorthand]["tagName"],
63  self.condShorts[rcdName][shorthand]["labelName"]]
64  else:
65  msg = ("In section [%s]: '%s' is used with '%s', "
66  "which is an unknown shorthand for '%s'. Either "
67  "provide at least a connect_string and a tag or "
68  "use a known shorthand.\n"
69  %(theSection, option, condPars[0], rcdName))
70  if rcdName in self.condShorts:
71  msg += "Known shorthands for '%s':\n"%(rcdName)
72  theShorts = self.condShorts[rcdName]
73  knownShorts = [("\t"+key+": "
74  +theShorts[key]["connectString"]+","
75  +theShorts[key]["tagName"]+","
76  +theShorts[key]["labelName"]) \
77  for key in theShorts]
78  msg+="\n".join(knownShorts)
79  else:
80  msg += ("There are no known shorthands for '%s'."
81  %(rcdName))
82  raise AllInOneError(msg)
83  if len( condPars ) == 2:
84  condPars.append( "" )
85  if len(condPars) > 3:
86  msg = ("In section [%s]: '%s' is used with too many "
87  "arguments. A maximum of 3 arguments is allowed."
88  %(theSection, option))
89  raise AllInOneError(msg)
90  conditions.append({"rcdName": rcdName.strip(),
91  "connectString": condPars[0].strip(),
92  "tagName": condPars[1].strip(),
93  "labelName": condPars[2].strip()})
94  return conditions
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
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.

References alignment.Alignment.condShorts.

Referenced by alignment.Alignment.__getConditions().

29 
30  def __shorthandExists(self, theRcdName, theShorthand):
31  """Method which checks, if `theShorthand` is a valid shorthand for the
32  given `theRcdName`.
33 
34  Arguments:
35  - `theRcdName`: String which specifies the database record.
36  - `theShorthand`: String which specifies the shorthand to check.
37  """
38 
39  if (theRcdName in self.condShorts) and \
40  (theShorthand in self.condShorts[theRcdName]):
41  return True
42  else:
43  return False
44 
def alignment.Alignment.__testDbExist (   self,
  dbpath 
)
private

Definition at line 95 of file alignment.py.

95 
96  def __testDbExist(self, dbpath):
97  #FIXME delete return to end train debuging
98  return
99  if not dbpath.startswith("sqlite_file:"):
100  print "WARNING: could not check existence for",dbpath
101  else:
102  if not os.path.exists( dbpath.split("sqlite_file:")[1] ):
103  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.

References alignment.Alignment.conditions, and helperFunctions.replaceByMap().

123  def getConditions(self):
124  """This function creates the configuration snippet to override
125  global tag conditions.
126  """
127  if len( self.conditions ):
128  loadCond = ("\nimport CalibTracker.Configuration."
129  "Common.PoolDBESSource_cfi\n")
130  for cond in self.conditions:
131  if not cond["labelName"] == "":
132  temp = configTemplates.conditionsTemplate.replace(
133  "tag = cms.string('.oO[tagName]Oo.')",
134  ("tag = cms.string('.oO[tagName]Oo.'),"
135  "\nlabel = cms.untracked.string('.oO[labelName]Oo.')"))
136  else:
137  temp = configTemplates.conditionsTemplate
138  loadCond += replaceByMap( temp, cond )
139  else:
140  loadCond = ""
141  return loadCond
def replaceByMap
— Helpers —############################
def alignment.Alignment.getRepMap (   self)

Definition at line 112 of file alignment.py.

References alignment.Alignment.color, alignment.Alignment.globaltag, entry.name, alignment.Alignment.name, MuonGeometrySanityCheckPoint.name, plotscripts.SawTeethFunction.name, alignment.Alignment.runGeomComp, and alignment.Alignment.style.

Referenced by trackSplittingValidation.TrackSplittingValidation.appendToExtendedValidation(), offlineValidation.OfflineValidation.appendToExtendedValidation(), offlineValidation.OfflineValidation.appendToMerge(), offlineValidation.OfflineValidationParallel.appendToMergeParJobs(), trackSplittingValidation.TrackSplittingValidation.createConfiguration(), monteCarloValidation.MonteCarloValidation.createConfiguration(), zMuMuValidation.ZMuMuValidation.createConfiguration(), offlineValidation.OfflineValidation.createConfiguration(), geometryComparison.GeometryComparison.createConfiguration(), offlineValidation.OfflineValidationParallel.createConfiguration(), genericValidation.GenericValidationData.createCrabCfg(), trackSplittingValidation.TrackSplittingValidation.createScript(), monteCarloValidation.MonteCarloValidation.createScript(), zMuMuValidation.ZMuMuValidation.createScript(), offlineValidation.OfflineValidation.createScript(), geometryComparison.GeometryComparison.createScript(), and offlineValidation.OfflineValidationParallel.createScript().

113  def getRepMap( self ):
114  result = {
115  "name": self.name,
116  "color": self.color,
117  "style": self.style,
118  "runGeomComp": self.runGeomComp,
119  "GlobalTag": self.globaltag
120  }
121  return result
def alignment.Alignment.restrictTo (   self,
  restriction 
)

Definition at line 104 of file alignment.py.

References alignment.Alignment.mode, and svgfig.Poly.mode.

105  def restrictTo( self, restriction ):
106  result = []
107  if not restriction == None:
108  for mode in self.mode:
109  if mode in restriction:
110  result.append( mode )
111  self.mode = result

Member Data Documentation

alignment.Alignment.color

Definition at line 25 of file alignment.py.

Referenced by cuy.plotElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), and alignment.Alignment.getRepMap().

alignment.Alignment.conditions

Definition at line 24 of file alignment.py.

Referenced by alignment.Alignment.getConditions().

alignment.Alignment.condShorts

Definition at line 8 of file alignment.py.

Referenced by alignment.Alignment.__getConditions(), and alignment.Alignment.__shorthandExists().

alignment.Alignment.globaltag

Definition at line 23 of file alignment.py.

Referenced by alignment.Alignment.getRepMap(), and cmsHarvester.CMSHarvester.option_handler_globaltag().

alignment.Alignment.mode

Definition at line 110 of file alignment.py.

Referenced by alignment.Alignment.restrictTo().

alignment.Alignment.name

Definition at line 21 of file alignment.py.

Referenced by dirstructure.Directory.__create_pie_image(), dqm_interfaces.DirID.__eq__(), BeautifulSoup.Tag.__eq__(), dirstructure.Directory.__get_full_path(), dirstructure.Comparison.__get_img_name(), dataset.Dataset.__getFileInfoList(), offlineValidation.OfflineValidationParallel.__init__(), genericValidation.GenericValidationData.__init__(), cuy.divideElement.__init__(), cuy.plotElement.__init__(), cuy.additionElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), dirstructure.Comparison.__make_image(), dirstructure.Directory.__repr__(), dqm_interfaces.DirID.__repr__(), dirstructure.Comparison.__repr__(), BeautifulSoup.Tag.__str__(), BeautifulSoup.SoupStrainer.__str__(), offlineValidation.OfflineValidationParallel.appendToMergeParJobs(), dirstructure.Directory.calcStats(), trackSplittingValidation.TrackSplittingValidation.createConfiguration(), monteCarloValidation.MonteCarloValidation.createConfiguration(), zMuMuValidation.ZMuMuValidation.createConfiguration(), offlineValidation.OfflineValidation.createConfiguration(), offlineValidation.OfflineValidationParallel.createConfiguration(), genericValidation.GenericValidationData.createCrabCfg(), trackSplittingValidation.TrackSplittingValidation.createScript(), monteCarloValidation.MonteCarloValidation.createScript(), zMuMuValidation.ZMuMuValidation.createScript(), offlineValidation.OfflineValidation.createScript(), geometryComparison.GeometryComparison.createScript(), offlineValidation.OfflineValidationParallel.createScript(), python.rootplot.utilities.Hist.divide(), python.rootplot.utilities.Hist.divide_wilson(), TreeCrawler.Package.dump(), utils.StatisticalTest.get_status(), trackSplittingValidation.TrackSplittingValidation.getRepMap(), monteCarloValidation.MonteCarloValidation.getRepMap(), offlineValidation.OfflineValidation.getRepMap(), alignment.Alignment.getRepMap(), offlineValidation.OfflineValidationParallel.getRepMap(), dirstructure.Directory.print_report(), BeautifulSoup.SoupStrainer.searchTag(), python.rootplot.utilities.Hist.TGraph(), python.rootplot.utilities.Hist.TH1F(), and Vispa.Views.PropertyView.Property.valueChanged().

alignment.Alignment.runGeomComp

Definition at line 22 of file alignment.py.

Referenced by alignment.Alignment.getRepMap().

alignment.Alignment.style

Definition at line 26 of file alignment.py.

Referenced by alignment.Alignment.getRepMap(), and Formatter.SimpleHTMLFormatter.headers().