diff --git a/Configuration/PyReleaseValidation/python/relval_nano.py b/Configuration/PyReleaseValidation/python/relval_nano.py index 30a127b7f7994..05c14f80541b9 100644 --- a/Configuration/PyReleaseValidation/python/relval_nano.py +++ b/Configuration/PyReleaseValidation/python/relval_nano.py @@ -166,6 +166,10 @@ def subnext(self): '--datatier':'NANOAOD', '--eventcontent':'NANOAOD'}]) +steps['muPOGNANO_data13.0']=merge([{'-s' : 'NANO:@PHYS+@MUPOG', + '-n' : '1000'}, + steps['NANO_data13.0']]) + ###current release cycle workflows : 13.2 steps['TTBarMINIAOD13.2'] = {'INPUT':InputInfo(location='STD', ## dataset below to be replaced with a 13.2 relval sample when available @@ -175,6 +179,9 @@ def subnext(self): '--conditions':'auto:phase1_2022_realistic'}, _NANO_mc]) +steps['muPOGNANO_mc13.2']=merge([{'-s' : 'NANO:@PHYS+@MUPOG ', '-n' : '1000'}, + steps['NANO_mc13.2']]) + ##13.X INPUT steps['RunScoutingPFRun32022D13.X']={'INPUT':InputInfo(dataSet='/ScoutingPFRun3/Run2022D-v1/RAW',label='2022D',events=100000,location='STD', ls=Run2022D)} @@ -231,11 +238,13 @@ def subnext(self): workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0_prompt', 'HRV_NANO_data']] workflows[_wfn()] = ['muDPGNANO130Xrun3', ['ZMuSkim2023DRAWRECO13.0', 'muDPGNANO_data13.0']] workflows[_wfn()] = ['muDPGNANOBkg130Xrun3', ['ZeroBias2023DRAW13.0', 'muDPGNANOBkg_data13.0']] +workflows[_wfn()] = ['muPOGNANO_data13.0', ['MuonEG2023MINIAOD13.0', 'muPOGNANO_data13.0']] _wfn.next() ################ #13.2 workflows workflows[_wfn()] = ['NANOmc132X', ['TTBarMINIAOD13.2', 'NANO_mc13.2', 'HRV_NANO_mc']] +workflows[_wfn()] = ['muPOGNANO_mc13.2', ['TTBarMINIAOD13.2', 'muPOGNANO_mc13.2']] _wfn.next() ################ diff --git a/PhysicsTools/NanoAOD/plugins/MuonSpecialVariables.cc b/PhysicsTools/NanoAOD/plugins/MuonSpecialVariables.cc index af2e41190c806..e12a0d1d04521 100644 --- a/PhysicsTools/NanoAOD/plugins/MuonSpecialVariables.cc +++ b/PhysicsTools/NanoAOD/plugins/MuonSpecialVariables.cc @@ -33,6 +33,7 @@ class MuonSpecialVariables : public edm::stream::EDProducer<> { void setArbitratedTracker(pat::Muon &mu) const; void setInnerTrackDxyz(pat::Muon &mu, const reco::Vertex &vtx) const; void setTrkiso04(pat::Muon &mu, const std::vector tracks) const; + void setTrkiso03(pat::Muon &mu, const std::vector tracks) const; void setNSegements(pat::Muon &mu) const; private: @@ -63,9 +64,21 @@ void MuonSpecialVariables::setTrkiso04(pat::Muon &mu, const std::vector 0) ? Trkiso04 : 0; - mu.addUserFloat("relTrkiso4", relTrkiso4); + float Trkiso04 = (energy - mu.pt()); + float absTrkiso04 = (Trkiso04 > 0) ? Trkiso04 : 0; + mu.addUserFloat("absTrkiso04", absTrkiso04); +} + +void MuonSpecialVariables::setTrkiso03(pat::Muon &mu, const std::vector tracks) const { + float energy = 0; + for (const auto &trk : tracks) { + if (deltaR(mu.eta(), mu.phi(), trk.eta(), trk.phi()) > 0.3) + continue; + energy += trk.pt(); + } + float Trkiso03 = (energy - mu.pt()); + float absTrkiso03 = (Trkiso03 > 0) ? Trkiso03 : 0; + mu.addUserFloat("absTrkiso03", absTrkiso03); } void MuonSpecialVariables::setNSegements(pat::Muon &mu) const { @@ -109,6 +122,7 @@ void MuonSpecialVariables::produce(edm::Event &iEvent, const edm::EventSetup &iS } mu.addUserInt("isGoodVertex", good_vertex); setTrkiso04(mu, *trkCollection); + setTrkiso03(mu, *trkCollection); setNSegements(mu); out->push_back(mu); } diff --git a/PhysicsTools/NanoAOD/python/autoNANO.py b/PhysicsTools/NanoAOD/python/autoNANO.py index 358aa6bb440ff..26f0a637d4803 100644 --- a/PhysicsTools/NanoAOD/python/autoNANO.py +++ b/PhysicsTools/NanoAOD/python/autoNANO.py @@ -28,6 +28,8 @@ def expandNanoMapping(seqList, mapping, key): # L1 flavours: add tables through customize, supposed to be combined with PHYS 'L1' : {'customize': 'nanoL1TrigObjCustomize'}, 'L1FULL' : {'customize': 'nanoL1TrigObjCustomizeFull'}, + # Muon POG flavours : add tables through customize, supposed to be combined with PHYS + 'MUPOG' : {'customize' : 'PhysicsTools/NanoAOD/custom_muon_cff.PrepMuonCustomNanoAOD'}, # MUDPG flavours: use their own sequence 'MUDPG' : {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoProducer', 'customize': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoCustomize'}, diff --git a/PhysicsTools/NanoAOD/python/custom_muon_cff.py b/PhysicsTools/NanoAOD/python/custom_muon_cff.py index 27d1ecc09cc19..3ae8c3b1f8cdc 100644 --- a/PhysicsTools/NanoAOD/python/custom_muon_cff.py +++ b/PhysicsTools/NanoAOD/python/custom_muon_cff.py @@ -5,6 +5,7 @@ from PhysicsTools.NanoAOD.common_cff import Var, P3Vars, P4Vars from PhysicsTools.NanoAOD.muons_cff import muonTable, finalMuons +from PhysicsTools.NanoAOD.triggerObjects_cff import triggerObjectTable, mksel def Custom_Muon_Task(process): process.nanoTableTaskCommon.remove(process.electronTablesTask) @@ -115,12 +116,14 @@ def AddVariablesForMuon(proc): proc.muonTable.variables.pfAbsIso03_neu = Var("pfIsolationR03().sumNeutralHadronEt",float,doc="PF absolute isolation dR=0.3, neutral component") proc.muonTable.variables.pfAbsIso03_pho = Var("pfIsolationR03().sumPhotonEt",float,doc="PF absolute isolation dR=0.3, photon component") proc.muonTable.variables.pfAbsIso03_sumPU = Var("pfIsolationR03().sumPUPt",float,doc="PF absolute isolation dR=0.3, pu component (no deltaBeta corrections)") + proc.muonTable.variables.absTrkIso03 = Var("userFloat('absTrkiso03')",float,doc="Realtive Tracker Iso with cone size 0.3") # Spark Tool Iso 04 variables proc.muonTable.variables.pfAbsIso04_chg = Var("pfIsolationR04().sumChargedHadronPt",float,doc="PF absolute isolation dR=0.4, charged component") proc.muonTable.variables.pfAbsIso04_neu = Var("pfIsolationR04().sumNeutralHadronEt",float,doc="PF absolute isolation dR=0.4, neutral component") proc.muonTable.variables.pfAbsIso04_pho = Var("pfIsolationR04().sumPhotonEt",float,doc="PF absolute isolation dR=0.4, photon component") proc.muonTable.variables.pfAbsIso04_sumPU = Var("pfIsolationR04().sumPUPt",float,doc="PF absolute isolation dR=0.4, pu component (no deltaBeta corrections)") + proc.muonTable.variables.absTrkIso04 = Var("userFloat('absTrkiso04')",float,doc="Realtive Tracker Iso with cone size 0.4") #Mini PF Isolation proc.muonTable.variables.miniPFAbsIso_chg = Var("userFloat('miniIsoChg')",float,doc="mini PF absolute isolation, charged component") @@ -134,19 +137,17 @@ def AddVariablesForMuon(proc): proc.muonTable.variables.pfAbsIso03_all = Var("(pfIsolationR03().sumChargedHadronPt + max(pfIsolationR03().sumNeutralHadronEt + pfIsolationR03().sumPhotonEt - pfIsolationR03().sumPUPt/2,0.0))",float,doc="PF absolute isolation dR=0.3, total (deltaBeta corrections)") proc.muonTable.variables.pfAbsIso04_all = Var("(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))",float,doc="PF absolute isolation dR=0.4, total (deltaBeta corrections)") proc.muonTable.variables.jetAbsIso = Var("?userCand('jetForLepJetVar').isNonnull()?(1./userFloat('ptRatio'))-1.:(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))",float,doc="Absolute isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet)",precision=8) - proc.muonTable.variables.relTrkiso4 = Var("userFloat('relTrkiso4')",float,doc="Realtive Tracker Iso with cone size 0.4") # Muon Quality Variables proc.muonTable.variables.expectedMatchedStations = Var("expectedNnumberOfMatchedStations()",int,doc="Expected Number of Matched stations") proc.muonTable.variables.RPCLayers = Var("numberOfMatchedRPCLayers()",int,doc="Number of RPC Layers") proc.muonTable.variables.stationMask = Var("stationMask()","uint8",doc="Number of masked station") proc.muonTable.variables.nShowers = Var("numberOfShowers()",int,doc="Number of Showers") - proc.muonTable.variables.muonHits = Var("? globalTrack().isNonnull() ? globalTrack().hitPattern().numberOfValidMuonHits() : ? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().hitPattern().numberOfValidMuonHits() :-99",float,doc="Number of valid Muon Hits from either globalTrack or innerTrack") - ## For completeness I save here also the muonHits for the outer tracker also - proc.muonTable.variables.outerTrackMuonHits = Var("? outerTrack().isNonnull() ? outerTrack().hitPattern().numberOfValidMuonHits() : -99", float, doc = "Number of valid Muon Hits from OuterTrack") ## + + + # Hits related variables proc.muonTable.variables.pixelLayers = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().hitPattern().pixelLayersWithMeasurement() : -99", float,doc="Number of Pixel Layers") # No of tracker layers are already saved in the standard NanoAODs - proc.muonTable.variables.validFraction = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().validFraction() : -99", float, doc="Inner Track Valid Fraction") proc.muonTable.variables.pixelHits = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().hitPattern().numberOfValidPixelHits() : -99", float, doc="Numbr of valid pixel hits") proc.muonTable.variables.muonStations = Var("? outerTrack().isNonnull() && outerTrack().isAvailable() ? outerTrack().hitPattern().muonStationsWithValidHits() : -99", float, doc="No of valid hits in muon stations") proc.muonTable.variables.DTHits = Var("? outerTrack().isNonnull() && outerTrack().isAvailable() ? outerTrack().hitPattern().numberOfValidMuonDTHits() : -99", float, doc="No of valid hits in DT") @@ -161,24 +162,81 @@ def AddVariablesForMuon(proc): proc.muonTable.variables.trkChi2_innerTrack = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().normalizedChi2() : -99",float,doc="Normalized Chi Square from outerTrack ") - #pt, ptErr, eta, phi, charge for different tracks - ## ptErr in standard NanoAOD are saved from bestTrack() - ## For Spark tool it is needed from innerTrack. For completeness outerTrack - ## variables are also saved + #Inner Track related variables proc.muonTable.variables.innerTrack_ptErr = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().ptError()/innerTrack().pt() : -99", float, doc="InnerTrack Pt Error") + proc.muonTable.variables.innerTrack_pt = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().pt(): -99", float, doc="InnerTrack Pt") + proc.muonTable.variables.innerTrack_eta = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().eta(): -99", float, doc="InnerrTrack Eta") + proc.muonTable.variables.innerTrack_phi = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().phi(): -99", float, doc="InnerTrack Phi") + proc.muonTable.variables.innerTrack_charge = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().charge(): -99", float, doc="InnerTrack charge") + proc.muonTable.variables.innerTrack_MuonHits = Var("? innerTrack().isNonnull() ? innerTrack().hitPattern().numberOfValidMuonHits() : -99", float, doc = "Number of valid Muon Hits from InnerTrack") + proc.muonTable.variables.innerTrack_validFraction = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().validFraction() : -99", float, doc="Inner Track Valid Fraction") + ## Pixellayers and PixelHits are already defined in the section related to the hits + ## TrackerLayers are already defined in standard NanoAOD + ## Chi2 is already defined in the Chi2 related section + + #Dxy Dz variables as of Spark tool + proc.muonTable.variables.innerTrackDxy = Var("? userInt('isGoodVertex') ? userFloat('innerTrackDxy') : -99.9",float,doc = "dxy from Primary Vertex calculated with Inner Track") + proc.muonTable.variables.innerTrackDz = Var("? userInt('isGoodVertex') ? userFloat('innerTrackDz') : -99.9",float,doc= "dz from Primary Vertex calculated with Inner Track") + + + # Outer Track related variables proc.muonTable.variables.outerTrack_ptErr = Var("? outerTrack().isNonnull() && outerTrack().isAvailable() ? outerTrack().ptError()/outerTrack().pt() : -99", float, doc="OuterTrack Pt Error") proc.muonTable.variables.outerTrack_pt = Var("? outerTrack().isNonnull() && outerTrack().isAvailable() ? outerTrack().pt(): -99", float, doc="OuterTrack Pt") proc.muonTable.variables.outerTrack_eta = Var("? outerTrack().isNonnull() && outerTrack().isAvailable() ? outerTrack().eta(): -99", float, doc="OuterTrack Eta") proc.muonTable.variables.outerTrack_phi = Var("? outerTrack().isNonnull() && outerTrack().isAvailable() ? outerTrack().phi(): -99", float, doc="OuterTrack Phi") proc.muonTable.variables.outerTrack_charge = Var("? outerTrack().isNonnull() && outerTrack().isAvailable() ? outerTrack().charge(): -99", float, doc="OuterTrack charge") - proc.muonTable.variables.innerTrack_charge = Var("? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().charge(): -99", float, doc="OuterTrack charge") + proc.muonTable.variables.outerTrack_MuonHits = Var("? outerTrack().isNonnull() ? outerTrack().hitPattern().numberOfValidMuonHits() : -99", float, doc = "Number of valid Muon Hits from OuterTrack") + ## Muonstations, DTHits and CSCHits are already defined in the Hits related section + ## Chi2 is already defined in the Chi2 related section + + #Global track realted variables + proc.muonTable.variables.muonHits = Var("? globalTrack().isNonnull() ? globalTrack().hitPattern().numberOfValidMuonHits() : ? innerTrack().isNonnull() && innerTrack().isAvailable() ? innerTrack().hitPattern().numberOfValidMuonHits() :-99",float,doc="Number of valid Muon Hits from either globalTrack or innerTrack") + proc.muonTable.variables.globalTrack_ptErr = Var("? globalTrack().isNonnull() ? globalTrack().ptError()/globalTrack().pt() : -99", float, doc="GlobalTrack Pt Error") + proc.muonTable.variables.globalTrack_pt = Var("? globalTrack().isNonnull() ? globalTrack().pt(): -99", float, doc="GlobalTrack Pt") + proc.muonTable.variables.globalTrack_eta = Var("? globalTrack().isNonnull() ? globalTrack().eta(): -99", float, doc="GlobalTrack Eta") + proc.muonTable.variables.globalTrack_phi = Var("? globalTrack().isNonnull() ? globalTrack().phi(): -99", float, doc="GlobalTrack Phi") + proc.muonTable.variables.globalTrack_charge = Var("? globalTrack().isNonnull() ? globalTrack().charge(): -99", float, doc="GlobalTrack charge") + #muonBestTrack related varaibles + ## tightCharge from muonBestTrack is already saved in deafult nanoAOD + proc.muonTable.variables.best_pt = Var("? muonBestTrack().isNonnull() && muonBestTrack().isAvailable() ? muonBestTrack().pt(): -99", float, doc="MuonBestTrack Pt") + proc.muonTable.variables.best_pterr = Var("? muonBestTrack().isNonnull() && muonBestTrack().isAvailable() ? muonBestTrack().ptError() : -99", float, doc = "pTerr from MuonBestTrack") + proc.muonTable.variables.best_eta = Var("? muonBestTrack().isNonnull() && muonBestTrack().isAvailable() ? muonBestTrack().eta(): -99", float, doc="MuonBestrack Eta") + proc.muonTable.variables.best_phi = Var("? muonBestTrack().isNonnull() && muonBestTrack().isAvailable() ? muonBestTrack().phi(): -99", float, doc="MuonBestTrack Phi") + proc.muonTable.variables.best_charge = Var("? muonBestTrack().isNonnull() && muonBestTrack().isAvailable() ? muonBestTrack().charge(): -99", float, doc="MuonBestTrack charge") # TuneP related variables - proc.muonTable.variables.tuneP_pt = Var("? tunePMuonBestTrack().isNonnull() ? tunePMuonBestTrack().pt() : -99", float, doc = "pT from tunePMuonBestTrack") - proc.muonTable.variables.tuneP_pterr = Var("? tunePMuonBestTrack().isNonnull() ? tunePMuonBestTrack().ptError() : -99", float, doc = "pTerr from tunePMuonBestTrack") - proc.muonTable.variables.tuneP_muonHits = Var("? tunePMuonBestTrack().isNonnull() ? tunePMuonBestTrack().hitPattern().numberOfValidMuonHits() : -99", int, doc="No of valid muon hists from tunePMuonBestTrack") - + proc.muonTable.variables.tuneP_pt = Var("? tunePMuonBestTrack().isNonnull() && tunePMuonBestTrack().isAvailable() ? tunePMuonBestTrack().pt() : -99", float, doc = "pT from tunePMuonBestTrack") + proc.muonTable.variables.tuneP_pterr = Var("? tunePMuonBestTrack().isNonnull() && tunePMuonBestTrack().isAvailable() ? tunePMuonBestTrack().ptError() : -99", float, doc = "pTerr from tunePMuonBestTrack") + proc.muonTable.variables.tuneP_eta = Var("? tunePMuonBestTrack().isNonnull() && tunePMuonBestTrack().isAvailable() ? tunePMuonBestTrack().eta(): -99", float, doc="tunePMuonBestTrack Eta") + proc.muonTable.variables.tuneP_phi = Var("? tunePMuonBestTrack().isNonnull() && tunePMuonBestTrack().isAvailable() ? tunePMuonBestTrack().phi(): -99", float, doc="tunePMuonBestTrack Phi") + proc.muonTable.variables.tuneP_charge = Var("? tunePMuonBestTrack().isNonnull() && tunePMuonBestTrack().isAvailable() ? tunePMuonBestTrack().charge(): -99", float, doc="tunePMuonBestTrack() charge") + proc.muonTable.variables.tuneP_muonHits = Var("? tunePMuonBestTrack().isNonnull() && tunePMuonBestTrack().isAvailable() ? tunePMuonBestTrack().hitPattern().numberOfValidMuonHits() : -99", int, doc="No of valid muon hists from tunePMuonBestTrack") + + # tpfms Track + proc.muonTable.variables.tpfms_pt = Var("? tpfmsTrack().isNonnull() && tpfmsTrack().isAvailable() ? tpfmsTrack().pt() : -99", float, doc = "pT from tpfmsTrack") + proc.muonTable.variables.tpfms_pterr = Var("? tpfmsTrack().isNonnull() && tpfmsTrack().isAvailable() ? tpfmsTrack().ptError() : -99", float, doc = "pTerr from tpfmsTrack") + proc.muonTable.variables.tpfms_eta = Var("? tpfmsTrack().isNonnull() && tpfmsTrack().isAvailable() ? tpfmsTrack().eta(): -99", float, doc="tpfmsTrack Eta") + proc.muonTable.variables.tpfms_phi = Var("? tpfmsTrack().isNonnull() && tpfmsTrack().isAvailable() ? tpfmsTrack().phi(): -99", float, doc="tpfmsTrack Phi") + proc.muonTable.variables.tpfms_charge = Var("? tpfmsTrack().isNonnull() && tpfmsTrack().isAvailable() ? tpfmsTrack().charge(): -99", float, doc="tpfmsTrack charge") + proc.muonTable.variables.tpfms_muonHits = Var("? tpfmsTrack().isNonnull() && tpfmsTrack().isAvailable() ? tpfmsTrack().hitPattern().numberOfValidMuonHits() : -99", int, doc="No of valid muon hists from tpfmsTrack") + + + #picky Track + proc.muonTable.variables.picky_pt = Var("? pickyTrack().isNonnull() && pickyTrack().isAvailable() ? pickyTrack().pt() : -99", float, doc = "pT from pickyTrack") + proc.muonTable.variables.picky_pterr = Var("? pickyTrack().isNonnull() && pickyTrack().isAvailable() ? pickyTrack().ptError() : -99", float, doc = "pTerr from pickyTrack") + proc.muonTable.variables.picky_eta = Var("? pickyTrack().isNonnull() && pickyTrack().isAvailable() ? pickyTrack().eta(): -99", float, doc="pickyTrack Eta") + proc.muonTable.variables.picky_phi = Var("? pickyTrack().isNonnull() && pickyTrack().isAvailable() ? pickyTrack().phi(): -99", float, doc="pickyTrack Phi") + proc.muonTable.variables.picky_charge = Var("? pickyTrack().isNonnull() && pickyTrack().isAvailable() ? pickyTrack().charge(): -99", float, doc="pickyTrack charge") + proc.muonTable.variables.picky_muonHits = Var("? pickyTrack().isNonnull() && pickyTrack().isAvailable() ? pickyTrack().hitPattern().numberOfValidMuonHits() : -99", int, doc="No of valid muon hists from pickyTrack") + + #dyt Track + proc.muonTable.variables.dyt_pt = Var("? dytTrack().isNonnull() && dytTrack().isAvailable() ? dytTrack().pt() : -99", float, doc = "pT from dytTrack") + proc.muonTable.variables.dyt_pterr = Var("? dytTrack().isNonnull() && dytTrack().isAvailable() ? dytTrack().ptError() : -99", float, doc = "pTerr from dytTrack") + proc.muonTable.variables.dyt_eta = Var("? dytTrack().isNonnull() && dytTrack().isAvailable() ? dytTrack().eta(): -99", float, doc="dytTrack Eta") + proc.muonTable.variables.dyt_phi = Var("? dytTrack().isNonnull() && dytTrack().isAvailable() ? dytTrack().phi(): -99", float, doc="dytTrack Phi") + proc.muonTable.variables.dyt_charge = Var("? dytTrack().isNonnull() && dytTrack().isAvailable() ? dytTrack().charge(): -99", float, doc="dytTrack charge") + proc.muonTable.variables.dyt_muonHits = Var("? dytTrack().isNonnull() && dytTrack().isAvailable() ? dytTrack().hitPattern().numberOfValidMuonHits() : -99", int, doc="No of valid muon hists from dytTrack") #CombinedQuality Variables proc.muonTable.variables.positionChi2 = Var("combinedQuality().chi2LocalPosition", float, doc="chi2 Local Position") @@ -203,9 +261,6 @@ def AddVariablesForMuon(proc): proc.muonTable.variables.jetDF = Var("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probbb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:problepb'),0.0):0.0",float,doc="b-tagging discriminator of the jet matched to the lepton, for muon MVA") proc.muonTable.variables.jetCSVv2 = Var("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfCombinedSecondaryVertexV2BJetTags'),0.0):0.0",float,doc="CSVv2 b-tagging discriminator of the jet matched to the lepton, for muon MVA") - #Dxy Dz variables as of Spark tool - proc.muonTable.variables.innerTrackDxy = Var("? userInt('isGoodVertex') ? userFloat('innerTrackDxy') : -99.9",float,doc = "dxy from Primary Vertex calculated with Inner Track") - proc.muonTable.variables.innerTrackDz = Var("? userInt('isGoodVertex') ? userFloat('innerTrackDz') : -99.9",float,doc= "dz from Primary Vertex calculated with Inner Track") #nSegments proc.muonTable.variables.nsegments = Var("userInt('nsegments')", int, doc = "nsegments as of Spark-tool") @@ -223,16 +278,72 @@ def AddVariablesForMuon(proc): proc.muonTable.variables.simPt = Var("? simPt() ? simPt(): -99",float,doc="simPt") proc.muonTable.variables.simEta = Var("? simEta() ? simEta(): -99",float,doc="simEta") proc.muonTable.variables.simPhi = Var("? simPhi() ? simPhi(): -99",float,doc='simPhi') - + + #ID Variables + proc.muonTable.variables.isRPC = Var("isRPCMuon",bool,doc="muon is RPC muon") return proc +def AddTriggerObjectBits(process): + process.triggerObjectTable.selections.Muon_POG = cms.PSet( + id = cms.int32(1313), + sel = cms.string("type(83) && pt > 5 && (coll('hltIterL3MuonCandidates') || (pt > 45 && coll('hltHighPtTkMuonCands')) || (pt > 95 && coll('hltOldL3MuonCandidates')))"), + l1seed = cms.string("type(-81)"), l1deltaR = cms.double(0.5), + l2seed = cms.string("type(83) && coll('hltL2MuonCandidates')"), l2deltaR = cms.double(0.3), + skipObjectsNotPassingQualityBits = cms.bool(True), + qualityBits = cms.VPSet( + mksel("filter('hltTripleMuonL2PreFiltered0')","hltTripleMuonL2PreFiltered0"), #0 + mksel("filter('hltTripleMuL3PreFiltered222')","hltTripleMuL3PreFiltered222"), #1 + mksel("filter('hltJpsiMuonL3Filtered3p5')","hltJpsiMuonL3Filtered3p5"), #2 + mksel("filter('hltVertexmumuFilterJpsiMuon3p5')","hltVertexmumuFilterJpsiMuon3p5"), #3 + mksel("filter('hltL2fL1sDoubleMu0er15OSIorDoubleMu0er14OSIorDoubleMu4OSIorDoubleMu4p5OSL1Filtered0')","hltL2fL1sDoubleMu0er15OSIorDoubleMu0er14OSIorDoubleMu4OSIorDoubleMu4p5OSL1Filtered0"), #4 + mksel("filter('hltDoubleMu4JpsiDisplacedL3Filtered')","hltDoubleMu4JpsiDisplacedL3Filtered"), #5 + mksel("filter('hltDisplacedmumuFilterDoubleMu4Jpsi')","hltDisplacedmumuFilterDoubleMu4Jpsi"), #6 + mksel("filter('hltJpsiTkVertexFilter')","hltJpsiTkVertexFilter"), #7 + mksel("filter('hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3trkIsoFiltered0p07')","hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3trkIsoFiltered0p07"), #8 + mksel("filter('hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3trkIsoFiltered0p08')","hltL3crIsoL1sSingleMu22L1f0L2f10QL3f24QL3trkIsoFiltered0p08"), #9 + mksel("filter('hltL3fL1DoubleMu155fPreFiltered8')","hltL3fL1DoubleMu155fPreFiltered8"), #10 + mksel("filter('hltL3fL1DoubleMu155fFiltered17')","hltL3fL1DoubleMu155fFiltered17"), #11 + mksel("filter('hltDiMuon178RelTrkIsoFiltered0p4')","hltDiMuon178RelTrkIsoFiltered0p4"), #12 + mksel("filter('hltDiMuon178RelTrkIsoFiltered0p4DzFiltered0p2')","hltDiMuon178RelTrkIsoFiltered0p4DzFiltered0p2"), #13 + mksel("filter('hltDiMuon178RelTrkIsoVVLFiltered')","hltDiMuon178RelTrkIsoVVLFiltered"), #14 + mksel("filter('hltDiMuon178RelTrkIsoVVLFilteredDzFiltered0p2')","hltDiMuon178RelTrkIsoVVLFilteredDzFiltered0p2"), #15 + mksel("filter('hltDiMuon178Mass3p8Filtered')","hltDiMuon178Mass3p8Filtered"), #16 + mksel("filter('hltL3fL1sMu22Or25L1f0L2f10QL3Filtered50Q')","hltL3fL1sMu22Or25L1f0L2f10QL3Filtered50Q"), #17 + mksel("filter('hltL2fOldL1sMu22or25L1f0L2Filtered10Q')","hltL2fOldL1sMu22or25L1f0L2Filtered10Q"), #18 + mksel("filter('hltL3fL1sMu22Or25L1f0L2f10QL3Filtered100Q')","hltL3fL1sMu22Or25L1f0L2f10QL3Filtered100Q"), #19 + mksel("filter('hltL3fL1sMu25f0TkFiltered100Q')","hltL3fL1sMu25f0TkFiltered100Q"), #20 + mksel("filter('hltL3fL1sMu15DQlqL1f0L2f10L3Filtered17')","hltL3fL1sMu15DQlqL1f0L2f10L3Filtered17"), #21 + mksel("filter('hltL3fL1sMu1lqL1f0L2f10L3Filtered17TkIsoFiltered0p4')","hltL3fL1sMu1lqL1f0L2f10L3Filtered17TkIsoFiltered0p4"), #22 + mksel("filter('hltL3fL1sMu1lqL1f0L2f10L3Filtered17TkIsoVVLFiltered')","hltL3fL1sMu1lqL1f0L2f10L3Filtered17TkIsoVVLFiltered"), #23 + mksel("filter('hltL3fL1sMu5L1f0L2f5L3Filtered8')","hltL3fL1sMu5L1f0L2f5L3Filtered8"), #24 + mksel("filter('hltL3fL1sMu5L1f0L2f5L3Filtered8TkIsoFiltered0p4')","hltL3fL1sMu5L1f0L2f5L3Filtered8TkIsoFiltered0p4"), #25 + mksel("filter('hltL3fL1sMu5L1f0L2f5L3Filtered8TkIsoVVLFiltered')","hltL3fL1sMu5L1f0L2f5L3Filtered8TkIsoVVLFiltered"), #26 + mksel("filter('hltL3fL1sMu15DQlqL1f0L2f10L3Filtered12')","hltL3fL1sMu15DQlqL1f0L2f10L3Filtered12"), #27 + mksel("filter('hltL3fL1sMu15DQlqL1f0L2f10L3Filtered15')","hltL3fL1sMu15DQlqL1f0L2f10L3Filtered15"), #28 + mksel("filter('hltL3fL1sMu15DQlqL1f0L2f10L3Filtered19')","hltL3fL1sMu15DQlqL1f0L2f10L3Filtered19"), #29 + mksel("filter('hltL3fL1sMu15DQlqL1f0L2f10L3Filtered19')","hltL3fL1sMu15DQlqL1f0L2f10L3Filtered19") #30 + ) + ) + + + return process + +def IncreaseGenPrecesion(process): + + process.genParticleTable.variables.pt = Var("pt", float, precision=16) + process.genParticleTable.variables.eta = Var("eta", float,precision=16) + process.genParticleTable.variables.phi = Var("phi", float,precision=16) + + return process def PrepMuonCustomNanoAOD(process): process = Custom_Muon_Task(process) process = AddPFTracks(process) process = AddVariablesForMuon(process) + process = AddTriggerObjectBits(process) + process = IncreaseGenPrecesion(process) return process