Skip to content

Commit

Permalink
Merge pull request #35 from UMN-CMS/billyDev
Browse files Browse the repository at this point in the history
Billy dev
  • Loading branch information
jack1851 authored Nov 4, 2024
2 parents 69174bc + b7abc4b commit 8933083
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 27 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ __pycache__
*.gz
*.png
*.pdf
plots/
datasets/.sites_map.json
.env/
.local/
.bashrc
.condor_config
old/
*.png
wr_env/
.sites_map.json
WR_Plotter/
root_outputs/
preprocess/jsons
50 changes: 30 additions & 20 deletions src/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,26 @@ def __init__(self, mass_point=None):
self._signal_sample = mass_point

self.make_output = lambda: {
'Jet_0_Pt': self.create_hist('pt_leadjet', 'process', 'region', (200, 0, 2000), r'p_{T} of the leading jet [GeV]'),
'Jet_1_Pt': self.create_hist('pt_subleadjet', 'process', 'region', (200, 0, 2000), r'p_{T} of the subleading jet [GeV]'),
'Lepton_0_Eta': self.create_hist('eta_leadlep', 'process', 'region', (60, -3, 3), r'#eta of the leading lepton'),
'Lepton_0_Pt': self.create_hist('pt_leadlep', 'process', 'region', (200, 0, 2000), r'p_{T} of the leading lepton [GeV]'),
'Lepton_1_Eta': self.create_hist('eta_subleadlep', 'process', 'region', (60, -3, 3), r'#eta of the subleading lepton'),
'Lepton_1_Pt': self.create_hist('pt_subleadlep', 'process', 'region', (200, 0, 2000), r'p_{T} of the subleading lepton [GeV]'),
'ZCand_Mass': self.create_hist('mass_dileptons', 'process', 'region', (500, 0, 5000), r'm_{ll} [GeV]'),
'ZCand_Pt': self.create_hist('pt_dileptons', 'process', 'region', (200, 0, 2000), r'p^{T}_{ll} [GeV]'),
'WRCand_Mass': self.create_hist('mass_fourobject', 'process', 'region', (800, 0, 8000), r'm_{lljj} [GeV]'),
'WRCand_Pt': self.create_hist('pt_fourobject', 'process', 'region', (800, 0, 8000), r'p^{T}_{lljj} [GeV]'),
'NCand_Lepton_0_Mass': self.create_hist('mass_threeobject_leadlep', 'process', 'region', (800, 0, 8000), r'm_{ljj} [GeV]'),
'NCand_Lepton_0_Pt': self.create_hist('pt_threeobject_leadlep', 'process', 'region', (800, 0, 8000), r'p^{T}_{ljj} [GeV]'),
'NCand_Lepton_1_Mass': self.create_hist('mass_threeobject_subleadlep', 'process', 'region', (800, 0, 8000), r'm_{ljj} [GeV]'),
'NCand_Lepton_1_Pt': self.create_hist('pt_threeobject_subleadlep', 'process', 'region', (800, 0, 8000), r'p^{T}_{ljj} [GeV]'),
'WRCand_Mass': self.create_hist('mass_fourobject', 'process', 'region', (800, 0, 8000), r'm_{lljj} [GeV]'),
'WRCand_Pt': self.create_hist('pt_fourobject', 'process', 'region', (800, 0, 8000), r'p^{T}_{lljj} [GeV]'),
'ZCand_Mass': self.create_hist('mass_dileptons', 'process', 'region', (5000, 0, 5000), r'm_{ll} [GeV]'),
'ZCand_Pt': self.create_hist('pt_dileptons', 'process', 'region', (200, 0, 2000), r'p^{T}_{ll} [GeV]'),
'Dijet_Mass': self.create_hist('mass_dijet', 'process', 'region', (500, 0, 5000), r'm_{jj} [GeV]'),
'Dijet_Pt': self.create_hist('pt_dijet', 'process', 'region', (500, 0, 5000), r'p^{T}_{jj} [GeV]'),
'Lepton_0_Pt': self.create_hist('pt_leadlep', 'process', 'region', (200, 0, 2000), r'p_{T} of the leading lepton [GeV]'),
'Lepton_0_Eta': self.create_hist('eta_leadlep', 'process', 'region', (60, -3, 3), r'#eta of the leading lepton'),
'Lepton_1_Pt': self.create_hist('pt_subleadlep', 'process', 'region', (200, 0, 2000), r'p_{T} of the subleading lepton [GeV]'),
'Lepton_1_Eta': self.create_hist('eta_subleadlep', 'process', 'region', (60, -3, 3), r'#eta of the subleading lepton'),
'Jet_0_Pt': self.create_hist('pt_leadjet', 'process', 'region', (200, 0, 2000), r'p_{T} of the leading jet [GeV]'),
'Jet_0_Eta': self.create_hist('eta_leadjet', 'process', 'region', (60, -3, 3), r'#eta of the leading jet [GeV]'),
'Jet_1_Pt': self.create_hist('pt_subleadjet', 'process', 'region', (200, 0, 2000), r'p_{T} of the subleading jet [GeV]'),
'Jet_1_Eta': self.create_hist('eta_subleadjet', 'process', 'region', (60, -3, 3), r'#eta of the subleading jet [GeV]'),
# 'Dijet_Mass': self.create_hist('mass_dijet', 'process', 'region', (500, 0, 5000), r'm_{jj} [GeV]'),
# 'Dijet_Pt': self.create_hist('pt_dijet', 'process', 'region', (500, 0, 5000), r'p^{T}_{jj} [GeV]'),
}

