CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
trackingPlots.TimePerTrackPlot Class Reference

Public Member Functions

def __init__
 
def __str__
 
def create
 

Private Member Functions

def _getDirectory
 

Private Attributes

 _name
 
 _selectedTracks
 
 _timeHisto
 

Detailed Description

Definition at line 1679 of file trackingPlots.py.

Constructor & Destructor Documentation

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

Definition at line 1680 of file trackingPlots.py.

1681  def __init__(self, name, timeHisto, selectedTracks=False):
1682  self._name = name
1683  self._timeHisto = timeHisto
1684  self._selectedTracks = selectedTracks

Member Function Documentation

def trackingPlots.TimePerTrackPlot.__str__ (   self)

Definition at line 1685 of file trackingPlots.py.

References FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, Logger._name, hcaldqm::DQModule._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, HistoParams< T >._name, CutApplicatorBase._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._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.

1686  def __str__(self):
1687  return self._name
def trackingPlots.TimePerTrackPlot._getDirectory (   self,
  tfile 
)
private

Definition at line 1688 of file trackingPlots.py.

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

1689  def _getDirectory(self, tfile):
1690  for dirName in _trackingFolders():
1691  tdir = tfile.Get(dirName)
1692  if tdir != None:
1693  return tdir
1694  return None
def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1695 of file trackingPlots.py.

References trackingPlots.TimePerTrackPlot._getDirectory(), plotting._getOrCreateObject(), FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, Logger._name, hcaldqm::DQModule._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, HistoParams< T >._name, CutApplicatorBase._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._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, trackingPlots.TimePerTrackPlot._timeHisto, and sistrip::SpyUtilities.range().

1696  def create(self, tdirectory):
1697  timeTh1 = plotting._getOrCreateObject(tdirectory, self._timeHisto)
1698  if timeTh1 is None:
1699  return None
1700 
1701  # this is bit of a hack, but as long as it is needed only
1702  # here, I won't invest in better solution
1703  tfile = tdirectory.GetFile()
1704  trkDir = self._getDirectory(tfile)
1705  if trkDir is None:
1706  return None
1707 
1708  iterMap = copy.copy(_collLabelMapHp)
1709  del iterMap["generalTracks"]
1710  del iterMap["jetCoreRegionalStep"] # this is expensive per track on purpose
1711  if self._selectedTracks:
1712  renameBin = lambda bl: _summaryBinRename(bl, highPurity=True, byOriginalAlgo=False, byAlgoMask=True, ptCut=False, seeds=False)
1713  else:
1714  renameBin = lambda bl: _summaryBinRename(bl, highPurity=False, byOriginalAlgo=False, byAlgoMask=False, ptCut=False, seeds=False)
1715  recoAB = AggregateBins("tmp", "num_reco_coll", mapping=iterMap,ignoreMissingBins=True, renameBin=renameBin)
1716  h_reco_per_iter = recoAB.create(trkDir)
1717  if h_reco_per_iter is None:
1718  return None
1719  values = {}
1720  for i in range(1, h_reco_per_iter.GetNbinsX()+1):
1721  values[h_reco_per_iter.GetXaxis().GetBinLabel(i)] = h_reco_per_iter.GetBinContent(i)
1722 
1723 
1724  result = []
1725  for i in range(1, timeTh1.GetNbinsX()+1):
1726  iterName = timeTh1.GetXaxis().GetBinLabel(i)
1727  if iterName in values:
1728  ntrk = values[iterName]
1729  result.append( (iterName,
1730  timeTh1.GetBinContent(i)/ntrk if ntrk > 0 else 0,
1731  timeTh1.GetBinError(i)/ntrk if ntrk > 0 else 0) )
1732 
1733  if len(result) == 0:
1734  return None
1735 
1736  res = ROOT.TH1F(self._name, self._name, len(result), 0, len(result))
1737  for i, (label, value, error) in enumerate(result):
1738  res.GetXaxis().SetBinLabel(i+1, label)
1739  res.SetBinContent(i+1, value)
1740  res.SetBinError(i+1, error)
1741 
1742  return res
const uint16_t range(const Frame &aFrame)
def _getOrCreateObject
Definition: plotting.py:57

Member Data Documentation

trackingPlots.TimePerTrackPlot._name
private

Definition at line 1681 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.__str__(), trackingPlots.TimePerTrackPlot.create(), and validation.SimpleSample.name().

trackingPlots.TimePerTrackPlot._selectedTracks
private

Definition at line 1683 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1682 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().