parameters: (self, tdirectory)
return_statement: return ret
docstring: Create and return the cut efficiency histogram from a TDirectory
docstring_summary: Create and return the cut efficiency histogram from a TDirectory
docstring_tokens: Create and return the cut efficiency histogram from a TDirectory
function: def create(self, tdirectory):
          """Create and return the cut efficiency histogram from a TDirectory"""
          histo = _getOrCreateObject(tdirectory, self._histo)
          if not histo:
              return None
  
          # infer cumulative direction from the under/overflow bins
          ascending = histo.GetBinContent(0) < histo.GetBinContent(histo.GetNbinsX())
          if ascending:
              n_tot = histo.GetBinContent(histo.GetNbinsX())
          else:
              n_tot = histo.GetBinContent(0)
  
          if n_tot == 0:
              return histo
  
          ret = histo.Clone(self._name)
          ret.SetTitle(self._title)
  
          # calculate efficiency
          for i in range(1, histo.GetNbinsX()+1):
              n = histo.GetBinContent(i)
              val = n/n_tot
              errVal = math.sqrt(val*(1-val)/n_tot)
              ret.SetBinContent(i, val)
              ret.SetBinError(i, errVal)
          return ret
function_tokens: def create ( self , tdirectory ) : histo = _getOrCreateObject ( tdirectory , self . _histo ) if not histo : return None # infer cumulative direction from the under/overflow bins ascending = histo . GetBinContent ( 0 ) < histo . GetBinContent ( histo . GetNbinsX ( ) ) if ascending : n_tot = histo . GetBinContent ( histo . GetNbinsX ( ) ) else : n_tot = histo . GetBinContent ( 0 ) if n_tot == 0 : return histo ret = histo . Clone ( self . _name ) ret . SetTitle ( self . _title ) # calculate efficiency for i in range ( 1 , histo . GetNbinsX ( ) + 1 ) : n = histo . GetBinContent ( i ) val = n / n_tot errVal = math . sqrt ( val * ( 1 - val ) / n_tot ) ret . SetBinContent ( i , val ) ret . SetBinError ( i , errVal ) return ret