-
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.
- Loading branch information
Showing
2 changed files
with
580 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,218 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from collections import defaultdict\n", | ||
"import csv\n", | ||
"import pandas as pd" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"! ls /eos/home-a/alobanov/www/L1T/Phase2/menu/Validation/NewMenuTools/V38nano_DT12x/rate_tables/*.csv" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"#fname = \"/afs/cern.ch/user/a/alobanov/work/L1T/phase2/menu/MenuTools/test/Phase2-L1MenuTools/outputs/V38nano_DT12x/rate_tables/rates_Step2_V38nano_DT12x.csv\"\n", | ||
"# fname = \"/eos/home-a/alobanov/www/L1T/Phase2/menu/Validation/NewMenuTools/V38nano_DT12x/rate_tables/rate_table_V38_DT12x/rates_Step1and2_V38nano_DT12x.csv\"\n", | ||
"\n", | ||
"# Step1\n", | ||
"#fname = \"/eos/home-a/alobanov/www/L1T/Phase2/menu/Validation/NewMenuTools/V38nano_DT12x/rate_tables/menu_Step1_V38nano_DT12x.csv\"\n", | ||
"# Step1+2\n", | ||
"fname = \"/eos/home-a/alobanov/www/L1T/Phase2/menu/Validation/NewMenuTools/V38nano_DT12x/rate_tables/rates_Step1and2_V38nano_DT12x.csv\"\n", | ||
"df = pd.read_csv(fname)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"### UNCOMMENT FOR OFFLINE THRESHOLDS -> DERIVED EXTERNALLY \n", | ||
"\n", | ||
"# l1_obj = []\n", | ||
"# thresholds = defaultdict(list)\n", | ||
"# with open(\"onl2off_th_update.txt\") as f:\n", | ||
"# for line in f:\n", | ||
"# if \"####\" in line: continue\n", | ||
"# if \"L1_\" in line:\n", | ||
"# l1_obj.append(line)\n", | ||
"# obj = line\n", | ||
"# if \"leg\" in line:\n", | ||
"# legs = line.split(',')\n", | ||
"# _dict = {}\n", | ||
"# _dict[legs[0].split(' Eta = ')[0]] = {'offline': legs[1].split(' = ')[1], 'online': legs[2].split(' = ')[1][:-1]}\n", | ||
"# thresholds[obj[:-1]].append(_dict)\n", | ||
"# # print(line) \n", | ||
"\n", | ||
"# l1_thresholds = defaultdict(list)\n", | ||
"# rates = defaultdict(list)\n", | ||
"# for _obj in thresholds:\n", | ||
"# # if _obj == 'L1_PFMHTT': continue # not in menu\n", | ||
"# dfi= df[df.seed==_obj]\n", | ||
"# if(len(dfi) == 0):\n", | ||
"# print(f\"... {_obj} missing ...\")\n", | ||
"# continue\n", | ||
"# rates[_obj] = float(dfi.rate)\n", | ||
"# offlines = []\n", | ||
"# onlines = []\n", | ||
"# for legs in thresholds[_obj]:\n", | ||
"# for leg in legs:\n", | ||
"# onlines.append(int(float(legs[leg]['online'])))\n", | ||
"# offlines.append(int(float(legs[leg]['offline'])))\n", | ||
"# l1_thresholds[_obj] = (onlines, offlines)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"l1_names_map = {\n", | ||
" \"Single/Double/Triple Lepton (electron, muon) seeds\":\n", | ||
" {\"L1_SingleTkMu\": [\"Single tkMuon\", r\"$|\\eta|<2.4$\", \"95\"],\n", | ||
" \"L1_DoubleTkMu\": [\"Double tkMuon\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$\", \"95\"],\n", | ||
"# \"L1_DoubleTkMu9_SQ\": [\"\\color{black}Double TkMuon 9 SQ\", r\"$|\\eta|<2.4$\", \"?\"], \n", | ||
" \"L1_SingleTkEle\": [\"Single tkElectron\", r\"$|\\eta|<2.4$\", \"93\"],\n", | ||
" \"L1_SingleTkEleIso\": [\"Single tkIsoElectron\", r\"$|\\eta|<2.4$\", \"93\"],\n", | ||
" \"L1_TkEleIso_EG\": [\"TkIsoElectron-StaEG\", r\"$|\\eta|<2.4$\", \"93,99\"],\n", | ||
" \"L1_DoubleTkEle\": [\"Double tkElectron\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$\", \"93\"],\n", | ||
" \"L1_SingleEGEle\": [\"Single StaEG\", r\"$|\\eta|<2.4$\", \"99\"],\n", | ||
" \"L1_DoubleEGEle\": [\"Double StaEG\", r\"$|\\eta|<2.4$\", \"99\"],},\n", | ||
" \n", | ||
" \"Photon seeds\":\n", | ||
" {\"L1_SingleTkPhoIso\": [\"Single TkIsoPhoton\", r\"$|\\eta|<2.4$\", \"97\"],\n", | ||
" \"L1_DoubleTkPhoIso\": [\"Double TkIsoPhoton\", r\"$|\\eta|<2.4$\", \"97\"],},\n", | ||
" \n", | ||
" \"Tau seeds\":\n", | ||
" {\"L1_SinglePFTau\": [\"Single CaloTau\", r\"$|\\eta|<2.172$\", \"99\"],\n", | ||
" \"L1_PFTau_PFTau\": [\"Double CaloTau\", r\"$|\\eta|<2.172$, ${\\Delta}R >0.5$\", \"99\"],\n", | ||
" \"L1_PFIsoTau_PFIsoTau\": [\"Double PuppiTau\", r\"$|\\eta|<2.172$, ${\\Delta}R >0.5$, $\\text{LooseNN} > 0$\", \"90\"],},\n", | ||
" \n", | ||
" r\"Hadronic seeds (jets,\\HT)\":\n", | ||
" {\"L1_SinglePfJet\": [\"Single PuppiJet\", r\"$|\\eta|<2.4$\", \"100\"],\n", | ||
" \"L1_DoublePFJet_dEtaMax\": [\"Double PuppiJet\", r\"$|\\eta|<2.4$, ${\\Delta}\\eta <1.6$\", \"100\"],\n", | ||
" \"L1_PFHTT\": [\"Puppi\\HT\", r\"jets: $|\\eta|<2.4$, $\\pt >30$\", \"100\"],\n", | ||
" \"L1_PFMHTT\": [r\"Puppi$\\slashed{\\ensuremath{H}}_{\\mathrm{T}}$\", r\"jets: $|\\eta|<2.4$, $\\pt >30$\", \"100\"],\n", | ||
" \"L1_PFHTT_QuadJet\": [\"QuadPuppiJets-Puppi\\HT(**)\", r\"jets: $|\\eta|<2.4$, $\\pt >25$\", \"100,100\"],},\n", | ||
"\n", | ||
" r\"\\ETmiss seeds\":\n", | ||
" {\"L1_PFMet\": [r\"PuppiE_{T}^{miss}\", \"\", \"100\"],},\n", | ||
" \n", | ||
" \"Cross Lepton seeds\":\n", | ||
" {\"L1_TkMu_TkEleIso\": [\"TkMuon-TkIsoElectron\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$\", \"95,93\"],\n", | ||
" \"L1_TkMu_TkEle\": [\"TkMuon-TkElectron\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$\", \"95,93\"],\n", | ||
" \"L1_TkEle_TkMu\": [\"\\color{black}TkElectron-TkMuon\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$\", \"93,95\"],\n", | ||
" \"L1_TripleTkMu\": [\"Triple TkMuon\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$, Qual $>$ 0\", \"95\"],\n", | ||
" \"L1_TkMu_DoubleTkEle\": [\"TkMuon-DoubleTkElectron\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$\", \"95,93\"],\n", | ||
" \"L1_DoubleTkMu_TkEle\": [\"DoubleTkMuon-TkElectron\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$, Qual $>$ 0\", \"95,93\"],\n", | ||
" \"L1_PFIsoTau_TkMu\": [\"PuppiTau-TkMuon\", r\" $|\\eta|<2.172$, $|\\eta|<2.1$, ${\\Delta}z <1$, $\\text{LooseNN} > 0$\", \"90,95\"],\n", | ||
" \"L1_TkEleIso_PFIsoTau\": [\"TkIsoElectron-PuppiTau\", r\"$|\\eta|<2.172$, $|\\eta|<2.1$, ${\\Delta}z <1$, $\\text{LooseNN} > 0$\", \"93,90\"],},\n", | ||
" \n", | ||
" \"Cross Hadronic-Lepton seeds\":\n", | ||
" {\"L1_TkMu_PfHTT\": [r\"TkMuon-Puppi\\HT\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$\", \"95,100\"],\n", | ||
" \"L1_TkMu_PfJet_dRMax_DoubleJet_dEtaMax\": [\"TkMuon-TriplePuppiJet\", r\"$|\\eta|<2.4$, ${\\Delta}R_{j1\\mu}<0.4$,${\\Delta}\\eta_{j2j3}<1.6$, ${\\Delta}z <1$\", \"95,100\"],\n", | ||
" \"L1_DoubleTkEle_PFHTT\": [\"DoubleTkElectron-Puppi\\HT\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$\", \"93,100\"],\n", | ||
" \"L1_DoubleTkMu_PfHTT\": [\"DoubleTkMuon-Puppi\\HT\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$, Qual $>$ 0\", \"93,100\"],\n", | ||
" \"L1_DoubleTkMu_PfJet_PfMet\": [\"DoubleTkMuon-PuppiJet-PuppiETmiss\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$, Qual $>$ 0\", \"95,100,100\"],\n", | ||
" \"L1_TkEleIso_PFHTT\": [\"TkIsoElectron-Puppi\\HT\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$, $\\text{LooseNN} > 0$\", \"93,100\"],\n", | ||
" \"L1_TkEle_PFJet_dRMin\": [\"TkElectron-PuppiJet (**)\", r\"$|\\eta|<2.1$, $|\\eta|<2.4$, ${\\Delta}R>0.3$, ${\\Delta}z <1$\", \"93,100\"],\n", | ||
" \"L1_PFIsoTau_PFMet\": [\"PuppiTau-PuppiE_{T}^{miss}\", r\"$|\\eta|<2.172$, $\\text{LooseNN} > 0$\", \"90,100\"],\n", | ||
" \"L1_TkMu_PfJet_PfMet\": [\"TkMuon-PuppiJet-PuppiETmiss\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$, Qual $>$ 0\", \"95,100,100\"],},\n", | ||
" \n", | ||
" \"VBF seeds\":\n", | ||
" {\"L1_DoublePFJet_MassMin\": [\"Double PuppiJets (**)\", r\"$|\\eta|<5$, $m_{jj}>620$\", \"100\"]},\n", | ||
" \n", | ||
" \"BPH seeds\": {\n", | ||
" \"L1_DoubleTkMu0er1p5_SQ_OS_dR_Max1p4\": [\"\\color{black}Double TkMuon\", r\"$|\\eta|<1.5$, ${\\Delta}z <1$, ${\\Delta}R <1.4$, $q_1\\times q_2 <0$\", \"95\"],\n", | ||
" \"L1_DoubleTkMu4_SQ_OS_dR_Max1p2\": [\"\\color{black}Double TkMuon\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$, ${\\Delta}R <1.5$, $q_1\\times q_2 <0$, Qual $>$ 0\", \"95\"],\n", | ||
" \"L1_DoubleTkMu4p5er2p0_SQ_OS_Mass7to18\": [\"\\color{black}Double TkMuon\", r\"$|\\eta|<2.0$, ${\\Delta}z <1$, $7 < m <18$, $q_1\\times q_2 <0$, Qual $>$ 0\", \"95\"],\n", | ||
" \"L1_TripleTkMu_5SQ_3SQ_0OQ_DoubleMu_5_3_SQ_OS_Mass_Max9\": [\"Triple TkMuon\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$, $0< m <9$, $q_1\\times q_2 <0$, Qual $>$ 0\", \"95\"],\n", | ||
" \"L1_TripleTkMu_5_3p5_2p5_OS_Mass_5to17\": [\"Triple TkMuon\", r\"$|\\eta|<2.4$, ${\\Delta}z <1$,$5 <m <17$, $q_1\\times q_2 <0$, Qual $>$ 0\", \"95\"],\n", | ||
" },\n", | ||
" \n", | ||
" \"Step2 seeds\":{\n", | ||
" \"L1_PFHTT_QuadJet_BTagNNScore\": [\"QuadPuppiJets-Puppi\\HT\", r\"$|\\eta|<2.4$, Tot. b-tag score $>$ 2.2\", \"95\"],\n", | ||
" \"L1_SinglePfJet8\": [\"Single Ak8 PuppiJet\", r\"$|\\eta|<2.4$\", \"100\"],\n", | ||
" \"L1_DoublePFJet8_dEtaMax\": [\"Double Ak8 PuppiJet\", r\"$|\\eta|<2.4$, ${\\Delta}\\eta_{j1j2}<1.6$\", \"100\"], \n", | ||
" \n", | ||
" \"L1_SingleDispMu\": [\"Single Displaced Muon\", r\"$|\\eta|<2.0$, Qual $\\geq$ 15\", \"99\"],\n", | ||
" \"L1_DoubleDispMu\": [\"Single Displaced Muon\", r\"$|\\eta|<2.4$\", \"99\"],\n", | ||
" \n", | ||
" \"L1_W3pi_GTT\": [\"Track Triplet for W3Pi\", \"\", \"100\"],\n", | ||
" }\n", | ||
"\n", | ||
" }" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"tot_rate = int(df[df.seed=='Total'].rate)\n", | ||
"tot_rate_30pc = int(1.3*tot_rate)\n", | ||
"my_rates = []\n", | ||
"# print('L1 Trigger seeds & Offline Threshold(s) at 90\\% or 95\\% [GeV] & Online Threshold(s) (Barrel) [kHz] & Rate [kHz] \\\\\\\\')\n", | ||
"for seed in l1_names_map:\n", | ||
" print(f\"\\\\hline \\\\multicolumn{{5}}{{|l|}}{{{seed}}} \\\\\\\\\")\n", | ||
" for obj in l1_names_map[seed]:\n", | ||
" if obj not in l1_thresholds.keys(): continue\n", | ||
" print(f\"\\\\hline {l1_names_map[seed][obj][0]}\", end = \" & \") #obj.replace('_', '\\_'), end=\" & \")\n", | ||
" print(*l1_thresholds[obj][1], end= \" & \", sep = \",\")\n", | ||
"# if \"0.0\" in l1_thresholds[obj][0]:\n", | ||
"# print(\"--\", sep=\",\", end = \" & \")\n", | ||
"# else:\n", | ||
"# print(*l1_thresholds[obj][0], sep=\",\", end = \" & \")\n", | ||
" print(int(rates[obj]), end = \" & \")\n", | ||
" my_rates.append(rates[obj])\n", | ||
" print(l1_names_map[seed][obj][1], end = \" & \")\n", | ||
" print(l1_names_map[seed][obj][2], end = '\\\\\\\\\\n')\n", | ||
" print(\"\\\\hline\")\n", | ||
"\n", | ||
"print(\"\\\\hline\")\n", | ||
"print(f\"\\multicolumn{{3}}{{|l}}{{Rate for above Trigger seeds}} & \\\\multicolumn{{2}}{{r|}}{{{{\\color{{black}}{tot_rate}}}}}\\\\\\\\\")\n", | ||
"print(\"\\\\hline\")\n", | ||
"print(f\"\\multicolumn{{3}}{{|l}}{{\\\\bf Total \\\\Lone Menu Rate (+30\\\\%)}} & \\\\multicolumn{{2}}{{r|}}{{{{\\color{{black}}{tot_rate_30pc}}}}}\\\\\\\\\")\n", | ||
"print(\"\\\\hline\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
Oops, something went wrong.