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

DeepCore (NN jetCore seeding) implementation #32222

Merged
5 changes: 5 additions & 0 deletions Configuration/ProcessModifiers/python/seedingDeepCore_cff.py
@@ -0,0 +1,5 @@
import FWCore.ParameterSet.Config as cms

# This modifier is for activating DeepCore seeding for the JetCore tracking iteration

seedingDeepCore = cms.Modifier()
2 changes: 2 additions & 0 deletions Configuration/PyReleaseValidation/python/relval_2017.py
Expand Up @@ -35,6 +35,7 @@
# (Patatrack ECAL-only: TTbar - on CPU, on GPU, both, auto)
# (Patatrack HCAL-only: TTbar - on CPU, on GPU, both, auto)
# (TTbar 0T, TTbar PU 0T)
# (QCD 1.8TeV DeepCore)
# 2023 (TTbar, TTbar PU, TTbar PU premix)
# 2024 (TTbar, TTbar PU, TTbar PU premix)
numWFIB = [10001.0,10002.0,10003.0,10004.0,10005.0,10006.0,10007.0,10008.0,10009.0,10059.0,10071.0,
Expand All @@ -59,6 +60,7 @@
11634.511,11634.512, # 11634.513,11634.514,
11634.521,11634.522, # 11634.523,11634.524
11634.24,11834.24,
11723.17,
vberta marked this conversation as resolved.
Show resolved Hide resolved
12434.0,12634.0,12634.99,
12834.0,13034.0,13034.99]
for numWF in numWFIB:
Expand Down
Expand Up @@ -311,6 +311,30 @@ def condition_(self, fragment, stepList, key, hasHarvest):
'--procModifiers': 'trackingMkFit'
}

