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  self.color = config.get(section,"color")
49  self.style = config.get(section,"style")
50 

Member Function Documentation

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

Definition at line 67 of file alignment.py.

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

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

References alignment.Alignment.condShorts.

Referenced by alignment.Alignment.__getConditions().

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

Definition at line 117 of file alignment.py.

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

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

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

Definition at line 134 of file alignment.py.

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

Referenced by trackSplittingValidation.TrackSplittingValidation.appendToExtendedValidation(), offlineValidation.OfflineValidation.appendToExtendedValidation(), preexistingValidation.PreexistingOfflineValidation.appendToExtendedValidation(), preexistingValidation.PreexistingTrackSplittingValidation.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(), genericValidation.GenericValidationData.createScript(), and preexistingValidation.PreexistingValidation.getCompareStrings().

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

Definition at line 126 of file alignment.py.

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

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

Member Data Documentation

alignment.Alignment.color

Definition at line 47 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 132 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(), 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(), monteCarloValidation.MonteCarloValidation.createConfiguration(), trackSplittingValidation.TrackSplittingValidation.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(), 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(), 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 48 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().