CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor Class Reference
Inheritance diagram for Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor:
Vispa.Share.BasicDataAccessor.BasicDataAccessor

Public Member Functions

def __init__ (self)
 
def addTool (self, tool)
 
def children (self, object)
 
def configDataAccessor (self)
 
def isContainer (self, object)
 
def label (self, object)
 
def parameterErrors (self, object)
 
def properties (self, object)
 
def removeTool (self, tool)
 
def setConfigDataAccessor (self, accessor)
 
def setProperty (self, object, name, value, categoryName)
 
def toolModules (self)
 
def topLevelObjects (self)
 
def updateProcess (self, cp=True)
 
def updateToolList (self)
 
- Public Member Functions inherited from Vispa.Share.BasicDataAccessor.BasicDataAccessor
def addProperty (self, object, name, value, type)
 
def allChildren (self, object)
 
def children (self, object)
 
def isContainer (self, object)
 
def label (self, object)
 
def properties (self, object)
 
def property (self, object, name)
 
def propertyValue (self, object, name)
 
def removeProperty (self, object, name)
 
def setProperty (self, object, name, value, categoryName)
 
def topLevelObjects (self)
 

Private Member Functions

def _property (self, name, value, description, typ, allowedValues)
 

Private Attributes

 _applyTool
 
 _configDataAccessor
 
 _importTool
 
 _parameterErrors
 
 _processCopy
 
 _toolList
 
 _toolModules
 

Detailed Description

Definition at line 75 of file ToolDataAccessor.py.

Constructor & Destructor Documentation

def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.__init__ (   self)

Member Function Documentation

def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._property (   self,
  name,
  value,
  description,
  typ,
  allowedValues 
)
private

Definition at line 106 of file ToolDataAccessor.py.

References str, and digitizers_cfi.strip.

Referenced by Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.properties().

106  def _property(self,name,value,description,typ,allowedValues):
107  if typ in [bool] and not isinstance(value, typ):
108  value=False
109  if typ in [int, long, float] and not isinstance(value, typ):
110  value=0
111  if not allowedValues is None and typ in [int,long,float,str]:
112  return ("DropDown", name, value,description, False, False, allowedValues)
113  elif typ in [bool]:
114  return ("Boolean", name, value,description)
115  elif typ in [int, long]:
116  return ("Integer", name, value,description)
117  elif typ in [float]:
118  return ("Double", name, value,description)
119  elif name=="filename":
120  return ("File", name, str(value),description)
121  elif name=="code":
122  return ("MultilineString", name, str(value).strip("\n"),description)
123  else:
124  return ("String", name, str(value),description)
125 
def _property(self, name, value, description, typ, allowedValues)
#define str(s)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.addTool (   self,
  tool 
)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.children (   self,
  object 
)
Return the children of a container object.

Definition at line 86 of file ToolDataAccessor.py.

