Skip to content

Commit

Permalink
Store gen_id in the TruthParticle object when it's provided in the la…
Browse files Browse the repository at this point in the history
…rcv.Particle one
  • Loading branch information
francois-drielsma committed Nov 9, 2023
1 parent 5755bb2 commit d418735
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions analysis/classes/TruthParticle.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ def register_larcv_particle(self, particle):
for k in scalar_keys:
val = getattr(particle, k)()
setattr(self, k, val)

# TODO: Move this to main list once this is in every LArCV file
if hasattr(particle, 'gen_id'):
setattr(self, 'gen_id', particle.gen_id())

# Exception for particle_id
self.truth_id = particle.id()
Expand Down Expand Up @@ -178,6 +182,10 @@ def load_larcv_attributes(self, particle_dict):
attr = attr.decode()
setattr(self, attr_name, attr)

# TODO: Move this to main list once this is in every LArCV file
if 'gen_id' in particle_dict:
setattr(self, 'gen_id', particle_dict['gen_id'])

def merge(self, particle):
'''
Merge another particle object into this one
Expand Down

0 comments on commit d418735

Please sign in to comment.