CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Vispa.Share.FindAlgorithm.FindAlgorithm Class Reference
Inheritance diagram for Vispa.Share.FindAlgorithm.FindAlgorithm:
Vispa.Share.ObjectHolder.ObjectHolder

Public Member Functions

def __init__ (self)
 
def clear (self)
 
def currentNumber (self)
 
def findUsingFindDialog (self, dialog)
 
def message (self)
 
def next (self)
 
def numberOfResults (self)
 
def previous (self)
 
def results (self)
 
def setDataAccessor (self, accessor)
 
- Public Member Functions inherited from Vispa.Share.ObjectHolder.ObjectHolder
def __init__ (self)
 
def allDataObjectChildren (self, objects=None)
 
def appendObject (self, object)
 
def applyFilter (self, objects)
 
def clearObjects (self)
 
def dataAccessor (self)
 
def dataObject (self)
 
def dataObjects (self)
 
def dataObjectsCount (self)
 
def numberDataObjectChildren (self, objects=None)
 
def removeObject (self, object)
 
def setDataAccessor (self, accessor)
 
def setDataObject (self, object)
 
def setDataObjects (self, objects)
 
def setExclusiveMode (self, exclusive=True)
 
def setFilter (self, filter)
 

Private Member Functions

def _findIn (self, object, dialog)
 

Private Attributes

 _index
 
 _message
 
 _results
 

Detailed Description

Searches for label and properties in a list of objects using a BasicDataAccessor.

One can search using findUsingFindDialog where a FindDialog is used as input for the search label and properties.
Navigation through the results in supported by next(), previous(),numberOfResult(),currentNumber()

Definition at line 7 of file FindAlgorithm.py.

Constructor & Destructor Documentation

def Vispa.Share.FindAlgorithm.FindAlgorithm.__init__ (   self)

Member Function Documentation

def Vispa.Share.FindAlgorithm.FindAlgorithm._findIn (   self,
  object,
  dialog 
)
private

Definition at line 41 of file FindAlgorithm.py.

