Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to heavy-ion jets in HI miniAOD #30898

Merged
merged 20 commits into from Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0e0c004
Switch to HI jets in PAT
mandrenguyen Jul 24, 2020
3705cca
Use addJetCollection
mandrenguyen Aug 24, 2020
9ee8b6c
Remove getattr and customizeHeavyIon function
mandrenguyen Aug 27, 2020
2c61949
moved customization to source configs, changed pfNoPileUpJMEHI to pfE…
mandrenguyen Aug 28, 2020
66c8f06
protect against missing slimmedJets collection
mandrenguyen Aug 28, 2020
c0b3282
Overwrite patjets instead of alias, various cleanups
mandrenguyen Sep 1, 2020
80e6f4c
more cleanup/reorganization
mandrenguyen Sep 2, 2020
5870179
modify patJets directly, rather than using addJetCollection
mandrenguyen Sep 3, 2020
0900429
use lowercase for names, use < 0 rather than > 9999
mandrenguyen Sep 13, 2020
3ae3fdd
Move patJet setup to producersLayer1 and deal with consequences in mi…
mandrenguyen Sep 14, 2020
ba9ab3a
add ES for self-consistency; remove updates of basicJetsForMetPuppi a…
slava77devel Sep 23, 2020
819db91
drop type specs
slava77devel Sep 23, 2020
d309260
fixed tabs
mandrenguyen Sep 23, 2020
d225fa1
define _hiGeneral = pp_on_AA_2018 | pp_on_PbPb_run3 for HI miniAOD; w…
slava77devel Sep 23, 2020
9f40285
disable puppi for packed cands in HI miniAOD
slava77devel Sep 23, 2020
9910559
fix missing addJetCollection
slava77devel Sep 23, 2020
7dda511
Cherry pick Slava's commits + address style comments
mandrenguyen Sep 24, 2020
81364a3
remove jet algo/radius for gen collections
mandrenguyen Sep 24, 2020
10ed6c8
Undo cloning of b-tagging sequences and other cleaning
mandrenguyen Sep 30, 2020
0fcdc06
use era for a few more parameters
mandrenguyen Oct 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions PhysicsTools/PatAlgos/python/mcMatchLayer0/jetFlavourId_cff.py
Expand Up @@ -41,3 +41,15 @@

patJetFlavourIdTask = cms.Task(patJetPartons, patJetFlavourAssociation)
patJetFlavourId = cms.Sequence(patJetFlavourIdTask)

from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3
(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetPartons, particles = "hiSignalGenParticles")
(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetFlavourAssociation,
jets = 'akCs4PFJets',
rParam = 0.4,
)
(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetPartonAssociationLegacy,
jets = "akCs4PFJets",
partons = "allPartons",
)
12 changes: 12 additions & 0 deletions PhysicsTools/PatAlgos/python/mcMatchLayer0/jetMatch_cfi.py
Expand Up @@ -27,4 +27,16 @@
resolveByMatchQuality = cms.bool(False), # False = just match input in order; True = pick lowest deltaR pair first
)

from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3
(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetGenJetMatch,
matched = 'ak4HiCleanedGenJets',
maxDeltaR = 0.4,
resolveByMatchQuality = True,
src = "akCs4PFJets",
)

(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetPartonMatch,
matched = "cleanedPartons",
src = "akCs4PFJets",
)
@@ -0,0 +1,13 @@
def removeL1FastJetJECs(process):
for label in process.producerNames().split():
module = getattr(process, label)
if module.type_() == "PATPFJetMETcorrInputProducer":
module.offsetCorrLabel = ''

def removeJECsForMC(process):
for label in process.producerNames().split():
module = getattr(process, label)
if module.type_() == "PATPFJetMETcorrInputProducer":
module.jetCorrLabel = 'Uncorrected'

process.basicJetsForMet.jetCorrLabel = 'Uncorrected'
71 changes: 59 additions & 12 deletions PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py
@@ -1,19 +1,66 @@
import FWCore.ParameterSet.Config as cms

from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cff import *
from RecoHI.HiJetAlgos.HiGenCleaner_cff import *
heavyIonCleaned = cms.Sequence(genPartons*hiPartons+heavyIonCleanedGenJets)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PhysicsTools/PatAlgos/python/producersHeavyIons apparently had some other support/development goals.
From a quick look (mostly in the commit history) it looks like it was built for support of data built with HI scenario,
with developments apparently stopped in 2010.

