Project

General

Profile

Support #642 » read_simulation.py

Rogers, Chris, 08 August 2011 17:39

 
1
import json
2
fh = open('simulation.out')
3
for line in fh.readlines():
4
    spill = json.loads(line)
5
    for event in spill['mc']:
6
        for i, hit in enumerate(event['hits']):
7
            if 'pid' in hit:
8
                print i,hit['pid'],hit['channel_id'] 
9
            else: print i,hit['channel_id']
10
    print
11

    
12

    
(2-2/3)