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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1671 of file trackingPlots.py.

1671  def __init__(self, name, timeHisto, selectedTracks=False):
1672  self._name = name
1673  self._timeHisto = timeHisto
1674  self._selectedTracks = selectedTracks
1675 

Member Function Documentation

◆ __str__()

def trackingPlots.TimePerTrackPlot.__str__ (   self)

◆ _getDirectory()

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

Definition at line 1679 of file trackingPlots.py.

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

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ create()

def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1686 of file trackingPlots.py.

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

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

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ _timeHisto

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1673 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

trackingPlots._trackingFolders
def _trackingFolders(lastDirName="Track")
Definition: trackingPlots.py:1198
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:674
TriggerAnalyzer.__str__
def __str__(self)
Definition: TriggerAnalyzer.py:103
plotting._getOrCreateObject
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:58