From 4169b7daef1e296849f0df56af155dfbbf8314c1 Mon Sep 17 00:00:00 2001 From: Mia Date: Fri, 5 Feb 2016 19:52:42 +0100 Subject: [PATCH 1/4] fix tracking HLT customization --- .../customizeHLTfor2016trackingTemplate.py | 66 ++++++++++++------- .../python/customizeHLTforCMSSW.py | 2 +- 2 files changed, 45 insertions(+), 23 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py b/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py index 92931f70871c8..ce2231979035a 100644 --- a/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py +++ b/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py @@ -29,6 +29,15 @@ def producers_by_type(process, *types): def esproducers_by_type(process, *types): return (module for module in process._Process__esproducers.values() if module._TypedParameterizable__type in types) +def module_in_sequence_by_label(sequence,label): + return (module for module in sequence.values() if module.label_() == label) + +def all_sequences(process): + return process._Process__sequences.values() + +def all_paths(process): + return process._Process__paths + def bug_fix(process): # fix 2015 bug for module in esproducers_by_type(process, 'MeasurementTrackerESProducer'): @@ -117,7 +126,7 @@ def new_selector(process): # new selectors # iter0 - if hasattr(process, 'HLTIterativeTrackingIteration0'): + if hasattr(process, 'HLTIterativeTrackingIteration0') or hasattr(process,'HLTIterativeTrackingIter02') or hasattr(process,'HLTTrackReconstructionForPF'): setattr(process,'hltIter0PFlowTrackCutClassifier', cms.EDProducer('TrackCutClassifier', src = cms.InputTag('hltIter0PFlowCtfWithMaterialTracks'), @@ -235,6 +244,7 @@ def new_selector(process): ) ) ) + setattr(process,'hltIter0PFlowTrackSelectionHighPurity', cms.EDProducer( "TrackCollectionFilterCloner", originalSource = cms.InputTag('hltIter0PFlowCtfWithMaterialTracks'), originalMVAVals = cms.InputTag('hltIter0PFlowTrackCutClassifier','MVAValues'), @@ -247,15 +257,21 @@ def new_selector(process): ) ) iter0HP = getattr(process,'hltIter0PFlowTrackSelectionHighPurity') + iter0classifier = getattr(process,'hltIter0PFlowTrackCutClassifier') + +# sequences = ['HLTIterativeTrackingIteration0'] + sequences = ['HLTIterativeTrackingIteration0','HLTTrackReconstructionForPF'] +# sequences = ['HLTIterativeTrackingIteration0','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] + for s in sequences: + if hasattr(process,s): + seq = getattr(process,s) + seq.insert( seq.index( iter0HP ), iter0classifier ) - iter0seq = getattr(process,'HLTIterativeTrackingIteration0') - iter0seq.insert( iter0seq.index( iter0HP ), getattr(process,'hltIter0PFlowTrackCutClassifier') ) -# iter02seq = getattr(process,'HLTIterativeTrackingIter02') -# iter02seq.insert( iter02seq.index( iter0HP ), process.hltIter0PFlowTrackCutClassifier ) - +# PFseq = getattr(process,'HLTTrackReconstructionForPF') +# ### iter1 - if hasattr(process, 'HLTIterativeTrackingIteration1'): + if hasattr(process, 'HLTIterativeTrackingIteration1') or hasattr(process,'HLTIterativeTrackingIter02') or hasattr(process,'HLTTrackReconstructionForPF'): setattr(process,'hltIter1PFlowTrackCutClassifierPrompt', cms.EDProducer('TrackCutClassifier', src = cms.InputTag('hltIter1PFlowCtfWithMaterialTracks'), @@ -513,18 +529,19 @@ def new_selector(process): iter1merge = getattr(process,'hltIter1PFlowTrackCutClassifierMerged') iter1HP = getattr(process,'hltIter1PFlowTrackSelectionHighPurity') - iter1seq = getattr(process,'HLTIterativeTrackingIteration1') - iter1seq.replace( getattr(process,'hltIter1PFlowTrackSelectionHighPurityLoose'), iter1prompt ) - iter1seq.replace( getattr(process,'hltIter1PFlowTrackSelectionHighPurityTight'), iter1detached ) - iter1seq.insert( iter1seq.index( iter1HP ), iter1merge ) - - iter02seq = getattr(process,'HLTIterativeTrackingIter02') - iter02seq.replace( getattr(process,'hltIter1PFlowTrackSelectionHighPurityLoose'), iter1prompt ) - iter02seq.replace( getattr(process,'hltIter1PFlowTrackSelectionHighPurityTight'), iter1detached ) - iter02seq.insert( iter02seq.index( iter1HP ), iter1merge ) +# sequences = ['HLTIterativeTrackingIteration1','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] + sequences = ['HLTIterativeTrackingIteration1','HLTTrackReconstructionForPF'] +# sequences = ['HLTIterativeTrackingIteration1','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] + for s in sequences: + if hasattr(process,s): + seq = getattr(process,s) + seq.replace( process.hltIter1PFlowTrackSelectionHighPurityLoose, iter1prompt ) + seq.replace( process.hltIter1PFlowTrackSelectionHighPurityTight, iter1detached ) + seq.insert( seq.index( iter1HP ), iter1merge ) + #### iter2 - if hasattr(process, 'HLTIterativeTrackingIteration2'): + if hasattr(process, 'HLTIterativeTrackingIteration2') or hasattr(process,'HLTIterativeTrackingIter02') or hasattr(process,'HLTTrackReconstructionForPF'): setattr(process,'hltIter2PFlowTrackCutClassifier', cms.EDProducer('TrackCutClassifier', src = cms.InputTag('hltIter2PFlowCtfWithMaterialTracks'), @@ -650,18 +667,23 @@ def new_selector(process): ) ) iter2HP = getattr(process,'hltIter2PFlowTrackSelectionHighPurity') + iter2classifier = getattr(process,'hltIter2PFlowTrackCutClassifier') - iter2seq = getattr(process,'HLTIterativeTrackingIteration2') - iter2seq.insert( iter2seq.index( iter2HP ), getattr(process,'hltIter2PFlowTrackCutClassifier') ) - iter02seq = getattr(process,'HLTIterativeTrackingIter02') - if hasattr(iter02seq,'hltIter2PFlowTrackSelectionHighPurity'): - iter02seq.insert( iter02seq.index( iter2HP ), getattr(process,'hltIter2PFlowTrackCutClassifier') ) +# sequences = ['HLTIterativeTrackingIteration2'] + sequences = ['HLTIterativeTrackingIteration2','HLTTrackReconstructionForPF'] +# sequences = ['HLTIterativeTrackingIteration2','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] + for s in sequences: + if hasattr(process,s): + seq = getattr(process,s) + seq.insert( seq.index( iter2HP ), iter2classifier ) + return process def customiseFor2016trackingTemplate(process): process = bug_fix(process) process = new_selector(process) + new_selector(process) process = CCC(process) process = speedup_building(process) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 3eaf3aab9b081..2cef9399b174c 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -76,7 +76,7 @@ def customizeHLTforCMSSW(process, menuType="GRun"): # process = customiseFor12718(process) process = customiseFor13062(process) from HLTrigger.Configuration.customizeHLTfor2016trackingTemplate import customiseFor2016trackingTemplate -# process = customiseFor2016trackingTemplate(process) + process = customiseFor2016trackingTemplate(process) pass return process From 6c9200efc464ea8f669d4635bc72134246157b95 Mon Sep 17 00:00:00 2001 From: Mia Date: Sat, 6 Feb 2016 14:35:55 +0100 Subject: [PATCH 2/4] delete not needed line --- .../python/customizeHLTfor2016trackingTemplate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py b/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py index ce2231979035a..dac3f8d1f3af5 100644 --- a/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py +++ b/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py @@ -683,8 +683,7 @@ def new_selector(process): def customiseFor2016trackingTemplate(process): process = bug_fix(process) process = new_selector(process) - new_selector(process) - + process = CCC(process) process = speedup_building(process) process = speedup_filtering(process) From 3529958312c30c6817d8a062675bd44d1992ee36 Mon Sep 17 00:00:00 2001 From: Mia Date: Mon, 8 Feb 2016 16:12:42 +0100 Subject: [PATCH 3/4] fisrt patch --- .../customizeHLTfor2016trackingTemplate.py | 747 ++++++------------ 1 file changed, 223 insertions(+), 524 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py b/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py index dac3f8d1f3af5..f8c8b712687a2 100644 --- a/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py +++ b/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py @@ -124,412 +124,179 @@ def speedup_filtering(process): def new_selector(process): + for label in process.sequences_().keys(): + if label == "HLTTrackReconstructionForPF": + print label + sequence = getattr(process,label) + print sequence + print '***********************' # new selectors # iter0 - if hasattr(process, 'HLTIterativeTrackingIteration0') or hasattr(process,'HLTIterativeTrackingIter02') or hasattr(process,'HLTTrackReconstructionForPF'): - - setattr(process,'hltIter0PFlowTrackCutClassifier', cms.EDProducer('TrackCutClassifier', - src = cms.InputTag('hltIter0PFlowCtfWithMaterialTracks'), - beamspot = cms.InputTag('hltOnlineBeamSpot'), - vertices = cms.InputTag('hltTrimmedPixelVertices'), - GBRForestLabel = cms.string(''), - GBRForestFileName = cms.string(''), - qualityCuts = cms.vdouble( - -0.7, - 0.1, - 0.7 - ), - mva = cms.PSet( - minNdof = cms.vdouble( - 1E-5, - 1E-5, - 1E-5 - ), - minPixelHits = cms.vint32( - 0, - 0, - 0 - ), - minLayers = cms.vint32( - 3, - 3, - 3 - ), - min3DLayers = cms.vint32( - 0, - 0, - 0 - ), - maxLostLayers = cms.vint32( - 1, - 1, - 1 - ), - maxChi2 = cms.vdouble( - 9999, - 25., - 16. - ), - maxChi2n = cms.vdouble( - 1.2, - 1., - 0.7 - ), - minNVtxTrk = cms.int32(3), - maxDz = cms.vdouble( - 0.5, - 0.2, - # 0.2 - 3.4028234663852886e+38 - ), - maxDzWrtBS = cms.vdouble( - 3.4028234663852886e+38, - 24, - 15 - ), - maxDr = cms.vdouble( - 0.5, - 0.03, - # 0.03 - 3.4028234663852886e+38 - ), - dz_par = cms.PSet( - dz_exp = cms.vint32( - 4, - 4, - 4, - ), - dz_par1 = cms.vdouble( - 0.4, - 0.4, - 0.4 - # 3.4028234663852886e+38 - ), - dz_par2 = cms.vdouble( - 0.35, - 0.35, - 0.35 - # 3.4028234663852886e+38 - ), - ), - dr_par = cms.PSet( - dr_exp = cms.vint32( - 4, - 4, - 4, - ), - dr_par1 = cms.vdouble( - 0.4, - 0.4, - 0.4 - # 3.4028234663852886e+38 - ), - dr_par2 = cms.vdouble( - 0.3, - 0.3, - 0.3 - # 3.4028234663852886e+38 - ), - d0err = cms.vdouble( - 0.003, - 0.003, - 0.003 - ), - d0err_par = cms.vdouble( - 0.001, - 0.001, - 0.001 + if hasattr(process,'HLTTrackReconstructionForPF'): + if hasattr(process, 'HLTIterativeTrackingIteration0') or hasattr(process,'HLTIterativeTrackingIter02'): + + print "FIND EVERYTHING" + + setattr(process,'hltIter0PFlowTrackCutClassifier', cms.EDProducer('TrackCutClassifier', + src = cms.InputTag('hltIter0PFlowCtfWithMaterialTracks'), + beamspot = cms.InputTag('hltOnlineBeamSpot'), + vertices = cms.InputTag('hltTrimmedPixelVertices'), + GBRForestLabel = cms.string(''), + GBRForestFileName = cms.string(''), + qualityCuts = cms.vdouble(-0.7,0.1,0.7), + mva = cms.PSet( + minNdof = cms.vdouble( 1E-5, 1E-5, 1E-5), + minPixelHits = cms.vint32(0, 0, 0), + minLayers = cms.vint32(3, 3, 3), + min3DLayers = cms.vint32(0, 0, 0), + maxLostLayers = cms.vint32(1, 1, 1), + maxChi2 = cms.vdouble(9999, 25., 16. ), + maxChi2n = cms.vdouble( 1.2, 1., 0.7), + minNVtxTrk = cms.int32(3), + maxDz = cms.vdouble(0.5, 0.2, 3.4028234663852886e+38), + maxDzWrtBS = cms.vdouble(3.4028234663852886e+38, 24, 15), + maxDr = cms.vdouble(0.5, 0.03, 3.4028234663852886e+38), + dz_par = cms.PSet( + dz_exp = cms.vint32(4,4,4), + dz_par1 = cms.vdouble(0.40, 0.40, 0.40), + dz_par2 = cms.vdouble(0.35, 0.35, 0.35), + ), + dr_par = cms.PSet( + dr_exp = cms.vint32(4,4,4), + dr_par1 = cms.vdouble(0.40, 0.40, 0.40), + dr_par2 = cms.vdouble(0.30, 0.30, 0.30), + d0err = cms.vdouble(0.003,0.003,0.003), + d0err_par = cms.vdouble(0.001,0.001,0.001) + ) ) + ) + ) + + setattr(process,'hltIter0PFlowTrackSelectionHighPurity', cms.EDProducer( "TrackCollectionFilterCloner", + originalSource = cms.InputTag('hltIter0PFlowCtfWithMaterialTracks'), + originalMVAVals = cms.InputTag('hltIter0PFlowTrackCutClassifier','MVAValues'), + originalQualVals = cms.InputTag('hltIter0PFlowTrackCutClassifier','QualityMasks'), + minQuality = cms.string('highPurity') , + cloner = cms.untracked.PSet( + copyExtras = cms.untracked.bool(False), + copyTrajectories = cms.untracked.bool(False) + ) ) - ) - ) - ) - - setattr(process,'hltIter0PFlowTrackSelectionHighPurity', cms.EDProducer( "TrackCollectionFilterCloner", - originalSource = cms.InputTag('hltIter0PFlowCtfWithMaterialTracks'), - originalMVAVals = cms.InputTag('hltIter0PFlowTrackCutClassifier','MVAValues'), - originalQualVals = cms.InputTag('hltIter0PFlowTrackCutClassifier','QualityMasks'), - minQuality = cms.string('highPurity') , - cloner = cms.untracked.PSet( - copyExtras = cms.untracked.bool(False), - copyTrajectories = cms.untracked.bool(False) - ) - ) - ) - iter0HP = getattr(process,'hltIter0PFlowTrackSelectionHighPurity') - iter0classifier = getattr(process,'hltIter0PFlowTrackCutClassifier') + ) -# sequences = ['HLTIterativeTrackingIteration0'] - sequences = ['HLTIterativeTrackingIteration0','HLTTrackReconstructionForPF'] -# sequences = ['HLTIterativeTrackingIteration0','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] - for s in sequences: - if hasattr(process,s): - seq = getattr(process,s) - seq.insert( seq.index( iter0HP ), iter0classifier ) + iter0HP = getattr(process,'hltIter0PFlowTrackSelectionHighPurity') + iter0classifier = getattr(process,'hltIter0PFlowTrackCutClassifier') + sequences = ['HLTIterativeTrackingIteration0','HLTTrackReconstructionForPF'] +# sequences = ['HLTIterativeTrackingIteration0','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] + for s in sequences: + if hasattr(process,s): + seq = getattr(process,s) + seq.insert( seq.index( iter0HP ), iter0classifier ) + + print '***********************' + print 'AFTER iter0' + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' # PFseq = getattr(process,'HLTTrackReconstructionForPF') # ### iter1 - if hasattr(process, 'HLTIterativeTrackingIteration1') or hasattr(process,'HLTIterativeTrackingIter02') or hasattr(process,'HLTTrackReconstructionForPF'): - - setattr(process,'hltIter1PFlowTrackCutClassifierPrompt', cms.EDProducer('TrackCutClassifier', - src = cms.InputTag('hltIter1PFlowCtfWithMaterialTracks'), - beamspot = cms.InputTag('hltOnlineBeamSpot'), - vertices = cms.InputTag('hltTrimmedPixelVertices'), - GBRForestLabel = cms.string(''), - GBRForestFileName = cms.string(''), - qualityCuts = cms.vdouble( - -0.7, - 0.1, - 0.7 - ), - mva = cms.PSet( - minNdof = cms.vdouble( - 1E-5, - 1E-5, - 1E-5 - ), - minPixelHits = cms.vint32( - 0, - 0, - 2 - ), - minLayers = cms.vint32( - 3, - 3, - 3 - ), - min3DLayers = cms.vint32( - 0, - 0, - 0 - ), - maxLostLayers = cms.vint32( - 1, - 1, - 1 - ), - maxChi2 = cms.vdouble( - 9999., - 25., - 16. - ), - maxChi2n = cms.vdouble( - 1.2, - 1., - 0.7 - ), - minNVtxTrk = cms.int32(3), - maxDz = cms.vdouble( - 3.4028234663852886e+38, - 1.0, - # 0.4 - 3.4028234663852886e+38 - ), - maxDzWrtBS = cms.vdouble( - 3.4028234663852886e+38, - 24, - 15 - ), - maxDr = cms.vdouble( - 3.4028234663852886e+38, - 1.0, - # 0.1 - 3.4028234663852886e+38 - ), - dz_par = cms.PSet( - dz_exp = cms.vint32( - 3, - 3, - 3, - ), - dz_par1 = cms.vdouble( - 3.4028234663852886e+38, - 1.0, - 0.9 - # 3.4028234663852886e+38 - ), - dz_par2 = cms.vdouble( - 3.4028234663852886e+38, - 1.0, - 0.8 - # 3.4028234663852886e+38 - ), - ), - dr_par = cms.PSet( - dr_exp = cms.vint32( - 3, - 3, - 3, - ), - dr_par1 = cms.vdouble( - 3.4028234663852886e+38, - 1.0, - 0.9 - # 3.4028234663852886e+38 - ), - dr_par2 = cms.vdouble( - 3.4028234663852886e+38, - 1.0, - 0.85 - # 3.4028234663852886e+38 - ), - d0err = cms.vdouble( - 0.003, - 0.003, - 0.003 - ), - d0err_par = cms.vdouble( - 0.001, - 0.001, - 0.001 + if hasattr(process,'HLTTrackReconstructionForPF'): + if hasattr(process, 'HLTIterativeTrackingIteration1') or hasattr(process,'HLTIterativeTrackingIter02'): + + setattr(process,'hltIter1PFlowTrackCutClassifierPrompt', cms.EDProducer('TrackCutClassifier', + src = cms.InputTag('hltIter1PFlowCtfWithMaterialTracks'), + beamspot = cms.InputTag('hltOnlineBeamSpot'), + vertices = cms.InputTag('hltTrimmedPixelVertices'), + GBRForestLabel = cms.string(''), + GBRForestFileName = cms.string(''), + qualityCuts = cms.vdouble(-0.7,0.1,0.7), + mva = cms.PSet( + minNdof = cms.vdouble( 1E-5, 1E-5, 1E-5), + minPixelHits = cms.vint32(0,0,2), + minLayers = cms.vint32(3, 3, 3), + min3DLayers = cms.vint32(0, 0, 0), + maxLostLayers = cms.vint32(1, 1, 1), + maxChi2 = cms.vdouble(9999, 25., 16. ), + maxChi2n = cms.vdouble( 1.2, 1., 0.7), + minNVtxTrk = cms.int32(3), + maxDz = cms.vdouble(3.4028234663852886e+38, 1.0, 3.4028234663852886e+38), + maxDzWrtBS = cms.vdouble(3.4028234663852886e+38, 24, 15), + maxDr = cms.vdouble(3.4028234663852886e+38, 1.0, 3.4028234663852886e+38), + dz_par = cms.PSet( + dz_exp = cms.vint32(3,3,3), + dz_par1 = cms.vdouble(3.4028234663852886e+38, 1.0, 0.9), + dz_par2 = cms.vdouble(3.4028234663852886e+38, 1.0, 0.8), + ), + dr_par = cms.PSet( + dr_exp = cms.vint32(3,3,3), + dr_par1 = cms.vdouble(3.4028234663852886e+38, 1.0, 0.90), + dr_par2 = cms.vdouble(3.4028234663852886e+38, 1.0, 0.85), + d0err = cms.vdouble(0.003,0.003,0.003), + d0err_par = cms.vdouble(0.001,0.001,0.001) + ) ) + ) + ) + + setattr(process,'hltIter1PFlowTrackCutClassifierDetached', cms.EDProducer('TrackCutClassifier', + src = cms.InputTag('hltIter1PFlowCtfWithMaterialTracks'), + beamspot = cms.InputTag('hltOnlineBeamSpot'), + vertices = cms.InputTag('hltTrimmedPixelVertices'), + GBRForestLabel = cms.string(''), + GBRForestFileName = cms.string(''), + qualityCuts = cms.vdouble(-0.7,0.1,0.7), + mva = cms.PSet( + minNdof = cms.vdouble( 1E-5, 1E-5, 1E-5), + minPixelHits = cms.vint32(0,0,2), + minLayers = cms.vint32(5,5,5), + min3DLayers = cms.vint32(0, 0, 0), + maxLostLayers = cms.vint32(1, 1, 1), + maxChi2 = cms.vdouble(9999, 25., 16. ), + maxChi2n = cms.vdouble(1.0, 0.7, 0.4), + minNVtxTrk = cms.int32(3), + maxDz = cms.vdouble(3.4028234663852886e+38, 1.0, 3.4028234663852886e+38), + maxDzWrtBS = cms.vdouble(3.4028234663852886e+38, 24, 15), + maxDr = cms.vdouble(3.4028234663852886e+38, 1.0, 3.4028234663852886e+38), + dz_par = cms.PSet( + dz_exp = cms.vint32(4,4,4), + dz_par1 = cms.vdouble(1.0, 1.0, 1.0), + dz_par2 = cms.vdouble(1.0, 1.0, 1.0), + ), + dr_par = cms.PSet( + dr_exp = cms.vint32(4,4,4), + dr_par1 = cms.vdouble(1.0,1.0,1.0), + dr_par2 = cms.vdouble(1.0,1.0,1.0), + d0err = cms.vdouble(0.003,0.003,0.003), + d0err_par = cms.vdouble(0.001,0.001,0.001) + + ) + ) + ) + ) + setattr(process,'hltIter1PFlowTrackCutClassifierMerged', cms.EDProducer('ClassifierMerger', + inputClassifiers = cms.vstring('hltIter1PFlowTrackCutClassifierPrompt','hltIter1PFlowTrackCutClassifierDetached') ) - ) - ) - ) - - setattr(process,'hltIter1PFlowTrackCutClassifierDetached', cms.EDProducer('TrackCutClassifier', - src = cms.InputTag('hltIter1PFlowCtfWithMaterialTracks'), - beamspot = cms.InputTag('hltOnlineBeamSpot'), - vertices = cms.InputTag('hltTrimmedPixelVertices'), - GBRForestLabel = cms.string(''), - GBRForestFileName = cms.string(''), - qualityCuts = cms.vdouble( - -0.7, - 0.1, - 0.7 - ), - mva = cms.PSet( - minNdof = cms.vdouble( - 1E-5, - 1E-5, - 1E-5 - ), - minPixelHits = cms.vint32( - 0, - 0, - 2 - ), - minLayers = cms.vint32( - 5, - 5, - 5 - ), - min3DLayers = cms.vint32( - 0, - 0, - 0 - ), - maxLostLayers = cms.vint32( - 1, - 1, - 1 - ), - maxChi2 = cms.vdouble( - 9999., - 25., - 16. - ), - maxChi2n = cms.vdouble( - 1.0, - 0.7, - 0.4 - ), - minNVtxTrk = cms.int32(3), - maxDz = cms.vdouble( - 3.4028234663852886e+38, - 1.0, - # 0.5 - 3.4028234663852886e+38 - ), - maxDzWrtBS = cms.vdouble( - 3.4028234663852886e+38, - 24, - 15 - ), - maxDr = cms.vdouble( - 3.4028234663852886e+38, - 1.0, - # 0.2 - 3.4028234663852886e+38 - ), - dz_par = cms.PSet( - dz_exp = cms.vint32( - 4, - 4, - 4, - ), - dz_par1 = cms.vdouble( - 1.0, - 1.0, - 1.0 - # 3.4028234663852886e+38 - ), - dz_par2 = cms.vdouble( - 1.0, - 1.0, - 1.0 - # 3.4028234663852886e+38 - ), - ), - dr_par = cms.PSet( - dr_exp = cms.vint32( - 4, - 4, - 4, - ), - dr_par1 = cms.vdouble( - 1.0, - 1.0, - 1.0 - # 3.4028234663852886e+38 - ), - dr_par2 = cms.vdouble( - 1.0, - 1.0, - 1.0 - # 3.4028234663852886e+38 - ), - d0err = cms.vdouble( - 0.003, - 0.003, - 0.003 - ), - d0err_par = cms.vdouble( - 0.001, - 0.001, - 0.001 + ) + + setattr(process,'hltIter1PFlowTrackSelectionHighPurity', cms.EDProducer( "TrackCollectionFilterCloner", + originalSource = cms.InputTag('hltIter1PFlowCtfWithMaterialTracks'), + originalMVAVals = cms.InputTag('hltIter1PFlowTrackCutClassifierMerged','MVAValues'), + originalQualVals = cms.InputTag('hltIter1PFlowTrackCutClassifierMerged','QualityMasks'), + minQuality = cms.string('highPurity') , + cloner = cms.untracked.PSet( + copyExtras = cms.untracked.bool(False), + copyTrajectories = cms.untracked.bool(False) ) - + ) ) - ) - ) - ) - setattr(process,'hltIter1PFlowTrackCutClassifierMerged', cms.EDProducer('ClassifierMerger', - inputClassifiers = cms.vstring('hltIter1PFlowTrackCutClassifierPrompt','hltIter1PFlowTrackCutClassifierDetached') - ) - ) - - setattr(process,'hltIter1PFlowTrackSelectionHighPurity', cms.EDProducer( "TrackCollectionFilterCloner", - originalSource = cms.InputTag('hltIter1PFlowCtfWithMaterialTracks'), - originalMVAVals = cms.InputTag('hltIter1PFlowTrackCutClassifierMerged','MVAValues'), - originalQualVals = cms.InputTag('hltIter1PFlowTrackCutClassifierMerged','QualityMasks'), - minQuality = cms.string('highPurity') , - cloner = cms.untracked.PSet( - copyExtras = cms.untracked.bool(False), - copyTrajectories = cms.untracked.bool(False) - ) - ) - ) + + iter1prompt = getattr(process,'hltIter1PFlowTrackCutClassifierPrompt') + iter1detached = getattr(process,'hltIter1PFlowTrackCutClassifierDetached') + iter1merge = getattr(process,'hltIter1PFlowTrackCutClassifierMerged') + iter1HP = getattr(process,'hltIter1PFlowTrackSelectionHighPurity') - iter1prompt = getattr(process,'hltIter1PFlowTrackCutClassifierPrompt') - iter1detached = getattr(process,'hltIter1PFlowTrackCutClassifierDetached') - iter1merge = getattr(process,'hltIter1PFlowTrackCutClassifierMerged') - iter1HP = getattr(process,'hltIter1PFlowTrackSelectionHighPurity') - -# sequences = ['HLTIterativeTrackingIteration1','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] sequences = ['HLTIterativeTrackingIteration1','HLTTrackReconstructionForPF'] # sequences = ['HLTIterativeTrackingIteration1','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] for s in sequences: @@ -539,144 +306,76 @@ def new_selector(process): seq.replace( process.hltIter1PFlowTrackSelectionHighPurityTight, iter1detached ) seq.insert( seq.index( iter1HP ), iter1merge ) + print '***********************' + print 'AFTER iter1' + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' + #### iter2 - if hasattr(process, 'HLTIterativeTrackingIteration2') or hasattr(process,'HLTIterativeTrackingIter02') or hasattr(process,'HLTTrackReconstructionForPF'): - - setattr(process,'hltIter2PFlowTrackCutClassifier', cms.EDProducer('TrackCutClassifier', - src = cms.InputTag('hltIter2PFlowCtfWithMaterialTracks'), - beamspot = cms.InputTag('hltOnlineBeamSpot'), - vertices = cms.InputTag('hltTrimmedPixelVertices'), - GBRForestLabel = cms.string(''), - GBRForestFileName = cms.string(''), - qualityCuts = cms.vdouble( - -0.7, - 0.1, - 0.7 - ), - mva = cms.PSet( - minNdof = cms.vdouble( - 1E-5, - 1E-5, - 1E-5 - ), - minPixelHits = cms.vint32( - 0, - 0, - 0 - ), - minLayers = cms.vint32( - 3, - 3, - 3 - ), - min3DLayers = cms.vint32( - 0, - 0, - 0 - ), - maxLostLayers = cms.vint32( - 1, - 1, - 1 - ), - maxChi2 = cms.vdouble( - 9999, - 25., - 16. - ), - maxChi2n = cms.vdouble( - 1.2, - 1., - 0.7 - ), - minNVtxTrk = cms.int32(3), - maxDz = cms.vdouble( - 0.5, - 0.2, - 3.4028234663852886e+38, - # 0.1 # 0.2 - ), - maxDzWrtBS = cms.vdouble( - 3.4028234663852886e+38, - 24, - 15 - ), - maxDr = cms.vdouble( - 0.5, - 0.03, - 3.4028234663852886e+38, - # 0.03 - ), - dz_par = cms.PSet( - dz_exp = cms.vint32( - 4, - 4, - 4, - ), - dz_par1 = cms.vdouble( - 3.4028234663852886e+38, - 0.4, - 0.4 - ), - dz_par2 = cms.vdouble( - 3.4028234663852886e+38, - 0.35, - 0.35 - ), - ), - dr_par = cms.PSet( - dr_exp = cms.vint32( - 4, - 4, - 4, - ), - dr_par1 = cms.vdouble( - 3.4028234663852886e+38, - 0.4, - 0.4 - ), - dr_par2 = cms.vdouble( - 3.4028234663852886e+38, - 0.3, - 0.3 - ), - d0err = cms.vdouble( - 0.003, - 0.003, - 0.003 - ), - d0err_par = cms.vdouble( - 0.001, - 0.001, - 0.001 + if hasattr(process,'HLTTrackReconstructionForPF'): + if hasattr(process, 'HLTIterativeTrackingIteration2') or hasattr(process,'HLTIterativeTrackingIter02'): + + setattr(process,'hltIter2PFlowTrackCutClassifier', cms.EDProducer('TrackCutClassifier', + src = cms.InputTag('hltIter2PFlowCtfWithMaterialTracks'), + beamspot = cms.InputTag('hltOnlineBeamSpot'), + vertices = cms.InputTag('hltTrimmedPixelVertices'), + GBRForestLabel = cms.string(''), + GBRForestFileName = cms.string(''), + qualityCuts = cms.vdouble(-0.7,0.1,0.7), + mva = cms.PSet( + minNdof = cms.vdouble( 1E-5, 1E-5, 1E-5), + minPixelHits = cms.vint32(0, 0, 0), + minLayers = cms.vint32(3, 3, 3), + min3DLayers = cms.vint32(0, 0, 0), + maxLostLayers = cms.vint32(1, 1, 1), + maxChi2 = cms.vdouble(9999, 25., 16. ), + maxChi2n = cms.vdouble( 1.2, 1., 0.7), + minNVtxTrk = cms.int32(3), + maxDz = cms.vdouble(0.5, 0.2, 3.4028234663852886e+38), + maxDzWrtBS = cms.vdouble(3.4028234663852886e+38, 24, 15), + maxDr = cms.vdouble(0.5, 0.03, 3.4028234663852886e+38), + dz_par = cms.PSet( + dz_exp = cms.vint32(4,4,4), + dz_par1 = cms.vdouble(3.4028234663852886e+38, 0.40, 0.40), + dz_par2 = cms.vdouble(3.4028234663852886e+38, 0.35, 0.35), + ), + dr_par = cms.PSet( + dr_exp = cms.vint32(4,4,4), + dr_par1 = cms.vdouble(3.4028234663852886e+38, 0.40, 0.40), + dr_par2 = cms.vdouble(3.4028234663852886e+38, 0.30, 0.30), + d0err = cms.vdouble(0.003,0.003,0.003), + d0err_par = cms.vdouble(0.001,0.001,0.001) + ) + ) + ) + ) + setattr(process,'hltIter2PFlowTrackSelectionHighPurity', cms.EDProducer( "TrackCollectionFilterCloner", + originalSource = cms.InputTag('hltIter2PFlowCtfWithMaterialTracks'), + originalMVAVals = cms.InputTag('hltIter2PFlowTrackCutClassifier','MVAValues'), + originalQualVals = cms.InputTag('hltIter2PFlowTrackCutClassifier','QualityMasks'), + minQuality = cms.string('highPurity') , + cloner = cms.untracked.PSet( + copyExtras = cms.untracked.bool(False), + copyTrajectories = cms.untracked.bool(False) ) + ) ) - ) - ) - ) - setattr(process,'hltIter2PFlowTrackSelectionHighPurity', cms.EDProducer( "TrackCollectionFilterCloner", - originalSource = cms.InputTag('hltIter2PFlowCtfWithMaterialTracks'), - originalMVAVals = cms.InputTag('hltIter2PFlowTrackCutClassifier','MVAValues'), - originalQualVals = cms.InputTag('hltIter2PFlowTrackCutClassifier','QualityMasks'), - minQuality = cms.string('highPurity') , - cloner = cms.untracked.PSet( - copyExtras = cms.untracked.bool(False), - copyTrajectories = cms.untracked.bool(False) - ) - ) - ) - iter2HP = getattr(process,'hltIter2PFlowTrackSelectionHighPurity') - iter2classifier = getattr(process,'hltIter2PFlowTrackCutClassifier') + iter2HP = getattr(process,'hltIter2PFlowTrackSelectionHighPurity') + iter2classifier = getattr(process,'hltIter2PFlowTrackCutClassifier') + + sequences = ['HLTIterativeTrackingIteration2','HLTTrackReconstructionForPF'] + # sequences = ['HLTIterativeTrackingIteration2','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] + for s in sequences: + if hasattr(process,s): + seq = getattr(process,s) + seq.insert( seq.index( iter2HP ), iter2classifier ) + + print '***********************' + print 'AFTER iter2' + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' -# sequences = ['HLTIterativeTrackingIteration2'] - sequences = ['HLTIterativeTrackingIteration2','HLTTrackReconstructionForPF'] -# sequences = ['HLTIterativeTrackingIteration2','HLTIterativeTrackingIter02','HLTTrackReconstructionForPF'] - for s in sequences: - if hasattr(process,s): - seq = getattr(process,s) - seq.insert( seq.index( iter2HP ), iter2classifier ) - return process From ba9eca50aaa8d2df2d563ae82cc5f6475f0725b9 Mon Sep 17 00:00:00 2001 From: Mia Date: Mon, 8 Feb 2016 16:32:55 +0100 Subject: [PATCH 4/4] final patch (?) --- .../customizeHLTfor2016trackingTemplate.py | 25 ------------- .../python/customizeHLTforCMSSW.py | 5 ++- .../Configuration/python/customizeHLTforMC.py | 35 +++++++++++++++++++ 3 files changed, 39 insertions(+), 26 deletions(-) diff --git a/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py b/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py index f8c8b712687a2..fec80ac8ab9f4 100644 --- a/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py +++ b/HLTrigger/Configuration/python/customizeHLTfor2016trackingTemplate.py @@ -124,19 +124,11 @@ def speedup_filtering(process): def new_selector(process): - for label in process.sequences_().keys(): - if label == "HLTTrackReconstructionForPF": - print label - sequence = getattr(process,label) - print sequence - print '***********************' # new selectors # iter0 if hasattr(process,'HLTTrackReconstructionForPF'): if hasattr(process, 'HLTIterativeTrackingIteration0') or hasattr(process,'HLTIterativeTrackingIter02'): - print "FIND EVERYTHING" - setattr(process,'hltIter0PFlowTrackCutClassifier', cms.EDProducer('TrackCutClassifier', src = cms.InputTag('hltIter0PFlowCtfWithMaterialTracks'), beamspot = cms.InputTag('hltOnlineBeamSpot'), @@ -194,11 +186,6 @@ def new_selector(process): seq = getattr(process,s) seq.insert( seq.index( iter0HP ), iter0classifier ) - print '***********************' - print 'AFTER iter0' - print getattr(process,'HLTTrackReconstructionForPF') - print '***********************' - # PFseq = getattr(process,'HLTTrackReconstructionForPF') # ### iter1 @@ -306,12 +293,6 @@ def new_selector(process): seq.replace( process.hltIter1PFlowTrackSelectionHighPurityTight, iter1detached ) seq.insert( seq.index( iter1HP ), iter1merge ) - print '***********************' - print 'AFTER iter1' - print getattr(process,'HLTTrackReconstructionForPF') - print '***********************' - - #### iter2 if hasattr(process,'HLTTrackReconstructionForPF'): if hasattr(process, 'HLTIterativeTrackingIteration2') or hasattr(process,'HLTIterativeTrackingIter02'): @@ -371,12 +352,6 @@ def new_selector(process): seq = getattr(process,s) seq.insert( seq.index( iter2HP ), iter2classifier ) - print '***********************' - print 'AFTER iter2' - print getattr(process,'HLTTrackReconstructionForPF') - print '***********************' - - return process def customiseFor2016trackingTemplate(process): diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 2cef9399b174c..d53b398b976d1 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -76,7 +76,10 @@ def customizeHLTforCMSSW(process, menuType="GRun"): # process = customiseFor12718(process) process = customiseFor13062(process) from HLTrigger.Configuration.customizeHLTfor2016trackingTemplate import customiseFor2016trackingTemplate - process = customiseFor2016trackingTemplate(process) + from Configuration.StandardSequences.Eras import eras + if not eras.fastSim.isChosen(): + process = customiseFor2016trackingTemplate(process) + pass pass return process diff --git a/HLTrigger/Configuration/python/customizeHLTforMC.py b/HLTrigger/Configuration/python/customizeHLTforMC.py index 0db14c80bb826..d8750d20151fa 100644 --- a/HLTrigger/Configuration/python/customizeHLTforMC.py +++ b/HLTrigger/Configuration/python/customizeHLTforMC.py @@ -31,6 +31,11 @@ def customizeHLTforMC(process,_fastSim=False): if _fastSim: + print '***********************' + print 'FAST SIM beginning' + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' + fastsim = cms.ProcessFragment( process.name_() ) fastsim.load( "FastSimulation.HighLevelTrigger.HLTSetup_cff" ) @@ -268,6 +273,9 @@ def customizeHLTforMC(process,_fastSim=False): ) SequencesToRemove = ( + "HLTIterativeTrackingIteration0", + "HLTIterativeTrackingIteration1", + "HLTIterativeTrackingIteration2", "HLTL1SeededEgammaRegionalRecoTrackerSequence", "HLTEcalActivityEgammaRegionalRecoTrackerSequence", "HLTPixelMatchElectronActivityTrackingSequence", @@ -311,11 +319,17 @@ def customizeHLTforMC(process,_fastSim=False): "HLTHBHENoiseCleanerSequence", ) + print "JUST BEFORE 'Removing ESmodules'" # Removing ESmodules for label in ESModulesToRemove: if (hasattr(process,label)): delattr(process,label) + print '***********************' + print "AFTER'Removing ESmodules'" + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' + # Removing paths import fnmatch,re ExplicitList = [] @@ -332,7 +346,13 @@ def customizeHLTforMC(process,_fastSim=False): for path in UniqueList: process.schedule.remove(getattr(process,path)) process.setSchedule_(process.schedule) + print 'before pruning' + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' process.prune() + print 'after pruning' + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' # Removing streams and datasets PSets if hasattr(process,'streams'): @@ -341,6 +361,7 @@ def customizeHLTforMC(process,_fastSim=False): delattr(process,'datasets') # Removing sequences, possibly to be taken from fastsim import + print 'REMOVING label *************' for label in SequencesToRemove: if hasattr(process,label): if hasattr(fastsim,label): @@ -361,6 +382,10 @@ def customizeHLTforMC(process,_fastSim=False): more = path.remove(object) delattr(process,label) + print "after label in sequence" + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' + # Removing modules, possibly to be taken from fastsim import for label in ModulesToRemove: if hasattr(process,label): @@ -417,6 +442,10 @@ def customizeHLTforMC(process,_fastSim=False): setattr(process,label,getattr(fastsim,label)) # Update InputTags + print '***********************' + print 'FAST SIM between' + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' InputTags = ( ('hltGtDigis','gtDigis'), @@ -500,6 +529,12 @@ def customizeHLTforMC(process,_fastSim=False): getattr(process,label).SeedConfiguration.initialSeeds = cms.InputTag('hltPixelPairSeeds') getattr(process,label).SeedConfiguration.preFilteredSeeds = cms.bool(False) + print '***********************' + print 'FAST SIM end' + print getattr(process,'HLTTrackReconstructionForPF') + print '***********************' + + # Extending fastsim import fastsim.extend(process) fastsim.setSchedule_(fastsim.schedule)