diff --git a/.gitignore b/.gitignore index 84bfc36c..4a403794 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ outputs menu_tools.egg-info dist ph2-menu-tools +prod_ph2-menu-tools +dev_ph2-menu-tools diff --git a/configs/V31/caching.yaml b/configs/V31/caching.yaml index 56f0a78e..57d6c31a 100644 --- a/configs/V31/caching.yaml +++ b/configs/V31/caching.yaml @@ -65,19 +65,26 @@ V31: trees_branches: l1PhaseIITree/L1PhaseIITree: puppiMET: "all" - # phase1PuppiJet: "all" - # phase1PuppiMHT: "all" - # phase1PuppiHT: "all" + phase1PuppiJet: "all" + phase1PuppiMHT: "all" + phase1PuppiHT: "all" seededConePuppiJet: [Pt, Et, Eta, Phi] seededConeExtendedPuppiJet: [Pt, Et, Eta, Phi, BJetNN] seededConeExtendedPuppiHT: "all" seededConePuppiHT: "all" seededConePuppiMHT: "all" + caloJet: [Et, Pt, Eta, Phi] tkElectron: [Pt, Et, Eta, Phi, Chg, TrkIso, PfIso, PuppiIso, zVtx, HwQual, HGC, PassesEleID, PassesPhoID] EG: [Pt, Et, Eta, Phi, Iso, HwQual, HGC, PassesEleID, PassesSaID] gmtTkMuon: [Pt, Eta, Phi, Z0, D0, Chg, Qual ] + gmtMuon: [Pt, Eta, Phi, Z0, D0, Chg, Qual ] nnTau: [Et, Eta, Pt, Phi, Z0, PassTightNN, Chg, DXY, PassLooseNN] tkPhoton: [Pt, Et, Eta, Phi, TrkIso, HwQual, HGC, PassesEleID, PassesPhoID] z0L1TkPV: "all" caloTau: [Et, Eta, Pt, Phi, Iso, HwQual] + trackerJet: [Pt, Eta, Phi] + trackerMET: "all" + trackerMHT: "all" + trackerHT: "all" + diff --git a/configs/V31/object_performance/bJetEff.yaml b/configs/V31/object_performance/comparisons/bJetEff.yml similarity index 100% rename from configs/V31/object_performance/bJetEff.yaml rename to configs/V31/object_performance/comparisons/bJetEff.yml diff --git a/configs/V31/object_performance/version_comparison.yaml b/configs/V31/object_performance/comparisons/version_comparison.yaml similarity index 100% rename from configs/V31/object_performance/version_comparison.yaml rename to configs/V31/object_performance/comparisons/version_comparison.yaml diff --git a/configs/V31/object_performance/jets_trigger.yaml b/configs/V31/object_performance/jets_trigger.yaml index 64689056..58511967 100644 --- a/configs/V31/object_performance/jets_trigger.yaml +++ b/configs/V31/object_performance/jets_trigger.yaml @@ -14,7 +14,7 @@ JetTurnonBarrel: test_objects: phase1PuppiJet:default:barrel: "Pt" seededConePuppiJet:default:barrel: "Pt" - caloJet:default: "Pt" + caloJet:default:barrel: "Pt" trackerJet:default:barrel: "Pt" thresholds: [50, 100] scalings: @@ -43,7 +43,7 @@ JetTurnonEndcap: test_objects: phase1PuppiJet:default:endcap: "Pt" seededConePuppiJet:default:endcap: "Pt" - caloJet:default: "Pt" + caloJet:default:endcap: "Pt" trackerJet:default:endcap: "Pt" thresholds: [50, 100] scalings: @@ -72,7 +72,7 @@ JetTurnonForward: test_objects: phase1PuppiJet:default:forward: "Pt" seededConePuppiJet:default:forward: "Pt" - caloJet:default: "Pt" + caloJet:default:forward: "Pt" thresholds: [50, 100] scalings: method: "naive" diff --git a/configs/V31/object_performance/jets_trigger_fwd.yaml b/configs/V31/object_performance/jets_trigger_fwd.yaml index 1775d462..ce0a68a3 100644 --- a/configs/V31/object_performance/jets_trigger_fwd.yaml +++ b/configs/V31/object_performance/jets_trigger_fwd.yaml @@ -12,7 +12,7 @@ JetTurnonFwd_3p7to7: object: - "abs({eta}) < 7" test_objects: - phase1PuppiJet:default:forward: "Pt" + #phase1PuppiJet:default:forward: "Pt" seededConePuppiJet:default:forward: "Pt" thresholds: [50,100] scalings: diff --git a/configs/V31/object_performance/mht.yaml b/configs/V31/object_performance/mht.yaml index 4658ff01..c2bdac75 100644 --- a/configs/V31/object_performance/mht.yaml +++ b/configs/V31/object_performance/mht.yaml @@ -1,29 +1,3 @@ -MHT30_90perc: - sample: TT - version: V31 - reference_object: - object: "jet" - x_arg: "Pt" - label: "Gen MHT" - cuts: - object: - - "abs({eta}) < 2.4" - - "{pt} > 30" - trafo: "MHT" - test_objects: - phase1PuppiMHT:default: "et" - seededConePuppiMHT:default: "et" - thresholds: [70, 150] - scalings: - method: "naive" - threshold: 0.90 - xlabel: "Gen. MHT30 (GeV)" - ylabel: "Trigger Efficiency ( GeV)" - binning: - min: 0 - max: 500 - step: 20 - MHT30_50perc: sample: TT version: V31 @@ -40,7 +14,7 @@ MHT30_50perc: phase1PuppiMHT:default: "et" seededConePuppiMHT:default: "et" trackerMHT:default: "" - thresholds: [70, 150] + thresholds: [70] scalings: method: "naive" threshold: 0.50 diff --git a/configs/V31/object_performance/tau_trigger.yaml b/configs/V31/object_performance/tau_trigger.yaml index 7f31dfd0..9a99be32 100644 --- a/configs/V31/object_performance/tau_trigger.yaml +++ b/configs/V31/object_performance/tau_trigger.yaml @@ -53,59 +53,3 @@ TauTriggerEndcap_90perc: min: 0 max: 150 step: 6 - -TauTriggerBarrel_50perc: - sample: VBFHToTauTau - version: V31 - match_test_to_ref: True - reference_object: - object: "part_tau" - x_arg: "Pt" - label: "Gen Taus" - cuts: - event: - - "{dr_0.3} < 0.15" - - "abs({eta}) < 1.5" - object: - - "abs({eta}) < 2.4" - test_objects: - nnTau:default:barrel: "Pt" - caloTau:default:barrel: "Pt" - xlabel: "Gen. pT (GeV)" - ylabel: "Trigger Efficiency (barrel, L1 $p_T > $ GeV)" - thresholds: [20, 30] - scalings: - method: "naive" - threshold: 0.50 - binning: - min: 0 - max: 150 - step: 6 - -TauTriggerEndcap_50perc: - sample: VBFHToTauTau - version: V31 - match_test_to_ref: True - reference_object: - object: "part_tau" - x_arg: "Pt" - label: "Gen Taus" - cuts: - event: - - "{dr_0.3} < 0.15" - - "abs({eta}) > 1.5" - object: - - "abs({eta}) < 2.4" - test_objects: - nnTau:default:endcap: "Pt" - caloTau:default:endcap: "Pt" - xlabel: "Gen. pT (GeV)" - ylabel: "Trigger Efficiency (endcap, L1 $p_T > $ GeV)" - thresholds: [20, 30] - scalings: - method: "naive" - threshold: 0.50 - binning: - min: 0 - max: 150 - step: 6 diff --git a/configs/V31/objects/jets.yaml b/configs/V31/objects/jets.yaml index b2128853..38a787ca 100644 --- a/configs/V31/objects/jets.yaml +++ b/configs/V31/objects/jets.yaml @@ -3,6 +3,9 @@ caloJet: label: "Calo Jet" eta_ranges: inclusive: [0, 7] + barrel: [0, 1.5] + endcap: [1.5, 2.4] + forward: [2.4, 5] cuts: inclusive: - "abs({eta}) < 7" diff --git a/configs/V31/objects/taus.yaml b/configs/V31/objects/taus.yaml index 2f1bf535..386adf5b 100644 --- a/configs/V31/objects/taus.yaml +++ b/configs/V31/objects/taus.yaml @@ -24,6 +24,8 @@ caloTau: endcap: [1.5, 2.4] ids: default: + label: "Calo Tau, pt>20" cuts: inclusive: - "abs({eta}) < 2.4" + - "{pt} > 20" diff --git a/configs/V31/rate_plots/eg.yaml b/configs/V31/rate_plots/eg.yaml new file mode 100644 index 00000000..0048997d --- /dev/null +++ b/configs/V31/rate_plots/eg.yaml @@ -0,0 +1,12 @@ +EGRates: + sample: MinBias + version: V31 + test_objects: + - EG:default + - tkElectron:NoIso + - tkElectron:Iso + - tkPhoton:Iso + binning: + min: 10 + max: 97 + step: 3 diff --git a/configs/V31/rate_plots/ht.yaml b/configs/V31/rate_plots/ht.yaml new file mode 100644 index 00000000..2a24a1bd --- /dev/null +++ b/configs/V31/rate_plots/ht.yaml @@ -0,0 +1,23 @@ +HTRates: + sample: MinBias + version: V31 + test_objects: + - phase1PuppiHT:default + - seededConePuppiHT:default + - trackerHT:default + binning: + min: 50 + max: 975 + step: 25 + +MHTRates: + sample: MinBias + version: V31 + test_objects: + - phase1PuppiMHT:default + - seededConePuppiMHT:default + - trackerMHT:default + binning: + min: 50 + max: 975 + step: 25 diff --git a/configs/V31/rate_plots/jets.yaml b/configs/V31/rate_plots/jets.yaml new file mode 100644 index 00000000..8277fde3 --- /dev/null +++ b/configs/V31/rate_plots/jets.yaml @@ -0,0 +1,27 @@ +JetDefaultRates: + sample: MinBias + version: V31 + test_objects: + - phase1PuppiJet:default + - seededConePuppiJet:default + # - seededConeExtendedPuppiJet:default + - trackerJet:default + - caloJet:default + binning: + min: 40 + max: 420 + step: 20 + +JetsByRegion: + sample: MinBias + version: V31 + test_objects: + - phase1PuppiJet:default:barrel + - phase1PuppiJet:default:endcap + - seededConePuppiJet:default:barrel + - seededConePuppiJet:default:endcap + binning: + min: 40 + max: 420 + step: 20 + diff --git a/configs/V31/rate_plots/met.yaml b/configs/V31/rate_plots/met.yaml new file mode 100644 index 00000000..a97eda8b --- /dev/null +++ b/configs/V31/rate_plots/met.yaml @@ -0,0 +1,10 @@ +METRates: + sample: MinBias + version: V31 + test_objects: + - puppiMET:default + - trackerMET:default + binning: + min: 50 + max: 500 + step: 25 diff --git a/configs/V31/rate_plots/muons.yaml b/configs/V31/rate_plots/muons.yaml new file mode 100644 index 00000000..515a6d63 --- /dev/null +++ b/configs/V31/rate_plots/muons.yaml @@ -0,0 +1,22 @@ +gmtMuonByRegion: + sample: MinBias + version: V31 + test_objects: + - gmtMuon:default:barrel + - gmtMuon:default:overlap + - gmtMuon:default:endcap + binning: + min: 0 + max: 75 + step: 3 + +MuonRates: + sample: MinBias + version: V31 + test_objects: + - gmtMuon:default + - gmtTkMuon:default + binning: + min: 0 + max: 75 + step: 3 diff --git a/configs/V31/rate_plots/taus.yaml b/configs/V31/rate_plots/taus.yaml new file mode 100644 index 00000000..9d6d90a5 --- /dev/null +++ b/configs/V31/rate_plots/taus.yaml @@ -0,0 +1,23 @@ +TauRates: + sample: MinBias + version: V31 + test_objects: + - nnTau:default + - caloTau:default + binning: + min: 10 + max: 155 + step: 5 + +TauRatesByRegion: + sample: MinBias + version: V31 + test_objects: + - caloTau:default:barrel + - caloTau:default:endcap + - nnTau:default:barrel + - nnTau:default:endcap + binning: + min: 10 + max: 155 + step: 5 diff --git a/configs/V32nano/objects/jets.yaml b/configs/V32nano/objects/jets.yaml index cfa6121f..b16315f7 100644 --- a/configs/V32nano/objects/jets.yaml +++ b/configs/V32nano/objects/jets.yaml @@ -68,17 +68,4 @@ L1puppiJetSC8: default: cuts: inclusive: - - "abs({eta}) < 7" - -# trackerJet: -# match_dR: 0.4 -# label: "Tracker Jet" -# eta_ranges: -# inclusive: [0, 7] -# barrel: [0, 1.5] -# endcap: [1.5, 2.4] -# ids: -# default: -# cuts: -# inclusive: -# - "abs({eta}) < 7" + - "abs({eta}) < 7" \ No newline at end of file diff --git a/configs/V33nano/caching.yaml b/configs/V33nano/caching.yaml index 064fa109..e6af4c77 100644 --- a/configs/V33nano/caching.yaml +++ b/configs/V33nano/caching.yaml @@ -3,10 +3,9 @@ V33nano: ntuple_path: /eos/cms/store/group/dpg_trigger/comm_trigger/L1Trigger/alobanov/phase2/menu/ntuples/14X/v33/GluGluHToGG_M-125_TuneCP5_14TeV-powheg-pythia8/GluGluHToGG_131_200PU_IB1400pre3V1/240221_221354/0000/test_*.root trees_branches: Events: - GenPart: [pt, eta, phi, pdgId, statusFlags] GenPart: [pt, eta, phi, pdgId, statusFlags] L1tkPhoton: "all" - L1tkElectron: "all" + # L1tkElectron: "all" L1EGbarrel: "all" L1EGendcap: "all" DYLL_M50: @@ -14,9 +13,8 @@ V33nano: trees_branches: Events: GenPart: "all" - # GenPart: "all" L1gmtTkMuon: "all" - L1gmtMuon: "all" # aka gmtMuon + L1gmtMuon: "all" L1tkElectron: "all" L1EGbarrel: "all" L1EGendcap: "all" @@ -26,6 +24,7 @@ V33nano: Events: # gen GenJet: [pt, eta, phi, partonFlavour] + GenJetAK8: [pt, eta, phi] GenMET: "all" # sums L1puppiMET: [pt, phi] @@ -49,4 +48,38 @@ V33nano: L1nnPuppiTau: "all" L1hpsTau: "all" L1caloTau: "all" - L1nnCaloTau: "all" \ No newline at end of file + L1nnCaloTau: "all" + MinBias: + ntuple_path: /eos/cms/store/group/dpg_trigger/comm_trigger/L1Trigger/alobanov/phase2/menu/ntuples/14X/v33_fromEmyr/minbias.root + trees_branches: + Events: + ## PV + L1PV: [z0] + ## EG + L1tkPhoton: "all" + L1tkElectron: "all" + L1EGbarrel: "all" + L1EGendcap: "all" + ## MUONS + L1gmtTkMuon: "all" + L1gmtMuon: "all" # aka gmtMuon + ## TAUS + L1nnPuppiTau: "all" + L1hpsTau: "all" + L1caloTau: "all" + L1nnCaloTau: "all" + ## MET/Sums + L1puppiMET: [pt, phi] + L1puppiMLMET: [pt] + L1puppiJetSC4sums: [pt, phi] + L1puppiHistoJetSums: [pt, phi] + # jets + L1puppiJetSC4: [pt, eta, phi] + L1puppiJetSC8: [pt, eta, phi] + L1puppiExtJetSC4: [pt, eta, phi, btagScore] + L1puppiJetHisto: [pt, eta, phi] + L1caloJet: [pt, eta, phi] + ## track-only + L1TrackMET: [pt] + L1TrackHT: [ht, mht] + L1TrackJet: [pt, eta, phi] \ No newline at end of file diff --git a/configs/V33nano/object_performance/electron_trigger.yaml b/configs/V33nano/object_performance/electron_trigger.yaml index e07d9900..1b514982 100644 --- a/configs/V33nano/object_performance/electron_trigger.yaml +++ b/configs/V33nano/object_performance/electron_trigger.yaml @@ -14,7 +14,7 @@ ElectronsTriggerBarrel: object: - "abs({eta}) < 2.8" test_objects: - # L1EG:default:barrel: "pt" + L1EG:default:barrel: "pt" L1tkElectron:NoIso:barrel: "pt" L1tkElectron:Iso:barrel: "pt" thresholds: [10, 20, 30, 40] @@ -44,7 +44,7 @@ ElectronsTriggerEndcap: object: - "abs({eta}) < 2.8" test_objects: - # L1EG:default:endcap: "pt" + L1EG:default:endcap: "pt" L1tkElectron:NoIso:endcap: "pt" L1tkElectron:Iso:endcap: "pt" thresholds: [10, 20, 30, 40] @@ -74,7 +74,7 @@ ElectronsTriggerEndcap: # object: # - "abs({eta}) < 2.8" # test_objects: -# # L1EG:default:barrel: "pt" + # L1EG:default:barrel: "pt" # L1tkElectron:NoIso:barrel: "pt" # L1tkElectron:Iso:barrel: "pt" # thresholds: [10, 20, 30, 40] diff --git a/configs/V33nano/object_performance/jets_matching.yaml b/configs/V33nano/object_performance/jets_matching.yaml index 29aaaa85..6f65cc15 100644 --- a/configs/V33nano/object_performance/jets_matching.yaml +++ b/configs/V33nano/object_performance/jets_matching.yaml @@ -71,3 +71,48 @@ JetMatchingForward: min: 0 max: 500 step: 10 + + +JetMatchingBarrelSC8: + sample: TT + version: V33nano + match_test_to_ref: True + reference_object: + object: "GenJetAK8" + x_arg: "pt" + label: "Gen AK8 Jets" + cuts: + event: + - "abs({eta}) < 1.5" + object: + - "abs({eta}) < 2.4" + test_objects: + L1puppiJetSC8:default:barrel: "pt" + xlabel: "Gen. $p_T$ (GeV)" + ylabel: "Trigger Efficiency ( GeV, barrel)" + binning: + min: 0 + max: 500 + step: 10 + +JetMatchingEndcapSC8: + sample: TT + version: V33nano + match_test_to_ref: True + reference_object: + object: "GenJetAK8" + x_arg: "pt" + label: "Gen AK8 Jets" + cuts: + event: + - "abs({eta}) > 1.5" + object: + - "abs({eta}) < 2.4" + test_objects: + L1puppiJetSC8:default:endcap: "pt" + xlabel: "Gen. $p_T$ (GeV)" + ylabel: "Trigger Efficiency ( GeV, endcap)" + binning: + min: 0 + max: 500 + step: 10 \ No newline at end of file diff --git a/configs/V33nano/object_performance/jets_matching_eta.yaml b/configs/V33nano/object_performance/jets_matching_eta.yaml index 373606cd..88e2a3a5 100644 --- a/configs/V33nano/object_performance/jets_matching_eta.yaml +++ b/configs/V33nano/object_performance/jets_matching_eta.yaml @@ -70,3 +70,25 @@ JetMatching_Eta_Pt100ToInf_extEta: min: -5.5 max: 5.5 step: 0.25 + +JetMatching_Eta_SC8_Pt100ToInf: + sample: TT + version: V33nano + match_test_to_ref: True + reference_object: + object: "GenJetAK8" + x_arg: "eta" + label: "Gen Jets" + cuts: + event: + - "{pt} > 100" + object: + - "abs({eta}) < 5" + test_objects: + L1puppiJetSC8:default: "eta" + xlabel: "Gen. $\\eta$" + ylabel: "Matching Efficiency (>100 GeV)" + binning: + min: -5 + max: 5 + step: 0.25 \ No newline at end of file diff --git a/configs/V33nano/object_performance/jets_matching_wBTag.yaml b/configs/V33nano/object_performance/jets_matching_wBTag.yaml index 24f08996..6c9d52f2 100644 --- a/configs/V33nano/object_performance/jets_matching_wBTag.yaml +++ b/configs/V33nano/object_performance/jets_matching_wBTag.yaml @@ -1,4 +1,4 @@ -JetMatching_Eta_pt40To100_ExtendedVsRegular: +JetMatching_Eta_Pt40To100_ExtendedVsRegular: sample: TT version: V33nano match_test_to_ref: True @@ -22,7 +22,7 @@ JetMatching_Eta_pt40To100_ExtendedVsRegular: max: 5 step: 0.25 -JetMatching_Eta_pt100ToInf_ExtendedVsRegular: +JetMatching_Eta_Pt100ToInf_ExtendedVsRegular: sample: TT version: V33nano match_test_to_ref: True @@ -45,7 +45,7 @@ JetMatching_Eta_pt100ToInf_ExtendedVsRegular: max: 5 step: 0.25 -JetMatching_Eta_pt30ToInf_genBJets: +JetMatching_Eta_Pt30ToInf_genBJets: sample: TT version: V33nano match_test_to_ref: True @@ -68,7 +68,7 @@ JetMatching_Eta_pt30ToInf_genBJets: max: 2.4 step: 0.25 -JetMatching_Eta_pt30ToInf_genNotBJets: +JetMatching_Eta_Pt30ToInf_genNotBJets: sample: TT version: V33nano match_test_to_ref: True @@ -91,7 +91,7 @@ JetMatching_Eta_pt30ToInf_genNotBJets: max: 2.4 step: 0.25 -JetMatching_pt_pt30ToInf_genBJets: +JetMatching_Pt_Pt30ToInf_genBJets: sample: TT version: V33nano match_test_to_ref: True @@ -113,7 +113,7 @@ JetMatching_pt_pt30ToInf_genBJets: max: 200 step: 10 -JetMatching_pt_pt30ToInf_genNotBJets: +JetMatching_Pt_Pt30ToInf_genNotBJets: sample: TT version: V33nano match_test_to_ref: True diff --git a/configs/V33nano/object_performance/jets_sc8_trigger.yaml b/configs/V33nano/object_performance/jets_sc8_trigger.yaml new file mode 100644 index 00000000..abbdf822 --- /dev/null +++ b/configs/V33nano/object_performance/jets_sc8_trigger.yaml @@ -0,0 +1,77 @@ +JetTurnonBarrelSC8: + version: V33nano + sample: TT + match_test_to_ref: True + reference_object: + object: "GenJetAK8" + x_arg: "pt" + label: "Gen Jets" + cuts: + event: + - "abs({eta}) < 1.5" + object: + - "abs({eta}) < 2.4" + test_objects: + L1puppiJetSC8:default:barrel: "pt" + thresholds: [150] + scalings: + method: "naive" + threshold: 0.95 + xlabel: "Gen. $p_T$ (GeV)" + ylabel: "Trigger Efficiency ( GeV, barrel)" + binning: + min: 0 + max: 500 + step: 10 + +JetTurnonEndcapSC8: + version: V33nano + sample: TT + match_test_to_ref: True + reference_object: + object: "GenJetAK8" + x_arg: "pt" + label: "Gen Jets" + cuts: + event: + - "abs({eta}) > 1.5" + object: + - "abs({eta}) < 2.4" + test_objects: + L1puppiJetSC8:default:endcap: "pt" + thresholds: [150] + scalings: + method: "naive" + threshold: 0.95 + xlabel: "Gen. $p_T$ (GeV)" + ylabel: "Trigger Efficiency ( GeV, endcap)" + binning: + min: 0 + max: 500 + step: 10 + +JetTurnonForwardSC8: + version: V33nano + sample: TT + match_test_to_ref: True + reference_object: + object: "GenJetAK8" + x_arg: "pt" + label: "Gen Jets" + cuts: + event: + - "abs({eta}) > 2.4" + object: + - "abs({eta}) < 5" + test_objects: + L1puppiJetSC8:default:forward: "pt" + thresholds: [150] + scalings: + method: "naive" + threshold: 0.95 + xlabel: "Gen. $p_T$ (GeV)" + ylabel: "Trigger Efficiency ( GeV, forward)" + binning: + min: 0 + max: 500 + step: 10 diff --git a/configs/V33nano/object_performance/muon_trigger.yaml b/configs/V33nano/object_performance/muon_trigger.yaml index 6365cf4f..9453fdb8 100644 --- a/configs/V33nano/object_performance/muon_trigger.yaml +++ b/configs/V33nano/object_performance/muon_trigger.yaml @@ -10,12 +10,11 @@ MuonsTrigger_Barrel: event: - "(({statusFlags}>>7)&1) == 1" - "abs({pdgId}) == 13" - - "{dr_0.3} < 0.15" object: - "abs({eta}) < 0.83" test_objects: - gmtMuon:default:barrel: "pt" - gmtTkMuon:default:barrel: "pt" + L1gmtMuon:default:barrel: "pt" + L1gmtTkMuon:default:barrel: "pt" xlabel: "Gen. pT (GeV)" ylabel: "Trigger Efficiency (barrel, L1 $p_T > 20$ GeV)" thresholds: [20, 25] @@ -39,13 +38,12 @@ MuonsTrigger_Overlap: event: - "(({statusFlags}>>7)&1) == 1" - "abs({pdgId}) == 13" - - "{dr_0.3} < 0.15" object: - "abs({eta}) > 0.83" - "abs({eta}) < 1.24" test_objects: - gmtMuon:default:overlap: "pt" - gmtTkMuon:default:overlap: "pt" + L1gmtMuon:default:overlap: "pt" + L1gmtTkMuon:default:overlap: "pt" xlabel: "Gen. pT (GeV)" ylabel: "Trigger Efficiency (overlap, L1 $p_T > 20$ GeV)" thresholds: [20, 25] @@ -69,12 +67,11 @@ MuonsTrigger_Endcap: event: - "(({statusFlags}>>7)&1) == 1" - "abs({pdgId}) == 13" - - "{dr_0.3} < 0.15" object: - "abs({eta}) > 1.24" test_objects: - gmtMuon:default:endcap: "pt" - gmtTkMuon:default:endcap: "pt" + L1gmtMuon:default:endcap: "pt" + L1gmtTkMuon:default:endcap: "pt" xlabel: "Gen. pT (GeV)" ylabel: "Trigger Efficiency (endcap, L1 $p_T > 20$ GeV)" thresholds: [20, 25] diff --git a/configs/V33nano/object_performance/tau_trigger.yaml b/configs/V33nano/object_performance/tau_trigger.yaml index c141d9e3..5c988399 100644 --- a/configs/V33nano/object_performance/tau_trigger.yaml +++ b/configs/V33nano/object_performance/tau_trigger.yaml @@ -13,10 +13,10 @@ TauTriggerBarrel_90perc: object: - "abs({eta}) < 2.4" test_objects: - L1nnPuppiTau:default: "pt" - L1hpsTau:default: "pt" - L1caloTau:default: "pt" - L1nnCaloTau:default: "pt" + L1nnPuppiTau:default:barrel: "pt" + L1hpsTau:default:barrel: "pt" + L1caloTau:default:barrel: "pt" + L1nnCaloTau:default:barrel: "pt" xlabel: "Gen. pT (GeV)" ylabel: "Trigger Efficiency (barrel, L1 $p_T > $ GeV)" thresholds: [20, 30] @@ -43,10 +43,10 @@ TauTriggerEndcap_90perc: object: - "abs({eta}) < 2.4" test_objects: - L1nnPuppiTau:default: "pt" - L1hpsTau:default: "pt" - L1caloTau:default: "pt" - L1nnCaloTau:default: "pt" + L1nnPuppiTau:default:endcap: "pt" + L1hpsTau:default:endcap: "pt" + L1caloTau:default:endcap: "pt" + L1nnCaloTau:default:endcap: "pt" xlabel: "Gen. pT (GeV)" ylabel: "Trigger Efficiency (endcap, L1 $p_T > $ GeV)" thresholds: [20, 30] @@ -57,63 +57,3 @@ TauTriggerEndcap_90perc: min: 0 max: 150 step: 6 - -TauTriggerBarrel_50perc: - sample: VBFHToTauTau - version: V33nano - match_test_to_ref: True - reference_object: - object: "GenVisTau" - x_arg: "pt" - label: "Gen Taus" - cuts: - event: - # - "{dr_0.3} < 0.15" - - "abs({eta}) < 1.5" - object: - - "abs({eta}) < 2.4" - test_objects: - L1nnPuppiTau:default: "pt" - L1hpsTau:default: "pt" - L1caloTau:default: "pt" - L1nnCaloTau:default: "pt" - xlabel: "Gen. pT (GeV)" - ylabel: "Trigger Efficiency (barrel, L1 $p_T > $ GeV)" - thresholds: [20, 30] - scalings: - method: "naive" - threshold: 0.50 - binning: - min: 0 - max: 150 - step: 6 - -TauTriggerEndcap_50perc: - sample: VBFHToTauTau - version: V33nano - match_test_to_ref: True - reference_object: - object: "GenVisTau" - x_arg: "pt" - label: "Gen Taus" - cuts: - event: - # - "{dr_0.3} < 0.15" - - "abs({eta}) > 1.5" - object: - - "abs({eta}) < 2.4" - test_objects: - L1nnPuppiTau:default: "pt" - L1hpsTau:default: "pt" - L1caloTau:default: "pt" - L1nnCaloTau:default: "pt" - xlabel: "Gen. pT (GeV)" - ylabel: "Trigger Efficiency (endcap, L1 $p_T > $ GeV)" - thresholds: [20, 30] - scalings: - method: "naive" - threshold: 0.50 - binning: - min: 0 - max: 150 - step: 6 diff --git a/configs/V33nano/objects/jets.yaml b/configs/V33nano/objects/jets.yaml index 46d533c0..087e1c87 100644 --- a/configs/V33nano/objects/jets.yaml +++ b/configs/V33nano/objects/jets.yaml @@ -20,6 +20,9 @@ L1puppiExtJetSC4: label: "Seeded Cone Extended PuppiJet" eta_ranges: inclusive: [0, 7] + barrel: [0, 1.5] + endcap: [1.5, 2.4] + forward: [2.4, 5] ids: default: cuts: @@ -59,15 +62,26 @@ L1puppiJetSC4: inclusive: - "abs({eta}) < 7" -L1TrackJet: - match_dR: 0.4 - label: "Tracker Jet" +L1puppiJetSC8: + match_dR: 0.35 + label: "Seeded Cone PuppiJet 8" eta_ranges: inclusive: [0, 7] barrel: [0, 1.5] endcap: [1.5, 2.4] + forward: [2.4, 5] ids: default: cuts: inclusive: - "abs({eta}) < 7" + +L1TrackJet: + match_dR: 0.4 + label: "Tracker Jet" + eta_ranges: + inclusive: [0, 7] + barrel: [0, 1.5] + endcap: [1.5, 2.4] + ids: + default diff --git a/configs/V33nano/rate_plots/eg.yaml b/configs/V33nano/rate_plots/eg.yaml new file mode 100644 index 00000000..12f54577 --- /dev/null +++ b/configs/V33nano/rate_plots/eg.yaml @@ -0,0 +1,12 @@ +EGRates: + sample: MinBias + version: V33nano + test_objects: + - L1EG:default + - L1tkElectron:NoIso + - L1tkElectron:Iso + - L1tkPhoton:Iso + binning: + min: 10 + max: 97 + step: 3 diff --git a/configs/V33nano/rate_plots/ht.yaml b/configs/V33nano/rate_plots/ht.yaml new file mode 100644 index 00000000..ac15d4c3 --- /dev/null +++ b/configs/V33nano/rate_plots/ht.yaml @@ -0,0 +1,23 @@ +HTRates: + sample: MinBias + version: V33nano + test_objects: + - L1puppiHistoJetSums:HT + - L1puppiJetSC4sums:HT + - L1TrackHT:HT + binning: + min: 50 + max: 975 + step: 25 + +MHTRates: + sample: MinBias + version: V33nano + test_objects: + - L1puppiHistoJetSums:MHT + - L1puppiJetSC4sums:MHT + - L1TrackHT:MHT + binning: + min: 50 + max: 975 + step: 25 diff --git a/configs/V33nano/rate_plots/jets.yaml b/configs/V33nano/rate_plots/jets.yaml new file mode 100644 index 00000000..1d6880fc --- /dev/null +++ b/configs/V33nano/rate_plots/jets.yaml @@ -0,0 +1,52 @@ +JetDefaultRates: + sample: MinBias + version: V33nano + test_objects: + - L1puppiJetHisto:default + - L1puppiJetSC4:default + - L1caloJet:default + - L1TrackJet:default + binning: + min: 40 + max: 420 + step: 20 + +JetsByRegion: + sample: MinBias + version: V33nano + test_objects: + - L1puppiJetSC4:default:barrel + - L1puppiJetSC4:default:endcap + - L1caloJet:default:barrel + - L1caloJet:default:endcap + - L1TrackJet:default:barrel + - L1TrackJet:default:endcap + binning: + min: 40 + max: 420 + step: 20 + +JetSC8Rates: + sample: MinBias + version: V33nano + test_objects: + - L1puppiJetSC4:default + - L1puppiJetSC8:default + binning: + min: 40 + max: 420 + step: 20 + + +JetSC8Rates_byRegion: + sample: MinBias + version: V33nano + test_objects: + # - L1puppiJetSC4:default + - L1puppiJetSC8:default + - L1puppiJetSC8:default:barrel + - L1puppiJetSC8:default:endcap + binning: + min: 40 + max: 420 + step: 20 \ No newline at end of file diff --git a/configs/V33nano/rate_plots/met.yaml b/configs/V33nano/rate_plots/met.yaml new file mode 100644 index 00000000..c0a58061 --- /dev/null +++ b/configs/V33nano/rate_plots/met.yaml @@ -0,0 +1,11 @@ +METRates: + sample: MinBias + version: V33nano + test_objects: + - L1puppiMET:default + - L1puppiMLMET:default + - L1TrackMET:default + binning: + min: 50 + max: 500 + step: 25 diff --git a/configs/V33nano/rate_plots/muons.yaml b/configs/V33nano/rate_plots/muons.yaml new file mode 100644 index 00000000..7573ef0f --- /dev/null +++ b/configs/V33nano/rate_plots/muons.yaml @@ -0,0 +1,34 @@ +gmtMuonByRegion: + sample: MinBias + version: V33nano + test_objects: + - L1gmtMuon:default:barrel + - L1gmtMuon:default:overlap + - L1gmtMuon:default:endcap + binning: + min: 0 + max: 75 + step: 3 + +gmtTkMuonByRegion: + sample: MinBias + version: V33nano + test_objects: + - L1gmtTkMuon:default:barrel + - L1gmtTkMuon:default:overlap + - L1gmtTkMuon:default:endcap + binning: + min: 0 + max: 75 + step: 3 + +MuonRates: + sample: MinBias + version: V33nano + test_objects: + - L1gmtMuon:default + - L1gmtTkMuon:default + binning: + min: 0 + max: 75 + step: 3 diff --git a/configs/V33nano/rate_plots/taus.yaml b/configs/V33nano/rate_plots/taus.yaml new file mode 100644 index 00000000..1bb5775d --- /dev/null +++ b/configs/V33nano/rate_plots/taus.yaml @@ -0,0 +1,25 @@ +TauRates: + sample: MinBias + version: V33nano + test_objects: + - L1nnPuppiTau:default + - L1hpsTau:default + - L1caloTau:default + - L1nnCaloTau:default + binning: + min: 10 + max: 155 + step: 5 + +TauRatesByRegion: + sample: MinBias + version: V33nano + test_objects: + - L1caloTau:default:barrel + - L1caloTau:default:endcap + - L1nnPuppiTau:default:barrel + - L1nnPuppiTau:default:endcap + binning: + min: 10 + max: 155 + step: 5 diff --git a/menu_tools/caching/cache_objects.py b/menu_tools/caching/cache_objects.py index c6e2e0aa..5e286cb5 100755 --- a/menu_tools/caching/cache_objects.py +++ b/menu_tools/caching/cache_objects.py @@ -293,12 +293,13 @@ def _concat_array_from_ntuples(self): self._final_ak_array = ak.zip({**all_arrays}) # sums -> add local index if "sums" in self._object.lower(): - self._final_ak_array[f"{self._object}_sumType"] = ak.local_index(self._final_ak_array) + self._final_ak_array[f"{self._object}_sumType"] = ak.local_index( + self._final_ak_array + ) self._branches += [f"{self._object}_sumType"] else: self._final_ak_array = ak.Array(all_arrays) - def _cache_file_exists(self): """ Checks if there is parquet file in cache diff --git a/menu_tools/caching/merge_arrays.py b/menu_tools/caching/merge_arrays.py index e493e518..7e5aea62 100644 --- a/menu_tools/caching/merge_arrays.py +++ b/menu_tools/caching/merge_arrays.py @@ -1,19 +1,19 @@ import awkward as ak -version = "V32nano" -sample = "DYLL_M50" +version = "V33nano" +sample = "MinBias" # sample = "Hgg" pattern = f"cache/{version}/{version}_{sample}_%s.parquet" -objects = ["L1EGbarrel","L1EGendcap"] +objects = ["L1EGbarrel", "L1EGendcap"] target_object = "L1EG" print(f"Reading files as {pattern} for {objects}") arrs = [] for obj in objects: - arr = ak.from_parquet(pattern%obj) - arr = ak.Array({f.replace(obj,target_object):arr[f] for f in arr.fields}) - # apply 5 gev cut + arr = ak.from_parquet(pattern % obj) + arr = ak.Array({f.replace(obj, target_object): arr[f] for f in arr.fields}) + # apply 5 gev cut arr = arr[arr[f"{target_object}_pt"] > 5] print(obj, arr.fields) arrs.append(arr) @@ -22,4 +22,4 @@ merge_arr = ak.concatenate(arrs, axis=1) print(merge_arr) print(f"Writing merged array to: {pattern%target_object}") -ak.to_parquet(merge_arr, pattern%target_object) +ak.to_parquet(merge_arr, pattern % target_object) diff --git a/menu_tools/object_performance/turnon_collection.py b/menu_tools/object_performance/turnon_collection.py index b22c1210..f916b6a9 100644 --- a/menu_tools/object_performance/turnon_collection.py +++ b/menu_tools/object_performance/turnon_collection.py @@ -299,7 +299,7 @@ def _skim_to_hists(self) -> None: for test_obj, x_arg in self.test_objects: sel = self.ak_arrays[str(test_obj)][x_arg] > self.threshold if (self.ak_arrays["ref"].ndim == 1) and (sel.ndim == 2): - sel = sel[:,0] + sel = sel[:, 0] ak_array = self._flatten_array(self.ak_arrays["ref"][ref_field][sel]) self.hists[str(test_obj)] = np.histogram(ak_array, bins=self.bins) diff --git a/menu_tools/rate_plots/plotter.py b/menu_tools/rate_plots/plotter.py index 051be015..c32f1514 100644 --- a/menu_tools/rate_plots/plotter.py +++ b/menu_tools/rate_plots/plotter.py @@ -29,6 +29,11 @@ def __init__(self, cfg, data, offline_pt: bool): self.data = data self.offline_pt = offline_pt + ## Overwrite outdir + self._outdir = os.path.join( + "outputs", self.cfg.version, "object_performance", "rates" + ) + @property def _online_offline(self): if self.offline_pt: @@ -65,7 +70,7 @@ def _plot_single_version_rate_curves(self): xvals = list(rate_values.keys()) yvals = list(rate_values.values()) - label = f"{obj_instances[version].plot_label} @ {version}" + label = f"{obj_instances[version].plot_label}" plot_dict[obj_specifier] = { "x_values": xvals, @@ -89,7 +94,7 @@ def _plot_single_version_rate_curves(self): self._outdir, f"{version}_{self._online_offline}_{self.cfg.plot_name}", ) - print ('Saving to ',fname) + print("Saving to ", fname) plt.savefig(fname + ".png") plt.savefig(fname + ".pdf") @@ -186,7 +191,7 @@ def _transform_key(self, raw_key: str) -> str: transformed to quality """ ## nano - if ("_" in raw_key): + if "_" in raw_key: key = raw_key.removeprefix(self.object.nano_obj_name).split("_")[-1] ## menu ntuples else: @@ -214,7 +219,7 @@ def _load_cached_arrays(self): # Apply scalings if so configured if self.apply_offline_conversion: arr = scalings.add_offline_pt(arr, self.object) - arr["pt"] = scalings.get_pt_branch(arr) + arr["pt"] = scalings.get_pt_branch(arr, str(self.object)) return arr diff --git a/menu_tools/utils/objects.py b/menu_tools/utils/objects.py index 16d02ad6..840d76d5 100644 --- a/menu_tools/utils/objects.py +++ b/menu_tools/utils/objects.py @@ -172,12 +172,16 @@ def compute_selection_mask_for_object_cuts(obj: Object, ak_array: ak.Array) -> a if not obj.cuts: return sel + ## add fake eta + if "eta" not in ak_array["eta"].fields: + ak_array["eta"] = 0 + for range_i, range_cuts in obj.cuts.items(): # Initialize temporary mask (for rangei) with True everywhere _sel = ak.ones_like(ak_array[ak_array.fields[0]]) > 0 for cut in range_cuts: cut = re.sub(r"{([^&|]*)}", r"ak_array['\1']", cut) - eta_sel = (abs(ak_array["eta"]) > obj.eta_ranges[range_i][0]) & ( + eta_sel = (abs(ak_array["eta"]) >= obj.eta_ranges[range_i][0]) & ( abs(ak_array["eta"]) < obj.eta_ranges[range_i][1] ) _sel = _sel & (eval(cut) + ~eta_sel) diff --git a/menu_tools/utils/scalings.py b/menu_tools/utils/scalings.py index a4b5a941..4ff1a332 100644 --- a/menu_tools/utils/scalings.py +++ b/menu_tools/utils/scalings.py @@ -35,15 +35,20 @@ def load_scaling_params(obj: Object, eta_range: str) -> tuple[float, float]: return scaling_params["slope"], scaling_params["offset"] -def get_pt_branch(arr: ak.Array) -> ak.Array: +def get_pt_branch(arr: ak.Array, obj_name: str) -> ak.Array: if "pt" in arr.fields: pt_orig = arr.pt elif "et" in arr.fields: pt_orig = arr.et elif "" in arr.fields: pt_orig = arr[""] + ### HACK + elif "L1TrackHT:MHT" in obj_name: + pt_orig = arr["mht"] + elif "L1TrackHT:HT" in obj_name: + pt_orig = arr["ht"] else: - raise RuntimeError("Unknown pt branch!") + raise RuntimeError(f"Unknown pt branch for {obj_name}! in fields", arr.fields) return pt_orig @@ -51,7 +56,7 @@ def add_offline_pt(arr: ak.Array, obj: Object) -> ak.Array: """ Add offline pt to filed called `offline_pt` and return array """ - pt_orig = get_pt_branch(arr) + pt_orig = get_pt_branch(arr, str(obj)) new_pt = ak.zeros_like(pt_orig) if len(obj.eta_ranges) == 1 and list(obj.eta_ranges)[0] == "inclusive": diff --git a/menu_tools/utils/utils.py b/menu_tools/utils/utils.py index a0003b5d..df53c38c 100644 --- a/menu_tools/utils/utils.py +++ b/menu_tools/utils/utils.py @@ -58,19 +58,23 @@ def get_branches(ntuple_path: str, tree: str, obj: str): ntuple = glob.glob(ntuple_path)[0] with uproot.open(ntuple) as f: all_branches = f[tree].keys() - if "GenTree" in tree: - prefix = "Generator/" - elif "L1PhaseII" in tree: - prefix = "L1PhaseII/" - elif "Events" in tree: - prefix = "" - - ## nano - if tree == "Events": - obj_branches = [x.split("_")[-1] for x in all_branches if x.startswith(obj)] - ## no nano - else: - obj_branches = [x.removeprefix(prefix + obj) for x in all_branches if x.startswith(prefix+obj)] + if "GenTree" in tree: + prefix = "Generator/" + elif "L1PhaseII" in tree: + prefix = "L1PhaseII/" + elif "Events" in tree: + prefix = "" + + ## nano + if tree == "Events": + obj_branches = [x.split("_")[-1] for x in all_branches if x.startswith(obj)] + ## no nano + else: + obj_branches = [ + x.removeprefix(prefix + obj) + for x in all_branches + if x.startswith(prefix + obj) + ] return obj_branches