Is it appropriate to just locally replace some methods/files in this directory for the specific needs of pp_on_AA miniAOD?

BTW, for this file in particular, the added task names are rather different from the file name itself.
(without too much more in depth analysis) I'd suggest to make a new file.

If it were a general PAT case, the post-AOD module definitions would go to PhysicsTools/PatAlgos/python/recoLayer0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was no follow up to my comment here.
Please check/comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't have an answer to this. If the previous use of this file is deprecated, it seems ok to re-purpose it.

from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJets
from RecoHI.HiJetAlgos.HiGenCleaner_cff import hiPartons
from RecoHI.HiJetAlgos.HiGenJets_cff import ak4HiGenJets
from RecoHI.HiJetAlgos.HiGenCleaner_cff import heavyIonCleanedGenJets

makeHeavyIonJets = cms.Sequence(
patJetCorrections *

# pat and HI specifics
heavyIonCleaned *
patJetGenJetMatch *
patJetPartonMatch *
allPartons = cms.EDProducer(
"PartonSelector",
src = cms.InputTag('genParticles'),
withLeptons = cms.bool(False),
)

# object production
patJets
cleanedPartons = hiPartons.clone(
src = 'allPartons',
)

ak4HiCleanedGenJets = heavyIonCleanedGenJets.clone(src = "ak4HiGenJets")

cleanedGenJetsTask = cms.Task(
genParticlesForJets,
cleanedPartons,
ak4HiGenJets,
ak4HiCleanedGenJets
)

from RecoHI.HiJetAlgos.HiRecoPFJets_cff import PFTowers, pfEmptyCollection, ak4PFJetsForFlow, hiPuRho, hiFJRhoFlowModulation, akCs4PFJets
from RecoHI.HiTracking.highPurityGeneralTracks_cfi import highPurityGeneralTracks
from RecoJets.JetAssociationProducers.ak5JTA_cff import *
from RecoBTag.Configuration.RecoBTag_cff import impactParameterTagInfos, trackCountingHighEffBJetTags, trackCountingHighPurBJetTags, jetProbabilityBJetTags, jetBProbabilityBJetTags, secondaryVertexTagInfos, combinedSecondaryVertexV2BJetTags, simpleSecondaryVertexHighEffBJetTags, simpleSecondaryVertexHighPurBJetTags
ak5JetTracksAssociatorAtVertex
from RecoBTag.SecondaryVertex.simpleSecondaryVertex2TrkComputer_cfi import *
from RecoBTag.SecondaryVertex.simpleSecondaryVertex3TrkComputer_cfi import *
from RecoBTag.SecondaryVertex.combinedSecondaryVertexV2Computer_cfi import *
from RecoBTag.ImpactParameter.jetBProbabilityComputer_cfi import *
from RecoBTag.ImpactParameter.jetProbabilityComputer_cfi import *
from RecoBTag.ImpactParameter.trackCounting3D2ndComputer_cfi import *
from RecoBTag.ImpactParameter.trackCounting3D3rdComputer_cfi import *
from PhysicsTools.PatAlgos.recoLayer0.jetCorrFactors_cfi import *

recoPFJetsHIpostAODTask = cms.Task(
PFTowers,
pfEmptyCollection,
ak4PFJetsForFlow,
hiFJRhoFlowModulation,
hiPuRho,
highPurityGeneralTracks,
akCs4PFJets,
ak5JetTracksAssociatorAtVertex,
impactParameterTagInfos,
trackCountingHighEffBJetTags,
trackCountingHighPurBJetTags,
jetProbabilityBJetTags,
jetBProbabilityBJetTags,
secondaryVertexTagInfos,
combinedSecondaryVertexV2BJetTags,
simpleSecondaryVertexHighEffBJetTags,
simpleSecondaryVertexHighPurBJetTags,
patJetCorrFactors
)

recoJetsHIpostAODTask = cms.Task(
recoPFJetsHIpostAODTask,
allPartons,
cleanedGenJetsTask,
)
11 changes: 11 additions & 0 deletions PhysicsTools/PatAlgos/python/producersLayer1/jetProducer_cff.py
Expand Up @@ -17,6 +17,17 @@
patJetFlavourIdTask,
patJets
)

