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

Constructor & Destructor Documentation

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

Definition at line 1599 of file trackingPlots.py.

1599  def __init__(self, name, timeHisto, selectedTracks=False):
1600  self._name = name
1601  self._timeHisto = timeHisto
1602  self._selectedTracks = selectedTracks
1603 
def __init__(self, name, timeHisto, selectedTracks=False)

Member Function Documentation

def trackingPlots.TimePerTrackPlot.__str__ (   self)

Definition at line 1604 of file trackingPlots.py.

References FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, LikelihoodSpecies._name, L1TMuon::PtAssignmentUnit._name, L1TMuon::PtRefinementUnit._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, Logger._name, hcaldqm::DQModule._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, ElectronMVAEstimatorRun2Spring15Trig._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._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, trackingPlots.TimePerTrackPlot._name, plotting.Plot._name, plotting.PlotGroup._name, plotting.PlotterFolder._name, and plotting.PlotterItem._name.

1604  def __str__(self):
1605  return self._name
1606 
def trackingPlots.TimePerTrackPlot._getDirectory (   self,
  tfile 
)
private

Definition at line 1607 of file trackingPlots.py.

References trackingPlots._trackingFolders().

Referenced by trackingPlots.TimePerTrackPlot.create().

1607  def _getDirectory(self, tfile):
1608  for dirName in _trackingFolders():
1609  tdir = tfile.Get(dirName)
1610  if tdir != None:
1611  return tdir
1612  return None
1613 
def _trackingFolders(lastDirName="Track")
def trackingPlots.TimePerTrackPlot.create (   self,
  tdirectory 
)

Definition at line 1614 of file trackingPlots.py.

References trackingPlots.TimePerTrackPlot._getDirectory(), plotting._getOrCreateObject(), TrackerHitsObject._name, FP420HitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, LikelihoodSpecies._name, L1TMuon::PtAssignmentUnit._name, L1TMuon::PtRefinementUnit._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, Logger._name, hcaldqm::DQModule._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15Trig._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._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, trackingPlots.TimePerTrackPlot._name, plotting.Plot._name, plotting.PlotGroup._name, plotting.PlotterFolder._name, plotting.PlotterItem._name, trackingPlots.TimePerTrackPlot._selectedTracks, trackingPlots._summaryBinRename(), trackingPlots.TimePerEventPlot._timeHisto, and trackingPlots.TimePerTrackPlot._timeHisto.

1614  def create(self, tdirectory):
1615  timeTh1 = plotting._getOrCreateObject(tdirectory, self._timeHisto)
1616  if timeTh1 is None:
1617  return None
1618 
1619  # this is bit of a hack, but as long as it is needed only
1620  # here, I won't invest in better solution
1621  tfile = tdirectory.GetFile()
1622  trkDir = self._getDirectory(tfile)
1623  if trkDir is None:
1624  return None
1625 
1626  iterMap = copy.copy(_collLabelMapHp)
1627  del iterMap["generalTracks"]
1628  del iterMap["jetCoreRegionalStep"] # this is expensive per track on purpose
1629  if self._selectedTracks:
1630  renameBin = lambda bl: _summaryBinRename(bl, highPurity=True, byOriginalAlgo=False, byAlgoMask=True, ptCut=False, seeds=False)
1631  else:
1632  renameBin = lambda bl: _summaryBinRename(bl, highPurity=False, byOriginalAlgo=False, byAlgoMask=False, ptCut=False, seeds=False)
1633  recoAB = AggregateBins("tmp", "num_reco_coll", mapping=iterMap,ignoreMissingBins=True, renameBin=renameBin)
1634  h_reco_per_iter = recoAB.create(trkDir)
1635  if h_reco_per_iter is None:
1636  return None
1637  values = {}
1638  for i in xrange(1, h_reco_per_iter.GetNbinsX()+1):
1639  values[h_reco_per_iter.GetXaxis().GetBinLabel(i)] = h_reco_per_iter.GetBinContent(i)
1640 
1641 
1642  result = []
1643  for i in xrange(1, timeTh1.GetNbinsX()+1):
1644  iterName = timeTh1.GetXaxis().GetBinLabel(i)
1645  if iterName in values:
1646  ntrk = values[iterName]
1647  result.append( (iterName,
1648  timeTh1.GetBinContent(i)/ntrk if ntrk > 0 else 0,
1649  timeTh1.GetBinError(i)/ntrk if ntrk > 0 else 0) )
1650 
1651  if len(result) == 0:
1652  return None
1653 
1654  res = ROOT.TH1F(self._name, self._name, len(result), 0, len(result))
1655  for i, (label, value, error) in enumerate(result):
1656  res.GetXaxis().SetBinLabel(i+1, label)
1657  res.SetBinContent(i+1, value)
1658  res.SetBinError(i+1, error)
1659 
1660  return res
1661 
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:54
def _summaryBinRename(binLabel, highPurity, byOriginalAlgo, byAlgoMask, ptCut, seeds)
def create(self, tdirectory)

Member Data Documentation

trackingPlots.TimePerTrackPlot._name
private
trackingPlots.TimePerTrackPlot._selectedTracks
private

Definition at line 1602 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().

trackingPlots.TimePerTrackPlot._timeHisto
private

Definition at line 1601 of file trackingPlots.py.

Referenced by trackingPlots.TimePerTrackPlot.create().