LLM4HEP / prompts /old /create_numpy_obsolete.txt
ho22joshua's picture
initial commit
cfcbbc8
User Prompt:
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 .root files to be processed are listed with absolute paths in '{BASE_DIR}/logs/file_list.txt'. 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. Photon ID flags such as `photon_isTightID` are jagged arrays with one entry per photon per event and must be flattened or indexed appropriately. 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 (last indices of the column) with NaN values to serve as placeholders for the diphoton invariant mass and transverse momentum, which will be computed later.
Save each observable in the NumPy array at the corresponding column index as listed below:
The indices should be as follows (note that these names may not correspond to the branch names in the ROOT files):
0: leading photon pt
1: leading photon eta
2: leading photon phi
3: subleading photon pt
4: subleading photon eta
5: subleading photon phi
6: leading lepton pt
7: leading lepton eta
8: leading lepton phi
9: subleading lepton pT
10: subleading lepton eta
11: subleading lepton 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: tight ID of leading photon
36: tight ID of subleading photon
37: scaleFactor_PILEUP
38: scaleFactor_PHOTON
39: scaleFactor_PhotonTRIGGER
40: scaleFactor_ELE
41: scaleFactor_MUON
42: scaleFactor_LepTRIGGER
43: scaleFactor_BTAG
44: NaN
45: NaN