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 1625 of file trackingPlots.py.

Constructor & Destructor Documentation

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

Definition at line 1626 of file trackingPlots.py.

1626  def __init__(self, name, timeHisto, selectedTracks=False):
1627  self._name = name
1628  self._timeHisto = timeHisto
1629  self._selectedTracks = selectedTracks
1630 
def __init__(self, name, timeHisto, selectedTracks=False)

Member Function Documentation

def trackingPlots.TimePerTrackPlot.__str__ (   self)

Definition at line 1631 of file trackingPlots.py.

References FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, LikelihoodSpecies._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, Logger._name, hcaldqm::DQModule._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, CutApplicatorBase._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, ElectronMVAEstimatorRun2Spring15Trig._name, ElectronMVAEstimatorRun2Spring15NonTrig._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, and plotting.PlotterItem._name.

1631  def __str__(self):
1632  return self._name
1633 
def trackingPlots.TimePerTrackPlot._getDirectory (   self,
  tfile 
)
private

Definition at line 1634 of file trackingPlots.py.

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

1634  def _getDirectory(self, tfile):
1635  for dirName in _trackingFolders():
1636  tdir = tfile.Get(dirName)
1637  if tdir != None:
1638  return tdir
1639  return None
1640 
def _trackingFolders(lastDirName="Track")
def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1641 of file trackingPlots.py.

References trackingPlots.TimePerTrackPlot._getDirectory(), plotting._getOrCreateObject(), FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, LikelihoodSpecies._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, Logger._name, hcaldqm::DQModule._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, CutApplicatorBase._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, ElectronMVAEstimatorRun2Spring15Trig._name, ElectronMVAEstimatorRun2Spring15NonTrig._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.

1641  def create(self, tdirectory):
1642  timeTh1 = plotting._getOrCreateObject(tdirectory, self._timeHisto)
1643  if timeTh1 is None:
1644  return None
1645 
1646  # this is bit of a hack, but as long as it is needed only
1647  # here, I won't invest in better solution
1648  tfile = tdirectory.GetFile()
1649  trkDir = self._getDirectory(tfile)
1650  if trkDir is None:
1651  return None
1652 
1653  iterMap = copy.copy(_collLabelMapHp)
1654  del iterMap["generalTracks"]
1655  del iterMap["jetCoreRegionalStep"] # this is expensive per track on purpose
1656  if self._selectedTracks:
1657  renameBin = lambda bl: _summaryBinRename(bl, highPurity=True, byOriginalAlgo=False, byAlgoMask=True, ptCut=False, seeds=False)
1658  else:
1659  renameBin = lambda bl: _summaryBinRename(bl, highPurity=False, byOriginalAlgo=False, byAlgoMask=False, ptCut=False, seeds=False)
1660  recoAB = AggregateBins("tmp", "num_reco_coll", mapping=iterMap,ignoreMissingBins=True, renameBin=renameBin)
1661  h_reco_per_iter = recoAB.create(trkDir)
1662  if h_reco_per_iter is None:
1663  return None
1664  values = {}
1665  for i in xrange(1, h_reco_per_iter.GetNbinsX()+1):
1666  values[h_reco_per_iter.GetXaxis().GetBinLabel(i)] = h_reco_per_iter.GetBinContent(i)
1667 
1668 
1669  result = []
1670  for i in xrange(1, timeTh1.GetNbinsX()+1):
1671  iterName = timeTh1.GetXaxis().GetBinLabel(i)
1672  if iterName in values:
1673  ntrk = values[iterName]
1674  result.append( (iterName,
1675  timeTh1.GetBinContent(i)/ntrk if ntrk > 0 else 0,
1676  timeTh1.GetBinError(i)/ntrk if ntrk > 0 else 0) )
1677 
1678  if len(result) == 0:
1679  return None
1680 
1681  res = ROOT.TH1F(self._name, self._name, len(result), 0, len(result))
1682  for i, (label, value, error) in enumerate(result):
1683  res.GetXaxis().SetBinLabel(i+1, label)
1684  res.SetBinContent(i+1, value)
1685  res.SetBinError(i+1, error)
1686 
1687  return res
1688 
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:54
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 1629 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1628 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().