Skip to content

Commit

Permalink
DeepCore PR edit: cleaning, dedicated validation on Run3 only
Browse files Browse the repository at this point in the history
aestethic stuff

This is the commit message #1.3:

seedingDeepCore modifier

This is the commit message #1.4:

cleaning DeepCore plugin code

This is the commit message #1.5:

deepCore module by modifier

This is the commit message #1.6:

some small fix

This is the commit message #1.7:

buildfile3

fix auto parameters

code format fix

validation on relvant eras only, some fix

fix eras bug

additional plots for Run3 only

move to existising object in _cff, cleaning of DeepCore

cleaning
  • Loading branch information
vberta committed Dec 9, 2020
1 parent 1749309 commit 24d8629
Show file tree
Hide file tree
Showing 34 changed files with 1,647 additions and 1,968 deletions.
5 changes: 5 additions & 0 deletions Configuration/ProcessModifiers/python/seedingDeepCore_cff.py
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,25 @@ def condition_(self, fragment, stepList, key, hasHarvest):
'--procModifiers': 'trackingMkFit'
}

#DeepCore seeding for JetCore iteration workflow
class UpgradeWorkflow_seedingDeepCore(UpgradeWorkflowTracking):
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 '2021' in key or '2024' in key
upgradeWFs['seedingDeepCore'] = UpgradeWorkflow_seedingDeepCore(
steps = [
'Reco',
'RecoGlobal',
],
PU = [],
suffix = '_seedingDeepCore',
offset = 0.13,
)
upgradeWFs['seedingDeepCore'].step3 = {
'--procModifiers': 'seedingDeepCore'
}