def create_hist(self, name, process, region, bins, label):
Expand Down Expand Up @@ -90,20 +96,24 @@ def fill_basic_histograms(self, output, region, cut, process, jets, leptons, we
"""Helper function to fill histograms dynamically."""
# Define a list of variables and their corresponding histograms
variables = [
('Jet_0_Pt', jets[:, 0].pt, 'pt_leadjet'),
('Jet_1_Pt', jets[:, 1].pt, 'pt_subleadjet'),
('Lepton_0_Eta', leptons[:, 0].eta, 'eta_leadlep'),
('Lepton_0_Pt', leptons[:, 0].pt, 'pt_leadlep'),
('Lepton_1_Eta', leptons[:, 1].eta, 'eta_subleadlep'),
('Lepton_1_Pt', leptons[:, 1].pt, 'pt_subleadlep'),
('ZCand_Mass', (leptons[:, 0] + leptons[:, 1]).mass, 'mass_dileptons'),
('ZCand_Pt', (leptons[:, 0] + leptons[:, 1]).pt, 'pt_dileptons'),
('WRCand_Mass', (leptons[:, 0] + leptons[:, 1] + jets[:, 0] + jets[:, 1]).mass, 'mass_fourobject'),
('WRCand_Pt', (leptons[:, 0] + leptons[:, 1] + jets[:, 0] + jets[:, 1]).pt, 'pt_fourobject'),
('NCand_Lepton_0_Mass', (leptons[:, 0] + jets[:, 0] + jets[:, 1]).mass, 'mass_threeobject_leadlep'),
('NCand_Lepton_0_Pt', (leptons[:, 0] + jets[:, 0] + jets[:, 1]).pt, 'pt_threeobject_leadlep'),
('NCand_Lepton_1_Mass', (leptons[:, 1] + jets[:, 0] + jets[:, 1]).mass, 'mass_threeobject_subleadlep'),
('NCand_Lepton_1_Pt', (leptons[:, 1] + jets[:, 0] + jets[:, 1]).pt, 'pt_threeobject_subleadlep'),
('WRCand_Mass', (leptons[:, 0] + leptons[:, 1] + jets[:, 0] + jets[:, 1]).mass, 'mass_fourobject'),
('WRCand_Pt', (leptons[:, 0] + leptons[:, 1] + jets[:, 0] + jets[:, 1]).pt, 'pt_fourobject'),
('ZCand_Mass', (leptons[:, 0] + leptons[:, 1]).mass, 'mass_dileptons'),
('ZCand_Pt', (leptons[:, 0] + leptons[:, 1]).pt, 'pt_dileptons'),
('Lepton_0_Pt', leptons[:, 0].pt, 'pt_leadlep'),
('Lepton_0_Eta', leptons[:, 0].eta, 'eta_leadlep'),
('Lepton_1_Pt', leptons[:, 1].pt, 'pt_subleadlep'),
('Lepton_1_Eta', leptons[:, 1].eta, 'eta_subleadlep'),
('Jet_0_Pt', jets[:, 0].pt, 'pt_leadjet'),
('Jet_0_Eta', jets[:, 0].eta, 'eta_leadjet'),
('Jet_1_Pt', jets[:, 1].pt, 'pt_subleadjet'),
('Jet_1_Eta', jets[:, 1].eta, 'eta_subleadjet'),
# ('Dijet_Mass', (jets[:, 0].pt + jets[:, 1]).mass, 'mass_dijet'),
# ('Dijet_Pt', (jets[:, 0].pt + jets[:, 1]).pt, 'pt_dijet'),
]

# Loop over variables and fill corresponding histograms
Expand Down

0 comments on commit 8933083

Please sign in to comment.