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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1674 of file trackingPlots.py.

1674  def __init__(self, name, timeHisto, selectedTracks=False):
1675  self._name = name
1676  self._timeHisto = timeHisto
1677  self._selectedTracks = selectedTracks
1678 

Member Function Documentation

◆ __str__()

def trackingPlots.TimePerTrackPlot.__str__ (   self)

◆ _getDirectory()

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

Definition at line 1682 of file trackingPlots.py.

1682  def _getDirectory(self, tfile):
1683  for dirName in _trackingFolders():
1684  tdir = tfile.Get(dirName)
1685  if tdir != None:
1686  return tdir
1687  return None
1688 

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ create()

def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1689 of file trackingPlots.py.

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

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 FastTimerService_cff.range.

Member Data Documentation

◆ _name

trackingPlots.TimePerTrackPlot._name
private

◆ _selectedTracks

trackingPlots.TimePerTrackPlot._selectedTracks
private

Definition at line 1677 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ _timeHisto

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1676 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

trackingPlots._trackingFolders
def _trackingFolders(lastDirName="Track")
Definition: trackingPlots.py:1181
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
plotting._getDirectory
def _getDirectory(*args, **kwargs)
Definition: plotting.py:98
trackingPlots._summaryBinRename
def _summaryBinRename(binLabel, highPurity, byOriginalAlgo, byAlgoMask, ptCut, seeds)
Definition: trackingPlots.py:654
TriggerAnalyzer.__str__
def __str__(self)
Definition: TriggerAnalyzer.py:103
plotting._getOrCreateObject
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:58