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

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1698 of file trackingPlots.py.

1698  def __init__(self, name, timeHisto, selectedTracks=False):
1699  self._name = name
1700  self._timeHisto = timeHisto
1701  self._selectedTracks = selectedTracks
1702 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ __str__()

def trackingPlots.TimePerTrackPlot.__str__ (   self)

◆ _getDirectory()

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

Definition at line 1706 of file trackingPlots.py.

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

1706  def _getDirectory(self, tfile):
1707  for dirName in _trackingFolders():
1708  tdir = tfile.Get(dirName)
1709  if tdir != None:
1710  return tdir
1711  return None
1712 
def _getDirectory(args, kwargs)
Definition: plotting.py:97
def _trackingFolders(lastDirName="Track")

◆ create()

def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1713 of file trackingPlots.py.

References trackingPlots.TimePerTrackPlot._getDirectory(), plotting._getOrCreateObject(), ModulesProxy._ModuleProxy._name, FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, Logger._name, hcaldqm::DQModule._name, citk::IsolationConeDefinitionBase._name, condhdf5tohdf5.H5DataProduct._name, WValidation._name, DrellYanValidation._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, HistoParams< T >._name, condhdf5tohdf5.H5Tag._name, CutApplicatorBase._name, condhdf5tohdf5.H5GlobalTag._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, conddb2hdf5.DBGlobalTag._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, trackingPlots.TimePerEventPlot._name, SequenceTypes._TaskBasePlaceholder._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 isotrackApplyRegressor.range.

1713  def create(self, tdirectory):
1714  timeTh1 = plotting._getOrCreateObject(tdirectory, self._timeHisto)
1715  if timeTh1 is None:
1716  return None
1717 
1718  # this is bit of a hack, but as long as it is needed only
1719  # here, I won't invest in better solution
1720  tfile = tdirectory.GetFile()
1721  trkDir = self._getDirectory(tfile)
1722  if trkDir is None:
1723  return None
1724 
1725  iterMap = copy.copy(_collLabelMapHp)
1726  del iterMap["generalTracks"]
1727  del iterMap["jetCoreRegionalStep"] # this is expensive per track on purpose
1728  if self._selectedTracks:
1729  renameBin = lambda bl: _summaryBinRename(bl, highPurity=True, byOriginalAlgo=False, byAlgoMask=True, ptCut=False, seeds=False)
1730  else:
1731  renameBin = lambda bl: _summaryBinRename(bl, highPurity=False, byOriginalAlgo=False, byAlgoMask=False, ptCut=False, seeds=False)
1732  recoAB = AggregateBins("tmp", "num_reco_coll", mapping=iterMap,ignoreMissingBins=True, renameBin=renameBin)
1733  h_reco_per_iter = recoAB.create(trkDir)
1734  if h_reco_per_iter is None:
1735  return None
1736  values = {}
1737  for i in range(1, h_reco_per_iter.GetNbinsX()+1):
1738  values[h_reco_per_iter.GetXaxis().GetBinLabel(i)] = h_reco_per_iter.GetBinContent(i)
1739 
1740 
1741  result = []
1742  for i in range(1, timeTh1.GetNbinsX()+1):
1743  iterName = timeTh1.GetXaxis().GetBinLabel(i)
1744  if iterName in values:
1745  ntrk = values[iterName]
1746  result.append( (iterName,
1747  timeTh1.GetBinContent(i)/ntrk if ntrk > 0 else 0,
1748  timeTh1.GetBinError(i)/ntrk if ntrk > 0 else 0) )
1749 
1750  if len(result) == 0:
1751  return None
1752 
1753  res = ROOT.TH1F(self._name, self._name, len(result), 0, len(result))
1754  for i, (label, value, error) in enumerate(result):
1755  res.GetXaxis().SetBinLabel(i+1, label)
1756  res.SetBinContent(i+1, value)
1757  res.SetBinError(i+1, error)
1758 
1759  return res
1760 
def create(alignables, pedeDump, additionalData, outputFile, config)
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:57
def _summaryBinRename(binLabel, highPurity, byOriginalAlgo, byAlgoMask, ptCut, seeds)

Member Data Documentation

◆ _name

trackingPlots.TimePerTrackPlot._name
private

◆ _selectedTracks

trackingPlots.TimePerTrackPlot._selectedTracks
private

Definition at line 1701 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

◆ _timeHisto

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1700 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().