Skip to content

Commit

Permalink
Updated MCS post-processor to accept new arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
francois-drielsma committed Nov 7, 2023
1 parent c4854da commit 8699666
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
29 changes: 21 additions & 8 deletions analysis/post_processing/reconstruction/mcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ class MCSEnergyProcessor(PostProcessor):
result_cap_optional = ['truth_particles']

def __init__(self,
tracking_mode='bin_pca',
segment_length=5,
include_pids=[2,3,4,5],
only_uncontained=False,
truth_point_mode='points',
run_mode = 'both',
tracking_mode = 'bin_pca',
segment_length = 5,
split_angle = False,
res_a = 0.25,
res_b = 1.25,
include_pids = [2,3,4,5],
only_uncontained = False,
truth_point_mode = 'points',
run_mode = 'reco',
**kwargs):
'''
Store the necessary attributes to do MCS-based estimations
Expand All @@ -34,10 +37,16 @@ def __init__(self,
'step_next' or 'bin_pca')
segment_length : float, default 5 cm
Segment length in the units that specify the coordinates
split_angle : bool, default False
Whether or not to project the 3D angle onto two 2D planes
res_a : float, default 0.25 rad*cm^res_b
Parameter a in the a/dx^b which models the angular uncertainty
res_b : float, default 1.25
Parameter b in the a/dx^b which models the angular uncertainty
include_pids : list, default [2, 3, 4, 5]
Particle species to compute the kinetic energy for
only_uncontained : bool, default False
Only run the algorithm on particles that are marked as not contained
Only run the algorithm on particles that are not contained
**kwargs : dict, optiona
Additional arguments to pass to the tracking algorithm
'''
Expand All @@ -53,6 +62,9 @@ def __init__(self,
'The tracking algorithm must provide segment angles'
self.tracking_mode = tracking_mode
self.segment_length = segment_length
self.split_angle = split_angle
self.res_a = res_a
self.res_b = res_b
self.tracking_kwargs = kwargs

def process(self, data_dict, result_dict):
Expand Down Expand Up @@ -97,6 +109,7 @@ def process(self, data_dict, result_dict):

# Store the length and the MCS kinetic energy
mass = PID_MASSES[p.pid]
p.mcs_ke = mcs_fit(theta, mass, self.segment_length)
p.mcs_ke = mcs_fit(theta, mass, self.segment_length, 1,
self.split_angle, self.res_a, self.res_b)

return {}, {}
4 changes: 2 additions & 2 deletions analysis/post_processing/reconstruction/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CSDAEnergyProcessor(PostProcessor):
result_cap_opt = ['truth_particles']

def __init__(self,
tracking_mode='bin_pca',
tracking_mode='step_next',
include_pids=[2,3,4,5],
truth_point_mode='points',
run_mode = 'both',
Expand All @@ -27,7 +27,7 @@ def __init__(self,
Parameters
----------
tracking_mode : str, default 'bin_pca'
tracking_mode : str, default 'step_next'
Method used to compute the track length (one of 'displacement',
'step', 'step_next', 'bin_pca' or 'spline')
include_pids : list, default [2, 3, 4, 5]
Expand Down

0 comments on commit 8699666

Please sign in to comment.