Skip to content

Commit

Permalink
update VBF soft activity and remove hjets/ajets leaving only indices. c…
Browse files Browse the repository at this point in the history
…loses cms-sw#33 and closes cms-sw#30
  • Loading branch information
arizzi committed Apr 2, 2015
1 parent 3b6450b commit f5f2eab
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
9 changes: 4 additions & 5 deletions VHbbAnalysis/Heppy/python/VHbbAnalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def doSoftActivity(self,event) :
event.bJetsForVBF=sorted(event.jetsForVBF,key = lambda jet : jet.btag('combinedInclusiveSecondaryVertexV2BJetTags'), reverse=True)[:2]
j1=event.bJetsForVBF[0]
j2=event.bJetsForVBF[1]
dRbb = deltaR(j1.eta(),j1.phi(),j2.eta(),j2.phi())
event.pfCands = list(self.handles['pfCands'].product())
inputs=ROOT.std.vector(ROOT.heppy.ReclusterJets.LorentzVector)()
used=[]
Expand All @@ -64,14 +65,12 @@ def doSoftActivity(self,event) :
remainingPF = [x for x in event.pfCands if x.charge() != 0 and abs(x.eta()) < 2.5 and x.pt() > 0.3 and x.fromPV() >=2 and x not in used]
etaMin = min(event.jetsForVBF,key=lambda x:x.eta()).eta()+0.4
etaMax = max(event.jetsForVBF,key=lambda x:x.eta()).eta()-0.4
focalDistance = deltaR(j1.eta(),j1.phi(),j2.eta(),j2.phi())
ellipseBhalf = 0.4
ellipseDis = 2.*sqrt(ellipseBhalf**2+focalDistance/2.)
dR0=0.4
for pf in remainingPF :
if pf.eta() > etaMin and pf.eta() < etaMax:
# if pf.eta() > etaMin and pf.eta() < etaMax:
dr1=deltaR(j1.eta(),j1.phi(),pf.eta(),pf.phi())
dr2=deltaR(j2.eta(),j2.phi(),pf.eta(),pf.phi())
if dr1+dr2 > ellipseDis:
if dr1+dr2 > dRbb + 2*dR0:
inputs.push_back(pf.p4())
clusterizer=ROOT.heppy.ReclusterJets(inputs,-1,0.4)
jets=clusterizer.getGrouping(1)
Expand Down
4 changes: 3 additions & 1 deletion VHbbAnalysis/Heppy/test/vhbb-combined.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#! /usr/bin/env python

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor

