CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions
alignment.Alignment Class Reference

Public Member Functions

def __init__ (self, name, config, runGeomComp="1")
 
def getConditions (self)
 
def getRepMap (self)
 
def restrictTo (self, restriction)
 

Public Attributes

 color
 
 conditions
 
 condShorts
 
 globaltag
 
 mode
 
 name
 
 runGeomComp
 
 style
 
 title
 

Private Member Functions

def __getConditions (self, theConfig, theSection)
 
def __shorthandExists (self, theRcdName, theShorthand)
 
def __testDbExist (self, dbpath)
 

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

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(), split, and digi_MixPreMix_cfi.strip.

70  def __getConditions( self, theConfig, theSection ):
71  conditions = []
72  for option in theConfig.options( theSection ):
73  if option.startswith( "condition " ):
74  rcdName = option.split( "condition " )[1]
75  condPars = theConfig.get( theSection, option ).split( "," )
76  if len(condPars) == 1:
77  if len(condPars[0])==0:
78  msg = ("In section [%s]: '%s' is used with too few "
79  "arguments. A connect_string and a tag are "
80  "required!"%(theSection, option))
81  raise AllInOneError(msg)
82  elif self.__shorthandExists(rcdName, condPars[0]):
83  shorthand = condPars[0]
84  condPars = [
85  self.condShorts[rcdName][shorthand]["connectString"],
86  self.condShorts[rcdName][shorthand]["tagName"],
87  self.condShorts[rcdName][shorthand]["labelName"]]
88  else:
89  msg = ("In section [%s]: '%s' is used with '%s', "
90  "which is an unknown shorthand for '%s'. Either "
91  "provide at least a connect_string and a tag or "
92  "use a known shorthand.\n"
93  %(theSection, option, condPars[0], rcdName))
94  if rcdName in self.condShorts:
95  msg += "Known shorthands for '%s':\n"%(rcdName)
96  theShorts = self.condShorts[rcdName]
97  knownShorts = [("\t"+key+": "
98  +theShorts[key]["connectString"]+","
99  +theShorts[key]["tagName"]+","
100  +theShorts[key]["labelName"]) \
101  for key in theShorts]
102  msg+="\n".join(knownShorts)
103  else:
104  msg += ("There are no known shorthands for '%s'."
105  %(rcdName))
106  raise AllInOneError(msg)
107  if len( condPars ) == 2:
108  condPars.append( "" )
109  if len(condPars) > 3:
110  msg = ("In section [%s]: '%s' is used with too many "
111  "arguments. A maximum of 3 arguments is allowed."
112  %(theSection, option))
113  raise AllInOneError(msg)
114  conditions.append({"rcdName": rcdName.strip(),
115  "connectString": condPars[0].strip(),
116  "tagName": condPars[1].strip(),
117  "labelName": condPars[2].strip()})
118  return conditions
119 
def __getConditions(self, theConfig, theSection)
Definition: alignment.py:70
def __shorthandExists(self, theRcdName, theShorthand)
Definition: alignment.py:54
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  def __shorthandExists(self, theRcdName, theShorthand):
55  """Method which checks, if `theShorthand` is a valid shorthand for the
56  given `theRcdName`.
57 
58  Arguments:
59  - `theRcdName`: String which specifies the database record.
60  - `theShorthand`: String which specifies the shorthand to check.
61  """
62 
63  if (theRcdName in self.condShorts) and \
64  (theShorthand in self.condShorts[theRcdName]):
65  return True
66  else:
67  return False
68 
69 
def __shorthandExists(self, theRcdName, theShorthand)
Definition: alignment.py:54
def alignment.Alignment.__testDbExist (   self,
  dbpath 
)
private

Definition at line 120 of file alignment.py.

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

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

Definition at line 137 of file alignment.py.

References alignment.Alignment.color, alignment.Alignment.globaltag, AlignableObjectId::entry.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().

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

Definition at line 129 of file alignment.py.

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

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

Member Data Documentation

alignment.Alignment.color
alignment.Alignment.conditions

Definition at line 46 of file alignment.py.

Referenced by alignment.Alignment.getConditions().

alignment.Alignment.condShorts
alignment.Alignment.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(), 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