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
 
 title
 

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  "TrackerAlignmentErrorExtendedRcd":
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', 'title'],
21  knownKeywords = ['condition'])
22  self.name = name
23  if config.exists(section,"title"):
24  self.title = config.get(section,"title")
25  else:
26  self.title = self.name
27  if "|" in self.title or "," in self.title or '"' in self.title:
28  msg = "The characters '|', '\"', and ',' cannot be used in the alignment title!"
29  raise AllInOneError(msg)
30  self.runGeomComp = runGeomComp
31  self.globaltag = config.get( section, "globaltag" )
32  self.conditions = self.__getConditions( config, section )
33  self.color = config.get(section,"color")
34  self.style = config.get(section,"style")
35 

Member Function Documentation

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

Definition at line 52 of file alignment.py.

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

52 
53  def __getConditions( self, theConfig, theSection ):
54  conditions = []
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))
64  raise AllInOneError(msg)
65  elif self.__shorthandExists(rcdName, condPars[0]):
66  shorthand = condPars[0]
67  condPars = [
68  self.condShorts[rcdName][shorthand]["connectString"],
69  self.condShorts[rcdName][shorthand]["tagName"],
70  self.condShorts[rcdName][shorthand]["labelName"]]
71  else:
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))
77  if rcdName in self.condShorts:
78  msg += "Known shorthands for '%s':\n"%(rcdName)
79  theShorts = self.condShorts[rcdName]
80  knownShorts = [("\t"+key+": "
81  +theShorts[key]["connectString"]+","
82  +theShorts[key]["tagName"]+","
83  +theShorts[key]["labelName"]) \
84  for key in theShorts]
85  msg+="\n".join(knownShorts)
86  else:
87  msg += ("There are no known shorthands for '%s'."
88  %(rcdName))
89  raise AllInOneError(msg)
90  if len( condPars ) == 2:
91  condPars.append( "" )
92  if len(condPars) > 3:
93  msg = ("In section [%s]: '%s' is used with too many "
94  "arguments. A maximum of 3 arguments is allowed."
95  %(theSection, option))
96  raise AllInOneError(msg)
97  conditions.append({"rcdName": rcdName.strip(),
98  "connectString": condPars[0].strip(),
99  "tagName": condPars[1].strip(),
100  "labelName": condPars[2].strip()})
101  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 36 of file alignment.py.

References alignment.Alignment.condShorts.

Referenced by alignment.Alignment.__getConditions().

36 
37  def __shorthandExists(self, theRcdName, theShorthand):
38  """Method which checks, if `theShorthand` is a valid shorthand for the
39  given `theRcdName`.
40 
41  Arguments:
42  - `theRcdName`: String which specifies the database record.
43  - `theShorthand`: String which specifies the shorthand to check.
44  """
45 
46  if (theRcdName in self.condShorts) and \
47  (theShorthand in self.condShorts[theRcdName]):
48  return True
49  else:
50  return False
51 
def alignment.Alignment.__testDbExist (   self,
  dbpath 
)
private

Definition at line 102 of file alignment.py.

103  def __testDbExist(self, dbpath):
104  #FIXME delete return to end train debuging
105  return
106  if not dbpath.startswith("sqlite_file:"):
107  print "WARNING: could not check existence for",dbpath
108  else:
109  if not os.path.exists( dbpath.split("sqlite_file:")[1] ):
110  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 130 of file alignment.py.

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

131  def getConditions(self):
132  """This function creates the configuration snippet to override
133  global tag conditions.
134  """
135  if len( self.conditions ):
136  loadCond = ("\nimport CalibTracker.Configuration."
137  "Common.PoolDBESSource_cfi\n")
138  for cond in self.conditions:
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.')"))
144  else:
145  temp = configTemplates.conditionsTemplate
146  loadCond += replaceByMap( temp, cond )
147  else:
148  loadCond = ""
149  return loadCond
def replaceByMap
— Helpers —############################
def alignment.Alignment.getRepMap (   self)

Definition at line 119 of file alignment.py.

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

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

120  def getRepMap( self ):
121  result = {
122  "name": self.name,
123  "title": self.title,
124  "color": self.color,
125  "style": self.style,
126  "runGeomComp": self.runGeomComp,
127  "GlobalTag": self.globaltag
128  }
129  return result
def alignment.Alignment.restrictTo (   self,
  restriction 
)

Definition at line 111 of file alignment.py.

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

112  def restrictTo( self, restriction ):
113  result = []
114  if not restriction == None:
115  for mode in self.mode:
116  if mode in restriction:
117  result.append( mode )
118  self.mode = result

Member Data Documentation

alignment.Alignment.color

