From 96b19d816e4fc1d71077265a7f987834cb6ec271 Mon Sep 17 00:00:00 2001 From: Francesco Pandolfi Date: Thu, 17 Jul 2014 17:13:59 +0200 Subject: [PATCH 1/5] finished sync with americans (except MT2) --- .../TTHAnalysis/cfg/run_susyFullHad_cfg.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/CMGTools/TTHAnalysis/cfg/run_susyFullHad_cfg.py b/CMGTools/TTHAnalysis/cfg/run_susyFullHad_cfg.py index 175228ce53251..b7347f38d3a42 100644 --- a/CMGTools/TTHAnalysis/cfg/run_susyFullHad_cfg.py +++ b/CMGTools/TTHAnalysis/cfg/run_susyFullHad_cfg.py @@ -8,11 +8,28 @@ ##------------------------------------------ ## Redefine what I need ##------------------------------------------ +ttHLepAna.loose_muon_dxy = 0.5 +ttHLepAna.loose_muon_dz = 1.0 +ttHLepAna.loose_muon_relIso = 0.15 +ttHLepAna.loose_electron_id = "POG_Cuts_ID_2012_Veto" +ttHLepAna.loose_electron_pt = 5 +ttHLepAna.loose_electron_eta = 2.4 +ttHLepAna.loose_electron_dxy = 0.04 +ttHLepAna.loose_electron_dz = 0.2 +ttHLepAna.loose_electron_relIso = 0.15 +ttHLepAna.loose_electron_lostHits = 999 # no cut + # JET (do not apply the jetID and PUID yet) ttHJetAna.relaxJetId = True ttHJetAna.doPuId = False -ttHJetAna.jetEtaCentral = 2.5 +#ttHJetAna.jetEta = 5.2 +ttHJetAna.jetEtaCentral = 5.2 +ttHJetAna.jetPt = 10. +ttHJetAna.recalibrateJets = False +ttHJetAna.jetLepDR = 0.4 + +ttHJetMCAna.smearJets = False ##------------------------------------------ ## ISOLATED TRACK @@ -35,7 +52,7 @@ ##### MaxIsoSum = 0.1, MaxIsoSumEMU = 0.2, - doSecondVeto = True + doSecondVeto = False ) From ae5c98ff64baafa882e324bb7dd5194c32a60ab4 Mon Sep 17 00:00:00 2001 From: Francesco Pandolfi Date: Thu, 17 Jul 2014 17:14:42 +0200 Subject: [PATCH 2/5] removed abs from partonFlavor, added motherID and grandmaID to genparticles --- CMGTools/TTHAnalysis/python/analyzers/ntupleTypes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMGTools/TTHAnalysis/python/analyzers/ntupleTypes.py b/CMGTools/TTHAnalysis/python/analyzers/ntupleTypes.py index 8c3e4c59e757d..6823645ef5e61 100644 --- a/CMGTools/TTHAnalysis/python/analyzers/ntupleTypes.py +++ b/CMGTools/TTHAnalysis/python/analyzers/ntupleTypes.py @@ -124,7 +124,7 @@ NTupleVariable("btagCSV", lambda x : x.btag('combinedSecondaryVertexBJetTags'), help="CSV discriminator"), NTupleVariable("rawPt", lambda x : x.pt() * x.rawFactor(), help="p_{T} before JEC"), NTupleVariable("mcPt", lambda x : x.mcJet.pt() if x.mcJet else 0., mcOnly=True, help="p_{T} of associated gen jet"), - NTupleVariable("mcFlavour", lambda x : abs(x.partonFlavour()), int, mcOnly=True, help="parton flavour (physics definition, i.e. including b's from shower)"), + NTupleVariable("mcFlavour", lambda x : x.partonFlavour(), int, mcOnly=True, help="parton flavour (physics definition, i.e. including b's from shower)"), #NTupleVariable("quarkGluonID", lambda x : x.QG, mcOnly=False), ]) jetTypeTTH = NTupleObjectType("jetTTH", baseObjectTypes = [ jetType ], variables = [ @@ -158,6 +158,8 @@ NTupleVariable("sourceId", lambda x : x.sourceId, int, help="origin of the particle: 6=t, 25=h, 23/24=W/Z") ]) genParticleWithMotherId = NTupleObjectType("genParticleWithMotherId", baseObjectTypes = [ genParticleType ], mcOnly=True, variables = [ - NTupleVariable("motherId", lambda x : x.motherId, int, help="pdgId of the mother of the particle") + #NTupleVariable("motherId", lambda x : x.motherId, int, help="pdgId of the mother of the particle") + NTupleVariable("motherId", lambda x : x.mother(0).pdgId() if x.mother(0) else 0, int, help="pdgId of the mother of the particle"), + NTupleVariable("grandmaId", lambda x : x.mother(0).mother(0).pdgId() if x.mother(0) and x.mother(0).mother(0) else 0, int, help="pdgId of the grandmother of the particle") ]) From a127267178d8f813a77d5fa259e5cf841510e7d0 Mon Sep 17 00:00:00 2001 From: Francesco Pandolfi Date: Thu, 17 Jul 2014 17:15:34 +0200 Subject: [PATCH 3/5] now ht/mht computed with objects40jc, and increased max size of collections, added genparticles --- .../python/analyzers/treeProducerSusyFullHad.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/CMGTools/TTHAnalysis/python/analyzers/treeProducerSusyFullHad.py b/CMGTools/TTHAnalysis/python/analyzers/treeProducerSusyFullHad.py index 79cc83dc8b5e5..19514671ef419 100644 --- a/CMGTools/TTHAnalysis/python/analyzers/treeProducerSusyFullHad.py +++ b/CMGTools/TTHAnalysis/python/analyzers/treeProducerSusyFullHad.py @@ -15,13 +15,13 @@ def __init__(self, cfg_ana, cfg_comp, looperName): NTupleVariable("nBJetLoose40", lambda ev: sum([j.btagWP("CSVL") for j in ev.cleanJets if j.pt() > 40]), int, help="Number of jets with pt > 40 passing CSV medium"), - NTupleVariable("ht", lambda ev : ev.htJet40j, help="H_{T} computed from only jets (with |eta|<2.4, pt > 40 GeV)"), + NTupleVariable("ht", lambda ev : ev.htJet40jc, help="H_{T} computed from only jets (with |eta|<2.5, pt > 40 GeV)"), NTupleVariable("deltaPhiMin", lambda ev : ev.deltaPhiMin, help="minimal deltaPhi between the MET and the four leading jets with pt>40 and eta<2.4"), NTupleVariable("diffMetMht", lambda ev : ev.diffMetMht, help="abs( vec(mht) - vec(met) )"), - NTupleVariable("mht_pt", lambda ev : ev.mhtJet40j, help="H_{T}^{miss} computed from only jets (with |eta|<2.4, pt > 40 GeV)"), - NTupleVariable("mht_phi", lambda ev : ev.mhtPhiJet40j, help="H_{T}^{miss} #phi computed from onlyy jets (with |eta|<2.4, pt > 40 GeV)"), + NTupleVariable("mht_pt", lambda ev : ev.mhtJet40jc, help="H_{T}^{miss} computed from only jets (with |eta|<2.5, pt > 40 GeV)"), + NTupleVariable("mht_phi", lambda ev : ev.mhtPhiJet40jc, help="H_{T}^{miss} #phi computed from onlyy jets (with |eta|<2.5, pt > 40 GeV)"), ##-------------------------------------------------- NTupleVariable("nMuons10", lambda ev: sum([l.pt() > 10 and abs(l.pdgId()) == 13 for l in ev.inclusiveLeptons]), int, help="Number of muons with pt > 10"), NTupleVariable("nElectrons10", lambda ev: sum([l.pt() > 10 and abs(l.pdgId()) == 11 for l in ev.inclusiveLeptons]), int, help="Number of electrons with pt > 10"), @@ -56,10 +56,11 @@ def __init__(self, cfg_ana, cfg_comp, looperName): }) self.collections.update({ # put more here - "inclusiveLeptons" : NTupleCollection("lep", leptonTypeSusy, 8, help="Leptons after the preselection", filter=lambda l : l.pt()>10 ), - #"inclusiveLeptonsCuts" : NTupleCollection("lep", leptonTypeSusy, 8, help="Leptons after the preselection", filter=lambda l : l.pt()>10 ), - "cleanJetsAll" : NTupleCollection("jet", jetTypeSusy, 8, help="all jets after full selection and cleaning, sorted by pt"), - "allphotons" : NTupleCollection("gamma", photonTypeSusy, 5, help="all photons"), + #"inclusiveLeptons" : NTupleCollection("lep", leptonTypeSusy, 8, help="Leptons after the preselection", filter=lambda l : l.pt()>10 ), + "selectedLeptons" : NTupleCollection("lep", leptonTypeSusy, 50, help="Leptons after the preselection", filter=lambda l : l.pt()>10 ), + "cleanJetsAll" : NTupleCollection("jet", jetTypeSusy, 150, help="all jets after full selection and cleaning, sorted by pt", filter=lambda j : j.jetID("POG_PFID")>0), + "allphotons" : NTupleCollection("gamma", photonTypeSusy, 50, help="all photons"), + "genParticles" : NTupleCollection("genPart", genParticleWithMotherId, 200, help="all pruned genparticles"), }) ## Book the variables, but only if we're called explicitly and not through a base class From ff93ba203ea42a0684edd95c43655c0eae92e90b Mon Sep 17 00:00:00 2001 From: Francesco Pandolfi Date: Thu, 17 Jul 2014 17:16:06 +0200 Subject: [PATCH 4/5] fixed mht computation (added minus sign) and added objects40jc --- .../python/analyzers/ttHCoreEventAnalyzer.py | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/CMGTools/TTHAnalysis/python/analyzers/ttHCoreEventAnalyzer.py b/CMGTools/TTHAnalysis/python/analyzers/ttHCoreEventAnalyzer.py index a95b4fce96b9e..f37bcab39b711 100644 --- a/CMGTools/TTHAnalysis/python/analyzers/ttHCoreEventAnalyzer.py +++ b/CMGTools/TTHAnalysis/python/analyzers/ttHCoreEventAnalyzer.py @@ -164,27 +164,33 @@ def process(self, iEvent, event): objects30 = [ j for j in event.cleanJets if j.pt() > 30 ] + event.selectedLeptons objects40 = [ j for j in event.cleanJets if j.pt() > 40 ] + event.selectedLeptons objects40j = [ j for j in event.cleanJets if j.pt() > 40 ] + objects40jc = [ j for j in event.cleanJets if j.pt() > 40 and abs(j.eta())<2.5 ] event.htJet25 = sum([x.pt() for x in objects25]) - event.mhtJet25vec = ROOT.reco.Particle.LorentzVector(sum([x.px() for x in objects25]) , sum([x.py() for x in objects25]), 0, 0 ) + event.mhtJet25vec = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects25])) , -1.*(sum([x.py() for x in objects25])), 0, 0 ) event.mhtPhiJet25 = event.mhtJet25vec.phi() event.mhtJet25 = event.mhtJet25vec.pt() event.htJet30 = sum([x.pt() for x in objects30]) - event.mhtJet30vec = ROOT.reco.Particle.LorentzVector(sum([x.px() for x in objects30]) , sum([x.py() for x in objects30]), 0, 0 ) + event.mhtJet30vec = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects30])) , -1.*(sum([x.py() for x in objects30])), 0, 0 ) event.mhtJet30 = event.mhtJet30vec.pt() event.mhtPhiJet30 = event.mhtJet30vec.phi() event.htJet40 = sum([x.pt() for x in objects40]) - event.mhtJet40vec = ROOT.reco.Particle.LorentzVector(sum([x.px() for x in objects40]) , sum([x.py() for x in objects40]), 0, 0 ) + event.mhtJet40vec = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects40])) , -1.*(sum([x.py() for x in objects40])), 0, 0 ) event.mhtJet40 = event.mhtJet40vec.pt() event.mhtPhiJet40 = event.mhtJet40vec.phi() event.htJet40j = sum([x.pt() for x in objects40j]) - event.mhtJet40jvec = ROOT.reco.Particle.LorentzVector(sum([x.px() for x in objects40j]) , sum([x.py() for x in objects40j]), 0, 0 ) + event.mhtJet40jvec = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects40j])) , -1.*(sum([x.py() for x in objects40j])), 0, 0 ) event.mhtJet40j = event.mhtJet40jvec.pt() event.mhtPhiJet40j = event.mhtJet40jvec.phi() + event.htJet40jc = sum([x.pt() for x in objects40jc]) + event.mhtJet40jcvec = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects40jc])) , -1.*(sum([x.py() for x in objects40jc])), 0, 0 ) + event.mhtJet40jc = event.mhtJet40jcvec.pt() + event.mhtPhiJet40jc = event.mhtJet40jcvec.phi() + ## same but with all eta range objects25a = [ j for j in event.cleanJetsAll if j.pt() > 25 ] + event.selectedLeptons objects30a = [ j for j in event.cleanJetsAll if j.pt() > 30 ] + event.selectedLeptons @@ -192,22 +198,22 @@ def process(self, iEvent, event): objects40ja = [ j for j in event.cleanJetsAll if j.pt() > 40 ] event.htJet25a = sum([x.pt() for x in objects25a]) - event.mhtJet25veca = ROOT.reco.Particle.LorentzVector(sum([x.px() for x in objects25a]) , sum([x.py() for x in objects25a]), 0, 0 ) + event.mhtJet25veca = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects25a])) , -1.*(sum([x.py() for x in objects25a])), 0, 0 ) event.mhtPhiJet25a = event.mhtJet25veca.phi() event.mhtJet25a = event.mhtJet25veca.pt() event.htJet30a = sum([x.pt() for x in objects30a]) - event.mhtJet30veca = ROOT.reco.Particle.LorentzVector(sum([x.px() for x in objects30a]) , sum([x.py() for x in objects30a]), 0, 0 ) + event.mhtJet30veca = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects30a])) , -1.*(sum([x.py() for x in objects30a])), 0, 0 ) event.mhtJet30a = event.mhtJet30veca.pt() event.mhtPhiJet30a = event.mhtJet30veca.phi() event.htJet40a = sum([x.pt() for x in objects40a]) - event.mhtJet40veca = ROOT.reco.Particle.LorentzVector(sum([x.px() for x in objects40a]) , sum([x.py() for x in objects40a]), 0, 0 ) + event.mhtJet40veca = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects40a])) , -1.*(sum([x.py() for x in objects40a])), 0, 0 ) event.mhtJet40a = event.mhtJet40veca.pt() event.mhtPhiJet40a = event.mhtJet40veca.phi() event.htJet40ja = sum([x.pt() for x in objects40ja]) - event.mhtJet40jveca = ROOT.reco.Particle.LorentzVector(sum([x.px() for x in objects40ja]) , sum([x.py() for x in objects40ja]), 0, 0 ) + event.mhtJet40jveca = ROOT.reco.Particle.LorentzVector(-1.*(sum([x.px() for x in objects40ja])) , -1.*(sum([x.py() for x in objects40ja])), 0, 0 ) event.mhtJet40ja = event.mhtJet40jveca.pt() event.mhtPhiJet40ja = event.mhtJet40jveca.phi() @@ -219,7 +225,7 @@ def process(self, iEvent, event): # look for minimal deltaPhi between MET and four leading jets with pt>40 and eta<2.4 event.deltaPhiMin = 999. - for n,j in enumerate(event.cleanJets): + for n,j in enumerate(objects40jc): if n>3: break thisDeltaPhi = abs( deltaPhi( j.phi(), event.met.phi() ) ) if thisDeltaPhi < event.deltaPhiMin : event.deltaPhiMin = thisDeltaPhi @@ -232,7 +238,7 @@ def process(self, iEvent, event): # absolute value of the vectorial difference between met and mht - diffMetMht_vec = ROOT.reco.Particle.LorentzVector(event.mhtJet40jvec.px()-event.met.px(), event.mhtJet40jvec.py()-event.met.py(), 0, 0 ) + diffMetMht_vec = ROOT.reco.Particle.LorentzVector(event.mhtJet40jcvec.px()-event.met.px(), event.mhtJet40jcvec.py()-event.met.py(), 0, 0 ) event.diffMetMht = sqrt( diffMetMht_vec.px()*diffMetMht_vec.px() + diffMetMht_vec.py()*diffMetMht_vec.py() ) return True From c6231d4abb38944cd17e6d8b3d7eaadb8b2821cb Mon Sep 17 00:00:00 2001 From: Francesco Pandolfi Date: Thu, 17 Jul 2014 17:16:31 +0200 Subject: [PATCH 5/5] deltaR matching reco-gen jets set to 0.3 --- .../TTHAnalysis/python/analyzers/ttHJetMCMatchAnalyzer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMGTools/TTHAnalysis/python/analyzers/ttHJetMCMatchAnalyzer.py b/CMGTools/TTHAnalysis/python/analyzers/ttHJetMCMatchAnalyzer.py index 2ae2edbb0d7ca..b9a0aa6800529 100644 --- a/CMGTools/TTHAnalysis/python/analyzers/ttHJetMCMatchAnalyzer.py +++ b/CMGTools/TTHAnalysis/python/analyzers/ttHJetMCMatchAnalyzer.py @@ -57,7 +57,7 @@ def isFlavour(x,f): def matchJets(self, event): match = matchObjectCollection2(event.cleanJetsAll, event.genbquarks + event.genwzquarks, - deltaRMax = 0.5) + deltaRMax = 0.3) for jet in event.cleanJetsAll: gen = match[jet] jet.mcParton = gen @@ -66,7 +66,7 @@ def matchJets(self, event): match = matchObjectCollection2(event.cleanJetsAll, event.genJets, - deltaRMax = 0.5) + deltaRMax = 0.3) for jet in event.cleanJetsAll: jet.mcJet = match[jet]