Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | None | 0 0
  1. #FIRST PART
  2. el_hit =0
  3. el_proto=0
  4. el_mc=0
  5. for i in xrange(1000):
  6.     #setting protos
  7.     protos = TES["Rec/ProtoP/MyProtoParticles"]
  8.     protos = filter(lambda x: is_el_from_ks(x),protos)
  9.     protos_keys = map(lambda x: get_mcpar(x).key(),protos)
  10.     #setting mc ks0s and els
  11.     ks0s  = TES["MC/Particles"]
  12.     ks0s = filter(lambda x: is_kspipiee(x),ks0s)
  13.     ks0_products = map(lambda x: x.endVertices()[-1].products(),ks0s)
  14.     ks0_els = []
  15.     for el in ks0_products:
  16.         el = filter(lambda x: abs(x.particleID().pid())==11,el)
  17.         ks0_els+=el
  18.     #ks0_els = filter(lambda x: x.momentum().theta()>0.015 and x.momentum().theta()<0.3,ks0_els)
  19.     #setting vclusters
  20.     vclusters = TES["Raw/Velo/Clusters"]
  21.     vclusters = filter(lambda x: is_el_hit_from_ks(x),vclusters)
  22.     els_vclusters = map(lambda x: mcid_to_particle2(x).key(),vclusters)
  23.  
  24.     for ks0 in ks0_els:
  25.         key = ks0.key()
  26.         el_mc+=1
  27.         if key in els_vclusters: el_hit +=1
  28.         if key in protos_keys: el_proto+=1
  29.  
  30. frac_hit = float(el_hit)/el_mc
  31. frac_proto = float(el_proto)/el_mc
  32. print "%f %% have hits"%(100*frac_hit)
  33. print "%f %% have track"%(100*frac_proto)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement