-
Notifications
You must be signed in to change notification settings - Fork 2
Plotting trigger efficiencies
Once the output coffea
files are merged via jmerge
(please see here for the instructions), trigger efficiencies can be plotted. The plotting scripts are located under plot/studies/trigger_analysis_run3
.
Use plot_efficiency.py
to plot efficiency for some triggers, using a given dataset. The usage is as follows:
./plot_efficiency.py /path/to/merged/coffea/files -t <triggerRegex> -d <dataset>
where the first argument is the path to the directory containing the merged coffea files via jmerge
. -t
option is used to provide a regular expression to match a single trigger or multiple triggers to plot efficiency for. -d
option is used to provide a regular expression for the dataset name.
An example with Muon 2023 dataset, to plot some jet trigger efficiencies:
./plot_efficiency.py /path/to/merged/coffea/files -t 'HLT_PFJet(\d+).*' -d 'Muon.*2023.*'
Plot efficiency for a single trigger using the Muon dataset:
./plot_efficiency.py /path/to/merged/coffea/files -t 'HLT_PFHT1050' -d 'Muon.*2023.*'
Using compare_turnons.py
, trigger efficiencies from different datasets or regions can be compared.
You can run the Python script as follows to compare efficiencies for different datasets:
./compare_turnons.py /path/to/merged/files -d '<dataset_regex1>' '<dataset_regex2>' ... -l '<dataset_label1>' '<dataset_label2>' ...
The above command will look up the histograms from the accumulator in /path/to/merged/files, and plot efficiencies for Jet500, HT1050 and METNoMu120 triggers for different datasets. Each argument to -d
specify a regular expression matching a dataset name we want to plot. Each argument to -l
in turn specifies the label for that dataset. The latter will be used to fill the plot legend.
If you want to make the plots using CMS style, you can also pass the flag --cms-style
while running the script.
As an example, if we have an accumulator that has Muon_2022G
and Muon_2023C
datasets processed, we can run a comparison of efficiencies for those two as follows:
./compare_turnons.py /path/to/merged/files -d 'Muon.*2022G' 'Muon.*2023C' -l 'Muon_2022G' 'Muon_2023C'
You can run the Python script to compare efficiencies on different regions, using the following syntax:
./compare_turnons.py /path/to/merged/files -t '<tag #1>' '<tag #2>' ...
A useful application of this is to compare efficiencies on the same dataset but different runs. In config/hlt.yaml
, one can provide a mapping of region tag to the run range:
ranges: # Run ranges to analyze
hltv1.0_noChange: [366400, 366898]
hltv1.0_offlineHCALUpdate: [366899, 367660]
hltv1.1_offlineHCALUpdate: [367661, 367764]
hltv1.1_offlineHCALGains: [367765, 368400]
Given this, you can plot efficiencies for different regions as:
./compare_turnons.py /path/to/merged/files -t hltv1.0_noChange hltv1.0_offlineHCALUpdate hltv1.1_offlineHCALUpdate hltv1.1_offlineHCALGains
You can use plot_num_and_den.py
to plot numerator and denominator regions for a given set of triggers. The usage is as follows:
./plot_num_and_den.py /path/to/merged/coffea/files -t <triggerRegex> -d <dataset>
where the first argument is the path to the directory containing the merged coffea files via jmerge
. -t
option is used to provide a regular expression to match a single trigger or multiple triggers to plot the regions for. -d
option is used to provide a regular expression for the dataset name.
An example with Muon 2023 dataset, to plot numerator and denominator regions for some single jet triggers as a function of pt:
./plot_num_and_den.py /path/to/merged/coffea/files -t 'HLT_PFJet(\d+).*' -d 'Muon.*2023.*'