#DeepCore seeding for JetCore iteration workflow
class UpgradeWorkflow_seedingDeepCore(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
if 'Reco' in step or 'HARVEST' in step: stepDict[stepName][k] = merge([{'--procModifiers': 'seedingDeepCore'}, stepDict[step][k]])
def condition(self, fragment, stepList, key, hasHarvest):
result = (fragment=="QCD_Pt_1800_2400_14") and ('2021' in key or '2024' in key) and hasHarvest
if result:
# skip ALCA and Nano
skipList = [s for s in stepList if (("ALCA" in s) or ("Nano" in s))]
for skip in skipList:
stepList.remove(skip)
return result
upgradeWFs['seedingDeepCore'] = UpgradeWorkflow_seedingDeepCore(
steps = [
'Reco',
'HARVEST',
'RecoGlobal',
'HARVESTGlobal',
],
PU = [],
suffix = '_seedingDeepCore',
offset = 0.17,
)

# Vector Hits workflows
class UpgradeWorkflow_vectorHits(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
Expand Down
Expand Up @@ -340,6 +340,9 @@ void LowPtGsfElectronSeedProducer::loop(const edm::Handle<std::vector<T> >& hand

// Create ElectronSeed
reco::ElectronSeed seed(*(trackRef->seedRef()));
if (seed.nHits() == 0) { //if DeepCore is used in jetCore iteration the seed are hitless, in case skip
continue;
}
seed.setCtfTrack(trackRef);

// Create PreIds
Expand Down
4 changes: 4 additions & 0 deletions RecoParticleFlow/PFTracking/plugins/GoodSeedProducer.cc
Expand Up @@ -345,6 +345,10 @@ void GoodSeedProducer::produce(Event& iEvent, const EventSetup& iSetup) {
auto tketa = tkmom.eta();
auto tkpt = std::sqrt(tkmom.perp2());
auto const& Seed = (*trackRef->seedRef());
if (Seed.nHits() == 0) { //if DeepCore is used in jetCore iteration the seed are hitless, in case skip
continue;
}

if (!disablePreId_) {
int ipteta = getBin(Tk[i].eta(), Tk[i].pt());
int ibin = ipteta * 9;
Expand Down
Expand Up @@ -68,3 +68,4 @@

from Configuration.ProcessModifiers.egamma_lowPt_exclusive_cff import egamma_lowPt_exclusive
egamma_lowPt_exclusive.toModify(trackerDrivenElectronSeeds,MinPt = 1.0)

35 changes: 35 additions & 0 deletions RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py
Expand Up @@ -95,6 +95,14 @@
minPt = 0.1
)

from Configuration.ProcessModifiers.seedingDeepCore_cff import seedingDeepCore
seedingDeepCore.toModify(jetCoreRegionalStepTrajectoryFilter,
minimumNumberOfHits = 2,
maxConsecLostHits = 2,
maxLostHitsFraction = 1.1,
minPt = 0.9
)

from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017
from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
(pp_on_XeXe_2017 | pp_on_AA).toModify(jetCoreRegionalStepTrajectoryFilter, minPt=5.0)
Expand All @@ -118,6 +126,28 @@
estimator = 'jetCoreRegionalStepChi2Est',
maxDPhiForLooperReconstruction = cms.double(2.0),
maxPtForLooperReconstruction = cms.double(0.7)
)

seedingDeepCore.toModify(jetCoreRegionalStepTrajectoryBuilder,
maxPtForLooperReconstruction = 0.,
keepOriginalIfRebuildFails = True,
lockHits = False,
requireSeedHitsInRebuild = False,
)

#customized cleaner for DeepCore
from TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi import trajectoryCleanerBySharedHits
jetCoreRegionalStepDeepCoreTrajectoryCleaner = trajectoryCleanerBySharedHits.clone(
ComponentName = 'jetCoreRegionalStepDeepCoreTrajectoryCleaner',
fractionShared = 0.45
)

import RecoTracker.TkSeedGenerator.deepCoreSeedGenerator_cfi
import Validation.RecoTrack.JetCoreMCtruthSeedGenerator_cfi
seedingDeepCore.toReplaceWith(jetCoreRegionalStepSeeds,
RecoTracker.TkSeedGenerator.deepCoreSeedGenerator_cfi.deepCoreSeedGenerator.clone(#to run MCtruthSeedGenerator clone here from Validation.RecoTrack
vertices="firstStepPrimaryVertices"
)
)

# MAKING OF TRACK CANDIDATES
Expand All @@ -131,6 +161,10 @@
#numHitsForSeedCleaner = cms.int32(50),
#onlyPixelHitsForSeedCleaner = cms.bool(True),
)
seedingDeepCore.toModify(jetCoreRegionalStepTrackCandidates,
TrajectoryCleaner = 'jetCoreRegionalStepDeepCoreTrajectoryCleaner',
doSeedingRegionRebuilding = True,
)


# TRACK FITTING
Expand Down Expand Up @@ -219,6 +253,7 @@
# jetCoreRegionalStepClassifier1,jetCoreRegionalStepClassifier2,
jetCoreRegionalStep)
JetCoreRegionalStep = cms.Sequence(JetCoreRegionalStepTask)
seedingDeepCore.toReplaceWith(JetCoreRegionalStep,JetCoreRegionalStep.copyAndExclude([jetCoreRegionalStepHitDoublets]))
fastSim.toReplaceWith(JetCoreRegionalStepTask,
cms.Task(jetCoreRegionalStepTracks,
jetCoreRegionalStep))
1 change: 1 addition & 0 deletions RecoTracker/TkSeedGenerator/plugins/BuildFile.xml
@@ -1,3 +1,4 @@
<use name="PhysicsTools/TensorFlow"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it really that hard to add the dependencies in alphabetical order ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@cms-sw/reconstruction-l2 could you add this suggestion to the list of requests you make of people ?

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 really sorry, nobody ever told me this requirement before (probably it is written in some twiki, but I missed it)

<use name="CommonTools/RecoAlgos"/>
<use name="DataFormats/L1TrackTrigger"/>
<use name="RecoTracker/TkSeedGenerator"/>
Expand Down