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_CONDITIONS"),
13  "tagName": "TrackerAlignmentExtendedErr_2009_v2_express_IOVs",
14 
15  "labelName": ""}}}
16  section = "alignment:%s"%name
17  if not config.has_section( section ):
18  raise AllInOneError, ("section %s not found. Please define the "
19  "alignment!"%section)
20  config.checkInput(section,
21  knownSimpleOptions = ['globaltag', 'style', 'color', 'title'],
22  knownKeywords = ['condition'])
23  self.name = name
24  if config.exists(section,"title"):
25  self.title = config.get(section,"title")
26  else:
27  self.title = self.name
28  if "|" in self.title or "," in self.title or '"' in self.title:
29  msg = "The characters '|', '\"', and ',' cannot be used in the alignment title!"
30  raise AllInOneError(msg)
31  self.runGeomComp = runGeomComp
32  self.globaltag = config.get( section, "globaltag" )
33  self.conditions = self.__getConditions( config, section )
34  self.color = config.get(section,"color")
35  self.style = config.get(section,"style")
36 

Member Function Documentation

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

Definition at line 53 of file alignment.py.

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

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

References alignment.Alignment.condShorts.

Referenced by alignment.Alignment.__getConditions().

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

Definition at line 103 of file alignment.py.

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

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

132  def getConditions(self):
133  """This function creates the configuration snippet to override
134  global tag conditions.
135  """
136  if len( self.conditions ):
137  loadCond = ("\nimport CalibTracker.Configuration."
138  "Common.PoolDBESSource_cfi\n")
139  for cond in self.conditions:
140  if not cond["labelName"] == "":
141  temp = configTemplates.conditionsTemplate.replace(
142  "tag = cms.string('.oO[tagName]Oo.')",
143  ("tag = cms.string('.oO[tagName]Oo.'),"
144  "\nlabel = cms.untracked.string('.oO[labelName]Oo.')"))
145  else:
146  temp = configTemplates.conditionsTemplate
147  loadCond += replaceByMap( temp, cond )
148  else:
149  loadCond = ""
150  return loadCond
def replaceByMap
— Helpers —############################
def alignment.Alignment.getRepMap (   self)

Definition at line 120 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().

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

Definition at line 112 of file alignment.py.

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

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

Member Data Documentation

alignment.Alignment.color

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

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

alignment.Alignment.mode

Definition at line 118 of file alignment.py.

Referenced by alignment.Alignment.restrictTo().

alignment.Alignment.name

Definition at line 22 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(), dataset.CMSDataset.getPrimaryDatasetEntries(), dataset.PrivateDataset.getPrimaryDatasetEntries(), alignment.Alignment.getRepMap(), genericValidation.GenericValidationData.getRepMap(), VIDSelectorBase.VIDSelectorBase.initialize(), core.autovars.NTupleVariable.makeBranch(), core.autovars.NTupleObject.makeBranches(), core.autovars.NTupleCollection.makeBranchesScalar(), core.autovars.NTupleCollection.makeBranchesVector(), dirstructure.Directory.print_report(), dataset.BaseDataset.printInfo(), dataset.Dataset.printInfo(), 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 30 of file alignment.py.

Referenced by alignment.Alignment.getRepMap().

alignment.Alignment.style

Definition at line 34 of file alignment.py.

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

alignment.Alignment.title

Definition at line 24 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().