Code from Ryan's CMS2 analysis tutorial