Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ROOT import *
- def pack(mystr): return '('+mystr+')'
- ntuple = '/scratch02/xabier.cid/A1MuMu/MC11_ttag_A0mumu.root'
- f = TFile(ntuple)
- t = f.Get('jets_tuple')
- init_cond = 'mct_b==2&&mct_a0_top==2&&mct_w==2 && A1_dec && A1_mctMatch'
- tand = ' && '
- tor = ' || '
- condlep = {"mu":{1:pack("abs(top1_lepton_id)==13&&top1_lepton_isMuon"),2:pack("abs(top2_lepton_id)==13&&top2_lepton_isMuon")}, "el":{1:pack("abs(top1_lepton_id)==11&&top1_lepton_isElectron"), 2:pack("abs(top2_lepton_id)==11&&top2_lepton_isElectron")}}
- tt = []
- for i in xrange(3):
- row = []
- for j in xrange(8):
- row.append('top'+str(i)+'_tag=='+str(j))
- tt.append(row)
- #tt = ['','top1_tag==1','top2_tag==1']
- norm = init_cond+ tand +'(top1_tag!=0 || top2_tag!=0)'
- bjet = {}
- bjet['mu'] = init_cond + tand + pack( pack(tt[1][1] + tand + condlep['mu'][1])+ tor + pack(tt[2][1]+ tand +condlep['mu'][2]))
- bjet['mu_tag']= init_cond + tand + pack( pack(tt[1][1] + tand + condlep['mu'][1]+tand+'top1_bjet_maxTopoBDT>0')+ tor + pack(tt[2][1]+ tand +condlep['mu'][2]+tand+'top2_bjet_maxTopoBDT>0'))
- bjet['el'] = init_cond + tand + pack( pack(tt[1][1] + tand + condlep['el'][1])+ tor + pack(tt[2][1]+ tand +condlep['el'][2]))
- bjet['el_tag'] = init_cond + tand + pack( pack(tt[1][1] + tand + condlep['el'][1]+tand+'top1_bjet_maxTopoBDT>0')+ tor + pack(tt[2][1]+ tand +condlep['el'][2]+tand+'top2_bjet_maxTopoBDT>0'))
- bjet['2W'] = init_cond + tand + pack(tt[1][2]+ tor + tt[2][2])
- bjet['2W_tag'] = init_cond + tand + pack(pack(tt[1][2]+' && top1_bjet_maxTopoBDT>0')+tor+ pack(tt[2][2]+' && top2_bjet_maxTopoBDT>0'))
- bjet['1W'] = init_cond + tand + pack(tt[1][3] + tor + tt[2][3])
- bjet['1W_tag'] = init_cond + tand + pack(pack(tt[1][3]+' && top1_bjet_maxTopoBDT>0')+tor+ pack(tt[2][3]+' && top2_bjet_maxTopoBDT>0'))
- bjet[''] = init_cond + tand + pack(tt[1][4] + tor + tt[2][4])
- bjet['tag'] = init_cond + tand + pack(tt[1][4]+' && top1_bjet_maxTopoBDT>0||'+ tt[2][4]+' && top2_bjet_maxTopoBDT>0')
- mu = init_cond + tand + pack(pack(tt[1][5]+tand+condlep['mu'][1] ) + tor + pack(tt[2][5]+tand+condlep['mu'][2]))
- el = init_cond + tand + pack(pack(tt[1][5]+tand+condlep['el'][1] ) + tor + pack(tt[2][5]+tand+condlep['el'][2]))
- jet_2W = init_cond + tand + pack(tt[1][6] + tor + tt[2][6])
- jet_1W = init_cond + tand + pack(tt[1][7] + tor + tt[2][7])
- print t.GetEntries(bjet['1W']+tand+'!'+pack(bjet['']))/float(t.GetEntries(init_cond))*100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement