Skip to content

Commit

Permalink
add tick labels to element/material dark brem histograms
Browse files Browse the repository at this point in the history
- move tick labels to bin centers so the number of labels is equal to
  the number of bins (and not the number of bin edges)
- update hcal and photonuclear modules to conform to this change,
  removing the trailing empty label present in those tick label lists
  • Loading branch information
tomeichlersmith committed Oct 3, 2023
1 parent 1f61df8 commit a7a199b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Validation/src/Validation/_differ.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def plot1d(self, column, xlabel,
legend_kw['title'] = self.grp_name

if tick_labels is not None:
ax.set_xticks(bins)
ax.set_xticks((bins[1:]+bins[:-1])/2)
ax.set_xticklabels(tick_labels)
ax.tick_params(axis='x', rotation=90)

Expand Down
38 changes: 36 additions & 2 deletions Validation/src/Validation/dark_brem.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,43 @@ def kinematics(d : Differ, out_dir = None) :
('incident_energy', 'Incident Energy [MeV]'),
('incident_pt', 'Incident $p_T$ [MeV]'),
('dark_brem_z', 'Dark Brem Z Location [mm]'),
('dark_brem_element', 'Element in which Dark Brem Occurred'),
('dark_brem_material', 'Material in which Dark Brem Occurred')
]
for h, name in features :
log.info(f'plotting {h}')
d.plot1d(f'db_kinematics/db_kinematics_{h}', name, out_dir = out_dir)

log.info('plotting dark_brem_element')
d.plot1d(
'db_kinematics/db_kinematics_dark_brem_element',
'Element in which Dark Brem Occurred',
out_dir = out_dir,
tick_labels = [
"did not happen",
"H 1",
"C 6",
"O 8",
"Na 11",
"Si 14",
"Ca 20",
"Cu 29",
"W 74",
"unlisted",
]
)

log.info('plotting dark_brem_material')
d.plot1d(
'db_kinematics/db_kinematics_dark_brem_material',
'Material in which Dark Brem Occurred',
out_dir = out_dir,
tick_labels = [
"Unknown",
"C",
"PCB",
"Glue",
"Si",
"Al",
"W",
"PVT"
]
)
2 changes: 1 addition & 1 deletion Validation/src/Validation/hcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def dqm(d: Differ, out_dir=None):
tick_labels=['', 'Back', 'Top', 'Bottom',
'Right', 'Left', 'Any',
'Both', 'Back only', 'Side only',
'Neither', '', ''],
'Neither', ''],
out_dir=out_dir,
yscale='linear',
)
Expand Down
6 changes: 3 additions & 3 deletions Validation/src/Validation/photonuclear.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def pndqm(d: Differ, out_dir=None):
event_type_labels = ['', 'Nothing hard', 'n', 'nn', '≥ 3n', 'π', 'ππ',
'π₀', 'πA', 'π2A', 'ππA', 'π₀A',
'π₀2A', 'π₀πA', 'p', 'pp', 'pn', 'K_L⁰X', 'KX',
'K_S⁰X', 'exotics', 'multi-body', '', '', '']
'K_S⁰X', 'exotics', 'multi-body', '', '']

compact_event_type_labels = ['', 'n', 'K^{±}X', 'K⁰', 'nn', 'soft', 'other', '','']
neutron_event_type_labels = ['', '', 'nn', 'pn', 'π^+n', 'π⁰n', '', '']
compact_event_type_labels = ['', 'n', 'K^{±}X', 'K⁰', 'nn', 'soft', 'other', '']
neutron_event_type_labels = ['', '', 'nn', 'pn', 'π^+n', 'π⁰n', '']

d.plot1d("PN/PN_event_type", "Event category (200 MeV cut)",
tick_labels=event_type_labels,
Expand Down

0 comments on commit a7a199b

Please sign in to comment.