CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
trackingPlots.TimePerTrackPlot Class Reference

Public Member Functions

def __init__ (self, name, timeHisto, selectedTracks=False)
 
def __str__ (self)
 
def create (self, tdirectory)
 

Private Member Functions

def _getDirectory (self, tfile)
 

Private Attributes

 _name
 
 _selectedTracks
 
 _timeHisto
 

Detailed Description

Definition at line 1653 of file trackingPlots.py.

Constructor & Destructor Documentation

def trackingPlots.TimePerTrackPlot.__init__ (   self,
  name,
  timeHisto,
  selectedTracks = False 
)

Definition at line 1654 of file trackingPlots.py.

1654  def __init__(self, name, timeHisto, selectedTracks=False):
1655  self._name = name
1656  self._timeHisto = timeHisto
1657  self._selectedTracks = selectedTracks
1658 
def __init__(self, name, timeHisto, selectedTracks=False)

Member Function Documentation

def trackingPlots.TimePerTrackPlot.__str__ (   self)
def trackingPlots.TimePerTrackPlot._getDirectory (   self,
  tfile 
)
private

Definition at line 1662 of file trackingPlots.py.

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

1662  def _getDirectory(self, tfile):
1663  for dirName in _trackingFolders():
1664  tdir = tfile.Get(dirName)
1665  if tdir != None:
1666  return tdir
1667  return None
1668 
def _trackingFolders(lastDirName="Track")
def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1669 of file trackingPlots.py.

References trackingPlots.TimePerTrackPlot._getDirectory(), plotting._getOrCreateObject(), TrackerHitsObject._name, FP420HitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, TrackingRecHitAlgorithm._name, LikelihoodPdfProduct._name, Logger._name, hcaldqm::DQModule._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, HistoParams< T >._name, GeometricTimingDetExtra._name, CutApplicatorBase._name, GeometricDetExtra._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.Subtract._name, plotting.Transform._name, plotting.FakeDuplicate._name, plotting.CutEfficiency._name, plotting.AggregateBins._name, plotting.AggregateHistos._name, plotting.ROC._name, trackingPlots.Iteration._name, SequenceTypes.TaskPlaceholder._name, trackingPlots.TimePerEventPlot._name, trackingPlots.TimePerTrackPlot._name, plotting.Plot._name, plotting.PlotGroup._name, plotting.PlotterFolder._name, plotting.PlotterItem._name, trackingPlots.TimePerTrackPlot._selectedTracks, trackingPlots._summaryBinRename(), trackingPlots.TimePerEventPlot._timeHisto, and trackingPlots.TimePerTrackPlot._timeHisto.

1669  def create(self, tdirectory):
1670  timeTh1 = plotting._getOrCreateObject(tdirectory, self._timeHisto)
1671  if timeTh1 is None:
1672  return None
1673 
1674  # this is bit of a hack, but as long as it is needed only
1675  # here, I won't invest in better solution
1676  tfile = tdirectory.GetFile()
1677  trkDir = self._getDirectory(tfile)
1678  if trkDir is None:
1679  return None
1680 
1681  iterMap = copy.copy(_collLabelMapHp)
1682  del iterMap["generalTracks"]
1683  del iterMap["jetCoreRegionalStep"] # this is expensive per track on purpose
1684  if self._selectedTracks:
1685  renameBin = lambda bl: _summaryBinRename(bl, highPurity=True, byOriginalAlgo=False, byAlgoMask=True, ptCut=False, seeds=False)
1686  else:
1687  renameBin = lambda bl: _summaryBinRename(bl, highPurity=False, byOriginalAlgo=False, byAlgoMask=False, ptCut=False, seeds=False)
1688  recoAB = AggregateBins("tmp", "num_reco_coll", mapping=iterMap,ignoreMissingBins=True, renameBin=renameBin)
1689  h_reco_per_iter = recoAB.create(trkDir)
1690  if h_reco_per_iter is None:
1691  return None
1692  values = {}
1693  for i in range(1, h_reco_per_iter.GetNbinsX()+1):
1694  values[h_reco_per_iter.GetXaxis().GetBinLabel(i)] = h_reco_per_iter.GetBinContent(i)
1695 
1696 
1697  result = []
1698  for i in range(1, timeTh1.GetNbinsX()+1):
1699  iterName = timeTh1.GetXaxis().GetBinLabel(i)
1700  if iterName in values:
1701  ntrk = values[iterName]
1702  result.append( (iterName,
1703  timeTh1.GetBinContent(i)/ntrk if ntrk > 0 else 0,
1704  timeTh1.GetBinError(i)/ntrk if ntrk > 0 else 0) )
1705 
1706  if len(result) == 0:
1707  return None
1708 
1709  res = ROOT.TH1F(self._name, self._name, len(result), 0, len(result))
1710  for i, (label, value, error) in enumerate(result):
1711  res.GetXaxis().SetBinLabel(i+1, label)
1712  res.SetBinContent(i+1, value)
1713  res.SetBinError(i+1, error)
1714 
1715  return res
1716 
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:58
def _summaryBinRename(binLabel, highPurity, byOriginalAlgo, byAlgoMask, ptCut, seeds)
def create(self, tdirectory)

Member Data Documentation

trackingPlots.TimePerTrackPlot._name
private
trackingPlots.TimePerTrackPlot._selectedTracks
private

Definition at line 1657 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1656 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().