test
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": {
12  "connectString":("frontier://FrontierProd"
13  "/CMS_CONDITIONS"),
14  "tagName": "TrackerIdealGeometryErrorsExtended210_mc",
15  "labelName": ""
16  }
17  },
18  "TrackerSurfaceDeformationRcd": {
19  "zeroDeformations": {
20  "connectString":("frontier://FrontierProd"
21  "/CMS_CONDITIONS"),
22  "tagName": "TrackerSurfaceDeformations_zero",
23  "labelName": ""
24  }
25  },
26  }
27  section = "alignment:%s"%name
28  if not config.has_section( section ):
29  raise AllInOneError("section %s not found. Please define the "
30  "alignment!"%section)
31  config.checkInput(section,
32  knownSimpleOptions = ['globaltag', 'style', 'color', 'title'],
33  knownKeywords = ['condition'])
34  self.name = name
35  if config.exists(section,"title"):
36  self.title = config.get(section,"title")
37  else:
38  self.title = self.name
39  if (int(runGeomComp) != 1):
40  self.name += "_run" + runGeomComp
41  self.title += " run " + runGeomComp
42  if "|" in self.title or "," in self.title or '"' in self.title:
43  msg = "The characters '|', '\"', and ',' cannot be used in the alignment title!"
44  raise AllInOneError(msg)
45  self.runGeomComp = runGeomComp
46  self.globaltag = config.get( section, "globaltag" )
47  self.conditions = self.__getConditions( config, section )
48 
49  self.color = config.get(section,"color")
50  self.style = config.get(section,"style")
51 
52  self.color = str(parsecolor(self.color))
53  self.style = str(parsestyle(self.style))

Member Function Documentation

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

Definition at line 70 of file alignment.py.

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

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

References alignment.Alignment.condShorts.

Referenced by alignment.Alignment.__getConditions().

54 
55  def __shorthandExists(self, theRcdName, theShorthand):
56  """Method which checks, if `theShorthand` is a valid shorthand for the
57  given `theRcdName`.
58 
59  Arguments:
60  - `theRcdName`: String which specifies the database record.
61  - `theShorthand`: String which specifies the shorthand to check.
62  """
63 
64  if (theRcdName in self.condShorts) and \
65  (theShorthand in self.condShorts[theRcdName]):
66  return True
67  else:
68  return False
69 
def alignment.Alignment.__testDbExist (   self,
  dbpath 
)
private

Definition at line 120 of file alignment.py.

121  def __testDbExist(self, dbpath):
122  #FIXME delete return to end train debuging
123  return
124  if not dbpath.startswith("sqlite_file:"):
125  print "WARNING: could not check existence for",dbpath
126  else:
127  if not os.path.exists( dbpath.split("sqlite_file:")[1] ):
128  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 148 of file alignment.py.

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

149  def getConditions(self):
150  """This function creates the configuration snippet to override
151  global tag conditions.
152  """
153  if len( self.conditions ):
154  loadCond = ("\nimport CalibTracker.Configuration."
155  "Common.PoolDBESSource_cfi\n")
156  for cond in self.conditions:
157  if not cond["labelName"] == "":
158  temp = configTemplates.conditionsTemplate.replace(
159  "tag = cms.string('.oO[tagName]Oo.')",
160  ("tag = cms.string('.oO[tagName]Oo.'),"
161  "\nlabel = cms.untracked.string('.oO[labelName]Oo.')"))
162  else:
163  temp = configTemplates.conditionsTemplate
164  loadCond += replaceByMap( temp, cond )
165  else:
166  loadCond = ""
167  return loadCond
def replaceByMap
— Helpers —############################
def alignment.Alignment.getRepMap (   self)

Definition at line 137 of file alignment.py.

References alignment.Alignment.color, alignment.Alignment.globaltag, entry.name, geometrydata.GeometryData.name, alignment.Alignment.name, TrackerSectorStruct.name, classes.MonitorData.name, MuonGeometrySanityCheckPoint.name, classes.OutputData.name, geometry.Structure.name, plotscripts.SawTeethFunction.name, alignment.Alignment.runGeomComp, alignment.Alignment.style, classes.PlotData.title, and alignment.Alignment.title.