from PhysicsTools.PatAlgos.producersHeavyIons.heavyIonJets_cff import *
_makePatJetsTaskHI = cms.Task(
recoJetsHIpostAODTask,
makePatJetsTask.copy()
)

from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3
(pp_on_AA_2018 | pp_on_PbPb_run3).toReplaceWith(makePatJetsTask, _makePatJetsTaskHI)

makePatJets = cms.Sequence(makePatJetsTask)

from RecoBTag.ImpactParameter.pfImpactParameterTagInfos_cfi import * #pfImpactParameterTagInfos
Expand Down
23 changes: 23 additions & 0 deletions PhysicsTools/PatAlgos/python/producersLayer1/jetProducer_cfi.py
Expand Up @@ -99,4 +99,27 @@
resolutions = cms.PSet()
)

from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3
(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(_patJets,
jetSource = "akCs4PFJets",
genJetMatch = "patJetGenJetMatch",
genPartonMatch = "patJetPartonMatch",
JetFlavourInfoSource = "patJetFlavourAssociation",
JetPartonMapSource = "patJetFlavourAssociationLegacy",
jetCorrFactorsSource = ["patJetCorrFactors"],
trackAssociationSource = "ak5JetTracksAssociatorAtVertex",
useLegacyJetMCFlavour = True,
discriminatorSources = [
"simpleSecondaryVertexHighEffBJetTags",
"simpleSecondaryVertexHighPurBJetTags",
"combinedSecondaryVertexV2BJetTags",
"jetBProbabilityBJetTags",
"jetProbabilityBJetTags",
"trackCountingHighEffBJetTags",
"trackCountingHighPurBJetTags",
],
addJetCharge = False,
)

patJets = _patJets.clone()
Expand Up @@ -34,8 +34,13 @@
makePatJetsTask,
makePatMETsTask
)
patCandidates = cms.Sequence(patCandidateSummary, patCandidatesTask)

_patCandidatesTask = patCandidatesTask.copy()
_patCandidatesTask.remove(makePatOOTPhotonsTask)
from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
pp_on_AA_2018.toReplaceWith(patCandidatesTask, patCandidatesTask.copyAndExclude([makePatOOTPhotonsTask]))
pp_on_AA_2018.toModify(patCandidateSummary.candidates, func = lambda list: list.remove(cms.InputTag("patOOTPhotons")) )
from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3
(pp_on_AA_2018 | pp_on_PbPb_run3).toReplaceWith(patCandidatesTask, _patCandidatesTask)
(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patCandidateSummary.candidates, func = lambda list: list.remove(cms.InputTag("patOOTPhotons")) )

patCandidates = cms.Sequence(patCandidateSummary, patCandidatesTask)

10 changes: 10 additions & 0 deletions PhysicsTools/PatAlgos/python/recoLayer0/jetCorrFactors_cfi.py
Expand Up @@ -40,3 +40,13 @@
useRho = cms.bool(True),
rho = cms.InputTag('fixedGridRhoFastjetAll'),
)

