Skip to content

Commit

Permalink
clean up ID in Z skimmer
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadalfonso committed Feb 13, 2015
1 parent 47411fc commit f09dd7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions CMGTools/TTHAnalysis/cfg/run_susyMT2_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@
# Tree Producer
ttHZskim = cfg.Analyzer(
ttHmllSkimmer, name='ttHmllSkimmer',
lepId=13,
lepId=[13],
maxLeps=3,
intPDG=13,
massMin=60,
massMax=120,
doZGen = False,
Expand Down Expand Up @@ -199,7 +198,6 @@
## 25 ns ttbar PHYS14
# comp = TTJets
# comp.files = comp.files[:1]

# comp=TTJets
# comp.files = ['/afs/cern.ch/work/d/dalfonso/public/ttjets_miniaodsim_00C90EFC-3074-E411-A845-002590DB9262.root']
comp=GJets_HT200to400
Expand Down
8 changes: 4 additions & 4 deletions CMGTools/TTHAnalysis/python/analyzers/ttHmllSkimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def beginLoop(self,setup):
count.register('pass gen Zll skim')
count.register('pass reco Zll skim')

def makeZs(self, event, maxLeps, intPDG):
def makeZs(self, event, maxLeps, lepId):
event.bestZ = [ 0., -1,-1 ]
nlep = len(event.selectedLeptons)
for i,l1 in enumerate(event.selectedLeptons):
for j in range(i+1,nlep):
if j >= maxLeps: break
l2 = event.selectedLeptons[j]
if l1.pdgId() == -l2.pdgId() and abs(l1.pdgId())==intPDG:
if l1.pdgId() == -l2.pdgId() and abs(l1.pdgId()) in lepId:
zmass = (l1.p4() + l2.p4()).M()
if event.bestZ[0] == 0 or abs(zmass - 91.188) < abs(event.bestZ[0] - 91.188):
event.bestZ = [ zmass, i, j ]
Expand All @@ -35,13 +35,13 @@ def process(self, event):
self.counters.counter('events').inc('all events')

if self.cfg_ana.doZGen and len(event.genleps)==2:
if(event.genleps[0].pdgId() == - event.genleps[1].pdgId()) and abs(event.genleps[0].pdgId())==self.cfg_ana.lepId :
if event.genleps[0].pdgId() == - event.genleps[1].pdgId() and abs(event.genleps[0].pdgId()) in self.cfg_ana.lepId :
if (event.genleps[0].sourceId==23 and event.genleps[1].sourceId==23) :
self.counters.counter('events').inc('pass gen Zll skim')
return True

if self.cfg_ana.doZReco:
self.makeZs( event, self.cfg_ana.maxLeps, self.cfg_ana.intPDG)
self.makeZs( event, self.cfg_ana.maxLeps, self.cfg_ana.lepId)
if event.bestZ[0] > self.cfg_ana.massMin and event.bestZ[0] < self.cfg_ana.massMax:
self.counters.counter('events').inc('pass reco Zll skim')
return True
Expand Down

0 comments on commit f09dd7c

Please sign in to comment.