-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from cms-l1-dpg/new_rate_fwk
Add new rate table tools
- Loading branch information
Showing
33 changed files
with
1,831 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
**/__pycache__/* | ||
*.pyc | ||
**/*.png | ||
**/.DS_Store | ||
**/*.parquet | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
# Rate table for the Phase-2 L1 Trigger Menu | ||
To run the rate table, for example for the L1 TDR results, do | ||
``` | ||
python run.py cfg/v10_TRIDAS_newThresholds_LHCCReview | ||
``` | ||
# L1 Phase2 Menu Tools: Rate Table | ||
|
||
For the firmware-based emulators under 123x, utilise `FBE_noMu_L1TDRMET_mhtSeed_123x` (`FBE_noMu_L1TDRMET_mhtSeed_123x_singleJetEta5` only includes forward region for the singleJet seed). | ||
|
||
To display the rates in an easy-to-read format, run | ||
``` | ||
python3 printRateTable.py -c cfg/v10_TRIDAS_newThresholds_LHCCReview -r out/2020-05-26-MENU-LHCCReview-BugFix_v10_TRIDAS_newThresholds_LHCCReview/thresholds/menu.csv | ||
``` | ||
You can also edit the `CFG_RATE_COMBOS` dictionary at the top of | ||
the file and run the script without any arguments `python3 printRateTable.py`. | ||
This way multiple rate tables can be compared quickly. | ||
The rates table can be produced using the following command: | ||
|
||
./rate_table.py cfg/v29/v29_cfg.yml | ||
|
||
where the `cfg` argument specifies the structure of the config file to be used. | ||
|
||
An example of config can be found in `./cfg/v29_cfg.yml` and it is a `yaml` file | ||
with the following structure: | ||
|
||
MenuV29: | ||
version: "V29" | ||
sample: "/eos/cms/store/group/dpg_trigger/comm_trigger/L1Trigger/alobanov/phase2/menu/ntuples/13X/v29_RelVal/RelValTTbar_14TeV/RelVal_13X_TT_200PU_crab_v29_13X_RelVal_FixGenTree/230710_081407/L1NtuplePhaseII_Step1_hadd.root" | ||
menu_config: "cfg/v29/v29_16Seeds_Final_clean_cfg.yml" | ||
scalings: | ||
scalings_path: "/eos/user/m/mbonanom/www/Postdoc/L1PhaseII/V29/scalings/" | ||
collect_scalings: False | ||
scalings_outdir: "scalings_input/V29/" | ||
scalings_file: "scalings.yml" | ||
table: | ||
table_fname: "rates_16Seeds_Final" | ||
table_outdir: "rates_tables/V29" | ||
|
||
The block above defines entirely a menu table (`MenuV29` in the example above). | ||
Several blocks (with a different title) can be specified in the config if one wants to produce | ||
rate tables for different menu configurations. | ||
|
||
The other fields that can be specified are: | ||
* `version`: specifies the version of the ntuples used; | ||
* `sample`: specifies the sample to be used; | ||
* `menu_config`: user-defined config of the menu seeds. See `cfg/v29/v29_16Seeds_Final_clean_cfg.yml` for an example. The current example replicates the menu config implemented in `cfg/v29/v29_16Seeds_Final`; | ||
* `scalings`: this block defines the properties of the scalings file to be used. If `collect_scalings` is `False`, | ||
the scalings file in `scalings_outdir` will be used (`scalings.yml` in the example above corresponds to the `v29` scalings used for AR). If `collect_scalings` is `True`, then the `Scaler` (cf `scaler.py`) class is used to create a new scalings file, with the name specified in `scalings_file` (which will be located in `scalings_outdir`), starting from the per-object `.txt` scalings saved under `scalings_path` (i.e. the output of the `objectPerformance` code); | ||
* `table`: this block defines the properties of the rates table that will be dumped to a `.csv` file. The table will be saved under `table_outdir` with `table_fname` as name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
L1_DoubleEGEle: | ||
cross_masks: | ||
- ak.where(abs(leg2.phi-leg1.phi)<math.pi, np.sqrt(abs(abs(leg2.eta)-abs(leg1.eta))**2 + abs(leg2.phi-leg1.phi)**2), np.sqrt(abs(abs(leg2.eta)-abs(leg1.eta))**2 + (2*math.pi-abs(leg2.phi-leg1.phi))**2)) > 0.1 | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt >= 37 | ||
- abs(leg1.eta)<2.4 | ||
- leg1.passeseleid * (abs(leg1.eta)<1.5) + leg1.passessaid * (abs(leg1.eta) >= 1.5) | ||
# - ak.where(abs(leg1.eta)<1.5, leg1.passeseleid, leg1.passessaid) | ||
obj: EG | ||
leg2: | ||
leg_mask: | ||
- leg2.offline_pt >= 24 | ||
- abs(leg2.eta)<2.4 | ||
- leg2.passeseleid * (abs(leg2.eta)<1.5) + leg2.passessaid * (abs(leg2.eta) >= 1.5) | ||
# - ak.where(abs(leg2.eta)<1.5, leg2.passeseleid, leg2.passessaid) | ||
obj: EG | ||
L1_SingleEGEle: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt >= 51.0 | ||
- abs(leg1.eta)<2.4 | ||
- leg1.passeseleid * (abs(leg1.eta)<1.5) + leg1.passessaid * (abs(leg1.eta) >= 1.5) | ||
obj: EG | ||
L1_SinglePfJet: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt > 230.0 | ||
- leg1.et>25 | ||
- abs(leg1.eta)<2.4 | ||
obj: seededConePuppiJet | ||
L1_SingleTkEle: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt >= 36.0 | ||
- abs(leg1.eta)<2.4 | ||
- leg1.passeseleid | ||
# - leg1.passeseleid > 0 | ||
obj: tkElectron | ||
L1_SingleTkEleIso: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt >= 28.0 | ||
- leg1.passeseleid>=0 | ||
- ak.where(abs(leg1.eta)<1.479, leg1.trkiso<0.13, leg1.trkiso<0.28) | ||
obj: tkIsoElectron | ||
L1_SingleTkMu: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt > 22.0 | ||
- abs(leg1.eta)<2.4 | ||
obj: gmtTkMuon | ||
L1_SingleTkPhoIso: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt >= 36.0 | ||
- abs(leg1.eta)<2.4 | ||
- ak.where(abs(leg1.eta)<1.5, leg1.passeseleid, leg1.passesphoid) | ||
- ak.where(abs(leg1.eta)<1.479, leg1.trkiso<0.25, leg1.trkiso<0.205) | ||
obj: tkPhoton | ||
L1_TkEleIso_EG: | ||
cross_masks: | ||
- leg2.deltaR(leg1) > 0.1 | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt > 22.0 | ||
- abs(leg1.eta)<2.4 | ||
- leg1.passeseleid >= 0 | ||
- ak.where(abs(leg1.eta)<1.479, leg1.trkiso<0.13, leg1.trkiso<0.28) | ||
obj: tkIsoElectron | ||
leg2: | ||
leg_mask: | ||
- leg2.offline_pt > 12.0 | ||
- abs(leg2.eta)<2.4 | ||
- ak.where(abs(leg2.eta)<1.5, leg2.passeseleid, leg2.passessaid) | ||
obj: EG | ||
L1_TripleTkMu: | ||
cross_masks: | ||
- abs(leg2.z0-leg1.z0)<1 | ||
- abs(leg3.z0-leg1.z0)<1 | ||
leg1: | ||
leg_mask: | ||
- leg1.pt>5 | ||
- abs(leg1.eta)<2.4 | ||
- leg1.qual>0 | ||
obj: gmtTkMuon | ||
leg2: | ||
leg_mask: | ||
- leg2.pt>3 | ||
- abs(leg2.eta)<2.4 | ||
- leg2.qual>0 | ||
obj: gmtTkMuon | ||
leg3: | ||
leg_mask: | ||
- leg3.pt>3 | ||
- abs(leg3.eta)<2.4 | ||
- leg3.qual>0 | ||
obj: gmtTkMuon | ||
L1_DoubleTkEle: | ||
cross_masks: | ||
- abs(leg2.zvtx-leg1.zvtx)<1 | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt >= 25.0 | ||
- abs(leg1.eta)<2.4 | ||
- (((leg1.passeseleid) * (abs(leg1.eta)<1.479)) + ((abs(leg1.eta)>1.479))) | ||
obj: tkElectron | ||
leg2: | ||
leg_mask: | ||
- leg2.offline_pt >= 12.0 | ||
- abs(leg2.eta)<2.4 | ||
- (((leg2.passeseleid) * (abs(leg2.eta)<1.479)) + ((abs(leg2.eta)>1.479))) | ||
obj: tkElectron | ||
L1_DoubleTkMu: | ||
cross_masks: | ||
- abs(leg1.z0-leg2.z0)<1 | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt > 15.0 | ||
- abs(leg1.eta)<2.4 | ||
obj: gmtTkMuon | ||
leg2: | ||
leg_mask: | ||
- leg2.pt > 7.0 | ||
- abs(leg2.eta)<2.4 | ||
- leg2.qual > 0 | ||
obj: gmtTkMuon | ||
L1_DoubleTkPhoIso: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt > 22.0 | ||
- abs(leg1.eta)<2.4 | ||
- ak.where(abs(leg1.eta)<1.5, leg1.passeseleid, leg1.passesphoid) | ||
- ak.where(abs(leg1.eta)<1.479, leg1.trkiso<0.25, leg1.trkiso<0.205) | ||
obj: tkPhoton | ||
leg2: | ||
leg_mask: | ||
- leg2.offline_pt > 12.0 | ||
- abs(leg2.eta)<2.4 | ||
- ak.where(abs(leg2.eta)<1.5, leg2.passeseleid, leg2.passesphoid) | ||
- ak.where(abs(leg2.eta)<1.479, leg2.trkiso<0.25, leg2.trkiso<0.205) | ||
obj: tkPhoton | ||
L1_PFHTT: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
# - leg1.pt > 372.9 | ||
- leg1.offline_pt > 450 | ||
obj: seededConePuppiHT | ||
L1_PFHTT_QuadJet: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt > 400.0 | ||
obj: seededConePuppiHT | ||
leg2: | ||
leg_mask: | ||
- leg2.offline_pt > 70.0 | ||
- leg2.et>25.0 | ||
- abs(leg2.eta)<2.4 | ||
obj: seededConePuppiJet | ||
leg3: | ||
leg_mask: | ||
- leg3.offline_pt > 55.0 | ||
- leg3.et>25.0 | ||
- abs(leg3.eta)<2.4 | ||
obj: seededConePuppiJet | ||
leg4: | ||
leg_mask: | ||
- leg4.offline_pt > 40.0 | ||
- leg4.et>25.0 | ||
- abs(leg4.eta)<2.4 | ||
obj: seededConePuppiJet | ||
leg5: | ||
leg_mask: | ||
- leg5.offline_pt > 40.0 | ||
- leg5.et>25.0 | ||
- abs(leg5.eta)<2.4 | ||
obj: seededConePuppiJet | ||
L1_PFIsoTau_PFIsoTau: | ||
cross_masks: | ||
# - ak.where(abs(leg2.phi-leg1.phi)<math.pi, np.sqrt(abs(abs(leg2.eta)-abs(leg1.eta))**2 + abs(leg2.phi-leg1.phi)**2), np.sqrt(abs(abs(leg2.eta)-abs(leg1.eta))**2 + (2*math.pi-abs(leg2.phi-leg1.phi))**2)) > 0.5 | ||
- leg1.deltaR(leg2) > 0.5 | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt > 52.0 | ||
- abs(leg1.eta)<2.172 | ||
- leg1.passloosenn>0 | ||
obj: nnTau | ||
leg2: | ||
leg_mask: | ||
- leg2.offline_pt > 52.0 | ||
- abs(leg2.eta)<2.172 | ||
- leg2.passloosenn>0 | ||
obj: nnTau | ||
L1_PFMet: | ||
cross_masks: [] | ||
leg1: | ||
leg_mask: | ||
- leg1.offline_pt > 200.0 | ||
obj: puppiMET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
MenuV29: | ||
version: "V29" | ||
sample: "/eos/cms/store/group/dpg_trigger/comm_trigger/L1Trigger/alobanov/phase2/menu/ntuples/13X/v29_RelVal/RelValTTbar_14TeV/RelVal_13X_TT_200PU_crab_v29_13X_RelVal_FixGenTree/230710_081407/L1NtuplePhaseII_Step1_hadd.root" | ||
menu_config: "cfg/v29/v29_16Seeds_Final_clean_cfg.yml" | ||
scalings: | ||
scalings_path: "/eos/user/m/mbonanom/www/Postdoc/L1PhaseII/V29/scalings/" | ||
collect_scalings: False | ||
scalings_outdir: "scalings_input/V29/" | ||
scalings_file: "scalings.yml" | ||
table: | ||
table_fname: "rates_16Seeds_Final" | ||
table_outdir: "rates_tables/V29" |
Oops, something went wrong.