def check_n_vertices_vs_met_threshold(): AtlasStyle.SetAtlasStyle() #input_tfile = utils.open_tfile(BasicConfig.workdir + 'DVTree_NTuple_data15_13TeV.root') input_tfile = utils.open_tfile(args.inputFile) #tree = input_tfile.Get('DVTree_NTuple') tree = input_tfile.Get('Nominal') #bin_name = ['Base', 'Trigger', 'Filter', 'MET200', 'MET220', 'MET250'] bin_name = ['Base', 'Trigger', 'Filter', 'MET250'] h_nevents_cut = TH1F('nevents_cut', ';;Double Ratio', len(bin_name), 0, len(bin_name)) h_nevents_all = TH1F('nevents_all', ';;Double Ratio', len(bin_name), 0, len(bin_name)) h_ndvs_cut = { ntracks: TH1F('ndvs_cut_' + str(ntracks), ';;Double Ratio', len(bin_name), 0, len(bin_name)) for ntracks in range(2, 6) } h_ndvs_all = { ntracks: TH1F('ndvs_all_' + str(ntracks), ';;Double Ratio', len(bin_name), 0, len(bin_name)) for ntracks in range(2, 6) } for bin, name in enumerate(bin_name): h_nevents_cut.GetXaxis().SetBinLabel(bin + 1, name) h_nevents_all.GetXaxis().SetBinLabel(bin + 1, name) for ntracks in range(2, 6): h_ndvs_cut[ntracks].GetXaxis().SetBinLabel(bin + 1, name) h_ndvs_all[ntracks].GetXaxis().SetBinLabel(bin + 1, name) entries = tree.GetEntries() for entry in range(entries): utils.show_progress(entry, entries) #if entry == 1000000: # break # get the next tree in the chain and verify ientry = tree.LoadTree(entry) if ientry < 0: break # copy next entry into memory and verify nb = tree.GetEntry(entry) if nb <= 0: continue if not utils.basic_event_selection(tree): continue # fill all for name in bin_name: h_nevents_all.Fill(name, 1.) for dv_index, DV_nTracks in enumerate(tree.DV_nTracks): if utils.basic_dv_selection(tree, dv_index): if DV_nTracks < 6: h_ndvs_all[DV_nTracks].Fill(name, 1.) else: h_ndvs_all[5].Fill(name, 1.) # h_nevents_cut.Fill('Base', 1.) for dv_index, DV_nTracks in enumerate(tree.DV_nTracks): if utils.basic_dv_selection(tree, dv_index): if DV_nTracks < 6: h_ndvs_cut[DV_nTracks].Fill('Base', 1.) else: h_ndvs_cut[5].Fill('Base', 1.) # Trigger if not tree.PassCut1: continue h_nevents_cut.Fill('Trigger', 1.) for dv_index, DV_nTracks in enumerate(tree.DV_nTracks): if utils.basic_dv_selection(tree, dv_index): if DV_nTracks < 6: h_ndvs_cut[DV_nTracks].Fill('Trigger', 1.) else: h_ndvs_cut[5].Fill('Trigger', 1.) # Filter if not tree.PassCut2: continue h_nevents_cut.Fill('Filter', 1.) for dv_index, DV_nTracks in enumerate(tree.DV_nTracks): if utils.basic_dv_selection(tree, dv_index): if DV_nTracks < 6: h_ndvs_cut[DV_nTracks].Fill('Filter', 1.) else: h_ndvs_cut[5].Fill('Filter', 1.) ## #if not tree.MET > 200: # continue #h_nevents_cut.Fill('MET200', 1.) #for dv_index, DV_nTracks in enumerate(tree.DV_nTracks): # if pass_base_dv_selection(tree, dv_index): # if DV_nTracks < 6: # h_ndvs_cut[DV_nTracks].Fill(name, 1.) # else: # h_ndvs_cut[5].Fill(name, 1.) ## #if not tree.MET > 220: # continue #h_nevents_cut.Fill('MET220', 1.) #for dv_index, DV_nTracks in enumerate(tree.DV_nTracks): # if pass_base_dv_selection(tree, dv_index): # if DV_nTracks < 6: # h_ndvs_cut[DV_nTracks].Fill(name, 1.) # else: # h_ndvs_cut[5].Fill(name, 1.) # if not tree.MET > 250: continue h_nevents_cut.Fill('MET250', 1.) for dv_index, DV_nTracks in enumerate(tree.DV_nTracks): if utils.basic_dv_selection(tree, dv_index): if DV_nTracks < 6: h_ndvs_cut[DV_nTracks].Fill('MET250', 1.) else: h_ndvs_cut[5].Fill('MET250', 1.) # output_tfile = TFile(args.outputFile, 'recreate') # #canvas = TCanvas('canvas', 'canvas', 1200, 800) #h_ndvs_all_clone = h_ndvs_all[2].Clone('unit') #h_ndvs_all_clone.Divide(h_ndvs_all[2]) #h_ndvs_all_clone.SetMaximum(3) #h_ndvs_all_clone.SetMinimum(0) #h_ndvs_all_clone.Draw() #legend = TLegend(0.5, 0.6, 0.85, 0.85) h_nevents_cut.Write() h_nevents_all.Write() for DV_nTracks in range(2, 6): h_ndvs_cut[DV_nTracks].Write() h_ndvs_all[DV_nTracks].Write() # # h_ndvs_cut[DV_nTracks].Sumw2() # h_ndvs_cut[DV_nTracks].Divide(h_ndvs_all[DV_nTracks]) # h_ndvs_cut[DV_nTracks].Divide(h_nevents_cut) # h_ndvs_cut[DV_nTracks].Multiply(h_nevents_all) # utils.decorate_histogram(h_ndvs_cut[DV_nTracks], BasicConfig.colors[DV_nTracks]) # h_ndvs_cut[DV_nTracks].Draw('same,hist') # legend.AddEntry(h_ndvs_cut[DV_nTracks], # '('+str(DV_nTracks)+'trk-DVs(cut)/2trk-DVs(all))/(Events(cut)/Events(all))', 'l') #utils.decorate_legend(legend) #legend.Draw() #utils.save_as(canvas, BasicConfig.plotdir + 'nVerts_met_dependency') #output = TFile('nVerts_met_dependency.root', 'recreate') #canvas.Write() output_tfile.Close()
def create_cut_flow(): AtlasStyle.SetAtlasStyle() #input_tfile = utils.open_tfile(BasicConfig.workdir + 'DVTree_NTuple_data15_13TeV.root') #tree = input_tfile.Get('DVTree_NTuple') input_tfile = utils.open_tfile(args.inputFile) tree = input_tfile.Get('Nominal') cut_flow = [ 'Initial', 'Trigger', 'Filter', 'Cleaning', 'GRL', 'PV', 'NCB veto', 'MET', 'DV Selection' ] h_cut_flow = TH1F('cut_flow', ';;Number of Events', len(cut_flow), 0, len(cut_flow)) #h_cut_flow2 = TH1F('cut_flow2', ';;Number of Events', len(cut_flow), 0, len(cut_flow)) for bin, cut in enumerate(cut_flow): h_cut_flow.GetXaxis().SetBinLabel(bin + 1, cut) # entries = tree.GetEntries() for entry in range(entries): #if entry % 10000 == 0: # print('*** processed {0} out of {1}'.format(entry, entries)) utils.show_progress(entry, entries) #if entry == 100000: # break # get the next tree in the chain and verify ientry = tree.LoadTree(entry) if ientry < 0: break # copy next entry into memory and verify nb = tree.GetEntry(entry) if nb <= 0: continue event_weight = tree.McEventWeight * tree.PileupWeight * tree.ISRWeight for step, cut in enumerate(cut_flow): if step == 0: h_cut_flow.Fill(cut, event_weight) #h_cut_flow2.Fill(cut, event_weight) #elif step == 2: # if tree.RandomRunNumber < 309311 and pass_event_cut(tree, 2): # h_cut_flow.Fill(cut, event_weight) # if tree.RandomRunNumber > 309311 and pass_event_cut(tree, 2): # h_cut_flow2.Fill(cut, event_weight) #elif step == 6: # if tree.RandomRunNumber < 309311 and pass_event_cut(tree, 6): # h_cut_flow.Fill(cut, event_weight) # if tree.RandomRunNumber > 309311 and pass_event_cut(tree, 6): # h_cut_flow2.Fill(cut, event_weight) #elif step == 7: # #have_signal_like_dv = False # #for dv_index in range(len(tree.DV_passVtxCuts)): # # have_signal_like_dv = have_signal_like_dv or tree.DV_passVtxCuts[dv_index] # #if pass_event_cut(tree, 7) and tree.MET > 220 and have_signal_like_dv: # if tree.RandomRunNumber < 309311 and pass_event_cut(tree, 7): # h_cut_flow.Fill(cut, event_weight) # if tree.RandomRunNumber > 309311 and pass_event_cut(tree, 7): # h_cut_flow2.Fill(cut, event_weight) elif pass_event_cut(tree, step): h_cut_flow.Fill(cut, event_weight) #h_cut_flow2.Fill(cut, event_weight) output = TFile('cut_flow.root', 'recreate') h_cut_flow.Write() output.Close()
'user.kmotohas.data16_13TeV.304337_DAOD_JETM2.SysUnc_MET.v3_histograms.root/' + 'all_data16_13TeV.304337_DAOD_JETM2.SysUnc_MET.v3_histograms.root', # 2015 Period D DAOD_JETM2 'all_JETM2_2015_PeriodD.root', # 2016 Period C DAOD_JETM2 'all_JETM2_2016_PeriodC.root', # 2016 Period C DAOD_JETM1 'all_data16_13TeV.PeriodC.DAOD_JETM1.SysUnc_MET.root', # 2016 Period F DAOD_JETM1 'all_data16_13TeV.PeriodF.DAOD_JETM1.SysUnc_MET.root', # 2015 Period J DAOD_JETM1 'all_data15_13TeV.PeriodJ.DAOD_JETM1.SysUnc_MET.root' ] tf = [ utils.open_tfile(BasicConfig.histodir + x) for x in path_to_root_file ] # mc mc_file_list = open( BasicConfig.workdir + 'DV_analysisScriptsRun2/mc_SysUnc_MET.list', 'r') tf_mc = [utils.open_tfile(x.rstrip()) for x in mc_file_list] mc_file_list = open( BasicConfig.workdir + 'DV_analysisScriptsRun2/mc_SysUnc_MET.list', 'r') dsid = [int(re.sub('.*hist_run', '', x)[:6]) for x in mc_file_list] # for x in mc_file_list: # tf_mc.append(utils.open_tfile(x.rstrip())) # dsid.append(int(re.sub('.*hist_run', '', x)[:6])) #legend_trigger = ['HLT_xe100_tc_lcw', 'HLT_xe100_tc_lcw_wEFMu',
import ROOT import AtlasStyle except ImportError: # on my laptop sys.path.append('/usr/local/root/latest/lib') sys.path.append(BasicConfig.workdir + 'DV_analysisScriptsRun2/') import ROOT import AtlasStyle import utils if __name__ == "__main__": # Configure ROOT as Atlas Style AtlasStyle.SetAtlasStyle() # filename_DVMultiTrkBkg = 'all.root' if RunConfig.year == 2015 else 'all_2016.root' # Material Volume if RunConfig.doMaterialVolume: matVol = MaterialVolume.MaterialVolume() if RunConfig.doCalcMV: matVol.calculateMaterialVolume() if RunConfig.doShowMR: canvas = ROOT.TCanvas("c", "c", 1000, 600) matVol.showMaterialRegions(canvas) if RunConfig.doEstiHI: tf = utils.open_tfile(BasicConfig.workdir + filename_DVMultiTrkBkg) matVol.estimateHadronicInteractions(tf)
mass_pion) tlv2 = tlv0 + tlv1 #print tlv2.M() hist.Fill(tlv2.M()) if __name__ == '__main__': h_mass_2 = [ TH1F('mass_2_region'+str(region), ';DV Mass [GeV]; Number of Vertices', 10000, 0, 10) for region in range(12) ] h_mass_2_in_3 = [ TH1F('mass_2_in_3_region'+str(region),';DV Mass [GeV]; Number of Vertices', 10000, 0, 10) for region in range(12) ] input_tfile = utils.open_tfile(input_file_name) tree = input_tfile.Get('Nominal') entries = tree.GetEntries() for entry in range(entries): if entry % 10000 == 0: print('*** processed {0} out of {1}'.format(entry, entries)) # get the next tree in the chain and verify ientry = tree.LoadTree(entry) if ientry < 0: break # copy next entry into memory and verify nb = tree.GetEntry(entry) if nb <= 0: continue for idv, nTracks in enumerate(tree.DV_nTracks):
print(' \\hline') print(' \multicolumn{3}{c}{Signal Region} \\\\ \\hline') print(' & 5 $(4+1)$ Track DV & 6 $(5+1)$ Track DV\\\\ \\hline') print(' Estimation & $ ' + '{0:3.3f} \\pm {1:3.3f} $ & $ {2:3.3f} \\pm {3:3.3f} $ \\\\'.format(est[5], est_err[5], est[6], est_err[6])) print(' Observation & Blinded & Blinded \\\\') print(' Observation & $ {0} $ & $ {1} $ \\\\'.format(obs[5], obs[6])) print(' \\hline') print(' \\end{tabular}') print('\\end{center}') print('\\end{table}') if __name__ == '__main__': AtlasStyle.SetAtlasStyle() #mass_fit = MassFit(2015) mass_fit = MassFit(2016) #tfile = utils.open_tfile('../all.root') #tfile = utils.open_tfile('../all_2016_1114.root') #tfile = utils.open_tfile('../MassTemplates_systTree_ALL_v21.root') tfile = utils.open_tfile('../MassTemplates_systTree_ALL_v30.root') #tfile = utils.open_tfile('../test.root') mass_fit.fit_3trk(tfile, use_multiple_models=False) #mass_fit.fit_3trk(tfile, use_multiple_models=True) #print(h_factor) mass_fit.apply_crossing_factor(tfile, 4) mass_fit.apply_crossing_factor(tfile, 5) mass_fit.apply_crossing_factor(tfile, 6) mass_fit.create_latex_summary()
from ROOT import * import utils tfile = utils.open_tfile('../output_systTree_PeriodA-I.root') #tfile = utils.open_tfile('../all_2016.root') #tfile = utils.open_tfile('../all_2016.root') h = [[TH1F() for _ in range(12)] for __ in range(5)] h_nolarge = [[TH1F() for _ in range(12)] for __ in range(5)] h_large = [[TH1F() for _ in range(12)] for __ in range(5)] h_cross = [[TH1F() for _ in range(12)] for __ in range(5)] for ntrk in [2, 3, 4]: for reg in range(12): tfile.GetObject('BkgEst_data_{0}Trk_Region{1}_DVMultiTrkBkg'.format(ntrk, reg), h[ntrk][reg]) #tfile.GetObject('BkgEst_Cross_NoLargeAngle_{0}Trk_Region{1}_DVMultiTrkBkg'.format(ntrk, reg), h_nolarge[ntrk][reg]) #tfile.GetObject('BkgEst_Cross_LargeAngle_{0}Trk_Region{1}_DVMultiTrkBkg'.format(ntrk, reg), h_large[ntrk][reg]) #tfile.GetObject('BkgEst_Cross_{0}Trk_Region{1}_DVMultiTrkBkg'.format(ntrk, reg), h_cross[ntrk][reg]) bin8 = h[2][0].FindBin(4) bin2 = h[2][0].FindBin(6) bin4 = h[2][0].FindBin(3.6) bin10 = h[2][0].FindBin(10) print(bin10) l = [] l2 = [] for reg in range(12): print('Region: ' + str(reg)) #print float(h_large[3][reg].GetEntries()) / h[2][reg].GetEntries() #print float(h_cross[4][reg].GetEntries()) / h[3][reg].GetEntries() #print float(h_large[3][reg].GetEntries()) / h_nolarge[3][reg].GetEntries()
# # #def PassNCBVeto(tree): # #idx = get_index_of_leading_jet(tree) # #if idx < 0: # # return True # #else: # # return (tree.Jet_EMFrac[idx] < 0.96 and tree.Jet_FracSamplingMax < 0.8) # if tree.Jet_n > 0: # return (tree.Jet_EMFrac[0] < 0.96 and tree.Jet_FracSamplingMax[0] < 0.8) # else: # return True if __name__ == '__main__': tfile1 = utils.open_tfile(input_file_name) #tfile2 = utils.open_tfile(input_file_name) tree1 = tfile1.Get('Nominal') #tree2 = tfile2.Get('Nominal') entries = tree1.GetEntries() print('Number of Entries = {}'.format(entries)) flavors = ['data', 'model'] data = 0 model = 1 combs = ['22', '23', '33'] h_xy = [[TH1F(flavor+'_xy_'+comb, ';Vertex Pair XY Distance [mm]; Number of Vertices / mm', 50, 0, 50) for comb in combs] for flavor in flavors] h_z = [[TH1F(flavor+'_z_'+comb, ';Vertex Pair Z Distance [mm]; Number of Vertices / mm', 250, 0, 250) for comb in combs] for flavor in flavors] h_3d = [[TH1F(flavor+'_3d_'+comb, ';Vertex Pair 3D Distance [mm]; Number of Vertices / mm', 250, 0, 250)
print(' Estimation & $ ' + '{0:3.3f} \\pm {1:3.3f} $ & $ {2:3.3f} \\pm {3:3.3f} $ \\\\'. format(est_8to10[3], est_err_8to10[3], est_8to10[4], est_err_8to10[4])) print(' Observation & $ {0} $ & $ {1} $ \\\\'.format( obs_8to10[3], obs_8to10[4])) print(' \\hline') print(' \\hline') print(' \multicolumn{3}{c}{Signal Region} \\\\ \\hline') print(' & 5 $(4+1)$ Track DV & 6 $(5+1)$ Track DV\\\\ \\hline') print(' Estimation & $ ' + '{0:3.3f} \\pm {1:3.3f} $ & $ {2:3.3f} \\pm {3:3.3f} $ \\\\'. format(est[5], est_err[5], est[6], est_err[6])) print(' Observation & Blinded & Blinded \\\\') print(' \\hline') print(' \\end{tabular}') print('\\end{center}') print('\\end{table}') if __name__ == '__main__': AtlasStyle.SetAtlasStyle() mass_fit = MassFit(2015) tfile = utils.open_tfile('../all.root') mass_fit.fit_3trk(tfile) print(h_factor) mass_fit.apply_crossing_factor(tfile, 4) mass_fit.apply_crossing_factor(tfile, 5) mass_fit.apply_crossing_factor(tfile, 6) mass_fit.create_latex_summary()
# 2016 Period F DAOD_JETM2 'user.kmotohas.data16_13TeV.304337_DAOD_JETM2.SysUnc_MET.v3_histograms.root/' + 'all_data16_13TeV.304337_DAOD_JETM2.SysUnc_MET.v3_histograms.root', # 2015 Period D DAOD_JETM2 'all_JETM2_2015_PeriodD.root', # 2016 Period C DAOD_JETM2 'all_JETM2_2016_PeriodC.root', # 2016 Period C DAOD_JETM1 'all_data16_13TeV.PeriodC.DAOD_JETM1.SysUnc_MET.root', # 2016 Period F DAOD_JETM1 'all_data16_13TeV.PeriodF.DAOD_JETM1.SysUnc_MET.root', # 2015 Period J DAOD_JETM1 'all_data15_13TeV.PeriodJ.DAOD_JETM1.SysUnc_MET.root' ] tf = [utils.open_tfile(BasicConfig.histodir + x) for x in path_to_root_file] # mc mc_file_list = open(BasicConfig.workdir + 'DV_analysisScriptsRun2/mc_SysUnc_MET.list', 'r') tf_mc = [utils.open_tfile(x.rstrip()) for x in mc_file_list] mc_file_list = open(BasicConfig.workdir + 'DV_analysisScriptsRun2/mc_SysUnc_MET.list', 'r') dsid = [int(re.sub('.*hist_run', '', x)[:6]) for x in mc_file_list] # for x in mc_file_list: # tf_mc.append(utils.open_tfile(x.rstrip())) # dsid.append(int(re.sub('.*hist_run', '', x)[:6])) #legend_trigger = ['HLT_xe100_tc_lcw', 'HLT_xe100_tc_lcw_wEFMu', # 'HLT_xe100_mht_L1XE50', 'HLT_xe110_mht_L1XE50', 'HLT_xe120_mht_L1XE50'] legend_trigger = ['HLT_xe110_mht_L1XE50']
import AtlasStyle import ROOT import BasicConfig import utils from datetime import date if __name__ == '__main__': AtlasStyle.SetAtlasStyle() mass_list = range(600, 1801, 200) tfiles = [utils.open_tfile(BasicConfig.workdir + 'SysUnc_ISR/SysUnc_ISR_{:04d}_weight.root'.format(mass)) for mass in mass_list] c = ROOT.TCanvas('c', 'c', 1000, 800) c.SetLogx() tf_out = ROOT.TFile(BasicConfig.workdir + 'SysUnc_ISR/SysUnc_ISR_weight.root', 'recreate') for ii, (tfile, mass) in enumerate(zip(tfiles, mass_list)): tfile.cd() c2 = ROOT.gROOT.FindObject('c2') hist = c2.GetPrimitive('ggSystem_SysUnc_ISR') hist.SetName('ggSystem_SysUnc_ISR_' + str(mass)) utils.decorate_histogram(hist, BasicConfig.colors[ii]) c.cd() if ii == 0: hist.Draw() else: hist.Draw('same') tf_out.cd()
print(' \multicolumn{3}{c}{Additional Control and Validation Regions (' + str(int(self.m_cut2)) + '-10 GeV)} \\\\ \\hline') print(' & 3 $(2+1)$ Track DV & 4 $(3+1)$ Track DV \\\\ \\hline') print(' Estimation & $ ' + '{0:3.3f} \\pm {1:3.3f} $ & $ {2:3.3f} \\pm {3:3.3f} $ \\\\'.format(est_8to10[3], est_err_8to10[3], est_8to10[4], est_err_8to10[4])) print(' Observation & $ {0} $ & $ {1} $ \\\\'.format(obs_8to10[3], obs_8to10[4])) print(' \\hline') print(' \\hline') print(' \multicolumn{3}{c}{Signal Region} \\\\ \\hline') print(' & 5 $(4+1)$ Track DV & 6 $(5+1)$ Track DV\\\\ \\hline') print(' Estimation & $ ' + '{0:3.3f} \\pm {1:3.3f} $ & $ {2:3.3f} \\pm {3:3.3f} $ \\\\'.format(est[5], est_err[5], est[6], est_err[6])) print(' Observation & Blinded & Blinded \\\\') print(' \\hline') print(' \\end{tabular}') print('\\end{center}') print('\\end{table}') if __name__ == '__main__': AtlasStyle.SetAtlasStyle() mass_fit = MassFit(2015) tfile = utils.open_tfile('../all.root') mass_fit.fit_3trk(tfile) print(h_factor) mass_fit.apply_crossing_factor(tfile, 4) mass_fit.apply_crossing_factor(tfile, 5) mass_fit.apply_crossing_factor(tfile, 6) mass_fit.create_latex_summary()
import AtlasStyle import BasicConfig import utils from datetime import date if __name__ == '__main__': AtlasStyle.SetAtlasStyle() directory = '/Volumes/HDPX-UTA/data/mc15_13TeV/' systTree = [ #utils.open_tfile(BasicConfig.rootcoredir + 'systTree_302137.root'), #utils.open_tfile(directory + 'systTree_group.phys-susy.402715.PythiaRhad_AUET2BCTEQ6L1_gen_gluino_p1_1200_qq_100_1ns.recon.ESD.e4732_s2821_s2183_r6869.trkvrt.v1_EXT0.root'), utils.open_tfile( directory + 'systTree_mc15_13TeV.402074.PythiaRhad_AUET2BCTEQ6L1_gen_gluino_p1_1200_qq_100_1ns.recon.DAOD_RPVLL.e4620_s2770_s2183_r8788.root' ), #utils.open_tfile(BasicConfig.rootcoredir + 'systTree_307732.root') utils.open_tfile( directory + 'DVPlusMETSys/systTree_mc15_13TeV.402074.PythiaRhad_AUET2BCTEQ6L1_gen_gluino_p1_1200_qq_100_1ns.merge.DAOD_SUSY15.e4620_s2770_s2183_r8788_p2877.root' ) ] nominal = [TTree(), TTree()] hist = [TH1F(), TH1F()] #legend1 = 'run302137 (group-susy)' #legend1 = 'mc15a from ESD (g1200 chi100 1ns)' legend1 = 'r8788 mc15c from HITS (g1200 chi100 1ns)' #legend2 = 'run307732 (central)' legend2 = 'p2877 mc15c from HITS (g1200 chi100 1ns)'
import AtlasStyle import ROOT import BasicConfig import utils from datetime import date if __name__ == '__main__': AtlasStyle.SetAtlasStyle() mass_list = range(600, 1801, 200) tfiles = [ utils.open_tfile( BasicConfig.workdir + 'SysUnc_ISR/SysUnc_ISR_{:04d}_weight.root'.format(mass)) for mass in mass_list ] c = ROOT.TCanvas('c', 'c', 1000, 800) c.SetLogx() tf_out = ROOT.TFile( BasicConfig.workdir + 'SysUnc_ISR/SysUnc_ISR_weight.root', 'recreate') for ii, (tfile, mass) in enumerate(zip(tfiles, mass_list)): tfile.cd() c2 = ROOT.gROOT.FindObject('c2') hist = c2.GetPrimitive('ggSystem_SysUnc_ISR') hist.SetName('ggSystem_SysUnc_ISR_' + str(mass)) utils.decorate_histogram(hist, BasicConfig.colors[ii]) c.cd()
import AtlasStyle import BasicConfig import utils from datetime import date if __name__ == '__main__': AtlasStyle.SetAtlasStyle() directory = '/Volumes/HDPX-UTA/data/mc15_13TeV/' systTree = [ #utils.open_tfile(BasicConfig.rootcoredir + 'systTree_302137.root'), #utils.open_tfile(directory + 'systTree_group.phys-susy.402715.PythiaRhad_AUET2BCTEQ6L1_gen_gluino_p1_1200_qq_100_1ns.recon.ESD.e4732_s2821_s2183_r6869.trkvrt.v1_EXT0.root'), utils.open_tfile(directory + 'systTree_mc15_13TeV.402074.PythiaRhad_AUET2BCTEQ6L1_gen_gluino_p1_1200_qq_100_1ns.recon.DAOD_RPVLL.e4620_s2770_s2183_r8788.root'), #utils.open_tfile(BasicConfig.rootcoredir + 'systTree_307732.root') utils.open_tfile(directory + 'DVPlusMETSys/systTree_mc15_13TeV.402074.PythiaRhad_AUET2BCTEQ6L1_gen_gluino_p1_1200_qq_100_1ns.merge.DAOD_SUSY15.e4620_s2770_s2183_r8788_p2877.root') ] nominal = [TTree(), TTree()] hist = [TH1F(), TH1F()] #legend1 = 'run302137 (group-susy)' #legend1 = 'mc15a from ESD (g1200 chi100 1ns)' legend1 = 'r8788 mc15c from HITS (g1200 chi100 1ns)' #legend2 = 'run307732 (central)' legend2 = 'p2877 mc15c from HITS (g1200 chi100 1ns)' systTree[0].GetObject('Nominal', nominal[0]) systTree[1].GetObject('Nominal', nominal[1]) #utils.compare_two_ntuples(nominal[0], nominal[1], 'DV_chisqPerDOF', 100, 0, 5,
#print tlv2.M() hist.Fill(tlv2.M()) if __name__ == '__main__': h_mass_2 = [ TH1F('mass_2_region' + str(region), ';DV Mass [GeV]; Number of Vertices', 10000, 0, 10) for region in range(12) ] h_mass_2_in_3 = [ TH1F('mass_2_in_3_region' + str(region), ';DV Mass [GeV]; Number of Vertices', 10000, 0, 10) for region in range(12) ] input_tfile = utils.open_tfile(input_file_name) tree = input_tfile.Get('Nominal') entries = tree.GetEntries() for entry in range(entries): if entry % 10000 == 0: print('*** processed {0} out of {1}'.format(entry, entries)) # get the next tree in the chain and verify ientry = tree.LoadTree(entry) if ientry < 0: break # copy next entry into memory and verify nb = tree.GetEntry(entry) if nb <= 0: continue for idv, nTracks in enumerate(tree.DV_nTracks):
from ROOT import * import utils tfile = utils.open_tfile('../output_systTree_PeriodA-I.root') #tfile = utils.open_tfile('../all_2016.root') #tfile = utils.open_tfile('../all_2016.root') h = [[TH1F() for _ in range(12)] for __ in range(5)] h_nolarge = [[TH1F() for _ in range(12)] for __ in range(5)] h_large = [[TH1F() for _ in range(12)] for __ in range(5)] h_cross = [[TH1F() for _ in range(12)] for __ in range(5)] for ntrk in [2, 3, 4]: for reg in range(12): tfile.GetObject( 'BkgEst_data_{0}Trk_Region{1}_DVMultiTrkBkg'.format(ntrk, reg), h[ntrk][reg]) #tfile.GetObject('BkgEst_Cross_NoLargeAngle_{0}Trk_Region{1}_DVMultiTrkBkg'.format(ntrk, reg), h_nolarge[ntrk][reg]) #tfile.GetObject('BkgEst_Cross_LargeAngle_{0}Trk_Region{1}_DVMultiTrkBkg'.format(ntrk, reg), h_large[ntrk][reg]) #tfile.GetObject('BkgEst_Cross_{0}Trk_Region{1}_DVMultiTrkBkg'.format(ntrk, reg), h_cross[ntrk][reg]) bin8 = h[2][0].FindBin(4) bin2 = h[2][0].FindBin(6) bin4 = h[2][0].FindBin(3.6) bin10 = h[2][0].FindBin(10) print(bin10) l = [] l2 = [] for reg in range(12): print('Region: ' + str(reg)) #print float(h_large[3][reg].GetEntries()) / h[2][reg].GetEntries()