Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.42 KB | None | 0 0
  1. from ROOT import *
  2. def pack(mystr): return '('+mystr+')'
  3.    
  4. ntuple = '/scratch02/xabier.cid/A1MuMu/MC11_ttag_A0mumu.root'
  5. f = TFile(ntuple)
  6. t = f.Get('jets_tuple')
  7.  
  8.  
  9. init_cond = 'mct_b==2&&mct_a0_top==2&&mct_w==2 && A1_dec && A1_mctMatch'
  10. tand = ' && '
  11. tor = ' || '
  12.  
  13.  
  14.  
  15. 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")}}
  16.  
  17. tt = []
  18.  
  19. for i in xrange(3):
  20.     row = []
  21.     for j in xrange(8):
  22.         row.append('top'+str(i)+'_tag=='+str(j))
  23.     tt.append(row)
  24.    
  25.                
  26.  
  27.  
  28.  
  29.  
  30. #tt = ['','top1_tag==1','top2_tag==1']
  31. norm = init_cond+ tand +'(top1_tag!=0 || top2_tag!=0)'
  32.  
  33. bjet = {}
  34. bjet['mu'] = init_cond + tand + pack( pack(tt[1][1] + tand + condlep['mu'][1])+ tor + pack(tt[2][1]+ tand +condlep['mu'][2]))
  35. 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'))
  36. bjet['el'] = init_cond + tand + pack( pack(tt[1][1] + tand + condlep['el'][1])+ tor + pack(tt[2][1]+ tand +condlep['el'][2]))
  37. 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'))
  38. bjet['2W'] = init_cond + tand + pack(tt[1][2]+ tor + tt[2][2])
  39. bjet['2W_tag'] = init_cond + tand + pack(pack(tt[1][2]+' && top1_bjet_maxTopoBDT>0')+tor+ pack(tt[2][2]+' && top2_bjet_maxTopoBDT>0'))
  40. bjet['1W'] = init_cond + tand + pack(tt[1][3] + tor + tt[2][3])
  41. bjet['1W_tag'] = init_cond + tand + pack(pack(tt[1][3]+' && top1_bjet_maxTopoBDT>0')+tor+ pack(tt[2][3]+' && top2_bjet_maxTopoBDT>0'))
  42. bjet[''] = init_cond + tand + pack(tt[1][4] + tor + tt[2][4])
  43. bjet['tag'] = init_cond + tand + pack(tt[1][4]+' && top1_bjet_maxTopoBDT>0||'+ tt[2][4]+' && top2_bjet_maxTopoBDT>0')
  44.  
  45. mu = init_cond + tand + pack(pack(tt[1][5]+tand+condlep['mu'][1] ) + tor + pack(tt[2][5]+tand+condlep['mu'][2]))
  46. el = init_cond + tand + pack(pack(tt[1][5]+tand+condlep['el'][1] ) + tor + pack(tt[2][5]+tand+condlep['el'][2]))
  47.  
  48. jet_2W = init_cond + tand + pack(tt[1][6] + tor + tt[2][6])
  49. jet_1W = init_cond + tand + pack(tt[1][7] + tor + tt[2][7])
  50. print t.GetEntries(bjet['1W']+tand+'!'+pack(bjet['']))/float(t.GetEntries(init_cond))*100
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement