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

Add Muon L1 to prefire weight producer #33758

Merged
merged 28 commits into from Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
525ef8a
add L1 muon prefiring to prefire weight producer
JanFSchulte May 17, 2021
7145c79
add missing era
JanFSchulte May 17, 2021
9d42d6b
code format
JanFSchulte May 17, 2021
999876d
correctly rename cff config
JanFSchulte May 18, 2021
8291674
fix test errors and address PR comments
JanFSchulte May 18, 2021
29a1f5d
code format
JanFSchulte May 18, 2021
e961914
add preVFP and postVFP options via modifiers
JanFSchulte May 18, 2021
baeed97
fix
JanFSchulte May 18, 2021
52dcdeb
bug fix plus add prefire weights to 2018 nanoAOD
JanFSchulte May 19, 2021
02827ff
make L1PrefiringWeightProducer a stream producer to address thread sa…
JanFSchulte May 20, 2021
e37a9cd
addressing code momments from the PR
JanFSchulte May 21, 2021
1de3d2e
make more member variables const
JanFSchulte May 21, 2021
05f63aa
remove unnecessary deletes
JanFSchulte May 21, 2021
1255d48
retrack some variables
JanFSchulte May 21, 2021
5704e9c
cleanup of log warnings
JanFSchulte May 24, 2021
816db5d
split muon uncertainty into syst. and stat.
JanFSchulte May 24, 2021
eb958e2
fix maximum weight conditions
JanFSchulte May 24, 2021
f93973f
new round of comments
JanFSchulte May 24, 2021
7a450d2
add logwarning for weights > 1
JanFSchulte May 24, 2021
5484ca6
update to 2016 UL prefiring maps for ECAL
JanFSchulte Jun 1, 2021
fd1d685
fix swapped stat and syst uncertainties
JanFSchulte Jun 2, 2021
fb3a0b3
add prefiring weights to Nano DQM
JanFSchulte Jun 2, 2021
d74deb9
make prefirng weights floats
JanFSchulte Jun 3, 2021
03de4ac
corect eras for miniAOD
JanFSchulte Jun 4, 2021
cb4759e
bug fix plus merge of photon and jet weights
JanFSchulte Jun 4, 2021
343d774
code format
JanFSchulte Jun 4, 2021
21f22a4
fix DQM to not have weights of 1 in the overflow
JanFSchulte Jun 8, 2021
1a4b06f
fix weight labels in nano
JanFSchulte Jun 9, 2021
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
2 changes: 2 additions & 0 deletions PhysicsTools/NanoAOD/python/nano_eras_cff.py
Expand Up @@ -4,9 +4,11 @@
from Configuration.Eras.Modifier_run2_jme_2016_cff import run2_jme_2016
from Configuration.Eras.Modifier_run2_jme_2017_cff import run2_jme_2017
from Configuration.Eras.Modifier_run2_muon_2016_cff import run2_muon_2016
from Configuration.Eras.Modifier_run2_muon_2018_cff import run2_muon_2018

from Configuration.Eras.Modifier_run2_HLTconditions_2016_cff import run2_HLTconditions_2016
from Configuration.Eras.Modifier_run2_HLTconditions_2017_cff import run2_HLTconditions_2017
from Configuration.Eras.Modifier_run2_HLTconditions_2018_cff import run2_HLTconditions_2018

from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X
Expand Down
27 changes: 21 additions & 6 deletions PhysicsTools/NanoAOD/python/triggerObjects_cff.py
Expand Up @@ -216,29 +216,44 @@
selections = selections2016
)

from PhysicsTools.PatUtils.L1ECALPrefiringWeightProducer_cff import prefiringweight
from PhysicsTools.PatUtils.L1PrefiringWeightProducer_cff import prefiringweight
#Next line will be updated once we get UL2016 maps
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment could be updated (but ONLY if you need to implement some other change together with it)

