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

Dynamic Reduction Network for photon energy regression in miniAOD using the SonicTriton service #37134

Merged
merged 42 commits into from Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f3fee7c
One merged commit
ssrothman Mar 3, 2022
32c5854
Fix ES data getting to be compliant with newer CMSSW
ssrothman Mar 3, 2022
2da29a3
Added test
ssrothman Mar 3, 2022
616831b
code-format and code-checks
ssrothman Mar 3, 2022
3cdd06c
Code-format (again??)
ssrothman Mar 3, 2022
0bf9e99
Made test shorter
ssrothman Mar 7, 2022
da3c714
Fixed model name
ssrothman Mar 7, 2022
5af31a1
Not sure what's going on here tbh...
ssrothman Mar 7, 2022
fe1ee8e
Revert "Not sure what's going on here tbh..."
ssrothman Mar 7, 2022
c65a63d
Rename customisation function appropriately
ssrothman Mar 7, 2022
e36b116
Updated test config to call correct customisation function name
ssrothman Mar 7, 2022
26dfae6
Fixed customisation function to be compatible with cmsDriver
ssrothman Mar 8, 2022
30e291e
Almost working.....
ssrothman Mar 9, 2022
82ced8d
Kevin found the problem :D
ssrothman Mar 10, 2022
2f80e2f
Removed test
ssrothman Mar 11, 2022
d357aa7
UserFloat functionality
ssrothman Mar 16, 2022
9556a83
Fixed fatal typos
ssrothman Mar 16, 2022
2637202
No reason to touch runtests.sh
ssrothman Mar 16, 2022
1a5de2f
Pointers..
ssrothman Mar 16, 2022
f994140
Clean up DRNCorrectionProducerT
ssrothman Mar 16, 2022
e5db2ac
Error fixing...
ssrothman Mar 16, 2022
ec15ac7
Should compile now
ssrothman Mar 16, 2022
cc93d65
empty commit to get cms bot to rerun code checks
ssrothman Mar 16, 2022
c3927d0
Code-format
ssrothman Mar 16, 2022
722602b
Don't need ES Handles
ssrothman Mar 17, 2022
c658fab
No longer pointers
ssrothman Mar 17, 2022
509d4a1
Typo fix
ssrothman Mar 17, 2022
84c52f2
Adding process modifier
ssrothman Mar 17, 2022
0e55eb0
Typo fix
ssrothman Mar 17, 2022
c99da3c
userFloats by default
ssrothman Mar 17, 2022
8a69393
RelVal use modifier
ssrothman Mar 17, 2022
fa89ab1
Replace p4 matching
ssrothman Mar 17, 2022
bb7c727
Clean up after removing p4 comparison
ssrothman Mar 17, 2022
bccd830
Merge branch 'noHandle' into photon_rebase2
ssrothman Mar 17, 2022
8c0bd7c
Code-format
ssrothman Mar 17, 2022
1ab9afd
photonDRN modifier now includes enableSonicTriton
ssrothman Apr 4, 2022
fc9c472
use fillDescriptions defaults for recHits
ssrothman Apr 4, 2022
78558dc
shared memory on
ssrothman Apr 4, 2022
7ecb877
test clone...
ssrothman Apr 13, 2022
a8702fa
Revert "test clone..."
ssrothman Apr 14, 2022
5977c4b
Cloning fillDescriptions config
ssrothman Apr 14, 2022
c8484f9
Same for electrons
ssrothman Apr 14, 2022
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
5 changes: 5 additions & 0 deletions Configuration/ProcessModifiers/python/photonDRN_cff.py
@@ -0,0 +1,5 @@
import FWCore.ParameterSet.Config as cms

#modifier to enable DRN energy regression for photons

photonDRN = cms.Modifier()
1 change: 1 addition & 0 deletions Configuration/PyReleaseValidation/README.md
Expand Up @@ -53,6 +53,7 @@ The offsets currently in use are:
* 0.17: Run-3 deep core seeding for JetCore iteration
* 0.21: Production-like sequence
* 0.24: 0 Tesla (Run-2, Run-3)
* 0.31: Photon energy corrections with DRN architecture
* 0.61: `phase2_ecal_devel` era
* 0.91: Track DNN modifier
* 0.97: Premixing stage1
Expand Down
2 changes: 2 additions & 0 deletions Configuration/PyReleaseValidation/python/relval_2017.py
Expand Up @@ -18,6 +18,7 @@
# (TTbar trackingOnly, trackingRun2, trackingOnlyRun2, trackingLowPU, pixelTrackingOnly)
# (TTbar PU with JME NanoAOD, disable for now due to Run-3 Nano-Prompt preparation)
# 2018 (ele guns 10, 35, 1000; pho guns 10, 35; mu guns 1, 10, 100, 1000, QCD 3TeV, QCD Flat)
# (pho guns 10, 35 with photonDRN enabled)
# 2018 (ZMM, TTbar, ZEE, MinBias, TTbar PU, ZEE PU, TTbar design)
# (TTbar trackingOnly, pixelTrackingOnly)
# (HE collapse: TTbar, TTbar PU, TTbar design)
Expand Down Expand Up @@ -47,6 +48,7 @@
10024.1,10024.2,10024.3,10024.4,10024.5,
#10224.15,
10801.0,10802.0,10803.0,10804.0,10805.0,10806.0,10807.0,10808.0,10809.0,10859.0,10871.0,
10804.31, 10805.31,
10842.0,10824.0,10825.0,10826.0,10823.0,11024.0,11025.0,11224.0,
10824.1,10824.5,
10824.6,11024.6,11224.6,
Expand Down
Expand Up @@ -490,6 +490,32 @@ def condition(self, fragment, stepList, key, hasHarvest):
'--procModifiers': 'mlpf'
}

# photonDRN workflows
class UpgradeWorkflow_photonDRN(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
if 'Reco' in step:
stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
def condition(self, fragment, stepList, key, hasHarvest):
return '2018' in key and "SingleGamma" in fragment

upgradeWFs['photonDRN'] = UpgradeWorkflow_photonDRN(
steps = [
'Reco',
'RecoNano',
'RecoFakeHLT'
],
PU = [
'Reco',
'RecoNano',
'RecoFakeHLT'
],
suffix = '_photonDRN',
offset = 0.31,
)
upgradeWFs['photonDRN'].step3 = {
'--procModifiers': 'enableSonicTriton,photonDRN'
}

# Patatrack workflows:
# - 2018 conditions, TTbar
# - 2018 conditions, Z->mumu,
Expand Down
@@ -0,0 +1,18 @@
import FWCore.ParameterSet.Config as cms

patElectronsDRN = cms.EDProducer("PatElectronDRNCorrectionProducer",
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be better to clone the existing config from the one provided by fillDescriptions (I recall a similar comment on the previous DRN PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you just mean to use the fillDescriptions defaults for more parameters, or is there something more I should do here? I have updated it to use default values for the RecHit collections; should I add more defaults?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean using .clone to avoid specifying the config options (and the types) that are already known.
3cb2459#diff-2d4d8dba5a6cd14974d0d42a9896706879c369b9ca833acca0f8e9f1883b1500R3

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'm a little confused about how to do this. If I try to import RecoEgamma.EgammaTools.PatPhotonDRNCorrectionProducer_cfi I get a ModuleNotFoundError. Where is this default config produced by fillDescriptions()? How (if at all) does it interact with class templating?

Copy link
Contributor

Choose a reason for hiding this comment

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

In your working area, you can look at $CMSSW_BASE/cfipython to find the default configs.

To ensure distinct cfi files are generated for different instances of the same class template, see this example:

//to ensure distinct cfi names
descriptions.addWithDefaultLabel(desc);

particleSource = cms.InputTag("selectedPatElectrons"),
rhoName = cms.InputTag("fixedGridRhoFastjetAll"),
reducedEcalRecHitsEB = cms.InputTag("reducedEcalRecHitsEB"),
reducedEcalRecHitsEE = cms.InputTag("reducedEcalRecHitsEE"),
reducedEcalRecHitsES = cms.InputTag("reducedEcalRecHitsES"),

Client = cms.PSet(
mode = cms.string("Async"),
modelName = cms.string("electronObjectEnsemble"),
modelConfigPath = cms.FileInPath("RecoEgamma/EgammaElectronProducers/data/models/electronObjectEnsemble/config.pbtxt"),
ssrothman marked this conversation as resolved.
Show resolved Hide resolved
allowedTries = cms.untracked.uint32(1),
timeout = cms.untracked.uint32(10),
useSharedMemory = cms.untracked.bool(False),
)
)
18 changes: 18 additions & 0 deletions PhysicsTools/PatAlgos/python/slimming/patPhotonDRNCorrector_cfi.py
@@ -0,0 +1,18 @@
import FWCore.ParameterSet.Config as cms

patPhotonsDRN = cms.EDProducer("PatPhotonDRNCorrectionProducer",
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment here regarding cloning the producer config

particleSource = cms.InputTag("selectedPatPhotons"),
rhoName = cms.InputTag("fixedGridRhoFastjetAll"),
reducedEcalRecHitsEB = cms.InputTag("reducedEcalRecHitsEB"),
reducedEcalRecHitsEE = cms.InputTag("reducedEcalRecHitsEE"),
reducedEcalRecHitsES = cms.InputTag("reducedEcalRecHitsES"),

Client = cms.PSet(
mode = cms.string("Async"),
modelName = cms.string("photonObjectEnsemble"),
modelConfigPath = cms.FileInPath("RecoEgamma/EgammaPhotonProducers/data/models/photonObjectEnsemble/config.pbtxt"),
ssrothman marked this conversation as resolved.
Show resolved Hide resolved
allowedTries = cms.untracked.uint32(1),
timeout = cms.untracked.uint32(10),
useSharedMemory = cms.untracked.bool(False),
)
)
4 changes: 4 additions & 0 deletions PhysicsTools/PatAlgos/python/slimming/slimming_cff.py
Expand Up @@ -102,3 +102,7 @@
_phase2_timing_slimmingTask = cms.Task(slimmingTask.copy(),
offlineSlimmedPrimaryVertices4D)
phase2_timing.toReplaceWith(slimmingTask,_phase2_timing_slimmingTask)

from PhysicsTools.PatAlgos.slimming.patPhotonDRNCorrector_cfi import patPhotonsDRN
from Configuration.ProcessModifiers.photonDRN_cff import photonDRN
photonDRN.toReplaceWith(slimmingTask, cms.Task(slimmingTask.copy(), patPhotonsDRN))
1 change: 1 addition & 0 deletions RecoEgamma/EgammaTools/BuildFile.xml
Expand Up @@ -17,6 +17,7 @@
<use name="RecoEcal/EgammaCoreTools"/>
<use name="DataFormats/ParticleFlowReco"/>
<use name="PhysicsTools/TensorFlow" />
<use name="HeterogeneousCore/SonicTriton"/>
<export>
<lib name="1"/>
</export>