CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
alignment.Alignment Class Reference
Inheritance diagram for alignment.Alignment:

Public Member Functions

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

Public Attributes

 color
 
 conditions
 
 globaltag
 
 mode
 
 name
 
 runGeomComp
 
 style
 
 title
 

Static Public Attributes

dictionary condShorts
 

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 31 of file alignment.py.

31  def __init__(self, name, config, runGeomComp = "1"):
32  section = "alignment:%s"%name
33  if not config.has_section( section ):
34  raise AllInOneError("section %s not found. Please define the "
35  "alignment!"%section)
36  config.checkInput(section,
37  knownSimpleOptions = ['globaltag', 'style', 'color', 'title'],
38  knownKeywords = ['condition'])
39  self.name = name
40  if config.exists(section,"title"):
41  self.title = config.get(section,"title")
42  else:
43  self.title = self.name
44  if (int(runGeomComp) != 1):
45  self.name += "_run" + runGeomComp
46  self.title += " run " + runGeomComp
47  if "|" in self.title or "," in self.title or '"' in self.title:
48  msg = "The characters '|', '\"', and ',' cannot be used in the alignment title!"
49  raise AllInOneError(msg)
50  self.runGeomComp = runGeomComp
51  self.globaltag = config.get( section, "globaltag" )
52  self.conditions = self.__getConditions( config, section )
53 
54  self.color = config.get(section,"color")
55  self.style = config.get(section,"style")
56 
57  self.color = str(parsecolor(self.color))
58  self.style = str(parsestyle(self.style))
59 
def __getConditions(self, theConfig, theSection)
Definition: alignment.py:76
def parsestyle(style)
def parsecolor(color)
def __init__(self, name, config, runGeomComp="1")
Definition: alignment.py:31

Member Function Documentation

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

Definition at line 76 of file alignment.py.

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

76  def __getConditions( self, theConfig, theSection ):
77  conditions = []
78  for option in theConfig.options( theSection ):
79  if option.startswith( "condition " ):
80  rcdName = option.split( "condition " )[1]
81  condPars = theConfig.get( theSection, option ).split( "," )
82  if len(condPars) == 1:
83  if len(condPars[0])==0:
84  msg = ("In section [%s]: '%s' is used with too few "
85  "arguments. A connect_string and a tag are "
86  "required!"%(theSection, option))
87  raise AllInOneError(msg)
88  elif self.__shorthandExists(rcdName, condPars[0]):
89  shorthand = condPars[0]
90  condPars = [
91  self.condShorts[rcdName][shorthand]["connectString"],
92  self.condShorts[rcdName][shorthand]["tagName"],
93  self.condShorts[rcdName][shorthand]["labelName"]]
94  elif rcdName == "TrackerAlignmentErrorExtendedRcd" and condPars[0] == "zeroAPE":
95  raise AllInOneError("Please specify either zeroAPE_phase0 or zeroAPE_phase1")
96  #can probably make zeroAPE an alias of zeroAPE_phase1 at some point,
97  #but not sure if now is the time
98  else:
99  msg = ("In section [%s]: '%s' is used with '%s', "
100  "which is an unknown shorthand for '%s'. Either "
101  "provide at least a connect_string and a tag or "
102  "use a known shorthand.\n"
103  %(theSection, option, condPars[0], rcdName))
104  if rcdName in self.condShorts:
105  msg += "Known shorthands for '%s':\n"%(rcdName)
106  theShorts = self.condShorts[rcdName]
107  knownShorts = [("\t"+key+": "
108  +theShorts[key]["connectString"]+","
109  +theShorts[key]["tagName"]+","
110  +theShorts[key]["labelName"]) \
111  for key in theShorts]
112  msg+="\n".join(knownShorts)
113  else:
114  msg += ("There are no known shorthands for '%s'."
115  %(rcdName))
116  raise AllInOneError(msg)
117  if len( condPars ) == 2:
118  condPars.append( "" )
119  if len(condPars) > 3:
120  msg = ("In section [%s]: '%s' is used with too many "
121  "arguments. A maximum of 3 arguments is allowed."
122  %(theSection, option))
123  raise AllInOneError(msg)
124  conditions.append({"rcdName": rcdName.strip(),
125  "connectString": condPars[0].strip(),
126  "tagName": condPars[1].strip(),
127  "labelName": condPars[2].strip()})
128  return conditions
129 
dictionary condShorts
Definition: alignment.py:7
def __getConditions(self, theConfig, theSection)
Definition: alignment.py:76
def __shorthandExists(self, theRcdName, theShorthand)
Definition: alignment.py:60
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 60 of file alignment.py.

References alignment.Alignment.condShorts.

Referenced by alignment.Alignment.__getConditions().

60  def __shorthandExists(self, theRcdName, theShorthand):
61  """Method which checks, if `theShorthand` is a valid shorthand for the
62  given `theRcdName`.
63 
64  Arguments:
65  - `theRcdName`: String which specifies the database record.
66  - `theShorthand`: String which specifies the shorthand to check.
67  """
68 
69  if (theRcdName in self.condShorts) and \
70  (theShorthand in self.condShorts[theRcdName]):
71  return True
72  else:
73  return False
74 
75 
dictionary condShorts
Definition: alignment.py:7
def __shorthandExists(self, theRcdName, theShorthand)
Definition: alignment.py:60
def alignment.Alignment.__testDbExist (   self,
  dbpath 
)
private

