LLM4HEP / solution /arrays /create_numpy_soln.txt
ho22joshua's picture
initial commit
cfcbbc8
Your task is to write a Python script that reads one of the ROOT files in '{BASE_DIR}/logs/file_list.txt' using uproot and stores the following observables in a NumPy array. The NumPy array should be named as either '{BASE_DIR}/arrays/data_A_raw.npy' or '{BASE_DIR}/arrays/signal_WH_raw.npy' Use "data_A.GamGam.root" for conversion to 'data_A_raw.npy' while "mc_345318.WpH125J_Wincl_gamgam.GamGam.root" for 'signal_WH_raw.npy'. You may use the ROOT file summary included below to see how the trees and branches in the ROOT file are labeled. It is very important to use the correct tree and branch names, so you should tell the worker agent exactly which trees and branches to extract. Note that some branches (for example, photon, lepton, and jet observables) will be arrays containing the corresponding observables for each particle, ordered from highest pT to lowest pT. Do NOT allow the worker to loop over all events; that will be very slow, and it is much better to read entire branches at a time.
For each event, you should save
- pT, eta, phi of each of the two photons.
- pT, eta, phi of the two highest-pT leptons in the event.
- pT, eta, phi of the six highest-pT jets in the event.
- ET and phi of the MET.
- MC weight.
- Flag for each photon indicating whether tight indentification(ID) requirements.
- Cross section.
- Sum of weights.
- Scale factors for photon, electron,muon, btagging, pileup, electron trigger, photon trigger.
Fill indices 44 and 45 with NaN values to serve as placeholders for the diphoton invariant mass and transverse momentum, which will be computed later.
The indices should be as follows (note that these names may not correspond to the branch names in the ROOT files):
0: photon 1 pT
1: photon 1 eta
2: photon 1 phi
3: photon 2 pT
4: photon 2 eta
5: photon 2 phi
6: lepton 1 pT
7: lepton 1 eta
8: lepton 1 phi
9: lepton 2 pT
10: lepton 2 eta
11: lepton 2 phi
12: jet 1 pT
13: jet 1 eta
14: jet 1 phi
15: jet 2 pT
16: jet 2 eta
17: jet 2 phi
18: jet 3 pT
19: jet 3 eta
20: jet 3 phi
21: jet 4 pT
22: jet 4 eta
23: jet 4 phi
24: jet 5 pT
25: jet 5 eta
26: jet 5 phi
27: jet 6 pT
28: jet 6 eta
29: jet 6 phi
30: met ET
31: met phi
32: MC weight
33: sum of weights
34: cross section
35: photon 1 tight ID?
36: photon 2 tight ID?
37: scaleFactor_PILEUP
38: scaleFactor_PHOTON
39: scaleFactor_PhotonTRIGGER
40: scaleFactor_ELE
41: scaleFactor_MUON
42: scaleFactor_LepTRIGGER
43: scaleFactor_BTAG
44: NaN values
45: NaN values
ROOT file summary
================================================================================
ROOT FILES ANALYSIS SUMMARY
================================================================================
COMMON BRANCHES ACROSS ALL FILES
========================================
Tree: mini;1
Common branches (81):
SumWeights, XSection, channelNumber, ditau_m, eventNumber, jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched, largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched, lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0, mcWeight, met_et, met_et_syst, met_phi, photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched, runNumber, scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU, tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched, trigE, trigM, trigP
================================================================================
File 1: data_A.GamGam.root
--------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 430344
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================
File 2: data_B.GamGam.root
--------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 1528717
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================
File 3: data_C.GamGam.root
--------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 2237187
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================
File 4: data_D.GamGam.root
--------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 3602176
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================
File 5: mc_341081.ttH125_gamgam.GamGam.root
-------------------------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 576491
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================
File 6: mc_343981.ggH125_gamgam.GamGam.root
-------------------------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 1054711
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================
File 7: mc_345041.VBFH125_gamgam.GamGam.root
--------------------------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 497468
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================
File 8: mc_345318.WpH125J_Wincl_gamgam.GamGam.root
--------------------------------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 113765
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================
File 9: mc_345319.ZH125J_Zincl_gamgam.GamGam.root
-------------------------------------------------
Total objects: 1
Trees found: 1
Tree: mini;1
Entries: 230900
Branches (81):
ditau: ditau_m
jet: jet_E, jet_MV2c10, jet_eta, jet_jvt, jet_n, jet_phi, jet_pt, jet_pt_syst, jet_trueflav, jet_truthMatched
largeRjet: largeRjet_D2, largeRjet_E, largeRjet_eta, largeRjet_m, largeRjet_n, largeRjet_phi, largeRjet_pt, largeRjet_pt_syst, largeRjet_tau32, largeRjet_truthMatched
lep: lep_E, lep_charge, lep_eta, lep_etcone20, lep_isTightID, lep_n, lep_phi, lep_pt, lep_pt_syst, lep_ptcone30, lep_trackd0pvunbiased, lep_tracksigd0pvunbiased, lep_trigMatched, lep_truthMatched, lep_type, lep_z0
met: met_et, met_et_syst, met_phi
other: SumWeights, XSection, channelNumber, eventNumber, mcWeight, runNumber, trigE, trigM, trigP
photon: photon_E, photon_convType, photon_eta, photon_etcone20, photon_isTightID, photon_n, photon_phi, photon_pt, photon_pt_syst, photon_ptcone30, photon_trigMatched, photon_truthMatched
scaleFactor: scaleFactor_BTAG, scaleFactor_ELE, scaleFactor_LepTRIGGER, scaleFactor_MUON, scaleFactor_PHOTON, scaleFactor_PILEUP, scaleFactor_PhotonTRIGGER, scaleFactor_TAU
tau: tau_BDTid, tau_E, tau_charge, tau_eta, tau_isTightID, tau_n, tau_nTracks, tau_phi, tau_pt, tau_pt_syst, tau_trigMatched, tau_truthMatched
==================================================