run2_jme_2016.toModify( prefiringweight, DataEra = cms.string("2016BtoH"))
(run2_muon_2016 & tracker_apv_vfp30_2016).toModify( prefiringweight, DataEraECAL = cms.string("UL2016preVFP"), DataEraMuon = cms.string("2016preVFP"))
(run2_muon_2016 & ~tracker_apv_vfp30_2016).toModify( prefiringweight, DataEraECAL = cms.string("UL2016postVFP"), DataEraMuon = cms.string("2016postVFP"))
#Next line is for UL2017 maps
run2_jme_2017.toModify( prefiringweight, DataEra = cms.string("UL2017BtoF"))
run2_jme_2017.toModify( prefiringweight, DataEraECAL = cms.string("UL2017BtoF"), DataEraMuon = cms.string("20172018"))
#Next line is for UL2018 maps
run2_muon_2018.toModify( prefiringweight, DataEraECAL = cms.string("None"), DataEraMuon = cms.string("20172018"))

Copy link
Contributor

Choose a reason for hiding this comment

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

we should add something for the run2_nanoAOD_102Xv1
I made this comments on the earlier version
https://github.com/cms-sw/cmssw/pull/32728/files#r563596034
now the changes for the muons indicate that something should happen.

can you clarify ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understand the old discussion correctly, we have indeed have to add the prefiring weights to the nanoAOD for 2018. Should this line be modified for that? https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/nano_cff.py#L106

Copy link
Contributor

Choose a reason for hiding this comment

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

for what I see we do not store the 2018 at all even for UL
https://cms-nanoaod-integration.web.cern.ch/integration/32728/mc106Xul16_doc.html#L1PreFiringWeight
https://cms-nanoaod-integration.web.cern.ch/integration/32728/mc106Xul17_doc.html#L1PreFiringWeight
https://cms-nanoaod-integration.web.cern.ch/integration/32728/mc106Xul18_doc.html

we do have the pre-UL (run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2)
i.e. https://cms-nanoaod-integration.web.cern.ch/integration/32728/mc94Xv2_doc.html#L1PreFiringWeight
but again not for the 2018 (i.e., with modifier run2_nanoAOD_102Xv1)

can you check locally what happens for the 2018? and do we really need it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added 2018 here: https://github.com/cms-sw/cmssw/pull/33758/files#diff-9b898944f08810913ea5c1605c47bd9a6c99eb91fc20f491ba2767702f4a0184R260 and confirmed that the prefiring weights are now added to 2018 nanoAOD.

We indeed need to add these weights as they are non-negligible for muons for that year.

#For pre-UL 2017 reprocessing, one should use the original maps and no muon jet protection
for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2:
modifier.toModify( prefiringweight, DataEra = cms.string("2017BtoF"))
modifier.toModify( prefiringweight, DataEraECAL = cms.string("2017BtoF"), DataEraMuon = cms.string("20172018"))
modifier.toModify( prefiringweight, JetMaxMuonFraction = cms.double(-1.) )
#For pre-UL 2016 reprocessing, same thing
run2_nanoAOD_94X2016.toModify( prefiringweight, DataEra = cms.string("2016BtoH") )
run2_nanoAOD_94X2016.toModify( prefiringweight, DataEraECAL = cms.string("2016BtoH"), DataEraMuon = cms.string("2016") )
run2_nanoAOD_94X2016.toModify( prefiringweight, JetMaxMuonFraction = cms.double(-1.) )

