Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Fix R outside TPC due to float32 rounding (#386)
Browse files Browse the repository at this point in the history
* Fix for bug where instructions are flagged outside of the TPC due to the float32 rounding

* Adding missing check to chain as well

* actually, it should be epix instruction here
  • Loading branch information
terliuk authored Jun 27, 2022
1 parent 69e7095 commit 12abb8a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wfsim/strax_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,9 @@ def check_instructions(self):
# Let below cathode S1 instructions pass but remove S2 instructions
m = (self.instructions['z'] < - self.config['tpc_length']) & (self.instructions['type'] == 2)
self.instructions = self.instructions[~m]
r_instr = np.sqrt(self.instructions['x']**2 + self.instructions['y']**2)

assert np.all(self.instructions['x']**2 + self.instructions['y']**2 < self.config['tpc_radius']**2), \
assert np.all((r_instr<self.config['tpc_radius'])|np.isclose(r_instr,self.config['tpc_radius'])), \
"Interaction is outside the TPC (radius)"
assert np.all(self.instructions['z'] < 0.25), \
"Interaction is outside the TPC (in Z)"
Expand Down Expand Up @@ -855,8 +856,8 @@ def check_instructions(self):
m = (self.instructions_epix['z'] < - self.config['tpc_length']) & (self.instructions_epix['type'] == 2)
self.instructions_epix = self.instructions_epix[~m]

assert np.all(self.instructions_epix['x']**2 + self.instructions_epix['y']**2 <
self.config['tpc_radius']**2), \
r_instr = np.sqrt(self.instructions_epix['x']**2 + self.instructions_epix['y']**2)
assert np.all((r_instr<self.config['tpc_radius'])|np.isclose(r_instr,self.config['tpc_radius'])), \
"Interaction is outside the TPC (radius)"
assert np.all(self.instructions_epix['z'] < 0.25), \
"Interaction is outside the TPC (in Z)"
Expand Down

0 comments on commit 12abb8a

Please sign in to comment.