-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updated S2 corrected area #686
Changes from 9 commits
c803719
1fb38c7
4824d18
1fb4a1c
57cb49e
7446530
20cb8da
3cf9b59
b059089
87021c1
af213a5
af955ee
5ab3157
aa490a3
ca47034
119df0b
443755e
4994476
406c912
6aa7419
176de84
6649601
633ea0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -599,20 +599,20 @@ def get_veto_tags(events, split_tags, result): | |
(first_sr1_run, pax_file('XENON1T_s1_xyz_lce_true_kr83m_SR1_pax-680_fdc-3d_v0.json'))]), # noqa | ||
strax.Option( | ||
's2_xy_correction_map', | ||
help="S2 (x, y) correction map. Correct S2 position dependence " | ||
help="S2 (x, y) correction map. Correct S2 position dependence, including S2 top, bottom, and total." | ||
"manly due to bending of anode/gate-grid, PMT quantum efficiency " | ||
"and extraction field distribution, as well as other geometric factors.", | ||
default_by_run=[ | ||
(0, pax_file('XENON1T_s2_xy_ly_SR0_24Feb2017.json')), | ||
(170118_1327, pax_file('XENON1T_s2_xy_ly_SR1_v2.2.json'))]), | ||
strax.Option( | ||
strax.Option( | ||
'elife_conf', | ||
default=("elife", "ONLINE", True), | ||
help='Electron lifetime ' | ||
'Specify as (model_type->str, model_config->str, is_nT->bool) ' | ||
'where model_type can be "elife" or "elife_constant" ' | ||
'and model_config can be a version.' | ||
), | ||
), | ||
*DEFAULT_POSREC_ALGO_OPTION | ||
) | ||
class CorrectedAreas(strax.Plugin): | ||
|
@@ -626,14 +626,26 @@ class CorrectedAreas(strax.Plugin): | |
Note: | ||
Please be aware that for both, the main and alternative S1, the | ||
area is corrected according to the xy-position of the main S2. | ||
|
||
There are now 3 components of cS2s: cS2top, cS2bot and cS2tot, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pep8] reported by reviewdog 🐶 |
||
all computed with respect to corresponding S2 components. Therefore | ||
cS2tot and cS2top+cS2bot are slightly different. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pep8] reported by reviewdog 🐶 |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pep8] reported by reviewdog 🐶 |
||
Also the cS2aft is calculated by cS2top/cS2tot for now. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pep8] reported by reviewdog 🐶 |
||
""" | ||
__version__ = '0.1.1' | ||
__version__ = '0.1.2' | ||
|
||
depends_on = ['event_basics', 'event_positions'] | ||
dtype = [('cs1', np.float32, 'Corrected S1 area [PE]'), | ||
('cs2', np.float32, 'Corrected S2 area [PE]'), | ||
('cs2_top', np.float32, 'Corrected S2 area in the top PMT array [PE]'), | ||
('cs2_bottom', np.float32, 'Corrected S2 area in the bottom PMT array [PE]'), | ||
('alt_cs1', np.float32, 'Corrected area of the alternate S1 [PE]'), | ||
('alt_cs2', np.float32, 'Corrected area of the alternate S2 [PE]') | ||
('alt_cs2', np.float32, 'Corrected area of the alternate S2 [PE]'), | ||
('alt_cs2_top', np.float32, 'Corrected area of the alternate S2 in the top PMT array [PE]'), | ||
('alt_cs2_bottom', np.float32, 'Corrected area of the alternate S2 in the bottom PMT array [PE]'), | ||
('cs2_area_fraction_top', np.float, 'Main cS2 fraction of area seen by the top PMT array'), | ||
('alt_cs2_area_fraction_top', np.float, 'Alternate cS2 fraction of area seen by the top PMT array'), | ||
] + strax.time_fields | ||
|
||
def setup(self): | ||
|
@@ -653,8 +665,10 @@ def setup(self): | |
|
||
self.s2_map = InterpolatingMap( | ||
get_cmt_resource(self.run_id, | ||
tuple([*self.config['s2_xy_correction_map']]), | ||
fmt='text')) | ||
tuple(['suffix', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No not for the moment, but in my opinion CMT must be reworked. It has become one of the most complicated parts in straxen. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need the suffix because now s2 maps are position dependent, and in order to use only one single option for three different maps i.e. s2_map_mlp, s2_map_gcn, s2_map_cnn we add that suffix, then at the end this works with one single straxen option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No this is clear. I am more arguing about the way we pass this option to CMT which is a bit odd and makes it hard to understand. I would have suspected some keyword argument contain some dictionary or something in this direction. Putting |
||
self.config['default_reconstruction_algorithm'], | ||
*self.config['s2_xy_correction_map']]), | ||
fmt='json')) | ||
|
||
def compute(self, events): | ||
# S1 corrections depend on the actual corrected event position. | ||
|
@@ -673,17 +687,47 @@ def compute(self, events): | |
s2_positions = np.vstack([events['s2_x'], events['s2_y']]).T | ||
alt_s2_positions = np.vstack([events['alt_s2_x'], events['alt_s2_y']]).T | ||
|
||
# S2 top and bottom are corrected separately, and cS2 total is the sum of the two | ||
# figure out the map name | ||
if len(self.s2_map.map_names) > 1: | ||
s2_top_map_name = "s2_top" | ||
s2_bottom_map_name = "s2_bottom" | ||
else: | ||
s2_top_map_name = "map" | ||
s2_bottom_map_name = "map" | ||
|
||
cs2_top = (events['s2_area'] * events['s2_area_fraction_top'] * lifetime_corr | ||
/ self.s2_map(s2_positions, map_name=s2_top_map_name)) | ||
alt_cs2_top = (events['alt_s2_area'] * events['alt_s2_area_fraction_top'] * alt_lifetime_corr | ||
/ self.s2_map(alt_s2_positions, map_name=s2_top_map_name)) | ||
|
||
cs2_bottom = (events['s2_area'] * (1 - events['s2_area_fraction_top']) * lifetime_corr | ||
/ self.s2_map(s2_positions, map_name=s2_bottom_map_name)) | ||
alt_cs2_bottom = (events['alt_s2_area'] * (1 - events['s2_area_fraction_top']) * alt_lifetime_corr | ||
/ self.s2_map(alt_s2_positions, map_name=s2_bottom_map_name)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit of duplicated code, but I see that a different solution might be more complicated. |
||
|
||
cs2 = cs2_top + cs2_bottom | ||
alt_cs2 = alt_cs2_top + alt_cs2_bottom | ||
|
||
return dict( | ||
time=events['time'], | ||
endtime=strax.endtime(events), | ||
|
||
cs1=events['s1_area'] / self.s1_map(event_positions), | ||
alt_cs1=events['alt_s1_area'] / self.s1_map(event_positions), | ||
|
||
cs2=(events['s2_area'] * lifetime_corr | ||
/ self.s2_map(s2_positions)), | ||
alt_cs2=(events['alt_s2_area'] * alt_lifetime_corr | ||
/ self.s2_map(alt_s2_positions))) | ||
cs2_top=cs2_top, | ||
alt_cs2_top=alt_cs2_top, | ||
|
||
cs2_bottom=cs2_bottom, | ||
alt_cs2_bottom=alt_cs2_bottom, | ||
|
||
cs2=cs2, | ||
alt_cs2=alt_cs2, | ||
|
||
cs2_area_fraction_top=cs2_top / cs2, | ||
alt_cs2_area_fraction_top=alt_cs2_top / alt_cs2, | ||
) | ||
|
||
|
||
@export | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pep8] reported by reviewdog 🐶
W293 blank line contains whitespace