CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
plotting.CutEfficiency Class Reference

Public Member Functions

def __init__ (self, name, histo, title="")
 
def __str__ (self)
 
def create (self, tdirectory)
 

Private Attributes

 _histo
 
 _name
 
 _title
 

Detailed Description

Class for making a cut efficiency histograms.

      N after cut
eff = -----------
        N total

Definition at line 898 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def plotting.CutEfficiency.__init__ (   self,
  name,
  histo,
  title = "" 
)
Constructor

Arguments:
name  -- String for name of the resulting histogram
histo -- String for a source histogram (needs to be cumulative)

Definition at line 905 of file plotting.py.

905  def __init__(self, name, histo, title=""):
906  """Constructor
907 
908  Arguments:
909  name -- String for name of the resulting histogram
910  histo -- String for a source histogram (needs to be cumulative)
911  """
912  self._name = name
913  self._histo = histo
914  self._title = title
915 
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 plotting.CutEfficiency.__str__ (   self)

◆ create()

def plotting.CutEfficiency.create (   self,
  tdirectory 
)
Create and return the cut efficiency histogram from a TDirectory

Definition at line 920 of file plotting.py.

References plotting._getOrCreateObject(), plotting.Transform._histo, plotting.CutEfficiency._histo, FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, Logger._name, hcaldqm::DQModule._name, citk::IsolationConeDefinitionBase._name, WValidation._name, DrellYanValidation._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, SequenceTypes._TaskBasePlaceholder._name, HistoParams< T >._title, HistoParams< TH2F >._title, SiStripHitEffFromCalibTree._title, HistoParams< TProfile2D >._title, html.PageSet._title, plotting.Subtract._title, html.HtmlReport._title, plotting.Transform._title, plotting.FakeDuplicate._title, plotting.CutEfficiency._title, and FastTimerService_cff.range.

920  def create(self, tdirectory):
921  """Create and return the cut efficiency histogram from a TDirectory"""
922  histo = _getOrCreateObject(tdirectory, self._histo)
923  if not histo:
924  return None
925 
926  # infer cumulative direction from the under/overflow bins
927  ascending = histo.GetBinContent(0) < histo.GetBinContent(histo.GetNbinsX())
928  if ascending:
929  n_tot = histo.GetBinContent(histo.GetNbinsX())
930  else:
931  n_tot = histo.GetBinContent(0)
932 
933  if n_tot == 0:
934  return histo
935 
936  ret = histo.Clone(self._name)
937  ret.SetTitle(self._title)
938 
939  # calculate efficiency
940  for i in range(1, histo.GetNbinsX()+1):
941  n = histo.GetBinContent(i)
942  val = n/n_tot
943  errVal = math.sqrt(val*(1-val)/n_tot)
944  ret.SetBinContent(i, val)
945  ret.SetBinError(i, errVal)
946  return ret
947 
def create(alignables, pedeDump, additionalData, outputFile, config)
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:57

Member Data Documentation

◆ _histo

plotting.CutEfficiency._histo
private

Definition at line 913 of file plotting.py.

Referenced by plotting.CutEfficiency.create().

◆ _name

plotting.CutEfficiency._name
private

◆ _title

plotting.CutEfficiency._title
private

Definition at line 914 of file plotting.py.

Referenced by plotting.CutEfficiency.create(), and plotting.Plot.create().