l1PreFiringEventWeightTable = cms.EDProducer("GlobalVariablesTableProducer",
variables = cms.PSet(
L1PreFiringWeight_Nom = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProb"), "double", doc = "L1 pre-firing event correction weight (1-probability)", precision=8),
L1PreFiringWeight_Up = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbUp"), "double", doc = "L1 pre-firing event correction weight (1-probability), up var.", precision=8),
L1PreFiringWeight_Dn = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbDown"), "double", doc = "L1 pre-firing event correction weight (1-probability), down var.", precision=8),
L1PreFiringWeightMuon_Nom = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbMuon"), "double", doc = "Muon L1 pre-firing event correction weight (1-probability)", precision=8),
L1PreFiringWeightMuon_SystUp = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbMuonSystUp"), "double", doc = "Muon L1 pre-firing event correction weight (1-probability), up var. syst.", precision=8),
L1PreFiringWeightMuon_SystDn = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbMuonSystDown"), "double", doc = "Muon L1 pre-firing event correction weight (1-probability), down var. syst.", precision=8),
L1PreFiringWeightMuon_StatUp = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbMuonStatUp"), "double", doc = "Muon L1 pre-firing event correction weight (1-probability), up var. stat.", precision=8),
L1PreFiringWeightMuon_StatDn = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbMuonStatDown"), "double", doc = "Muon L1 pre-firing event correction weight (1-probability), down var. stat.", precision=8),
L1PreFiringWeightJet_Nom = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbJet"), "double", doc = "Jet L1 pre-firing event correction weight (1-probability)", precision=8),
L1PreFiringWeightJet_Up = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbJetUp"), "double", doc = "Jet L1 pre-firing event correction weight (1-probability), up var.", precision=8),
L1PreFiringWeightJet_Dn = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbJetDown"), "double", doc = "Jet L1 pre-firing event correction weight (1-probability), down var.", precision=8),
L1PreFiringWeightPhoton_Nom = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbPhoton"), "double", doc = "Photon L1 pre-firing event correction weight (1-probability)", precision=8),
L1PreFiringWeightPhoton_Up = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbPhotonUp"), "double", doc = "Photon L1 pre-firing event correction weight (1-probability), up var.", precision=8),
L1PreFiringWeightPhoton_Dn = ExtVar(cms.InputTag("prefiringweight:nonPrefiringProbPhotonDown"), "double", doc = "Photon L1 pre-firing event correction weight (1-probability), down var.", precision=8),
Copy link
Contributor

Choose a reason for hiding this comment

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

do all these need to be a double ? in nano will be converted in float for now

Copy link
Contributor

Choose a reason for hiding this comment

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

do not forget to move double -> float

)
)

triggerObjectTables = cms.Sequence( unpackedPatTrigger + triggerObjectTable )

_triggerObjectTables_withL1PreFiring = triggerObjectTables.copy()
_triggerObjectTables_withL1PreFiring.replace(triggerObjectTable, prefiringweight + l1PreFiringEventWeightTable + triggerObjectTable)
(run2_HLTconditions_2016 | run2_HLTconditions_2017).toReplaceWith(triggerObjectTables, _triggerObjectTables_withL1PreFiring)
(run2_HLTconditions_2016 | run2_HLTconditions_2017 | run2_HLTconditions_2018).toReplaceWith(triggerObjectTables, _triggerObjectTables_withL1PreFiring)
12 changes: 8 additions & 4 deletions PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Expand Up @@ -537,13 +537,17 @@ def _add_deepMET(process):
process.load("RecoEgamma.EgammaTools.slimmedEgammaFromMultiCl_cff")
phase2_hgcal.toModify(task, func=lambda t: t.add(process.slimmedEgammaFromMultiClTask))

# L1 pre-firing weights for 2016 and 2017
# L1 pre-firing weights for 2016, 2017, and 2018
from Configuration.Eras.Modifier_run2_L1prefiring_cff import run2_L1prefiring
from Configuration.Eras.Modifier_stage1L1Trigger_cff import stage1L1Trigger
from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017
process.load("PhysicsTools.PatUtils.L1ECALPrefiringWeightProducer_cff")
stage1L1Trigger.toModify(process.prefiringweight, DataEra = "2016BtoH")
stage2L1Trigger_2017.toModify(process.prefiringweight, DataEra = "2017BtoF")
from Configuration.Eras.Modifier_stage2L1Trigger_2018_cff import stage2L1Trigger_2018
from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016
process.load("PhysicsTools.PatUtils.L1PrefiringWeightProducer_cff")
(stage1L1Trigger & tracker_apv_vfp30_2016).toModify(process.prefiringweight, DataEraECAL = "UL2016preVFP", DataEraMuon = "2016preVFP" )
(stage1L1Trigger & ~tracker_apv_vfp30_2016).toModify(process.prefiringweight, DataEraECAL = "UL2016postVFP", DataEraMuon = "2016postVFP" )
stage2L1Trigger_2017.toModify(process.prefiringweight, DataEraECAL = "UL2017BtoF", DataEraMuon = "20172018")
stage2L1Trigger_2018.toModify(process.prefiringweight, DataEraECAL = "None", DataEraMuon = "20172018")
run2_L1prefiring.toModify(task, func=lambda t: t.add(process.prefiringweight))

from PhysicsTools.PatAlgos.producersHeavyIons.heavyIonJetSetup import removeL1FastJetJECs
Expand Down
231 changes: 0 additions & 231 deletions PhysicsTools/PatUtils/plugins/L1ECALPrefiringWeightProducer.cc

This file was deleted.