Referenced by Vispa.Share.BasicDataAccessor.BasicDataAccessor.allChildren(), Vispa.Views.LineDecayView.LineDecayView.autolayout(), Vispa.Views.BoxDecayView.BoxDecayContainer.autolayoutAlgorithm(), Vispa.Gui.WidgetContainer.WidgetContainer.autolayoutChildren(), Vispa.Gui.WidgetContainer.WidgetContainer.autosize(), Vispa.Views.LineDecayView.LineDecayContainer.childContainer(), Vispa.Views.WidgetView.WidgetView.clear(), Vispa.Views.LineDecayView.LineDecayContainer.createDecayObjectsFromPxlObject(), Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.deleteSelectedConnections(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner.deselectAllWidgets(), Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.getWidgetByName(), Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.hideMenuWidgets(), Vispa.Views.LineDecayView.LineDecayView.lineDecayContainer(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner.mouseReleaseEvent(), Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.portConnection(), Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.propagateEventUnderConnectionWidget(), Vispa.Views.LineDecayView.LineDecayContainer.scheduleUpdateVisibleList(), Vispa.Views.LineDecayView.LineDecayView.scrollBarValueChanged(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner.selectedWidgets(), Vispa.Views.LineDecayView.LineDecayContainer.setAcceptDrops(), Vispa.Gui.VispaWidget.VispaWidget.setDragable(), Vispa.Views.LineDecayView.LineDecayView.setEditable(), Vispa.Gui.ZoomableWidget.ZoomableWidget.setZoom(), Vispa.Gui.WidgetContainer.WidgetContainer.toggleCollapse(), Vispa.Gui.ConnectableWidgetOwner.ConnectableWidgetOwner.updateConnections(), and Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner.widgetDragged().

86  def children(self, object):
87  """ Return the children of a container object.
88  """
89  return ()
90 
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.configDataAccessor (   self)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.isContainer (   self,
  object 
)

Definition at line 91 of file ToolDataAccessor.py.

91  def isContainer(self, object):
92  return False
93 
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.label (   self,
  object 
)
Return a string that is used as caption of an object.

Definition at line 94 of file ToolDataAccessor.py.

Referenced by Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.properties(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor.properties(), and Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.updateProcess().

94  def label(self, object):
95  """ Return a string that is used as caption of an object.
96  """
97  if isinstance(object,type):
98  directory=os.path.splitext(os.path.basename(inspect.getfile(object)))[0]
99  else:
100  directory=os.path.splitext(os.path.basename(inspect.getfile(type(object))))[0]
101  if directory=="ToolDataAccessor":
102  return object._label
103  else:
104  return directory+"."+object._label
105 
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.parameterErrors (   self,
  object 
)

Definition at line 264 of file ToolDataAccessor.py.

References Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._parameterErrors, triggerObjects_cff.id, and str.

264  def parameterErrors(self,object):
265  return [self._parameterErrors[key] for key in self._parameterErrors.keys() if str(id(object))==key.split(".")[0]]
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.properties (   self,
  object 
)
Return the list of the properties of an object.

Each property is represented by a tuple containing its
type, name, value, description and readonly(True/False).
Possible types are: 'Category','String','MultilineString','File','FileVector','Boolean','Integer','Double'.

Definition at line 126 of file ToolDataAccessor.py.

References Vispa.Views.PropertyView.ClosableProperty._property, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._property(), Vispa.Views.PropertyView.LabelItem._property, mps_monitormerge.items, python.readProv.filereader.Module.label, reco::tau::entry.label, core.AutoHandle.AutoHandle.label, L1TriggerKeyExtViewer.label, SubDetParams.label, reco::Centrality.label(), ElectronLikelihoodCategoryData.label, cond::BoostVersion.label(), entry< T >.label, classes.PlotData.label, SiPixelFedFillerWordEventNumber.label, GenericMVAComputerCache::IndividualComputer.label, l1t::L1GtBoardTypeStringToEnum.label, TtEvent::HypoClassKeyStringToEnum.label, HcalLutSet.label, L1GtBoardTypeStringToEnum.label, ConverterTester.label, TrackCandidateTopBottomHitFilter.label, l1t::L1TGtObjectStringToEnum.label, L1GtObjectStringToEnum.label, TaggingVariablePlotter::VariableConfig.label, SiPixelRawToDigi.label, HGCalValidator.label, muon::SelectionTypeStringToEnum.label, SiPixelQualityESProducer.label, HLTVertexPerformanceAnalyzer.label, hltPlot.label, FWPSetTableManager::PSetData.label, GlobalDigisHistogrammer.label, MillePedeVariables.label(), MultiTrackValidator.label, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.label, MuonSimHitsValidAnalyzer.label, PrimaryVertexProducer::algo.label, GlobalRecHitsHistogrammer.label, L1GtPsbQuadStringToEnum.label, PhysicsTools::MVAModuleHelper< Record, Object, Filler >.label, python.rootplot.utilities.Hist2D.label, TauDiscriminationProducerBase< TauType, TauDiscriminator >::TauDiscInfo.label, cond::DataProxyWrapperBase.label(), l1t::GtConditionTypeStringToEnum.label, GlobalHitsTester.label, pat::TriggerFilter.label(), DependencyGraph::node.label, GlobalHitsHistogrammer.label, MatrixInjector.MatrixInjector.label, ValidationMisalignedTracker.label, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.label(), PrimaryVertexProducerAlgorithm::algo.label, GlobalHitsAnalyzer.label, TrackerHitProducer.label, HLTBTagPerformanceAnalyzer.label, l1t::GtConditionCategoryStringToEnum.label, GlobalHitsProducer.label, DTDigiReader.label, MatrixUtil.InputInfo.label, hitfit::FE_Obj.label, L1GtConditionTypeStringToEnum.label, python.rootplot.utilities.Hist.label, cond::payloadInspector::ModuleVersion.label, EcalSimHitsValidProducer.label, GlobalDigisProducer.label, FWColorSelect.label(), GlobalDigisAnalyzer.label, L1GtConditionCategoryStringToEnum.label, TkAlStyle.label(), GlobalRecHitsAnalyzer.label, GlobalRecHitsProducer.label, MuonTrackValidatorBase.label, Vispa.Gui.FindDialog.FindDialog.label(), FastTimerService::GroupOfModules.label, ScaleVarWeight.label, edm::TrieNodeIter< T >.label(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.label(), and JsonOutputProducer::JsonVars.label.

Referenced by Vispa.Share.BasicDataAccessor.BasicDataAccessor.property().

126  def properties(self, object):
127  """ Return the list of the properties of an object.
128 
129  Each property is represented by a tuple containing its
130  type, name, value, description and readonly(True/False).
131  Possible types are: 'Category','String','MultilineString','File','FileVector','Boolean','Integer','Double'.
132  """
133  properties=[]
134  if not isinstance(object,(ImportTool,UserCodeTool,ApplyTool)):
135  properties+=[("String","Tool",self.label(object),None,True)]
136  if not isinstance(object,(ImportTool,UserCodeTool)):
137  properties+=[("String","Description",object.description(),None,True)]
138  if not isinstance(object,(UserCodeTool,ApplyTool)):
139  code=object.dumpPython()
140  if isinstance(code,tuple):
141  code=code[1]
142  properties+=[("MultilineString","code",code.strip("\n"),None,True)]
143  if not isinstance(object,(ImportTool,UserCodeTool,ApplyTool)):
144  properties+=[("String","comment",object._comment,None,False)]
145  if len(object.getParameters().items())>0:
146  properties += [("Category", "Parameters", "")]
147  properties+=[self._property(value.name,value.value,value.description,value.type,object.getAllowedValues(value.name)) for key,value in object.getParameters().items()]
148  return properties
149 
def _property(self, name, value, description, typ, allowedValues)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.removeTool (   self,
  tool 
)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.setConfigDataAccessor (   self,
  accessor 
)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.setProperty (   self,
  object,
  name,
  value,
  categoryName 
)
Change the property 'name' of an object to a new value.

Definition at line 150 of file ToolDataAccessor.py.

References Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._parameterErrors, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.configDataAccessor(), Vispa.Main.Exceptions.exception_traceback(), triggerObjects_cff.id, LaserDQM_cfg.process, and str.

150  def setProperty(self, object, name, value, categoryName):
151  """ Change the property 'name' of an object to a new value.
152  """
153  if self.configDataAccessor().process() and name=="code":
154  # for UserCodeTool
155  process=self.configDataAccessor().process()
156  try:
157  process.disableRecording()
158  exec(value)
159  process.enableRecording()
160  process.resetModified()
161  process.resetModifiedObjects()
162  except Exception as e:
163  error="Error in python code (see logfile for details):\n"+str(e)
164  logging.warning(__name__ + ": setProperty: Error in python code: "+exception_traceback())
165  self._parameterErrors[str(id(object))+"."+name]=error
166  return error
167  elif isinstance(value,str):
168  # for e.g. cms.InputTag
169  try:
170  exec("value="+value)
171  except:
172  pass
173  if name!="comment":
174  try:
175  object.setParameter(name,value)
176  except Exception as e:
177  error="Cannot set parameter "+name+" (see logfile for details):\n"+str(e)
178  logging.warning(__name__ + ": setProperty: Cannot set parameter "+name+": "+exception_traceback())
179  self._parameterErrors[str(id(object))+"."+name]=error
180  return error
181  elif name=="comment":
182  try:
183  object.setComment(value)
184  except Exception as e:
185  error="Cannot set comment (see logfile for details):\n"+str(e)
186  logging.warning(__name__ + ": setProperty: Cannot set comment "+exception_traceback())
187  self._parameterErrors[str(id(object))+"."+name]=error
188  return error
189  if str(id(object))+"."+name in self._parameterErrors.keys():
190  del self._parameterErrors[str(id(object))+"."+name]
191  return True
192 
def setProperty(self, object, name, value, categoryName)
#define str(s)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.toolModules (   self)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.updateProcess (   self,
  cp = True 
)

Definition at line 213 of file ToolDataAccessor.py.

References Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._parameterErrors, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._processCopy, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._toolList, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.configDataAccessor(), Vispa.Main.Exceptions.exception_traceback(), python.readProv.filereader.Module.label, reco::tau::entry.label, L1TriggerKeyExtViewer.label, core.AutoHandle.AutoHandle.label, SubDetParams.label, reco::Centrality.label(), ElectronLikelihoodCategoryData.label, cond::BoostVersion.label(), entry< T >.label, SiPixelFedFillerWordEventNumber.label, classes.PlotData.label, GenericMVAComputerCache::IndividualComputer.label, l1t::L1GtBoardTypeStringToEnum.label, HcalLutSet.label, TtEvent::HypoClassKeyStringToEnum.label, L1GtBoardTypeStringToEnum.label, TrackCandidateTopBottomHitFilter.label, ConverterTester.label, l1t::L1TGtObjectStringToEnum.label, L1GtObjectStringToEnum.label, TaggingVariablePlotter::VariableConfig.label, HGCalValidator.label, SiPixelRawToDigi.label, SiPixelQualityESProducer.label, muon::SelectionTypeStringToEnum.label, HLTVertexPerformanceAnalyzer.label, hltPlot.label, FWPSetTableManager::PSetData.label, GlobalDigisHistogrammer.label, MillePedeVariables.label(), MultiTrackValidator.label, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.label, MuonSimHitsValidAnalyzer.label, PrimaryVertexProducer::algo.label, GlobalRecHitsHistogrammer.label, L1GtPsbQuadStringToEnum.label, PhysicsTools::MVAModuleHelper< Record, Object, Filler >.label, python.rootplot.utilities.Hist2D.label, TauDiscriminationProducerBase< TauType, TauDiscriminator >::TauDiscInfo.label, cond::DataProxyWrapperBase.label(), l1t::GtConditionTypeStringToEnum.label, GlobalHitsTester.label, pat::TriggerFilter.label(), GlobalHitsHistogrammer.label, DependencyGraph::node.label, MatrixInjector.MatrixInjector.label, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.label(), PrimaryVertexProducerAlgorithm::algo.label, ValidationMisalignedTracker.label, GlobalHitsAnalyzer.label, TrackerHitProducer.label, HLTBTagPerformanceAnalyzer.label, l1t::GtConditionCategoryStringToEnum.label, GlobalHitsProducer.label, DTDigiReader.label, MatrixUtil.InputInfo.label, hitfit::FE_Obj.label, L1GtConditionTypeStringToEnum.label, python.rootplot.utilities.Hist.label, cond::payloadInspector::ModuleVersion.label, EcalSimHitsValidProducer.label, GlobalDigisProducer.label, FWColorSelect.label(), GlobalDigisAnalyzer.label, L1GtConditionCategoryStringToEnum.label, TkAlStyle.label(), GlobalRecHitsAnalyzer.label, GlobalRecHitsProducer.label, MuonTrackValidatorBase.label, Vispa.Gui.FindDialog.FindDialog.label(), FastTimerService::GroupOfModules.label, ScaleVarWeight.label, edm::TrieNodeIter< T >.label(), Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigDataAccessor.label(), JsonOutputProducer::JsonVars.label, LaserDQM_cfg.process, and str.

Referenced by Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.removeTool(), and Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.setConfigDataAccessor().

213  def updateProcess(self,cp=True):
214  logging.debug(__name__ + ": updateProcess")
215  if cp:
216  process=copy.deepcopy(self._processCopy)
217  else:
218  process=self.configDataAccessor().process()
219  try:
220  for tool in self._toolList:
221  tool.apply(process)
222  if not process.checkRecording():
223  logging.error(__name__ + ": Could not apply tool: "+self.label(tool)+" (problem with enable recording flag)")
224  QCoreApplication.instance().errorMessage("Could not apply tool: "+self.label(tool)+" (problem with enable recording flag)")
225  return False
226  except Exception as e:
227  logging.error(__name__ + ": Could not apply tool: "+self.label(tool)+": "+exception_traceback())
228  QCoreApplication.instance().errorMessage("Could not apply tool (see log file for details):\n"+str(e))
229  return False
230  self.configDataAccessor().setProcess(process)
231  self._parameterErrors={}
232  return True
233 
#define str(s)
def Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.updateToolList (   self)

Definition at line 234 of file ToolDataAccessor.py.

References Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._toolList, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._toolModules, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor.configDataAccessor(), and LaserDQM_cfg.process.

Referenced by Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog.changedir().

234  def updateToolList(self):
235  logging.debug(__name__ + ": updateToolList")
236  if not self.configDataAccessor().process():
237  return
238  history=self.configDataAccessor().process().history(True)
239  self._toolList=[]
240  self._toolModules={}
241  importCommands=[]
242  for tool,objects in history:
243  if isinstance(tool,str):
244  userTool=UserCodeTool()
245  userTool.setParameter("code",tool)
246  self._toolList+=[userTool]
247  elif isinstance(tool,ConfigToolBase):
248  self._toolList+=[tool]
249  command=tool.dumpPython()[0]
250  if command!="" and not command in importCommands:
251  importCommands+=[command]
252  self._toolModules[self._toolList[-1]]=objects
253  self._importTool.setImportCommands(importCommands)
254 

Member Data Documentation

Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._applyTool
private
Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._importTool
private
Vispa.Plugins.ConfigEditor.ToolDataAccessor.ToolDataAccessor._toolModules
private