# Vector Hits workflows
class UpgradeWorkflow_vectorHits(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,12 @@ void LowPtGsfElectronSeedProducer::loop(const edm::Handle<std::vector<T> >& hand
if (!passThrough_ && (trackRef->pt() < minPtThreshold_)) {
continue;
}
if(trackRef->algo() == 11) continue; //Skip jetcore tracks because the seeds are hitless

// 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
6 changes: 4 additions & 2 deletions RecoParticleFlow/PFTracking/plugins/GoodSeedProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@ void GoodSeedProducer::produce(Event& iEvent, const EventSetup& iSetup) {
for (unsigned int i = 0; i < Tk.size(); ++i) {
if (useQuality_ && (!(Tk[i].quality(trackQuality_))))
continue;
if(Tk[i].algo() == 11)
continue; //Skip jetcore tracks because the seeds are hitless

reco::PreId myPreId;
bool GoodPreId = false;
Expand All @@ -347,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
Original file line number Diff line number Diff line change
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)

1 change: 0 additions & 1 deletion RecoTracker/CkfPattern/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@
<use name="TrackingTools/TrajectoryCleaning"/>
<use name="TrackingTools/TrajectoryFiltering"/>
<use name="TrackingTools/TrackFitters"/>
<use name="TrackPropagation/SteppingHelixPropagator"/>
<use name="root"/>
10 changes: 0 additions & 10 deletions RecoTracker/CkfPattern/src/CkfTrackCandidateMakerBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "DataFormats/TrackReco/interface/SeedStopInfo.h"

#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
// #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"


#include "TrackingTools/PatternTools/interface/Trajectory.h"
#include "TrackingTools/TrajectoryCleaning/interface/TrajectoryCleanerBySharedHits.h"
Expand All @@ -28,10 +26,6 @@
#include "RecoTracker/CkfPattern/interface/CachingSeedCleanerBySharedInput.h"

#include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h"
// #include "RecoTracker/TransientTrackingRecHit/interface/TRecHit2DPosConstraint.h"
// #include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h"
// #include "DataFormats/GeometrySurface/interface/SimpleCylinderBounds.h"
// #include "DataFormats/GeometrySurface/interface/Cylinder.h"

#include "RecoTracker/Record/interface/NavigationSchoolRecord.h"
#include "TrackingTools/DetLayers/interface/NavigationSchool.h"
Expand Down Expand Up @@ -154,10 +148,6 @@ namespace cms {

// set the correct navigation
// NavigationSetter setter( *theNavigationSchool);

//geometry, for jetCore iteration
// edm::ESHandle<GlobalTrackingGeometry> geometry_;
// es.get<GlobalTrackingGeometryRecord>().get(geometry_);

// propagator
edm::ESHandle<Propagator> thePropagator;
Expand Down
4 changes: 0 additions & 4 deletions RecoTracker/CkfPattern/src/TransientInitialStateEstimator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ std::pair<TrajectoryStateOnSurface, const GeomDet*> TransientInitialStateEstimat
TSOS startingState = measvec[actualLast].updatedState();
startingState.rescaleError(100.);

// std::cout << "DEBUG DEEPCORE: distance first hit" << measvec[0].recHit()->globalPosition().perp() << std::endl;

// avoid cloning...
KFUpdator const aKFUpdator;
Chi2MeasurementEstimator const aChi2MeasurementEstimator(100., 3);
Expand Down Expand Up @@ -120,7 +118,5 @@ std::pair<TrajectoryStateOnSurface, const GeomDet*> TransientInitialStateEstimat
<< "\n it's field pointer is: " << firstState.magneticField()
<< "\n the pointer from the state of the back fit was: " << firstMeas.updatedState().magneticField();

// std::cout << "DEBUG deepCore: firstState------>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>:\n" << "initial parameters:" << ", inv.Pt=" << firstState.freeState()->parameters().signedInverseTransverseMomentum() << ", trans.Curv=" <<firstState.freeState()->transverseCurvature()<< ", p=" << firstState.freeState()->momentum().mag() << ", pt=" << firstState.freeState()->momentum().perp() <<", phi=" <<firstState.freeState()->momentum().phi() << ", eta="<<firstState.freeState()->momentum().eta() << std::endl;
// std::cout << firstState << std::endl;
return std::pair<TrajectoryStateOnSurface, const GeomDet*>(std::move(firstState), firstMeas.recHit()->det());
}
83 changes: 34 additions & 49 deletions RecoTracker/IterativeTracking/python/JetCoreRegionalStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@
# QUALITY CUTS DURING TRACK BUILDING
import TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff
jetCoreRegionalStepTrajectoryFilter = TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff.CkfBaseTrajectoryFilter_block.clone(
minPt = 0.1,
minimumNumberOfHits = 4,
seedPairPenalty = 0,
minPt = 0.1
)

from Configuration.ProcessModifiers.seedingDeepCore_cff import seedingDeepCore
seedingDeepCore.toModify(jetCoreRegionalStepTrajectoryFilter,
maxCCCLostHits = cms.int32(9999),
maxConsecLostHits = cms.int32(2),
maxLostHits = cms.int32(999),
Expand All @@ -99,10 +105,8 @@
minimumNumberOfHits = cms.int32(2),
pixelSeedExtension = cms.bool(False),
seedExtension = cms.int32(0),
seedPairPenalty = cms.int32(0),
strictSeedExtension = cms.bool(False)

)
)

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
Expand All @@ -122,75 +126,59 @@
jetCoreRegionalStepTrajectoryBuilder = RecoTracker.CkfPattern.GroupedCkfTrajectoryBuilder_cfi.GroupedCkfTrajectoryBuilder.clone(
MeasurementTrackerName = '',
trajectoryFilter = cms.PSet(refToPSet_ = cms.string('jetCoreRegionalStepTrajectoryFilter')),
#clustersToSkip = cms.InputTag('jetCoreRegionalStepClusters'),
maxCand = 50,
estimator = 'jetCoreRegionalStepChi2Est',
maxDPhiForLooperReconstruction = cms.double(2.0),
maxPtForLooperReconstruction = cms.double(0.7)
)
seedingDeepCore.toModify(jetCoreRegionalStepTrajectoryBuilder,
maxPtForLooperReconstruction = cms.double(0),
keepOriginalIfRebuildFails = True,
lockHits = False,
requireSeedHitsInRebuild = False,
trajectoryFilter = cms.PSet(refToPSet_ = cms.string('jetCoreRegionalStepDeepCoreTrajectoryFilter'))
)

)


#customized cleaner
trajectoryCleanerBySharedHits_JetCore = cms.ESProducer("TrajectoryCleanerESProducer",
ComponentName = cms.string('jetCoreTrajectoryCleanerBySharedHits'),
ComponentType = cms.string('TrajectoryCleanerBySharedHits'),
MissingHitPenalty = cms.double(20.0),
ValidHitBonus = cms.double(5.0),
allowSharedFirstHit = cms.bool(True),
#customized cleaner for DeepCore
from TrackingTools.TrajectoryCleaning.TrajectoryCleanerBySharedHits_cfi import trajectoryCleanerBySharedHits
jetCoreRegionalStepDeepCoreTrajectoryCleaner = trajectoryCleanerBySharedHits.clone(
ComponentName = cms.string('jetCoreRegionalStepDeepCoreTrajectoryCleaner'),
fractionShared = cms.double(0.45)
)

CkfBaseTrajectoryFilter_blockLoose = cms.PSet(
ComponentType = cms.string('CkfBaseTrajectoryFilter'),
chargeSignificance = cms.double(-1.0),
constantValueForLostHitsFractionFilter = cms.double(2.0),
extraNumberOfHitsBeforeTheFirstLoop = cms.int32(4),
maxCCCLostHits = cms.int32(9999),
#DeepCore filter
jetCoreRegionalStepDeepCoreTrajectoryFilter = TrackingTools.TrajectoryFiltering.TrajectoryFilter_cff.CkfBaseTrajectoryFilter_block.clone( #blockloose
maxConsecLostHits = cms.int32(2),
maxLostHits = cms.int32(999),
maxLostHitsFraction = cms.double(1.1),
maxNumberOfHits = cms.int32(100),
minGoodStripCharge = cms.PSet(
refToPSet_ = cms.string('SiStripClusterChargeCutNone')
),
minHitsMinPt = cms.int32(3),
minNumberOfHitsForLoopers = cms.int32(13),
minNumberOfHitsPerLoop = cms.int32(4),
minPt = cms.double(0.9),
minimumNumberOfHits = cms.int32(2),
nSigmaMinPt = cms.double(5.0),
pixelSeedExtension = cms.bool(False),
seedExtension = cms.int32(0),
seedPairPenalty = cms.int32(0),
strictSeedExtension = cms.bool(False)
minimumNumberOfHits = cms.int32(2)
)


import RecoTracker.TkSeedGenerator.jetCoreDirectSeedGenerator_cfi
import RecoTracker.TkSeedGenerator.jetCorePerfectSeedGenerator_cfi
jetCoreRegionalStepSeeds = RecoTracker.TkSeedGenerator.jetCoreDirectSeedGenerator_cfi.jetCoreDirectSeedGenerator.clone(
# jetCoreSeeds = RecoTracker.TkSeedGenerator.jetCoreDirectSeedGenerator_cfi.jetCoreDirectSeedGenerator.clone(
# jetCoreSeeds = RecoTracker.TkSeedGenerator.jetCorePerfectSeedGenerator_cfi.JetCorePerfectSeedGenerator.clone(
vertices="firstStepPrimaryVertices"
import RecoTracker.TkSeedGenerator.DeepCoreSeedGenerator_cfi
import RecoTracker.TkSeedGenerator.JetCoreMCtruthSeedGenerator_cfi
seedingDeepCore.toReplaceWith(jetCoreRegionalStepSeeds,
RecoTracker.TkSeedGenerator.DeepCoreSeedGenerator_cfi.DeepCoreSeedGenerator.clone(
# RecoTracker.TkSeedGenerator.JetCoreMCtruthSeedGenerator_cfi.JetCoreMCtruthSeedGenerator.clone( #MCtruthSeedGenerator
vertices="firstStepPrimaryVertices"
)
)

# MAKING OF TRACK CANDIDATES
import RecoTracker.CkfPattern.CkfTrackCandidates_cfi
jetCoreRegionalStepTrackCandidates = RecoTracker.CkfPattern.CkfTrackCandidates_cfi.ckfTrackCandidates.clone(
# src = 'jetCoreSeeds',
src = 'jetCoreRegionalStepSeeds',
maxSeedsBeforeCleaning = 10000,
TrajectoryBuilderPSet = cms.PSet( refToPSet_ = cms.string('jetCoreRegionalStepTrajectoryBuilder')),
TrajectoryCleaner = 'jetCoreTrajectoryCleanerBySharedHits',
NavigationSchool = 'SimpleNavigationSchool',
doSeedingRegionRebuilding = True,
### these two parameters are relevant only for the CachingSeedCleanerBySharedInput
#numHitsForSeedCleaner = cms.int32(50),
#onlyPixelHitsForSeedCleaner = cms.bool(True),
)
seedingDeepCore.toModify(jetCoreRegionalStepTrackCandidates,
TrajectoryCleaner = 'jetCoreRegionalStepDeepCoreTrajectoryCleaner',
doSeedingRegionRebuilding = True,
)


# TRACK FITTING
Expand Down Expand Up @@ -266,22 +254,19 @@

fastSim.toModify(jetCoreRegionalStep,vertices = 'firstStepPrimaryVerticesBeforeMixing')



# Final sequence
JetCoreRegionalStepTask = cms.Task(jetsForCoreTracking,
JetCoreRegionalStepTask = cms.Task(jetsForCoreTracking,
firstStepGoodPrimaryVertices,
#jetCoreRegionalStepClusters,
jetCoreRegionalStepSeedLayers,
jetCoreRegionalStepTrackingRegions,
jetCoreRegionalStepHitDoublets,
jetCoreRegionalStepSeeds,
# jetCoreSeeds,
jetCoreRegionalStepTrackCandidates,
jetCoreRegionalStepTracks,
# jetCoreRegionalStepClassifier1,jetCoreRegionalStepClassifier2,
jetCoreRegionalStep)
JetCoreRegionalStep = cms.Sequence(JetCoreRegionalStepTask)
fastSim.toReplaceWith(JetCoreRegionalStepTask,
fastSim.toReplaceWith(JetCoreRegionalStepTask,
cms.Task(jetCoreRegionalStepTracks,
jetCoreRegionalStep))
4 changes: 2 additions & 2 deletions RecoTracker/TkSeedGenerator/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<use name="PhysicsTools/TensorFlow"/>
<use name="SimDataFormats/TrackingAnalysis"/>
<use name="CommonTools/RecoAlgos"/>
<use name="DataFormats/L1TrackTrigger"/>
<use name="RecoTracker/TkSeedGenerator"/>
Expand Down Expand Up @@ -41,8 +43,6 @@
<use name="TrackingTools/Records"/>
<use name="TrackingTools/TrajectoryState"/>
<use name="TrackingTools/TransientTrackingRecHit"/>
<use name="PhysicsTools/TensorFlow"/>
<use name="SimDataFormats/TrackingAnalysis"/>
<library file="*.cc" name="RecoTrackerTkSeedGeneratorPlugins">
<flags EDM_PLUGIN="1"/>
<use name="DataFormats/TrackerRecHit2D"/>
Expand Down
Loading

0 comments on commit 24d8629

Please sign in to comment.