Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-22 22:52:33

0001 import FWCore.ParameterSet.Config as cms
0002 from PhysicsTools.NanoAOD.common_cff import *
0003 from PhysicsTools.NanoAOD.electrons_cff import *
0004 from PhysicsTools.NanoAOD.electrons_cff import _eleVarsExtra
0005 from PhysicsTools.NanoAOD.photons_cff import *
0006 from PhysicsTools.NanoAOD.photons_cff import _phoVarsExtra
0007 from PhysicsTools.NanoAOD.NanoAODEDMEventContent_cff import *
0008 from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM
0009 from PhysicsTools.NanoAOD.nanoDQM_cff import _Photon_extra_plots, _Electron_extra_plots
0010 from PhysicsTools.NanoAOD.triggerObjects_cff import triggerObjectTable, mksel
0011 from RecoEgamma.EgammaIsolationAlgos.superclusValueMapProducer_cfi import superclusValueMaps
0012 
0013 customElectronFilterBits = cms.PSet(
0014     doc = cms.string("PixelMatched e/gamma"), # this may also select photons!
0015     id = cms.int32(11),
0016     sel = cms.string("type(92) && pt > 7 && (coll('hltEgammaCandidates') || coll('hltEgammaCandidatesUnseeded')) && (filter('*PixelMatchFilter') || filter('*PixelMatchUnseededFilter'))"),
0017     l1seed = cms.string("type(-98)"),  l1deltaR = cms.double(0.3),
0018     skipObjectsNotPassingQualityBits = cms.bool(True),
0019     qualityBits = cms.VPSet(
0020         #HLT_Ele30_WPTight_Gsf
0021         mksel("filter('hltEGL1SingleEGOrFilter')","1e WPTight L1T match"), 
0022         mksel("filter('hltEG30L1SingleEGOrEtFilter')","1e WPTight Et"),
0023         mksel("filter('hltEle30WPTightClusterShapeFilter')","1e WPTight SigmaIeIe"),
0024         mksel("filter('hltEle30WPTightHEFilter')","1e WPTight HoE"),
0025         mksel("filter('hltEle30WPTightEcalIsoFilter')","1e WPTight ECAL Iso"),
0026         mksel("filter('hltEle30WPTightHcalIsoFilter')","1e WPTight HCAL Iso"),
0027         mksel("filter('hltEle30WPTightPixelMatchFilter')","1e WPTight Pixel match"),
0028         mksel("filter('hltEle30WPTightPMS2Filter')","1e WPTight S2"),
0029         mksel("filter('hltEle30WPTightGsfOneOEMinusOneOPFilter')","1e WPTight 1/E-1/p"),
0030         mksel("filter('hltEle30WPTightGsfMissingHitsFilter')","1e WPTight missing hits"),
0031         mksel("filter('hltEle30WPTightGsfDetaFilter')","1e WPTight DEta"),
0032         mksel("filter('hltEle30WPTightGsfDphiFilter')","1e WPTight DPhi"),
0033         mksel("filter('hltEle30WPTightGsfTrackIsoFilter')","1e WPTight Track Iso"),
0034         #HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL
0035         mksel("filter('hltEGL1SingleAndDoubleEGOrPairFilter')","2e L1T match"), 
0036         mksel("filter('hltEle23Ele12CaloIdLTrackIdLIsoVLTrackIsoLeg1Filter')","2e Track Iso Leg1"),
0037         mksel("filter('hltEle23Ele12CaloIdLTrackIdLIsoVLTrackIsoLeg2Filter')","2e Track Iso Leg2"),
0038         #HLT_DoubleEle33_CaloIdL_MW
0039         mksel("filter('hltEGL1SingleAndDoubleEGNonIsoOrWithEG26WithJetAndTauFilter')","2e (CaloIdL_MW) L1T match"), 
0040         mksel("filter('hltEle33CaloIdLPixelMatchFilter')","2e (CaloIdL_MW) Pixel match Leg1"),
0041         mksel("filter('hltEle33CaloIdLMWPMS2Filter')","2e (CaloIdL_MW) S2"),
0042         mksel("filter('hltDiEle33CaloIdLMWPMS2UnseededFilter')","2e (CaloIdL_MW unseeded) S2"),
0043         #HLT_Photon200
0044         mksel("filter('hltEG200HEFilter')","1e Photon200"),
0045         #HLT_Photon50EB
0046         mksel("filter('hltEG50EBEtFilter')","1e Photon50EB"),
0047         #HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL
0048         mksel("filter('hltEle16Ele12Ele8CaloIdLTrackIdLDphiLeg3Filter')","3e Leg3"),
0049         #HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL (wildcarded as the name is likely going to change soon)
0050         mksel("filter('hltMu*TrkIsoVVLEle23CaloIdLTrackIdLIsoVLElectronlegTrackIsoFilter')","1mu-1e eLeg"),
0051         #HLT_Ele24_eta2p1_WPTight_Gsf_PNetTauhPFJet30_*_eta2p3_CrossL1 OR HLT_Ele24_eta2p1_WPTight_Gsf_LooseDeepTauPFTauHPS30_eta2p1_CrossL1
0052         mksel("filter('hltEle24erWPTightGsfTrackIsoFilterForTau')","1e-1tau eLeg"),
0053         #HLT_Ele115_CaloIdVT_GsfTrkIdT
0054         mksel("filter('hltEle115CaloIdVTGsfTrkIdTGsfDphiFilter')","1e high pT noIso"),
0055     )
0056 )
0057 
0058 customPhotonFilterBits = cms.PSet(
0059     id = cms.int32(22),
0060     sel = cms.string("type(92) && pt > 15 && coll('hltEgammaCandidates')"),
0061     l1seed = cms.string("type(-98)"),  l1deltaR = cms.double(0.3),
0062     skipObjectsNotPassingQualityBits = cms.bool(True),
0063     qualityBits = cms.VPSet(
0064         #HLT_Photon50EB
0065         mksel("filter('hltEG50EBEtFilter')","Photon50EB"),
0066         #HLT_Photon***
0067         mksel("filter('hltEG120HEFilter')","Photon120"),
0068         mksel("filter('hltEG150HEFilter')","Photon150"),
0069         mksel("filter('hltEG175HEFilter')","Photon175"),
0070         mksel("filter('hltEG200HEFilter')","Photon200"),
0071         #HLT_ECALHT800        
0072         mksel("filter('hltHtEcal800')","ECAL HT800"),
0073         #HLT_Photon110EB_TightID_TightIso
0074         mksel("filter('hltEG110EBTightIDTightIsoTrackIsoFilter')","Photon110EB Tight"),
0075         #HLT_Mu17_Photon30_IsoCaloId
0076         mksel("filter('hltMu17Photon30IsoCaloIdPhotonlegTrackIsoFilter')","1mu-1photon"),
0077         #HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90/95 
0078         mksel("filter('hltEG30LR9Id85b90eHE12R9Id50b80eR9IdLastFilter')","diPhoton 30_22 R9ID"),
0079         mksel("filter('hltEG30LIso60CaloId15b35eHE12R9Id50b80eEcalIsoLastFilter')","diPhoton 30_22 ECALIso"),
0080         mksel("filter('hltEG22R9Id85b90eHE12R9Id50b80eR9UnseededLastFilter')","diPhoton 30_22 unseeded R9ID"),
0081         mksel("filter('hltEG22Iso60CaloId15b35eHE12R9Id50b80eTrackIsoUnseededLastFilter')","diPhoton 30_22 unseeded TrackIso"),
0082     )
0083 )
0084 
0085 superclusterTable = cms.EDProducer("SimpleSuperclusterFlatTableProducer",
0086   src = cms.InputTag("reducedEgamma","reducedSuperClusters"),
0087   name = cms.string("Supercluster"),
0088   doc = cms.string("Supercluster collection"),
0089   variables = cms.PSet(
0090     energy = Var("energy()",float,doc="supercluster energy",precision=10),
0091     eta = Var("eta()",float,doc="supercluster eta",precision=10),
0092     phi = Var("phi()",float,doc="supercluster phi",precision=10),
0093     rawEnergy = Var("rawEnergy()",float,doc="sum of basic clusters energy",precision=10),
0094     preshowerEnergy = Var("preshowerEnergy()",float,doc="sum of energy in preshower",precision=10),
0095     etaWidth = Var("etaWidth()",float,doc="supercluster eta width",precision=10),
0096     phiWidth = Var("etaWidth()",float,doc="supercluster phi width",precision=10),
0097     seedClusEnergy = Var("seed().energy()",float,doc="seed cluster energy",precision=10),
0098     seedClusterEta = Var("seed().eta()",float,doc="seed cluster eta",precision=10),
0099     seedClusterPhi = Var("seed().phi()",float,doc="seed cluster phi",precision=10),
0100   ),
0101   externalVariables = cms.PSet(
0102     trkIso = ExtVar("superclusValueMaps:superclusTkIso",float,doc="supercluster track iso within 0.06 < dR < 0.4 & |dEta| > 0.03",precision=10),
0103   )
0104 )
0105 
0106 def addExtraEGammaVarsCustomize(process):
0107     #photon
0108     process.finalPhotons.cut = cms.string("pt > 1 ")
0109     process.photonTable.variables.setValue(_phoVarsExtra.parameters_())
0110     process.triggerObjectTable.selections.Photon = customPhotonFilterBits
0111 
0112     if hasattr(process,'nanoDQM'):
0113       process.nanoDQM.vplots.Photon.plots = _Photon_extra_plots
0114 
0115     #electron
0116     process.finalElectrons.cut = cms.string("pt > 1 ")
0117     process.electronTable.variables.setValue(_eleVarsExtra.parameters_())
0118     process.triggerObjectTable.selections.Electron = customElectronFilterBits
0119 
0120     if hasattr(process,'nanoDQM'):
0121       process.nanoDQM.vplots.Electron.plots = _Electron_extra_plots
0122 
0123     #superCluster
0124     process.superclusValueMaps = superclusValueMaps
0125     process.superclusterTable = superclusterTable
0126 
0127     process.superclusterTask = cms.Task(process.superclusValueMaps)
0128     process.superclusterTask.add(process.superclusterTable)
0129     process.nanoTableTaskCommon.add(process.superclusterTask)
0130       
0131     return process