Referenced by trackSplittingValidation.TrackSplittingValidation.appendToExtendedValidation(), zMuMuValidation.ZMuMuValidation.appendToExtendedValidation(), primaryVertexValidation.PrimaryVertexValidation.appendToExtendedValidation(), offlineValidation.OfflineValidation.appendToExtendedValidation(), preexistingValidation.PreexistingOfflineValidation.appendToExtendedValidation(), preexistingValidation.PreexistingTrackSplittingValidation.appendToExtendedValidation(), trackSplittingValidation.TrackSplittingValidation.appendToMerge(), primaryVertexValidation.PrimaryVertexValidation.appendToMerge(), offlineValidation.OfflineValidation.appendToMerge(), trackSplittingValidation.TrackSplittingValidation.createConfiguration(), monteCarloValidation.MonteCarloValidation.createConfiguration(), primaryVertexValidation.PrimaryVertexValidation.createConfiguration(), offlineValidation.OfflineValidation.createConfiguration(), zMuMuValidation.ZMuMuValidation.createConfiguration(), geometryComparison.GeometryComparison.createConfiguration(), genericValidation.GenericValidationData.createCrabCfg(), geometryComparison.GeometryComparison.createScript(), genericValidation.GenericValidationData.createScript(), preexistingValidation.PreexistingValidation.getCompareStrings(), and plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

138  def getRepMap( self ):
139  result = {
140  "name": self.name,
141  "title": self.title,
142  "color": self.color,
143  "style": self.style,
144  "runGeomComp": self.runGeomComp,
145  "GlobalTag": self.globaltag
146  }
147  return result
def alignment.Alignment.restrictTo (   self,
  restriction 
)

Definition at line 129 of file alignment.py.

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

130  def restrictTo( self, restriction ):
131  result = []
132  if not restriction == None:
133  for mode in self.mode:
134  if mode in restriction:
135  result.append( mode )
136  self.mode = result

Member Data Documentation

alignment.Alignment.color

Definition at line 48 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 46 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 45 of file alignment.py.

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

alignment.Alignment.mode

Definition at line 135 of file alignment.py.

Referenced by alignment.Alignment.restrictTo().

alignment.Alignment.name

Definition at line 33 of file alignment.py.

Referenced by ElectronMVAID.ElectronMVAID.__call__(), dirstructure.Directory.__create_pie_image(), DisplayManager.DisplayManager.__del__(), 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.Service.__setattr__(), config.CFG.__str__(), counter.Counter.__str__(), average.Average.__str__(), BeautifulSoup.Tag.__str__(), BeautifulSoup.SoupStrainer.__str__(), core.autovars.NTupleObjectType.addSubObjects(), core.autovars.NTupleObjectType.addVariables(), core.autovars.NTupleObjectType.allVars(), dirstructure.Directory.calcStats(), trackSplittingValidation.TrackSplittingValidation.createConfiguration(), monteCarloValidation.MonteCarloValidation.createConfiguration(), primaryVertexValidation.PrimaryVertexValidation.createConfiguration(), offlineValidation.OfflineValidation.createConfiguration(), zMuMuValidation.ZMuMuValidation.createConfiguration(), genericValidation.GenericValidationData.createCrabCfg(), geometryComparison.GeometryComparison.createScript(), genericValidation.GenericValidationData.createScript(), validation.Sample.digest(), python.rootplot.utilities.Hist.divide(), python.rootplot.utilities.Hist.divide_wilson(), DisplayManager.DisplayManager.Draw(), 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(), production_tasks.Task.getname(), dataset.CMSDataset.getPrimaryDatasetEntries(), dataset.PrivateDataset.getPrimaryDatasetEntries(), primaryVertexValidation.PrimaryVertexValidation.getRepMap(), zMuMuValidation.ZMuMuValidation.getRepMap(), alignment.Alignment.getRepMap(), genericValidation.GenericValidationData.getRepMap(), VIDSelectorBase.VIDSelectorBase.initialize(), personalPlayback.Applet.log(), 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(), production_tasks.MonitorJobs.run(), 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 44 of file alignment.py.

Referenced by alignment.Alignment.getRepMap().

alignment.Alignment.style

Definition at line 49 of file alignment.py.

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

alignment.Alignment.title

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