22 from EventKernel
import ParticleDataType
24 from PyAnalysisUtils
import combo
25 from PyAnalysisUtils
import PDG
26 from ROOT
import TH1F, gROOT
50 return TH1F (name, name, n, lo, hi)
62 this_dr = hlv.deltaR (pp.hlv())
75 self.
pt = mybook (name +
"_pt", 50, 0, 250*GeV)
76 self.
eta = mybook (name +
"_eta", 50, -4, 4)
77 self.
phi = mybook (name +
"_phi", 50, -3.5, 3.5)
83 self.
eta.Fill (p.eta())
84 self.
phi.Fill (p.phi())
96 self.
n = mybook (name +
"_n", 10, 0, 10)
98 self.
h = Parthists (name)
105 self.
n.Fill (len (plist))
138 numerator = a.px()*b.py() - a.py()*b.px()
141 x_a = numerator/(b.py()*(a.px()+metx)-b.px()*(a.py()+mety))
142 x_b = numerator/(a.px()*(b.py()+mety)-a.py()*(b.px()+metx))
144 def make_nu (p, scale):
147 hlv.setE(hlv.vect().
mag())
151 nu = g.TruthParticle()
155 return (make_nu (a, 1./x_a - 1),
156 make_nu (b, 1./x_b - 1))
167 def __init__ (self, pdgid=None, charge=None, plist=None):
168 g.CompositeParticle.__init__ (self)
170 if pdgid !=
None: self.set_pdgId (pdgid)
171 if charge !=
None: self.set_charge (charge)
172 if plist !=
None: self.
extend (plist)
176 g.CompositeParticle.add (self, p)
180 return len (self.
__l)
186 return item
in self.
__l
194 return self.
__l.count (x)
195 def index (self, x, i=0, j=999999999):
196 return self.
__l.ndex (i, j)
204 PyCompositeParticle.__init__ (self, pdgid, 0, [l1, l2])
207 return self[0].hlv().deltaR (self[1].hlv())
218 Parthists.__init__ (self, name)
219 self.
eoverp = mybook (name +
"eoverp", 50, 0, 2)
220 self.
isem = mybook (name +
"isem", 20, -1.5, 18.5)
224 Parthists.fill (self, p)
226 self.
eoverp.Fill (p.parameter (EoverP))
231 for i
in range(0, 16):
232 if isem & (1<<i): self.
isem.Fill (i)
235 return Partlisthists (name, Parthists_Ele (name))
246 Parthists.__init__ (self, name)
247 self.
chi2 = mybook (name +
"chi2", 200, 0, 1000)
251 Parthists.fill (self, p)
252 self.
chi2.Fill (p.chi2())
255 return Partlisthists (name, Parthists_Muo (name))
266 Parthists.__init__ (self, name)
267 self.
etem = mybook (name +
"etem", 100, 0, 200*GeV)
268 self.
ethad = mybook (name +
"ethad", 100, 0, 200*GeV)
269 self.
ntrack = mybook (name +
"ntrack", 10, -0.5, 9.5)
270 self.
charge = mybook (name +
"charge", 10, -4.5, 4.5)
271 self.
emrad = mybook (name +
"emrad", 100, 0, 50)
272 self.
isofrac = mybook (name +
"isofrac", 100, 0, 1)
273 self.
stripw2 = mybook (name +
"stripw2", 100, 0, 1)
274 self.
likeli = mybook (name +
"likeli", -10, 0, 40)
275 self.
pt1 = mybook (name +
"pt1", 100, 0, 200*GeV)
276 self.
emfrac = mybook (name +
"emfrac", 100, 0, 1)
277 self.
tote = mybook (name +
"tote", 100, 0, 200*GeV)
281 Parthists.fill (self, p)
282 self.
etem.Fill (p.etEM())
283 self.
ethad.Fill (p.etHad())
284 self.
ntrack.Fill (p.numTrack())
285 self.
charge.Fill (p.charge())
286 self.
emrad.Fill (p.EMRadius())
287 self.
isofrac.Fill (p.IsoFrac())
288 self.
stripw2.Fill (p.stripWidth2())
289 self.
likeli.Fill (p.likelihood())
290 if not not p.track(0):
291 self.
pt1.Fill (p.track(0).
pt())
292 tote = p.etEM() + p.etHad()
294 emfrac = p.etEM() / tote
297 self.
tote.Fill (tote)
301 return Partlisthists (name, Parthists_Taujet (name))
312 Parthists.__init__ (self, name)
313 self.
m = mybook (name +
"m", 100, 0, m_max)
314 self.
dr = mybook (name +
"dr", 100, 0, 10)
318 Parthists.fill (self, p)
320 self.
dr.Fill (p.dr())
323 return Partlisthists (name, Parthists_Z (name, m_max))
334 return dt != ParticleDataType.Fast
and dt != ParticleDataType.True
348 PyAlgorithm.__init__ (self, name)
360 h.ele0 = Partlisthists_Ele (
'ele0')
361 h.ele1 = Partlisthists_Ele (
'ele1')
362 h.ele2 = Partlisthists_Ele (
'ele2')
364 h.muo0 = Partlisthists_Muo (
'muo0')
365 h.muo1 = Partlisthists_Muo (
'muo1')
367 h.taujet0 = Partlisthists_Taujet (
'taujet0')
368 h.taujet1 = Partlisthists_Taujet (
'taujet1')
370 h.metx = mybook (
"metx", 100, 0, 500*GeV)
371 h.mety = mybook (
"mety", 100, 0, 500*GeV)
372 h.met = mybook (
"met", 100, 0, 500*GeV)
380 h.hzz = [Partlisthists_Z (
'hzz0', m_max=500*GeV),
381 Partlisthists_Z (
'hzz1', m_max=500*GeV)]
383 h.ncand = mybook (
"ncand", 10, 0, 10)
419 if met.pt < args.met_cut:
return 1
423 if len (zlls) == 0:
return 1
427 if len (eles) + len (muos) + len (taujets) < 4:
return 1
432 parts = eles + muos + taujets
444 ztts = self.
find_ztt (parts, met, z, h.ztt)
446 for z2
in ztts: candlist.append ((z, z2))
450 if len (candlist) == 0:
return 1
452 h.ncand.Fill (len (candlist))
455 hzzs = self.
find_hzz (candlist, h.hzz)
468 def track_select (e):
470 return e.hasTrack()
and e.isEM()%16 == 0
474 return e.pt() > args.ele_pt_cut
and abs(e.eta()) < args.ele_eta_cut
479 eles = PyParticleTools.getElectrons (args.electron_container)
481 eles = [e
for e
in eles
if track_select (e)]
483 eles = [e
for e
in eles
if select (e)]
497 return m.pt() > args.muo_pt_cut
and abs(m.eta()) < args.muo_eta_cut
502 muos = PyParticleTools.getMuons (args.muon_container)
504 muos = [m
for m
in muos
if select (m)]
518 if (t.pt() < args.taujet_pt_cut
or
519 abs(t.eta()) > args.taujet_eta_cut):
522 if t.likelihood() < args.taujet_likeli_cut:
return 0
523 emfrac = t.etEM() / (t.etEM() + t.etHad())
524 if emfrac > args.taujet_max_emfrac:
return 0
530 taujets = PyParticleTools.getTauJets (args.taujet_container)
531 h.taujet0.fill (taujets)
532 taujets = [t
for t
in taujets
if select (t)]
533 h.taujet1.fill (taujets)
543 met = PyParticleTools.getMissingET (args.met_container)
544 h.metx.Fill (met.etx())
545 h.mety.Fill (met.ety())
546 met.pt = math.hypot (met.etx(), met.ety())
562 zlist = [Z (l1, l2)
for (l1,l2)
in combo.combinations (llist, 2)
563 if l1.charge()*l2.charge() < 0]
569 return (z.dr() < args.zll_deltar_cut
and
570 abs(z.m() - MZ) < args.zll_deltam_cut)
571 zlist = [z
for z
in zlist
if select (z)]
587 parts = [p
for p
in parts
if p
not in zll]
593 for (l1, l2)
in combo.combinations (parts, 2):
596 if l1.charge() * l2.charge() > 0:
continue
602 (nu1, nu2) = neutrinos_from_colinear_approximation (l1, l2,
614 return (z.dr() < args.ztt_deltar_cut
and
615 abs(z.m() - MZ) < args.ztt_deltam_cut)
616 zlist = [z
for z
in zlist
if select (z)]
632 hzzs = [Z (zll, ztt, PDG.Higgs0)
for (zll, ztt)
in candlist]
637 return hg.dr() < args.hzz_deltar_cut
638 hzzs = [hg
for hg
in hzzs
if select (hg)]