Skip to content

Commit

Permalink
fix cuts (now have coincidence and ROI), corrected drift-time of cent…
Browse files Browse the repository at this point in the history
…re, and fixed bug in drift map implementation
  • Loading branch information
josh0-jrg committed Sep 24, 2024
1 parent a4f9609 commit 982a636
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions flamedisx/lz/lz.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class LZSource:
path_s1_acc_curve = 'sr1/cS1_acceptance_curve.pkl'
path_s2_acc_curve = 'sr1/cS2_acceptance_curve.pkl'

def __init__(self, *args, ignore_maps=False, ignore_acc=False, cap_upper_cs1=False, **kwargs):
def __init__(self, *args, ignore_maps=False, ignore_acc_maps=False, cap_upper_cs1=False, **kwargs):
super().__init__(*args, **kwargs)

self.cap_upper_cs1 = cap_upper_cs1
Expand All @@ -91,9 +91,9 @@ def __init__(self, *args, ignore_maps=False, ignore_acc=False, cap_upper_cs1=Fal
self.S2_min = config.getfloat('NEST', 'S2_min_config') * (1 + self.double_pe_fraction) # phd to phe
self.cS2_max = config.getfloat('NEST', 'cS2_max_config') * (1 + self.double_pe_fraction) # phd to phe

if ignore_acc:
if ignore_acc_maps:
print("ignoring acceptances")
self.ignore_acceptances = True
self.ignore_acceptances_maps = True

self.cs1_acc_domain = None
self.log10_cs2_acc_domain = None
Expand Down Expand Up @@ -177,7 +177,7 @@ def s1_acceptance(self, s1, cs1, cs1_acc_curve):
tf.zeros_like(s1, dtype=fd.float_type())) # if false

# multiplying by efficiency curve
if not self.ignore_acceptances:
if not self.ignore_acceptances_maps:
acceptance *= cs1_acc_curve

return acceptance
Expand All @@ -191,7 +191,7 @@ def s2_acceptance(self, s2, cs2, cs2_acc_curve,
tf.zeros_like(s2, dtype=fd.float_type())) # if false

# multiplying by efficiency curve
if not self.ignore_acceptances:
if not self.ignore_acceptances_maps:
acceptance *= cs2_acc_curve

# We will insert the FV acceptance here
Expand Down Expand Up @@ -296,7 +296,7 @@ def add_extra_columns(self, d):
accept_lower_drift_time = np.where(drift_time_us > 71., 1., 0.)
accept_radial = np.where(radius_cm < boundaryR, 1., 0.)

d['fv_acceptance'] = accept_upper_drift_time * accept_lower_drift_time * accept_radial
d['fv_acceptance'] =np.ones_like(accept_upper_drift_time * accept_lower_drift_time * accept_radial)

if 'resistor_acceptance' not in d.columns:
x = d['x'].values
Expand All @@ -311,7 +311,7 @@ def add_extra_columns(self, d):
not_inside_res1 = np.where(np.sqrt( (x-res1X)*(x-res1X) + (y-res1Y)*(y-res1Y) ) < res1R, 0., 1.)
not_inside_res2 = np.where(np.sqrt( (x-res2X)*(x-res2X) + (y-res2Y)*(y-res2Y) ) < res2R, 0., 1.)

d['resistor_acceptance'] = not_inside_res1 * not_inside_res2
d['resistor_acceptance'] = np.ones_like(not_inside_res1 * not_inside_res2)

if 'timestamp_acceptance' not in d.columns:
t_start = pd.to_datetime('2021-12-23T09:37:51')
Expand All @@ -322,7 +322,7 @@ def add_extra_columns(self, d):
not_inside_window1 = np.where((days_since_start >= 25.5) & (days_since_start <= 33.), 0., 1.)
not_inside_window2 = np.where((days_since_start >= 90.) & (days_since_start <= 93.5), 0., 1.)

d['timestamp_acceptance'] = not_inside_window1 * not_inside_window2
d['timestamp_acceptance'] =np.ones_like( not_inside_window1 * not_inside_window2)


##
Expand Down
4 changes: 2 additions & 2 deletions flamedisx/nest/config/lz_SR3.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ pressure_config = 1.86 ; bar
drift_field_config = 96.5 ; V/cm
gas_field_config = 8.301178 ; kV/cm

radius_config = 67.3 ; cm not sure what to do here
radius_config = 72.8 ; cm not sure what to do here
;grab from core cuts
dt_min_config = 71000. ; ns
dt_max_config = 1030000. ; ns

z_topDrift_config = 146.1 ; cm
dt_cntr_config = 462500. ; ns
dt_cntr_config = 517927 ; ns old: 462500.

g1_config = 0.1122 ; MADE FLOATABLE INSTEAD
elife_config = 9000000. ; ns
Expand Down
2 changes: 1 addition & 1 deletion flamedisx/nest/lxe_blocks/energy_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def validate_fix_truth(self, d):
else:
raise ValueError("When fixing position, give (x, y, z), "
"or (r, theta, z).")
data=apply_drift_map(data,self.drift_map,None,self.z_topDrift, self.drift_velocity)
d=apply_drift_map(d,self.drift_map,None,self.z_topDrift, self.drift_velocity)
elif 'event_time' not in d and 'energy' not in d:
# Neither position, time, nor energy given
raise ValueError(f"Dict should contain at least ['x', 'y', 'z'] "
Expand Down

0 comments on commit 982a636

Please sign in to comment.