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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1680 of file trackingPlots.py.

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

Member Function Documentation

◆ __str__()

def trackingPlots.TimePerTrackPlot.__str__ (   self)

◆ _getDirectory()

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

Definition at line 1688 of file trackingPlots.py.

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

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ create()

def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1695 of file trackingPlots.py.

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

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

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ _timeHisto

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1682 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

trackingPlots._trackingFolders
def _trackingFolders(lastDirName="Track")
Definition: trackingPlots.py:1182
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:97
trackingPlots._summaryBinRename
def _summaryBinRename(binLabel, highPurity, byOriginalAlgo, byAlgoMask, ptCut, seeds)
Definition: trackingPlots.py:655
TriggerAnalyzer.__str__
def __str__(self)
Definition: TriggerAnalyzer.py:103
plotting._getOrCreateObject
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:57