#!/bin/env python # # postconv.py - select events from postconv.hddm that should be simulated # for a triplet polarimeter simulation. # # author: richard.t.jones at uconn.edu # version: may 5, 2018 import hddm_s import sys count = 0 fout = hddm_s.ostream(sys.argv[2]) for r in hddm_s.istream(sys.argv[1]): inc = 1 runNo = r.getPhysicsEvents()[0].runNo for v in r.getVertices(): for p in v.getProducts(): for m in p.getMomenta(): if m.id == 2 and m.E < 2.0: inc = 0 elif m.id == 3 and m.E < 2.0: inc = 0 for b in r.getBeams(): for m in b.getMomenta(): if (runNo < 20000 and m.E > 9.0) or (runNo > 20000 and m.E > 8.8): inc = 0 if inc: fout.write(r) count += inc print count