Skip to content

Commit

Permalink
Merge pull request cms-sw#75 from jpata/tth-vhbb-743
Browse files Browse the repository at this point in the history
Replace PR cms-sw#67 on 74X branch
  • Loading branch information
arizzi committed Jun 23, 2015
2 parents 73a76c2 + dce30a6 commit 1d779cc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
16 changes: 16 additions & 0 deletions VHbbAnalysis/Heppy/python/vhbbobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@
NTupleVariable("mult", lambda x : getattr(x,'mult', 0) , int, mcOnly=False,help="QG input variable: total multiplicity"),
NTupleVariable("numberOfDaughters", lambda x : x.numberOfDaughters(), int, mcOnly=False,help="number of daughters"),
])

#add per-jet b-tag systematic weight
from PhysicsTools.Heppy.physicsutils.BTagWeightCalculator import BTagWeightCalculator
bweightcalc = BTagWeightCalculator("csv/csv_rwt_hf_IT_FlatSF.root", "csv/csv_rwt_lf_IT_FlatSF.root")
for syst in ["JES", "LF", "HF", "Stats1", "Stats2"]:
for sdir in ["Up", "Down"]:
jetTypeVHbb.variables += [NTupleVariable("bTagWeight"+syst+sdir,
lambda jet, sname=syst+sdir,bweightcalc=bweightcalc: bweightcalc.calcJetWeight(
jet, kind="final", systematic=sname
), float, mcOnly=True, help="b-tag CSV weight, variating "+syst + " "+sdir
)]
jetTypeVHbb.variables += [NTupleVariable("bTagWeight",
lambda jet, bweightcalc=bweightcalc: bweightcalc.calcJetWeight(
jet, kind="final", systematic="nominal",
), float, mcOnly=True, help="b-tag CSV weight, nominal"
)]

##------------------------------------------
## FAT JET
Expand Down
1 change: 1 addition & 0 deletions VHbbAnalysis/Heppy/test/vhbb-combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
sequence.insert(sequence.index(VHbb),TauGenJet)

treeProducer.collections["tauGenJets"] = NTupleCollection("GenHadTaus", genTauJetType, 15, help="Generator level hadronic tau decays")
treeProducer.collections["genJetsHadronMatcher"] = NTupleCollection("GenJet", genJetType, 15, help="Generated jets with hadron matching, sorted by pt descending",filter=lambda x: x.pt() > 20,mcOnly=True)

# Run Everything

Expand Down
4 changes: 0 additions & 4 deletions VHbbAnalysis/Heppy/test/vhbb.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@

#dump of gen objects
#"genJets" : NTupleCollection("GenJet", genParticleType, 15, help="Generated jets with hadron matching, sorted by pt descending",filter=lambda x: x.pt() > 20,mcOnly=True),
"genJetsHadronMatcher" : NTupleCollection("GenJet", genJetType, 15, help="Generated jets with hadron matching, sorted by pt descending",filter=lambda x: x.pt() > 20,mcOnly=True),
"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"),
Expand All @@ -103,9 +102,6 @@
shifted_mets = {mk: NTupleObject(nm, shiftedMetType, help="PF E_{T}^{miss}, after default type 1 corrections, shifted with %s" %mk) for mk,nm in zip(shifted_met_keys,shifted_met_names)}
treeProducer.globalObjects.update(shifted_mets)

#Set up b-tag re-weighting
from PhysicsTools.Heppy.physicsutils.BTagWeightCalculator import BTagWeightCalculator
bweightcalc = BTagWeightCalculator("csv/csv_rwt_hf_IT_FlatSF.root", "csv/csv_rwt_lf_IT_FlatSF.root")
btag_weights = {}
for syst in ["JES", "LF", "HF", "Stats1", "Stats2"]:
for sdir in ["Up", "Down"]:
Expand Down

0 comments on commit 1d779cc

Please sign in to comment.