ATLAS Offline Software
DataQuality/DQUtils/python/ext/__init__.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2 
3 from collections import defaultdict
4 def tally(stuff):
5  """
6  From python thread http://mail.python.org/pipermail/python-dev/2006-April/063462.html
7  Subject: [Python-Dev] tally (and other accumulators)
8  """
9  accumulator = defaultdict(int)
10  for element in stuff:
11  accumulator[element] += 1
12  return sorted(accumulator.iteritems())
13 
python.ext.tally
def tally(stuff)
Definition: DataQuality/DQUtils/python/ext/__init__.py:4
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.