Skip to content

Commit

Permalink
Merge pull request #44043 from rbhattacharya04/Mu_POG_NanoAOD_v2_back…
Browse files Browse the repository at this point in the history
…port

Mu pog nano aod v2 backport
  • Loading branch information
cmsbuild committed Feb 26, 2024
2 parents 37792f2 + 3a3cf3e commit 85000db
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 21 deletions.
9 changes: 9 additions & 0 deletions Configuration/PyReleaseValidation/python/relval_nano.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)}

Expand Down Expand Up @@ -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()
################
Expand Down
20 changes: 17 additions & 3 deletions PhysicsTools/NanoAOD/plugins/MuonSpecialVariables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<reco::Track> tracks) const;
void setTrkiso03(pat::Muon &mu, const std::vector<reco::Track> tracks) const;
void setNSegements(pat::Muon &mu) const;

private:
Expand Down Expand Up @@ -63,9 +64,21 @@ void MuonSpecialVariables::setTrkiso04(pat::Muon &mu, const std::vector<reco::Tr
continue;
energy += trk.pt();
}
float Trkiso04 = (energy - mu.pt()) / mu.pt();
float relTrkiso4 = (Trkiso04 > 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<reco::Track> 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 {
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions PhysicsTools/NanoAOD/python/autoNANO.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'},
Expand Down
Loading

0 comments on commit 85000db

Please sign in to comment.