References Vispa.Share.FindAlgorithm.FindAlgorithm._findIn(), Vispa.Share.FindAlgorithm.FindAlgorithm._message, RooGKCounter._message, Vispa.Share.ObjectHolder.ObjectHolder.applyFilter(), class-composition.children, Vispa.Share.ObjectHolder.ObjectHolder.dataAccessor(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.dataAccessor(), Vispa.Main.Exceptions.exception_traceback(), label, and str.

Referenced by Vispa.Share.FindAlgorithm.FindAlgorithm._findIn(), and Vispa.Share.FindAlgorithm.FindAlgorithm.findUsingFindDialog().

41  def _findIn(self, object,dialog):
42  # find Label
43  foundLabel=True
44  findLabel=dialog.label()
45  if findLabel!="":
46  label=self.dataAccessor().label(object)
47  #logging.debug(__name__ +': _findIn: ' + label)
48  if not dialog.caseSensitive():
49  label=label.lower()
50  findLabel=findLabel.lower()
51  if dialog.exactMatch():
52  foundLabel=findLabel=="" or findLabel==label
53  else:
54  foundLabel=findLabel in label
55 
56  # find property
57  foundProperties=True
58  findProperties=dialog.properties()
59  if len(findProperties)>0 and (findProperties[0][0]!="" or findProperties[0][1]!=""):
60  properties=[(p[1],p[2]) for p in self.dataAccessor().properties(object)]
61  if not dialog.caseSensitive():
62  properties=[(str(property[0]).lower(),str(property[1]).lower()) for property in properties]
63  findProperties=[(str(property[0]).lower(),str(property[1]).lower()) for property in findProperties]
64  if dialog.exactMatch():
65  for findProperty in findProperties:
66  foundProperties=(foundProperties and\
67  True in [(findProperty[0]=="" or findProperty[0]==p[0]) and\
68  (findProperty[1]=="" or findProperty[1]==p[1]) for p in properties])
69  else:
70  for findProperty in findProperties:
71  foundProperties=(foundProperties and\
72  True in [findProperty[0] in p[0] and\
73  findProperty[1] in p[1] for p in properties])
74 
75  # find property
76  findScripts=dialog.scripts()
77  foundScripts=True
78  if len(findScripts)>0 and findScripts[0]!="":
79  dataAccessorObject=BasicDataAccessorInterface(object,self.dataAccessor())
80  for findScript in findScripts:
81  try:
82  foundScripts=(foundScripts and\
83  (findScript=="" or dataAccessorObject.runScript(findScript)))
84  except Exception as e:
85  foundScripts=False
86  logging.info("Error in script: "+ exception_traceback())
87  self._message="Error in script: "+ str(e)
88 
89  # combine the searches
90  found=foundLabel and foundProperties and foundScripts
91  if found:
92  results=[object]
93  else:
94  results=[]
95  for daughter in self.applyFilter(self.dataAccessor().children(object)):
96  for object in self._findIn(daughter,dialog):
97  if not object in results:
98  results+=[object]
99  return results
100 
char const * label
def _findIn(self, object, dialog)
#define str(s)
def Vispa.Share.FindAlgorithm.FindAlgorithm.clear (   self)
def Vispa.Share.FindAlgorithm.FindAlgorithm.currentNumber (   self)
def Vispa.Share.FindAlgorithm.FindAlgorithm.findUsingFindDialog (   self,
  dialog 
)

Definition at line 29 of file FindAlgorithm.py.

References Vispa.Share.FindAlgorithm.FindAlgorithm._findIn(), SeedingNode< DATA >._index, Vispa.Share.FindAlgorithm.FindAlgorithm._index, Vispa.Share.FindAlgorithm.FindAlgorithm._results, ReducedTrackerTreeVariables.clear(), EopVariables.clear(), CastorCalibrationsSet.clear(), TkOffTreeVariables.clear(), StringMap.clear(), TrackerTreeVariables.clear(), AlignmentErrors.clear(), AlignmentErrorsExtended.clear(), Alignments.clear(), NumberOfDevices.clear(), CastorCalibrationWidthsSet.clear(), CTPPSTrkDetector.clear(), edm::reftobase::RefVectorHolderBase.clear(), OOTPileupCorrectionColl.clear(), HLTTauDQMOfflineObjects.clear(), HcalCalibrationsSet.clear(), HcalCalibrationWidthsSet.clear(), Overlayer.clear(), StorableDoubleMap< T >.clear(), Vispa.Plugins.EdmBrowser.EventContentView.EventContentView.clear(), EcalCondObjectContainer< T >.clear(), Vispa.Share.FindAlgorithm.FindAlgorithm.clear(), edm::BranchChildren.clear(), EcalContainer< DetId, T >.clear(), ecaldqm::MESetMulti.clear(), edm::reftobase::RefVectorHolder< REFV >.clear(), edm::reftobase::BaseVectorHolder< T >.clear(), CSCALCTDigi.clear(), HcalIndexLookup.clear(), HcalItemColl< Item >.clear(), CSCCLCTPreTriggerDigi.clear(), CSCCLCTDigi.clear(), helper::ClusterStorer.clear(), edm::reftobase::IndirectVectorHolder< T >.clear(), ClusterCollectionFP420.clear(), RecoCollectionFP420.clear(), TrackCollectionFP420.clear(), DigiCollectionFP420.clear(), KDTreeLinkerAlgo< DATA >.clear(), CSCCorrelatedLCTDigi.clear(), reco::PattRecoTree< ScaleType, Cluster >.clear(), ClhepEvaluator.clear(), OpticalAlignMeasurementInfo.clear(), SiPixelPerformanceSummary.clear(), FWFromSliceSelector.clear(), SegmentToTrackAssociator.clear(), pos::PixelROCStatus.clear(), edm::reftobase::VectorHolder< T, REFV >.clear(), HBHEChannelInfo.clear(), CTPPSToFDetector.clear(), AlignmentParameterSelector.clear(), edm::OrphanHandleBase.clear(), ME0TriggerDigi.clear(), ecaldqm::MESet.clear(), HcalItemArrayColl< Item, N >.clear(), edm::ParentageRegistry.clear(), HLTPerformanceInfo::Module.clear(), CSCTriggerContainer< T >.clear(), edm::RefToBaseVector< T >.clear(), edm::StreamedProduct.clear(), edm::ScheduleItems.clear(), DTBufferTree< Key, Content >.clear(), DrawIteration.clear(), edm::ThinnedAssociationsHelper.clear(), KDTreeNodes< DATA >.clear(), cond::Iov_t.clear(), edm::WorkerRegistry.clear(), OpticalAlignParam.clear(), edm::HandleBase.clear(), SiStripQuality.clear(), egHLT::OffEvt.clear(), edm::TrieFactory< T >.clear(), SiStripDelay.clear(), DDI::Store< N, I, K >.clear(), cond::Tag_t.clear(), TrackerDetToDTCELinkCablingMap.clear(), edm::Association< C >.clear(), DTTFFEDReader.clear(), SiPixelCalibDigiProducer.clear(), edm::DetSet< T >.clear(), edm::EventSetupImpl.clear(), edm::ProcessHistory.clear(), MuonResidualsFromTrack.clear(), DTuROSDigiToRaw.clear(), FBaseSimEvent.clear(), CTPPSRPAlignmentCorrectionsData.clear(), edm::PtrVectorBase.clear(), HLTPerformanceInfo::Path.clear(), BXVector< T >.clear(), l1t::IntervalManager< TimeType, PayloadType >.clear(), edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >.clear(), HcalDTCHeader.clear(), DTCCBConfig.clear(), OpticalAlignInfo.clear(), StudyHLT.clear(), DDXMLElement.clear(), CSCDCCExaminer.clear(), FQueue< T >.clear(), DTLVStatus.clear(), edm::Handle< GenericObject >.clear(), edm::BasicHandle.clear(), DTT0.clear(), edm::RefVectorBase< KEY >.clear(), DTTPGParameters.clear(), DTRangeT0.clear(), CastorCTDCHeader.clear(), Vispa.Plugins.EdmBrowser.EventContentDataAccessor.EventContentDataAccessor.clear(), FWGeometry.clear(), HcalDCCHeader.clear(), DTHVStatus.clear(), AlignmentParameterSelector::PXBDetIdRanges.clear(), edm::Handle< FWGenericObject >.clear(), edm::TrieNode< T >.clear(), DTReadOutMapping.clear(), edm::OwnArray< T, MAX_SIZE, P >.clear(), reco::FlavorHistoryEvent.clear(), AlignmentParameterSelector::PXFDetIdRanges.clear(), edm::AssociationMap< Tag >.clear(), edm::RefVector< C, T, F >.clear(), DTTtrig.clear(), DTPerformance.clear(), AlignmentParameterSelector::TIBDetIdRanges.clear(), DTStatusFlag.clear(), HLTPerformanceInfo.clear(), edm::OwnVector< T, P >.clear(), edm::ValueMap< T >.clear(), DTDeadFlag.clear(), AlignmentParameterSelector::TIDDetIdRanges.clear(), rpcamc13::AMCPayload.clear(), AlignmentParameterSelector::TOBDetIdRanges.clear(), DTMtime.clear(), pos::PixelFEDCard.clear(), math::Graph< N, E >.clear(), AlignmentParameterSelector::TECDetIdRanges.clear(), edm::Trie< T >.clear(), Json::Value.clear(), reco::HitPattern.clear(), BeautifulSoup.Tag.clear(), Vispa.Share.ObjectHolder.ObjectHolder.dataAccessor(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController.dataAccessor(), and Vispa.Share.ObjectHolder.ObjectHolder.dataObjects().

29  def findUsingFindDialog(self, dialog):
30  logging.debug(__name__ +': findUsingFindDialog')
31  self.clear()
32  if self.dataAccessor():
33  for object in self.dataObjects():
34  self._results+=self._findIn(object,dialog)
35  self._index=0
36  if len(self._results)>0:
37  return self._results[0]
38  else:
39  return []
40 
def _findIn(self, object, dialog)
def Vispa.Share.FindAlgorithm.FindAlgorithm.message (   self)
def Vispa.Share.FindAlgorithm.FindAlgorithm.next (   self)

Definition at line 110 of file FindAlgorithm.py.

References SeedingNode< DATA >._index, Vispa.Share.FindAlgorithm.FindAlgorithm._index, and Vispa.Share.FindAlgorithm.FindAlgorithm._results.

110  def next(self):
111  if len(self._results)==0:
112  return None
113  self._index+=1
114  if self._index>len(self._results)-1:
115  self._index=0
116  return self._results[self._index]
117 
def Vispa.Share.FindAlgorithm.FindAlgorithm.numberOfResults (   self)
def Vispa.Share.FindAlgorithm.FindAlgorithm.previous (   self)

Definition at line 118 of file FindAlgorithm.py.

References SeedingNode< DATA >._index, Vispa.Share.FindAlgorithm.FindAlgorithm._index, and Vispa.Share.FindAlgorithm.FindAlgorithm._results.

118  def previous(self):
119  if len(self._results)==0:
120  return None
121  self._index-=1
122  if self._index<0:
123  self._index=len(self._results)-1
124  return self._results[self._index]
125 
def Vispa.Share.FindAlgorithm.FindAlgorithm.results (   self)
def Vispa.Share.FindAlgorithm.FindAlgorithm.setDataAccessor (   self,
  accessor 
)

Definition at line 19 of file FindAlgorithm.py.

19  def setDataAccessor(self, accessor):
20  logging.debug(__name__ + ": setDataAccessor")
21  if not isinstance(accessor, BasicDataAccessor):
22  raise TypeError(__name__ + " requires data accessor of type BasicDataAccessor.")
23  ObjectHolder.setDataAccessor(self, accessor)
24 

Member Data Documentation

Vispa.Share.FindAlgorithm.FindAlgorithm._index
private

Definition at line 16 of file FindAlgorithm.py.

Referenced by ntupleDataFormat._Object.__getattr__(), python.cmstools.EventTree.__getitem__(), python.cmstools.EventTree.__iter__(), python.cmstools.EventBranch.__readData(), python.cmstools.EventTree.__setBranchIndicies(), ntupleDataFormat.TrackingParticle._nMatchedSeeds(), ntupleDataFormat._SimHitMatchAdaptor._nMatchedSimHits(), ntupleDataFormat._TrackingParticleMatchAdaptor._nMatchedTrackingParticles(), ntupleDataFormat.TrackingParticle._nMatchedTracks(), Vispa.Share.FindAlgorithm.FindAlgorithm.currentNumber(), ntupleDataFormat.TrackingVertex.daughterTrackingParticles(), ntupleDataFormat.TrackingParticle.decayVertices(), ntupleDataFormat._DetIdStrAdaptor.detIdStr(), Vispa.Share.FindAlgorithm.FindAlgorithm.findUsingFindDialog(), ntupleDataFormat._Object.index(), python.cmstools.EventTree.index(), ntupleDataFormat.Seed.indexWithinAlgo(), ntupleDataFormat._Object.isValid(), ntupleDataFormat._DetIdStrAdaptor.layerStr(), ntupleDataFormat.InvalidHit.layerStr(), ntupleDataFormat.TrackingParticle.matchedSeedInfos(), ntupleDataFormat._SimHitMatchAdaptor.matchedSimHitInfos(), ntupleDataFormat.TrackingParticle.matchedTrackInfos(), ntupleDataFormat._TrackingParticleMatchAdaptor.matchedTrackingParticleInfos(), ntupleDataFormat.GluedHit.monoHit(), ntupleDataFormat.TrackingVertex.nDaughterTrackingParticles(), Vispa.Share.FindAlgorithm.FindAlgorithm.next(), ntupleDataFormat.SimHit.nRecHits(), ntupleDataFormat._HitObject.nseeds(), ntupleDataFormat.GluedHit.nseeds(), ntupleDataFormat.TrackingVertex.nSourceTrackingParticles(), ntupleDataFormat._HitObject.ntracks(), ntupleDataFormat.Vertex.nTracks(), ntupleDataFormat.TrackingParticle.parentVertex(), Vispa.Share.FindAlgorithm.FindAlgorithm.previous(), ntupleDataFormat.SeedMatchInfo.seed(), ntupleDataFormat.Track.seed(), ntupleDataFormat._HitObject.seeds(), ntupleDataFormat.GluedHit.seeds(), python.cmstools.EventBranch.setIndex(), ntupleDataFormat.SimHitMatchInfo.simHit(), ntupleDataFormat.TrackingVertex.sourceTrackingParticles(), ntupleDataFormat.GluedHit.stereoHit(), ntupleDataFormat.Seed.track(), ntupleDataFormat.SimHit.trackingParticle(), ntupleDataFormat._HitObject.tracks(), ntupleDataFormat.Vertex.tracks(), ntupleDataFormat.Track.vertex(), and html.HtmlReport.write().

Vispa.Share.FindAlgorithm.FindAlgorithm._message
private