from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3
(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetCorrFactors,
useNPV = False,
useRho = False,
levels = ['L2Relative','L3Absolute'],
payload = "AK4PF",
src = "akCs4PFJets",
)
Expand Up @@ -141,6 +141,7 @@
_pp_on_AA_extraCommands = [
'keep patPackedCandidates_hiPixelTracks_*_*',
'keep *_packedCandidateMuonID_*_*',
'keep *_slimmedJets_pfCandidates_*',
'keep floatedmValueMap_packedPFCandidateTrackChi2_*_*',
'keep floatedmValueMap_lostTrackChi2_*_*',
'keep recoCentrality_hiCentrality_*_*',
Expand Down
Expand Up @@ -88,4 +88,3 @@ def applyDeepBtagging( process, postfix="" ) :
# delete module not used anymore (slimmedJetsAK8 substitutes)
delattr(process, 'selectedUpdatedPatJetsSlimmedAK8DeepTags'+postfix)


10 changes: 6 additions & 4 deletions PhysicsTools/PatAlgos/python/slimming/applySubstructure_cff.py
Expand Up @@ -25,14 +25,15 @@ def applySubstructure( process, postfix="" ) :
_run2_miniAOD_ANY = (run2_miniAOD_80XLegacy | run2_miniAOD_94XFall17 | run2_miniAOD_UL)
from Configuration.Eras.Modifier_pA_2016_cff import pA_2016
from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3
if postfix=='':
# Avoid recomputing the PUPPI collections that are present in AOD
_rerun_puppijets_task = task.copy()
_rerun_puppijets_task.add(getattr(process,'ak8PFJetsPuppi'),
getattr(process,'ak8PFJetsPuppiConstituents'),
getattr(process,'ak8PFJetsPuppiSoftDrop'),
getattr(process,'ak8PFJetsPuppiSoftDropMass'))
(_run2_miniAOD_ANY | pA_2016 | pp_on_AA_2018).toReplaceWith(task, _rerun_puppijets_task)
(_run2_miniAOD_ANY | pA_2016 | pp_on_AA_2018 | pp_on_PbPb_run3).toReplaceWith(task, _rerun_puppijets_task)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that a call to applySubstructure is not done for the HI modifiers, edits for pp_on_AA_2018 | pp_on_PbPb_run3 in this file could be even dropped.
OK to leave for now, pending some related cleaning.

else:
task.add(getattr(process,'ak8PFJetsPuppi'+postfix),
getattr(process,'ak8PFJetsPuppiConstituents'+postfix),
Expand All @@ -53,6 +54,8 @@ def applySubstructure( process, postfix="" ) :
dropSpecific = cms.bool(True), # Save space
), process, task )

(pp_on_AA_2018 | pp_on_PbPb_run3).toModify( getattr(process,'slimmedGenJetsAK8SoftDropSubJets'), cut = 'pt<0', nLoose = 0)

## PATify puppi soft drop fat jets
addJetCollection(
process,
Expand Down Expand Up @@ -88,10 +91,9 @@ def applySubstructure( process, postfix="" ) :
addToProcessAndTask('nb2AK8PuppiSoftDrop'+postfix, process.ecfNbeta2.clone(src = cms.InputTag("ak8PFJetsPuppiSoftDrop"+postfix), cuts = cms.vstring('', '', 'pt > 250')), process, task)

#too slow now ==> disable
from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018
from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017
from Configuration.Eras.Modifier_phase2_common_cff import phase2_common
for e in [pp_on_XeXe_2017, pp_on_AA_2018, phase2_common]:
for e in [pp_on_XeXe_2017, pp_on_AA_2018, pp_on_PbPb_run3, phase2_common]:
e.toModify(getattr(process,'nb1AK8PuppiSoftDrop'+postfix), cuts = ['pt > 999999', 'pt > 999999', 'pt > 999999'] )
e.toModify(getattr(process,'nb2AK8PuppiSoftDrop'+postfix), cuts = ['pt > 999999', 'pt > 999999', 'pt > 999999'] )

Expand All @@ -106,7 +108,7 @@ def applySubstructure( process, postfix="" ) :
getattr(process,"patJetsAK8PFPuppiSoftDropSubjets"+postfix).userData.userFloats.src += ['nb2AK8PuppiSoftDropSubjets'+postfix+':ecfN2','nb2AK8PuppiSoftDropSubjets'+postfix+':ecfN3']
getattr(process,"patJetsAK8PFPuppiSoftDropSubjets"+postfix).userData.userFloats.src += ['NjettinessAK8Subjets'+postfix+':tau1','NjettinessAK8Subjets'+postfix+':tau2','NjettinessAK8Subjets'+postfix+':tau3','NjettinessAK8Subjets'+postfix+':tau4']

for e in [pp_on_XeXe_2017, pp_on_AA_2018, phase2_common]:
for e in [pp_on_XeXe_2017, pp_on_AA_2018, pp_on_PbPb_run3, phase2_common]:
e.toModify(getattr(process,'nb1AK8PuppiSoftDropSubjets'+postfix), cuts = ['pt > 999999', 'pt > 999999', 'pt > 999999'] )
e.toModify(getattr(process,'nb2AK8PuppiSoftDropSubjets'+postfix), cuts = ['pt > 999999', 'pt > 999999', 'pt > 999999'] )

Expand Down