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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1669 of file trackingPlots.py.

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

Member Function Documentation

◆ __str__()

def trackingPlots.TimePerTrackPlot.__str__ (   self)

◆ _getDirectory()

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

Definition at line 1677 of file trackingPlots.py.

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

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ create()

def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1684 of file trackingPlots.py.

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

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, GeometricDetExtra._name, GeometricTimingDetExtra._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 1672 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ _timeHisto

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1671 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

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