Definition at line 32 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 31 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 30 of file alignment.py.

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

alignment.Alignment.mode

Definition at line 117 of file alignment.py.

Referenced by alignment.Alignment.restrictTo().

alignment.Alignment.name

Definition at line 21 of file alignment.py.

Referenced by ElectronMVAID.ElectronMVAID.__call__(), dirstructure.Directory.__create_pie_image(), dqm_interfaces.DirID.__eq__(), BeautifulSoup.Tag.__eq__(), dirstructure.Directory.__get_full_path(), dirstructure.Comparison.__get_img_name(), dataset.Dataset.__getDataType(), dataset.Dataset.__getFileInfoList(), cuy.divideElement.__init__(), cuy.plotElement.__init__(), cuy.additionElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), dirstructure.Comparison.__make_image(), core.autovars.NTupleVariable.__repr__(), core.autovars.NTupleObjectType.__repr__(), core.autovars.NTupleObject.__repr__(), core.autovars.NTupleCollection.__repr__(), dirstructure.Directory.__repr__(), dqm_interfaces.DirID.__repr__(), dirstructure.Comparison.__repr__(), config.CFG.__str__(), counter.Counter.__str__(), average.Average.__str__(), BeautifulSoup.Tag.__str__(), BeautifulSoup.SoupStrainer.__str__(), core.autovars.NTupleObjectType.allVars(), dirstructure.Directory.calcStats(), trackSplittingValidation.TrackSplittingValidation.createConfiguration(), monteCarloValidation.MonteCarloValidation.createConfiguration(), zMuMuValidation.ZMuMuValidation.createConfiguration(), offlineValidation.OfflineValidation.createConfiguration(), genericValidation.GenericValidationData.createCrabCfg(), geometryComparison.GeometryComparison.createScript(), genericValidation.GenericValidationData.createScript(), python.rootplot.utilities.Hist.divide(), python.rootplot.utilities.Hist.divide_wilson(), TreeCrawler.Package.dump(), core.autovars.NTupleVariable.fillBranch(), core.autovars.NTupleObject.fillBranches(), core.autovars.NTupleCollection.fillBranchesScalar(), core.autovars.NTupleCollection.fillBranchesVector(), core.autovars.NTupleCollection.get_cpp_declaration(), core.autovars.NTupleCollection.get_cpp_wrapper_class(), core.autovars.NTupleCollection.get_py_wrapper_class(), utils.StatisticalTest.get_status(), alignment.Alignment.getRepMap(), genericValidation.GenericValidationData.getRepMap(), core.autovars.NTupleVariable.makeBranch(), core.autovars.NTupleObject.makeBranches(), core.autovars.NTupleCollection.makeBranchesScalar(), core.autovars.NTupleCollection.makeBranchesVector(), dirstructure.Directory.print_report(), BeautifulSoup.SoupStrainer.searchTag(), python.rootplot.utilities.Hist.TGraph(), python.rootplot.utilities.Hist.TH1F(), Vispa.Views.PropertyView.Property.valueChanged(), counter.Counter.write(), and average.Average.write().

alignment.Alignment.runGeomComp

Definition at line 29 of file alignment.py.

Referenced by alignment.Alignment.getRepMap().

alignment.Alignment.style

Definition at line 33 of file alignment.py.

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

alignment.Alignment.title

Definition at line 23 of file alignment.py.

Referenced by cuy.plotElement.__init__(), cuy.additionElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), Vispa.Views.LineDecayView.LineDecayContainer.autolayout(), Vispa.Views.LineDecayView.LineDecayContainer.autolayoutThreadFinished(), python.rootplot.root2matplotlib.HistStack.bar(), python.rootplot.root2matplotlib.HistStack.bar3d(), python.rootplot.root2matplotlib.HistStack.barcluster(), python.rootplot.root2matplotlib.HistStack.barh(), python.rootplot.root2matplotlib.HistStack.barstack(), Vispa.Views.LineDecayView.LineDecayContainer.childFinishedAutolayouting(), python.rootplot.root2matplotlib.HistStack.errorbar(), python.rootplot.root2matplotlib.HistStack.errorbarh(), alignment.Alignment.getRepMap(), Formatter.SimpleHTMLFormatter.headers(), python.rootplot.root2matplotlib.HistStack.histstack(), Vispa.Gui.PortWidget.PortWidget.name(), python.rootplot.root2matplotlib.Hist.show_titles(), python.rootplot.utilities.Hist.TGraph(), python.rootplot.utilities.Hist.TH1F(), python.rootplot.utilities.Hist2D.TH2F(), and python.rootplot.root2matplotlib.Hist2D.TH2F().