def make_cutDict(cut, inputDict=None): global c c = klt.pyPlot(REPLAYPATH, readDict) x = c.w_dict(cut) # print("%s" % cut) # print("x ", x) if inputDict == None: inputDict = {} for key, val in readDict.items(): if key == cut: inputDict.update({key: {}}) for i, val in enumerate(x): tmp = x[i] if tmp == "": continue else: inputDict[cut].update(eval(tmp)) return inputDict
T_coin_pTRIG1_ROC1_tdcTime = tree.array("T.coin.pTRIG1_ROC1_tdcTime") T_coin_pTRIG3_ROC1_tdcTime = tree.array("T.coin.pTRIG3_ROC1_tdcTime") T_coin_pTRIG5_ROC1_tdcTime = tree.array("T.coin.pTRIG5_ROC1_tdcTime") T_coin_pTRIG1_ROC2_tdcTime = tree.array("T.coin.pTRIG1_ROC2_tdcTime") T_coin_pTRIG3_ROC2_tdcTime = tree.array("T.coin.pTRIG3_ROC2_tdcTime") T_coin_pTRIG5_ROC2_tdcTime = tree.array("T.coin.pTRIG5_ROC2_tdcTime") T_coin_pEDTM_tdcTime = tree.array("T.coin.pEDTM_tdcTime") EvtType = tree.array("fEvtHdr.fEvtType") fout = REPLAYPATH + '/UTIL_KAONLT/DB/CUTS/run_type/lumi.cuts' # read in cuts file and make dictionary c = klt.pyPlot(REPLAYPATH) # apply RF cuts to timing cuts file c.cut_RF(runNum, MaxEvent) readDict = c.read_dict(fout, runNum) # This method calls several methods in kaonlt package. It is required to create properly formated # dictionaries. The evaluation must be in the analysis script because the analysis variables (i.e. the # leaves of interest) are not defined in the kaonlt package. This makes the system more flexible # overall, but a bit more cumbersome in the analysis script. Perhaps one day a better solution will be # implimented. def make_cutDict(cut, inputDict=None): global c c = klt.pyPlot(REPLAYPATH, readDict)
H_gtr_beta = e_tree.array("H.gtr.beta") H_gtr_xp = e_tree.array("H.gtr.th") # xpfp -> Theta H_gtr_yp = e_tree.array("H.gtr.ph") # ypfp -> Phi H_gtr_dp = e_tree.array("H.gtr.dp") # SHMS info P_gtr_beta = e_tree.array("P.gtr.beta") P_gtr_xp = e_tree.array("P.gtr.th") # xpfp -> Theta P_gtr_yp = e_tree.array("P.gtr.ph") # ypfp -> Phi P_gtr_p = e_tree.array("P.gtr.p") P_gtr_dp = e_tree.array("P.gtr.dp") r = klt.pyRoot() # Specify the file which contains the cuts we want to use fout = '%s/UTIL_KAONLT/DB/CUTS/run_type/demo.cuts' % REPLAYPATH # read in cuts file and make dictionary c = klt.pyPlot(REPLAYPATH, DEBUG=False) # Switch False to True to enable DEBUG mode readDict = c.read_dict(fout, runNum) # This method calls several methods in kaonlt package. It is required to create properly formated # dictionaries. The evaluation must be in the analysis script because the analysis variables (i.e. the # leaves of interest) are not defined in the kaonlt package. This makes the system more flexible # overall, but a bit more cumbersome in the analysis script. Perhaps one day a better solution will be # implimented. def make_cutDict(cut, inputDict=None): global c c = klt.pyPlot(REPLAYPATH, readDict) x = c.w_dict(cut) print("%s" % cut)
missmass = np.array(np.sqrt(abs(emiss * emiss - pmiss * pmiss))) # # Mp = 0.93828 # MPi = 0.13957018 # MK = 0.493677 # MMpi = np.array([math.sqrt(abs((em + math.sqrt(abs((MK*MK) + (gtrp*gtrp))) - math.sqrt(abs((MPi*MPi) + (gtrp*gtrp) - (pm*pm))) ))**2) for (em, pm, gtrp) in zip(emiss, pmiss, P_gtr_p)]) # MMK = np.array([math.sqrt(abs((em*em)-(pm*pm))) for (em, pm) in zip(emiss, pmiss)]) # MMp = np.array([math.sqrt(abs((em + math.sqrt(abs((MK*MK) + (gtrp*gtrp))) - math.sqrt(abs((Mp*Mp) + (gtrp*gtrp) - (pm*pm))) ))**2) for (em, pm, gtrp) in zip(emiss, pmiss, P_gtr_p)]) r = klt.pyRoot() fout = REPLAYPATH + '/UTIL_PION/DB/CUTS/run_type/pid_eff.cuts' # read in cuts file and make dictionary c = klt.pyPlot(None) readDict = c.read_dict(fout, runNum) # This method calls several methods in kaonlt package. It is required to create properly formated # dictionaries. The evaluation must be in the analysis script because the analysis variables (i.e. the # leaves of interest) are not defined in the kaonlt package. This makes the system more flexible # overall, but a bit more cumbersome in the analysis script. Perhaps one day a better solution will be # implimented. def make_cutDict(cut, inputDict=None): global c c = klt.pyPlot(readDict) x = c.w_dict(cut) print("%s" % cut)
# Author: Richard L. Trotta III <*****@*****.**> # # Copyright (c) trottar # import numpy as np import pandas as pd from csv import DictReader import matplotlib.pyplot as plt import scipy.optimize as opt import sys sys.path.insert(0, '../../../../bin/python/') import kaonlt as klt c = klt.pyPlot(None) # inp_f = "../covid-19-data/public/data/ecdc/full_data.csv" inp_case = "../covid-19-data/public/data/ecdc/total_cases.csv" inp_death = "../covid-19-data/public/data/ecdc/total_deaths.csv" inp_test = "../covid-19-data/public/data/testing/covid-testing-latest-data-source-details.csv" try: case_data = dict(pd.read_csv(inp_case)) death_data = dict(pd.read_csv(inp_death)) test_data = dict(pd.read_csv(inp_test)) except IOError: print("Error: %s or %s [plz]does not appear to exist." % (inp_death, case_data)) # Testing