def __init__(self, filename): info(f"Opening ROOT file {filename} with columns") tree, ak_table, np_table = open_up(filename) self.tree = tree self.ak_table = ak_table self.np_table = np_table self.nevents = len(ak_table) self.jet_idx = np_table['jet_idx'] self.jet_pt = np_table['jet_pt'] self.jet_eta = np_table['jet_eta'] self.jet_phi = np_table['jet_phi'] self.jet_m = np_table['jet_m'] self.jet_btag = np_table['jet_btag']
############################################################# # Import file info from config file config_file = 'config/input_files.cfg' config = ConfigParser() config.optionxform = str config.read(config_file) filename1 = config['MuonGun']['filename'] + "_1.root" filename2 = config['MuonGun']['filename'] + "_2.root" filename3 = config['MuonGun']['filename'] + "_3.root" filename4 = config['MuonGun']['filename'] + "_4.root" treename = config['MuonGun']['treename'] version = config['MuonGun']['version'] info("Loading files...") tree1, table1, nptab1 = open_up(filename1, treename) info("Loaded file1:") info(filename1) tree2, table2, nptab2 = open_up(filename2, treename) info("Loaded file2:") info(filename2) tree3, table3, nptab3 = open_up(filename3, treename) info("Loaded file3:") info(filename3) tree4, table4, nptab4 = open_up(filename4, treename) info("Loaded file4:") info(filename4) nevents = len(table1) + len(table2) + len(table3) + len(table4) info(f"File contains {nevents} events.")
from configparser import ConfigParser import awkward as ak from icecream import ic import numpy as np np.seterr(all='ignore') import matplotlib as mpl from matplotlib.lines import Line2D import matplotlib.pyplot as plt from myuproot import open_up import sys N_bx = 2736 # IP5, CMS # https://indico.cern.ch/event/751857/contributions/3259413/attachments/1781638/3257666/ExperimentsInRun3_proceedings.pdf f_LHC = filename = '/eos/cms/store/user/eyigitba/emtf/L1Ntuples/Run3/L1TMenuStudies/Run3Rates/NuGun_11.05.21/nuGun_11May21.root' tree, ak_table, np_table = open_up(filename, 'tree')
import numpy as np import awkward0 as awk from myuproot import open_up from kinematics import calcDeltaR, calcStar, convert_emtf from logger import info config_file = 'config/input_files.cfg' config = ConfigParser() config.optionxform = str config.read(config_file) HtoLL = config['HtoLL']['filename'] treename = config['HtoLL']['treename'] tree = open_up(HtoLL, treename) nevents = len(tree['genPart_pt']) muon = (abs(tree['genPart_ID']) == 13) & (tree['genPart_parentID'] == 6000113) nmuons = len(tree['genPart_pt'][muon].flatten()) # print(tree.columns) # with open("branches.txt", "w") as f: # for branches in tree.columns: # f.writelines(branches + '\n') efe_file = 'matchedNtuple_HTo2LLTo4Mu_combined_cmssw_11_0_2_fwImplementation_NNv5.root' efe_tree = open_up(efe_file, 'tree')
config_file = 'config/input_files.cfg' config = ConfigParser() config.optionxform = str config.read(config_file) # sample = 'HtoLL' sample = 'MuonGun' filename = config[sample]['filename'] treename = config[sample]['treename'] info(f"Importing ROOT file from {CYAN+filename+W}") tree, table, nptab = open_up(filename, treename) if 'skimmed' in filename: prefix = 'gen' muon = nptab[prefix + '_ID'] == 0 else: prefix = 'genPart' muon = (abs(nptab[prefix + '_ID']) == 13) & (nptab[prefix + '_parentID'] == 6000113) nevents = len(nptab[prefix + '_pt']) muons = ak.flatten(table[prefix + '_pt'][muon]) nmuons = len(muons) print("Number of muons in sample: ",nmuons)