Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-12 09:07:53

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 
0004 from RecoParticleFlow.PFTracking.particleFlowTrack_cff import *
0005 #from RecoParticleFlow.PFTracking.particleFlowTrackWithDisplacedVertex_cff import *
0006 
0007 from RecoParticleFlow.PFProducer.particleFlowSimParticle_cff import *
0008 from RecoParticleFlow.PFProducer.particleFlowBlock_cff import *
0009 
0010 from RecoParticleFlow.PFProducer.particleFlowEGamma_cff import *
0011 from RecoParticleFlow.PFProducer.particleFlow_cff import *
0012 from RecoParticleFlow.PFProducer.pfElectronTranslator_cff import *
0013 from RecoParticleFlow.PFProducer.pfPhotonTranslator_cff import *
0014 #from RecoParticleFlow.PFProducer.pfGsfElectronCiCSelector_cff import *
0015 from RecoParticleFlow.PFProducer.pfGsfElectronMVASelector_cff import *
0016 
0017 from RecoParticleFlow.PFProducer.pfLinker_cff import *
0018 
0019 from CommonTools.ParticleFlow.pfParticleSelection_cff import *
0020 
0021 from RecoEgamma.EgammaIsolationAlgos.particleBasedIsoProducer_cff import *
0022 from RecoParticleFlow.PFProducer.chargedHadronPFTrackIsolation_cfi import *
0023 
0024 from RecoJets.JetProducers.fixedGridRhoProducerFastjet_cfi import *
0025 fixedGridRhoFastjetAllTmp = fixedGridRhoFastjetAll.clone(pfCandidatesTag = "particleFlowTmp")
0026 
0027 particleFlowTmpTask = cms.Task(particleFlowTmp)
0028 particleFlowTmpSeq = cms.Sequence(particleFlowTmpTask)
0029 
0030 particleFlowRecoTask = cms.Task( particleFlowTrackWithDisplacedVertexTask,
0031 #                                pfGsfElectronCiCSelectionSequence,
0032                                  pfGsfElectronMVASelectionTask,
0033                                  particleFlowBlock,
0034                                  particleFlowEGammaFullTask,
0035                                  particleFlowTmpTask,
0036                                  fixedGridRhoFastjetAllTmp,
0037                                  particleFlowTmpPtrs,
0038                                  particleFlowEGammaFinalTask,
0039                                  pfParticleSelectionTask )
0040 particleFlowReco = cms.Sequence(particleFlowRecoTask)
0041 
0042 particleFlowLinksTask = cms.Task( particleFlow, particleFlowPtrs, chargedHadronPFTrackIsolation, particleBasedIsolationTask)
0043 particleFlowLinks = cms.Sequence(particleFlowLinksTask)
0044 
0045 #
0046 # for phase 2
0047 particleFlowTmpBarrel = particleFlowTmp.clone()
0048 _phase2_hgcal_particleFlowTmp = cms.EDProducer(
0049     "PFCandidateListMerger",
0050     src = cms.VInputTag("particleFlowTmpBarrel",
0051                         "pfTICL")
0052 
0053 )
0054 
0055 from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
0056 phase2_hgcal.toReplaceWith( particleFlowTmp, _phase2_hgcal_particleFlowTmp )
0057 phase2_hgcal.toModify(
0058     particleFlowTmpBarrel,
0059     vetoEndcap = True
0060     # If true, PF(Muon)Algo will ignore muon candidates incorporated via pfTICL
0061     # in addMissingMuons. This will prevent potential double-counting.
0062 )
0063 
0064 #
0065 # for simPF
0066 from RecoParticleFlow.PFClusterProducer.particleFlowClusterHGC_cfi import *
0067 from RecoParticleFlow.PFTracking.hgcalTrackCollection_cfi import *
0068 from RecoParticleFlow.PFProducer.simPFProducer_cff import *
0069 from SimTracker.TrackerHitAssociation.tpClusterProducer_cfi import *
0070 from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import *
0071 
0072 _phase2_hgcal_simPFTask = cms.Task( pfTrack ,
0073                                     hgcalTrackCollection ,
0074                                     tpClusterProducer ,
0075                                     quickTrackAssociatorByHits ,
0076                                     particleFlowClusterHGCalFromSimCl ,
0077                                     simPFProducer )
0078 _phase2_hgcal_simPFSequence = cms.Sequence(_phase2_hgcal_simPFTask)
0079 
0080 _phase2_hgcal_particleFlowRecoTask = cms.Task( _phase2_hgcal_simPFTask , particleFlowRecoTask.copy() )
0081 _phase2_hgcal_particleFlowRecoTask.replace( particleFlowTmpTask, cms.Task( particleFlowTmpBarrel, particleFlowTmp ) )
0082 
0083 phase2_hgcal.toReplaceWith( particleFlowRecoTask, _phase2_hgcal_particleFlowRecoTask )
0084 
0085 #
0086 # for heavy ion
0087 from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017
0088 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
0089 
0090 for e in [pp_on_XeXe_2017, pp_on_AA]:
0091     e.toModify(particleFlowDisplacedVertexCandidate,
0092                tracksSelectorParameters = dict(pt_min = 999999.0,
0093                                                nChi2_max = 0.0,
0094                                                pt_min_prim = 999999.0,
0095                                                dxy = 999999.0)
0096                )
0097 
0098     e.toModify(particleFlowBlock, useNuclear = cms.bool(False))
0099 
0100     e.toModify(pfNoPileUpIso, enable = False)
0101     e.toModify(pfPileUpIso, enable = False)
0102     e.toModify(pfNoPileUp, enable = False)
0103     e.toModify(pfPileUp, enable = False)
0104 
0105 
0106 # for MLPF, replace standard PFAlgo with the ONNX-based MLPF producer 
0107 from Configuration.ProcessModifiers.mlpf_cff import mlpf
0108 from RecoParticleFlow.PFProducer.mlpfProducer_cfi import mlpfProducer
0109 mlpf.toReplaceWith(particleFlowTmp, mlpfProducer)
0110 
0111 #
0112 # switch from pfTICL to simPF
0113 def _findIndicesByModule(process,name):
0114     ret = []
0115     if hasattr(process,'particleFlowBlock'):
0116         for i, pset in enumerate(process.particleFlowBlock.elementImporters):
0117             if pset.importerName.value() == name:
0118                 ret.append(i)
0119     return ret
0120 
0121 from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
0122 def replaceTICLwithSimPF(process):
0123     if hasattr(process,'particleFlowTmp'):
0124       process.particleFlowTmp.src = ['particleFlowTmpBarrel', 'simPFProducer']
0125 
0126     if hasattr(process,'particleFlowTmpBarrel'):
0127       process.particleFlowTmpBarrel.vetoEndcap = False
0128 
0129     _insertTrackImportersWithVeto = {}
0130     _trackImporters = ['GeneralTracksImporter','ConvBremTrackImporter',
0131                    'ConversionTrackImporter','NuclearInteractionTrackImporter']
0132     for importer in _trackImporters:
0133         for idx in _findIndicesByModule(process,importer):
0134             _insertTrackImportersWithVeto[idx] = dict(
0135                 vetoMode = cms.uint32(0), # HGCal-region PFTrack list for simPF
0136                 vetoSrc = cms.InputTag('hgcalTrackCollection:TracksInHGCal')
0137             )
0138     phase2_hgcal.toModify(
0139       process.particleFlowBlock,
0140       elementImporters = _insertTrackImportersWithVeto
0141     )
0142 
0143     return process