Created
September 12, 2014 12:08
-
-
Save betatim/071b714c406c85c38780 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cluster2mc_particles(cluster, event): | |
links = event['/Event/Link/Raw/VP/Clusters'] | |
refs = links.linkReference() | |
mc_particles = event['MC/Particles'] | |
next_idx = -1 | |
particles = [] | |
for channel, key in links.keyIndex(): | |
if channel == cluster.channelID().channelID(): | |
mc_key = refs[key].objectKey() | |
particles.append(mc_particles.object(mc_key)) | |
next_idx = refs[key].nextIndex() | |
break | |
while next_idx != -1: | |
particles.append(mc_particles.object(refs[next_idx].objectKey())) | |
next_idx = refs[next_idx].nextIndex() | |
return particles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment