#!/usr/bin/env python import hddm_s import ROOT h2 = ROOT.TH2D("h2", "virtual spot, transverse vertex distribution", 100, -1, 1, 100, -1, 1) h2.GetXaxis().SetTitle("vertex x (cm)") h2.GetYaxis().SetTitle("vertex y (cm)") h1 = ROOT.TH1D("h1", "virtual spot, longitudinal vertex distribution", 200, 0, 100) nfiles = 0 for fin in open("samples"): for rec in hddm_s.istream(fin.rstrip()): origins = rec.getOrigins() if len(origins) > 1: h2.Fill(origins[1].vx, origins[1].vy) h1.Fill(origins[1].vz) nfiles += 1 if nfiles == 10: break