outtree.Branch("nHits", nHits, "nHits/I") RT.gROOT.SetBatch(1) #print "Entries:", tree.GetEntries() isMC = 0 for e in tree: if e.MC: isMC = 1 if not ( e.true_beam_PDG in [211, -13, 13] and e.reco_beam_type == 13 ): continue #if not ( e.reco_beam_true_byHits_matched and e.true_beam_PDG in [211, -13, 13] and e.reco_beam_type == 13 ): continue #if not ( ang_pos_test_cut( e, xlow=-3, xhigh=0., ylow=-1., yhigh=2., zlow=28., zhigh=32. ) ): continue if not ( ang_pos_test_cut( e) ): continue else: if not data_ang_pos_test_cut(e): continue if not ( e.reco_beam_type == 13 and (211 in [i for i in e.data_BI_PDG_candidates])): continue #if not (e.reco_beam_Chi2_proton / e.reco_beam_Chi2_ndof > 50. and e.reco_beam_Chi2_proton / e.reco_beam_Chi2_ndof < 500 ): continue if( e.reco_beam_endZ > 226. ): continue if( args.chi2 > 0. ): if( e.reco_beam_Chi2_proton / e.reco_beam_Chi2_ndof < args.chi2): continue #if e.MC: vertex_type[0] = vt(e, 5., 3) event[0] = e.event subrun[0] = e.subrun run[0] = e.run beamTrackID[0] = e.reco_beam_trackID
outtree.Branch("daughterTrackID", daughterTrackID, "daughterTrackID/I") outtree.Branch("is_track", is_track, "is_track/I") outtree.Branch("vertex_type", vertex_type, "vertex_type/I") gROOT.SetBatch(1) print "Entries:", tree.GetEntries() for e in tree: if not ( e.reco_beam_true_byE_matched and e.true_beam_PDG == 211 and e.reco_beam_type == 13 ): continue if( len(sys.argv) > 3 ): if( int(sys.argv[3]) ): if not ( ang_pos_test_cut( e, xlow=-3, xhigh=0., ylow=-1., yhigh=2., zlow=28., zhigh=32. ) ): continue vertex_type[0] = vt(e, 5.) event[0] = e.event subrun[0] = e.subrun run[0] = e.run beamTrackID[0] = e.reco_beam_trackID vertex_slice[0] = e.reco_beam_vertex_slice pi0_decay_IDs = [i for i in e.true_beam_Pi0_decay_ID] for i in range(0, e.reco_beam_nTrackDaughters): is_track[0] = 1
if (e.MC): if not (e.true_beam_PDG in [211, -13, 13]): passes_PID[0] = 0 #continue else: passes_PID[0] = 1 n_mu_pi_incident += 1 if e.reco_beam_type != 13: passes_beam_type[0] = 0 #continue else: passes_beam_type[0] = 1 n_track_like += 1 if not ang_pos_test_cut(e): passes_beam_cuts[0] = 0 #continue else: passes_beam_cuts[0] = 1 n_pass_beam_cuts += 1 else: if not (211 in [i for i in e.data_BI_PDG_candidates]): passes_PID[0] = 0 #continue else: passes_PID[0] = 1 n_mu_pi_incident += 1 if e.reco_beam_type != 13:
lenhists[name].SetLineColor(colors[name]) endP_hists[name] = TH1D("endP_ang_pos_dedx_cut_" + name, "", 40, 0., 1.2) endP_hists[name].SetFillColor(colors[name]) endP_hists[name].SetLineColor(colors[name]) endZ_hists[name] = TH1D("endZ_ang_pos_dedx_cut_" + name, "", 40, 0., 1.2) endZ_hists[name].SetFillColor(colors[name]) endZ_hists[name].SetLineColor(colors[name]) print for e in tree: if len([i for i in e.reco_beam_dEdX]) < 1: continue if not ang_pos_test_cut(e): continue total_dedx = sum([i for i in e.reco_beam_dEdX]) avg_dedx = total_dedx / len([i for i in e.reco_beam_dEdX]) len_avg_dedx = total_dedx / e.reco_beam_len if (avg_dedx > 5.): continue cut = testcuts_FS(e) if cut == "bad" or cut == "PrimaryElectron" or cut == "PrimaryProton" or cut == "NeutronInel" or cut == "ProtonInel" or cut == "Other": continue lenhists[cut].Fill(e.reco_beam_len) endP_hists[cut].Fill(e.reco_beam_true_byE_endP) endZ_hists[cut].Fill(e.reco_beam_endZ)