forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cms-sw#85 from CERN-PH-CMG/80X
Update from 80X upstream
- Loading branch information
Showing
369 changed files
with
193,488 additions
and
14,968 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import PhysicsTools.HeppyCore.framework.config as cfg | ||
from PhysicsTools.HeppyCore.framework.config import printComps | ||
from PhysicsTools.HeppyCore.framework.heppy_loop import getHeppyOption | ||
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events | ||
|
||
from CMGTools.RootTools.samples.ComponentCreator import ComponentCreator | ||
|
||
from CMGTools.H2TauTau.proto.analyzers.TauHLTAnalyzer import TauHLTAnalyzer | ||
from CMGTools.H2TauTau.proto.analyzers.HLTTauTreeProducer import HLTTauTreeProducer | ||
|
||
production = getHeppyOption('production', True) | ||
|
||
c = ComponentCreator() | ||
# ggH135_0 = c.makeMCComponentFromEOS('ggH135_rawaod', 'ggH135_rawaod', '/store/group/phys_higgs/cmshtt/steggema/HPSatHLTv5/GluGluHToTauTau_M125_13TeV_powheg_pythia8/TauHPSatHLTFine/161117_103941/0000/') | ||
# ggH135_1 = c.makeMCComponentFromEOS('ggH135_rawaod', 'ggH135_rawaod', '/store/group/phys_higgs/cmshtt/steggema/HPSatHLTv5/GluGluHToTauTau_M125_13TeV_powheg_pythia8/TauHPSatHLTFine/161117_103941/0001/') | ||
|
||
|
||
ggH135_0 = c.makeMCComponentFromEOS('ggH135_rawaod', 'ggH135_rawaod', '/store/group/phys_tau/HLT2016/HPSatHLT/GluGluHToTauTau_M125_13TeV_powheg_pythia8/HPSatHLT/161206_134434/0000/') | ||
ggH135_1 = c.makeMCComponentFromEOS('ggH135_rawaod_2', 'ggH135_rawaod', '/store/group/phys_tau/HLT2016/HPSatHLT/GluGluHToTauTau_M125_13TeV_powheg_pythia8/HPSatHLT/161206_134434/0001/') | ||
|
||
|
||
selectedComponents = [ggH135_0, ggH135_1] | ||
|
||
|
||
tauHLTAna = cfg.Analyzer( | ||
TauHLTAnalyzer, | ||
name='TauHLTAnalyzer', | ||
) | ||
|
||
tauHLTTree = cfg.Analyzer( | ||
HLTTauTreeProducer, | ||
name='HLTTauTreeProducer' | ||
) | ||
|
||
sequence = cfg.Sequence([ | ||
tauHLTAna, | ||
tauHLTTree | ||
]) | ||
|
||
|
||
if not production: | ||
selectedComponents = selectedComponents[:1] | ||
for comp in selectedComponents: | ||
comp.splitFactor = 1 | ||
comp.fineSplitFactor = 1 | ||
# comp.files = comp.files[:1] | ||
else: | ||
for comp in selectedComponents: | ||
comp.splitFactor = 200 | ||
|
||
config = cfg.Config(components=selectedComponents, | ||
sequence=sequence, | ||
services=[], | ||
events_class=Events | ||
) | ||
|
||
printComps(config.components, True) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
from PhysicsTools.HeppyCore.utils.deltar import deltaR | ||
from PhysicsTools.Heppy.physicsutils.TauDecayModes import tauDecayModes | ||
from CMGTools.H2TauTau.proto.analyzers.TauGenTreeProducer import TauGenTreeProducer | ||
from CMGTools.H2TauTau.proto.analyzers.H2TauTauTreeProducerBase import H2TauTauTreeProducerBase | ||
|
||
class HLTTauTreeProducer(H2TauTauTreeProducerBase): | ||
''' Tree producer for tau POG study. | ||
''' | ||
|
||
def __init__(self, *args): | ||
super(HLTTauTreeProducer, self).__init__(*args) | ||
|
||
def declareHandles(self): | ||
super(HLTTauTreeProducer, self).declareHandles() | ||
|
||
|
||
def bookTau(self, tau_name): | ||
self.bookParticle(self.tree, tau_name) | ||
self.bookGenParticle(self.tree, tau_name+'_gen') | ||
self.var(self.tree, 'tau_gen_decayMode') | ||
|
||
for var in ['ptSumIso', 'chargedPtSumIso', 'chargedPUPtSumIso', 'gammaPtSumIso', 'neutralPtSumIso', 'ptSumSignal', 'chargedCandsPtSumSignal', 'gammaCandsPtSumSignal', 'neutralCandsPtSumSignal', 'dm', 'loose_db_iso', 'nphotons', 'decayMode']: | ||
self.var(self.tree, '_'.join([tau_name, var])) | ||
|
||
def fillTau(self, tau, tau_name): | ||
self.fillParticle(self.tree, tau_name, tau) | ||
if tau.genp: | ||
self.fillGenParticle(self.tree, tau_name+'_gen', tau.genp) | ||
if abs(tau.genp.pdgId()) == 15: | ||
self.fill(self.tree, 'tau_gen_decayMode', tauDecayModes.genDecayModeInt(tau.genp.daughters)) | ||
|
||
print 'From final daughters', tauDecayModes.genDecayModeInt(tau.genp.daughters) | ||
|
||
|
||
for var in ['ptSumIso', 'chargedPtSumIso', 'chargedPUPtSumIso', 'gammaPtSumIso', 'neutralPtSumIso', 'ptSumSignal', 'chargedCandsPtSumSignal', 'gammaCandsPtSumSignal', 'neutralCandsPtSumSignal', 'dm', 'loose_db_iso', 'nphotons']: | ||
try: | ||
self.fill(self.tree, '_'.join([tau_name, var]), getattr(tau, var)) | ||
except TypeError: | ||
import pdb; pdb.set_trace() | ||
for var in ['decayMode']: | ||
try: | ||
self.fill(self.tree, '_'.join([tau_name, var]), getattr(tau, var)()) | ||
except TypeError: | ||
import pdb; pdb.set_trace() | ||
|
||
def declareVariables(self, setup): | ||
self.bookTau('tau') | ||
self.bookTau('hlt_tau') | ||
self.bookTau('hlt_single_tau') | ||
self.var(self.tree, 'rho') | ||
|
||
def process(self, event): | ||
# needed when doing handle.product(), goes back to | ||
# PhysicsTools.Heppy.analyzers.core.Analyzer | ||
self.readCollections(event.input) | ||
|
||
if not eval(self.skimFunction): | ||
return False | ||
|
||
|
||
hlt_taus = [tau for tau in event.hlt_taus] # it's a vector | ||
hlt_single_taus = [tau for tau in event.hlt_single_taus] # it's a vector | ||
for tau in event.taus: | ||
self.tree.reset() | ||
|
||
self.fill(self.tree, 'rho', event.rho) | ||
|
||
if tau.pt() < 20.: | ||
continue | ||
self.fillTau(tau, 'tau') | ||
|
||
for hlt_tau in hlt_taus: | ||
if deltaR(tau, hlt_tau) < 0.3: | ||
self.fillTau(hlt_tau, 'hlt_tau') | ||
hlt_taus.remove(hlt_tau) | ||
break | ||
|
||
for hlt_tau in hlt_single_taus: | ||
if deltaR(tau, hlt_tau) < 0.3: | ||
self.fillTau(hlt_tau, 'hlt_single_tau') | ||
hlt_single_taus.remove(hlt_tau) | ||
break | ||
|
||
|
||
self.fillTree(event) | ||
|
||
for hlt_tau in hlt_taus: | ||
self.tree.reset() | ||
self.fill(self.tree, 'rho', event.rho) | ||
|
||
if hlt_tau.pt() < 20.: | ||
continue | ||
self.fillTau(hlt_tau, 'hlt_tau') | ||
for single_tau in hlt_single_taus: | ||
if deltaR(single_tau, hlt_tau) < 0.3: | ||
self.fillTau(single_tau, 'hlt_single_tau') | ||
hlt_single_taus.remove(single_tau) | ||
break | ||
self.fillTree(event) | ||
|
||
for hlt_tau in hlt_single_taus: | ||
self.tree.reset() | ||
self.fill(self.tree, 'rho', event.rho) | ||
|
||
if hlt_tau.pt() < 20.: | ||
continue | ||
self.fillTau(hlt_tau, 'hlt_single_tau') | ||
self.fillTree(event) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.