Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/FCCee/higgs/mH-recoil/mumu/analysis_final.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
# Number of threads to use
nCPUS = 2

doTerminalDump = True

# Whether to produce ROOT TTrees, default is False
doTree = True

Expand Down
16 changes: 16 additions & 0 deletions python/run_final_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,14 @@ def run(rdf_module, config, args) -> None:
LOGGER.error('No histograms defined!\nAborting...')
sys.exit(3)

do_terminal_dump = get_attribute(rdf_module, "doTerminalDump", False)
if do_terminal_dump:
try:
import plotext as plt
except ModuleNotFoundError:
LOGGER.error("plotext module was not found. Disabling the terminal dump.")
do_terminal_dump = False

# Check whether to scale the results to the luminosity
do_scale = get_attribute(rdf_module, "doScale", True)
if do_scale:
Expand Down Expand Up @@ -641,6 +649,14 @@ def run(rdf_module, config, args) -> None:
generate_graph(dframe, graph_path)
args.graph = False

if do_terminal_dump:
cut_labels, n_events, n_events_raw = zip(*[(cut_name, cut_result["n_events"], cut_result["n_events_raw"]) \
for cut_name, cut_result in results[process_name].items()])
plt.simple_bar(cut_labels, n_events, width=100, title="Weighted events passing cut")
plt.show()
plt.simple_bar(cut_labels, n_events_raw, width=100, title="Unweighted events passing cut")
plt.show()

# And save everything
LOGGER.info('Saving the outputs...')
if do_scale:
Expand Down