from vhbb import *
Expand Down Expand Up @@ -44,7 +46,7 @@
config.preprocessor=preprocessor
if __name__ == '__main__':
from PhysicsTools.HeppyCore.framework.looper import Looper
looper = Looper( 'Loop', config, nPrint = 1, nEvents = 200)
looper = Looper( 'Loop', config, nPrint = 1, nEvents = 1000)
import time
import cProfile
p = cProfile.Profile(time.clock)
Expand Down
31 changes: 16 additions & 15 deletions VHbbAnalysis/Heppy/test/vhbb.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
NTupleVariable("lheV_pt", lambda ev: ev.lheV_pt, float,mcOnly=True, help="Vector pT at LHE level"),
NTupleVariable("lheHT", lambda ev: ev.lheHT, float,mcOnly=True, help="HT at LHE level"),
NTupleVariable("genTTHtoTauTauDecayMode", lambda ev: ev.genTTHtoTauTauDecayMode, int,mcOnly=True, help="gen level ttH, H -> tautau decay mode"),
NTupleVariable("totSoftActivityJets", lambda ev: len(ev.softActivityJets), int, help="gen level ttH, H -> tautau decay mode"),
NTupleVariable("totSoftActivityJets", lambda ev: len([ x for x in ev.softActivityJets if x.pt()> 2 ] ), int, help="number of jets from soft activity with pt>2Gev"),
],
globalObjects = {
"met" : NTupleObject("met", metType, help="PF E_{T}^{miss}, after default type 1 corrections"),
Expand All @@ -55,33 +55,34 @@
#old style stuff, can be removed at some point
"vLeptons" : NTupleCollection("vLeptons", leptonTypeVHbb, 8, help="Leptons after the preselection"),
"aLeptons" : NTupleCollection("aLeptons", leptonTypeVHbb, 8, help="Additional leptons, not passing the preselection"),
"hJets" : NTupleCollection("hJets", jetTypeVHbb, 8, sortDescendingBy = lambda jet : jet.btag('combinedSecondaryVertexBJetTags'),help="Higgs jets"),
"aJets" : NTupleCollection("aJets", jetTypeVHbb, 8, sortDescendingBy = lambda jet : jet.btag('combinedSecondaryVertexBJetTags'),help="Additional jets"),
# now store only indices, this lines are left commented for possible debugging
# "hJets" : NTupleCollection("hJets", jetTypeVHbb, 8, sortDescendingBy = lambda jet : jet.btag('combinedSecondaryVertexBJetTags'),help="Higgs jets"),
# "aJets" : NTupleCollection("aJets", jetTypeVHbb, 8, sortDescendingBy = lambda jet : jet.btag('combinedSecondaryVertexBJetTags'),help="Additional jets"),

"hjidx" : NTupleCollection("hJidx", objectInt, 2,help="Higgs jet indices"),
"hjidxDiJetPtByCSV" : NTupleCollection("hJidx_sortcsv", objectInt, 2,help="Higgs jet indices within hJets with CSV sorting "),
"ajidx" : NTupleCollection("aJidx", objectInt, 2,help="additional jet indices"),
"ajidx" : NTupleCollection("aJidx", objectInt, 8,help="additional jet indices"),
"hjidxCSV" : NTupleCollection("hJCidx", objectInt, 2,help="Higgs jet indices CSV"),
"ajidxCSV" : NTupleCollection("aJCidx", objectInt, 2,help="additional jet indices CSV"),
"hjidx3cj" : NTupleCollection("hJ3Cidx", objectInt, 2,help="Higgs jet indices 3 cen jets"),
"ajidx3cj" : NTupleCollection("aJ3Cidx", objectInt, 2,help="additional jet indices 3 cen jets"),
"ajidxCSV" : NTupleCollection("aJCidx", objectInt, 8,help="additional jet indices CSV"),
"hjidx3cj" : NTupleCollection("hJ3Cidx", objectInt, 3,help="Higgs jet indices 3 cen jets"),
"ajidx3cj" : NTupleCollection("aJ3Cidx", objectInt, 8,help="additional jet indices 3 cen jets"),

"cleanJetsAll" : NTupleCollection("Jet", jetTypeVHbb, 15, help="Cental+fwd jets after full selection and cleaning, sorted by b-tag"),
"selectedTaus" : NTupleCollection("TauGood", tauTypeVHbb, 3, help="Taus after the preselection"),
"softActivityJets" : NTupleCollection("softActivityJets", fourVectorType, 5, help="jets made for soft activity"),

#dump of gen objects
"genJets" : NTupleCollection("GenJet", genParticleType, 15, help="Generated top quarks from hard scattering",filter=lambda x: x.pt() > 20,mcOnly=True),
"gentopquarks" : NTupleCollection("GenTop", genParticleType, 2, help="Generated top quarks from hard scattering"),
"gennusFromTop" : NTupleCollection("GenNuFromTop", genParticleType, 2, help="Generated neutrino from t->W decay"),
"genbquarksFromH" : NTupleCollection("GenBQuarkFromH", genParticleType, 2, help="Generated bottom quarks from Higgs decays"),
"genbquarksFromTop" : NTupleCollection("GenBQuarkFromTop", genParticleType, 2, help="Generated bottom quarks from top decays"),
"genbquarksFromHafterISR" : NTupleCollection("GenBQuarkFromHafterISR", genParticleType, 2, help="Generated bottom quarks from Higgs decays"),
"gentopquarks" : NTupleCollection("GenTop", genParticleType, 4, help="Generated top quarks from hard scattering"),
"gennusFromTop" : NTupleCollection("GenNuFromTop", genParticleType, 4, help="Generated neutrino from t->W decay"),
"genbquarksFromH" : NTupleCollection("GenBQuarkFromH", genParticleType, 4, help="Generated bottom quarks from Higgs decays"),
"genbquarksFromTop" : NTupleCollection("GenBQuarkFromTop", genParticleType, 4, help="Generated bottom quarks from top decays"),
"genbquarksFromHafterISR" : NTupleCollection("GenBQuarkFromHafterISR", genParticleType, 4, help="Generated bottom quarks from Higgs decays"),
"genwzquarks" : NTupleCollection("GenWZQuark", genParticleType, 6, help="Generated quarks from W/Z decays"),
"genleps" : NTupleCollection("GenLep", genParticleType, 2, help="Generated leptons from W/Z decays"),
"genlepsFromTop" : NTupleCollection("GenLepFromTop", genParticleType, 2, help="Generated leptons from t->W decays"),
"genleps" : NTupleCollection("GenLep", genParticleType, 4, help="Generated leptons from W/Z decays"),
"genlepsFromTop" : NTupleCollection("GenLepFromTop", genParticleType, 4, help="Generated leptons from t->W decays"),
"gentauleps" : NTupleCollection("GenLepFromTau", genParticleType, 6, help="Generated leptons from decays of taus from W/Z decays"),
"genHiggsBosons" : NTupleCollection("GenHiggsBoson", genParticleType, 2, help="Generated Higgs boson "),
"genHiggsBosons" : NTupleCollection("GenHiggsBoson", genParticleType, 4, help="Generated Higgs boson "),
#"genZbosonsToLL" : NTupleCollection("GenZbosonsToLL", genParticleType, 6, help="Generated W or Z bosons decaying to LL"),
#"genWbosonsToLL" : NTupleCollection("GenWbosonsToLL", genParticleType, 6, help="Generated W or Z bosons decaying to LL"),
"genvbosons" : NTupleCollection("GenVbosons", genParticleType, 6, help="Generated W or Z bosons, mass > 30"),
Expand Down

0 comments on commit f5f2eab

Please sign in to comment.