Definition at line 130 of file alignment.py.

130  def __testDbExist(self, dbpath):
131  #FIXME delete return to end train debuging
132  return
133  if not dbpath.startswith("sqlite_file:"):
134  print "WARNING: could not check existence for",dbpath
135  else:
136  if not os.path.exists( dbpath.split("sqlite_file:")[1] ):
137  raise "could not find file: '%s'"%dbpath.split("sqlite_file:")[1]
138 
def __testDbExist(self, dbpath)
Definition: alignment.py:130
def alignment.Alignment.getConditions (   self)
This function creates the configuration snippet to override
   global tag conditions.

Definition at line 158 of file alignment.py.

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

158  def getConditions(self):
159  """This function creates the configuration snippet to override
160  global tag conditions.
161  """
162  if len( self.conditions ):
163  loadCond = ("\nimport CalibTracker.Configuration."
164  "Common.PoolDBESSource_cfi\n")
165  for cond in self.conditions:
166  if not cond["labelName"] == "":
167  temp = configTemplates.conditionsTemplate.replace(
168  "tag = cms.string('.oO[tagName]Oo.')",
169  ("tag = cms.string('.oO[tagName]Oo.'),"
170  "\nlabel = cms.untracked.string('.oO[labelName]Oo.')"))
171  else:
172  temp = configTemplates.conditionsTemplate
173  loadCond += replaceByMap( temp, cond )
174  else:
175  loadCond = ""
176  return loadCond
177 
def replaceByMap(target, the_map)
— Helpers —############################
def getConditions(self)
Definition: alignment.py:158
def alignment.Alignment.getRepMap (   self)

Definition at line 147 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.appendToMerge(), primaryVertexValidation.PrimaryVertexValidation.appendToMerge(), offlineValidation.OfflineValidation.appendToMerge(), trackSplittingValidation.TrackSplittingValidation.appendToPlots(), primaryVertexValidation.PrimaryVertexValidation.appendToPlots(), zMuMuValidation.ZMuMuValidation.appendToPlots(), geometryComparison.GeometryComparison.createConfiguration(), genericValidation.GenericValidationData.createConfiguration(), genericValidation.GenericValidationData.createCrabCfg(), geometryComparison.GeometryComparison.createScript(), genericValidation.GenericValidationData.createScript(), genericValidation.ParallelValidation.doMerge(), zMuMuValidation.ZMuMuValidation.filesToCompare(), genericValidation.GenericValidationData.filesToCompare(), and plottingOptions.PlottingOptionsTrackSplitting.validsubdets().

147  def getRepMap( self ):
148  result = {
149  "name": self.name,
150  "title": self.title,
151  "color": self.color,
152  "style": self.style,
153  "runGeomComp": self.runGeomComp,
154  "GlobalTag": self.globaltag
155  }
156  return result
157 
def getRepMap(self)
Definition: alignment.py:147
def alignment.Alignment.restrictTo (   self,
  restriction 
)

Definition at line 139 of file alignment.py.

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

139  def restrictTo( self, restriction ):
140  result = []
141  if not restriction == None:
142  for mode in self.mode:
143  if mode in restriction:
144  result.append( mode )
145  self.mode = result
146 
def restrictTo(self, restriction)
Definition: alignment.py:139

Member Data Documentation

alignment.Alignment.color
alignment.Alignment.conditions

Definition at line 52 of file alignment.py.

Referenced by alignment.Alignment.getConditions().

dictionary alignment.Alignment.condShorts
static
Initial value:
1 = {
2  "TrackerAlignmentErrorExtendedRcd": {
3  "zeroAPE_phase0": {
4  "connectString":("frontier://FrontierProd"
5  "/CMS_CONDITIONS"),
6  "tagName": "TrackerIdealGeometryErrorsExtended210_mc",
7  "labelName": ""
8  },
9  "zeroAPE_phase1": {
10  "connectString":("frontier://FrontierProd"
11  "/CMS_CONDITIONS"),
12  "tagName": "TrackerAlignmentErrorsExtended_Upgrade2017_design_v0",
13  "labelName": ""
14  },
15  },
16  "TrackerSurfaceDeformationRcd": {
17  "zeroDeformations": {
18  "connectString":("frontier://FrontierProd"
19  "/CMS_CONDITIONS"),
20  "tagName": "TrackerSurfaceDeformations_zero",
21  "labelName": ""
22  },
23  },
24  }

Definition at line 7 of file alignment.py.

Referenced by alignment.Alignment.__getConditions(), and alignment.Alignment.__shorthandExists().

alignment.Alignment.globaltag
alignment.Alignment.mode

Definition at line 145 of file alignment.py.

Referenced by alignment.Alignment.restrictTo().

alignment.Alignment.name

Definition at line 39 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(), genericValidation.GenericValidationData.cfgName(), 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 50 of file alignment.py.

Referenced by alignment.Alignment.getRepMap().

alignment.Alignment.style