Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13_0_X backport ] Fall17V2 photon IDs and Isolations saved only in Run2 Nanos #42717

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,11 @@
Plot1D('mvaID_Fall17V2_WP80', 'mvaID_WP80_Fall17V2', 2, -0.5, 1.5, 'Fall17V2 MVA ID WP80'),
Plot1D('mvaID_Fall17V2_WP90', 'mvaID_WP90_Fall17V2', 2, -0.5, 1.5, 'Fall17V2 MVA ID WP90'),
Plot1D('trkSumPtHollowConeDR03', 'trkSumPtHollowConeDR03', 100, 0, 8, 'Sum of track pT in a hollow cone of outer radius, inner radius'),
Plot1D('trkSumPtSolidConeDR04', 'trkSumPtSolidConeDR04', 100, 0, 8, 'Sum of track pT in a cone of dR=0.4'),
Plot1D('ecalPFClusterIso', 'ecalPFClusterIso', 100, 0, 10, 'sum pt of ecal clusters, vetoing clusters part of photon'),
Plot1D('hcalPFClusterIso', 'hcalPFClusterIso', 100, 0, 10, 'sum pt of hcal clusters, vetoing clusters part of photon'),
Plot1D('pfPhoIso03', 'pfPhoIso03', 100, 0, 1, 'PF absolute isolation dR=0.3, photon component (uncorrected)'),
Plot1D('pfChargedIso', 'pfChargedIso', 100, 0, 10, 'PF absolute isolation dR=0.3, charged component with dxy,dz match to PV'),
Plot1D('pfChargedIsoPFPV', 'pfChargedIsoPFPV', 100, 0, 5, 'PF absolute isolation dR=0.3, charged component (PF PV only)'),
Plot1D('pfChargedIsoWorstVtx', 'pfChargedIsoWorstVtx', 100, 0, 10,'PF absolute isolation dR=0.3, charged component (Vertex with largest isolation)'),
Plot1D('pdgId', 'pdgId', 1, 21.5, 22.5, 'PDG code assigned by the event reconstruction (not by MC truth)'),
Expand All @@ -639,6 +643,7 @@
Plot1D('pfRelIso03_chg_quadratic', 'pfRelIso03_chg_quadratic', 20, 0, 2, 'PF relative isolation dR=0.3, charged hadron component (with quadraticEA*rho*rho + linearEA*rho corrections)'),
Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'),
Plot1D('pixelSeed', 'pixelSeed', 2, -0.5, 1.5, 'has pixel seed'),
Plot1D('hasConversionTracks', 'hasConversionTracks', 2, -0.5, 1.5, 'Variable specifying if photon has associated conversion tracks (one-legged or two-legged)'),
Plot1D('pt', 'pt', 20, 0, 200, 'pt (corrected)'),
Plot1D('r9', 'r9', 20, 0, 1.1, 'R9 of the supercluster, calculated with full 5x5 region'),
Plot1D('seedGain', 'seedGain', 12, 0.5, 12.5, 'Gain of the seed crystal'),
Expand Down
62 changes: 26 additions & 36 deletions PhysicsTools/NanoAOD/python/photons_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,37 +205,27 @@ def make_bitmapVID_docstring(id_modules_working_points_pset):
"uint8",
doc="cut-based ID bitmap, RunIIIWinter22V1, (0:fail, 1:loose, 2:medium, 3:tight)",
),
cutBased_Fall17V2 = Var(
"userInt('cutBasedID_Fall17V2_loose')+userInt('cutBasedID_Fall17V2_medium')+userInt('cutBasedID_Fall17V2_tight')",
"uint8",
doc="cut-based ID bitmap, Fall17V2, (0:fail, 1:loose, 2:medium, 3:tight)",
),
vidNestedWPBitmap = Var(
"userInt('VIDNestedWPBitmap')",
int,
doc="RunIIIWinter22V1 " + _bitmapVIDForPho_docstring
),
vidNestedWPBitmap_Fall17V2 = Var(
"userInt('VIDNestedWPBitmapFall17V2')",
int,
doc="Fall17V2 " + _bitmapVIDForPhoRun2_docstring
),
electronVeto = Var("passElectronVeto()",bool,doc="pass electron veto"),
pixelSeed = Var("hasPixelSeed()",bool,doc="has pixel seed"),
hasConversionTracks = Var("hasConversionTracks()",bool,doc="Variable specifying if photon has associated conversion tracks (one-legged or two-legged)"),
mvaID = Var("userFloat('mvaID')",float,doc="MVA ID score, Winter22V1",precision=10),
mvaID_WP90 = Var("userInt('mvaID_WP90')",bool,doc="MVA ID WP90, Winter22V1"),
mvaID_WP80 = Var("userInt('mvaID_WP80')",bool,doc="MVA ID WP80, Winter22V1"),
mvaID_Fall17V2 = Var("userFloat('mvaID_Fall17V2')",float,doc="MVA ID score, Fall17V2",precision=10),
mvaID_Fall17V2_WP90 = Var("userInt('mvaID_Fall17V2_WP90')",bool,doc="MVA ID WP90, Fall17V2"),
mvaID_Fall17V2_WP80 = Var("userInt('mvaID_Fall17V2_WP80')",bool,doc="MVA ID WP80, Fall17V2"),
trkSumPtHollowConeDR03 = Var("trkSumPtHollowConeDR03()",float,doc="Sum of track pT in a hollow cone of outer radius, inner radius", precision=8),
trkSumPtSolidConeDR04 = Var("trkSumPtSolidConeDR04()",float,doc="Sum of track pT in a cone of dR=0.4", precision=8),
ecalPFClusterIso = Var("ecalPFClusterIso()",float,doc="sum pt of ecal clusters, vetoing clusters part of photon", precision=8),
hcalPFClusterIso = Var("hcalPFClusterIso()",float,doc="sum pt of hcal clusters, vetoing clusters part of photon", precision=8),
pfPhoIso03 = Var("photonIso()",float,doc="PF absolute isolation dR=0.3, photon component (uncorrected)"),
pfChargedIso = Var("chargedHadronIso()",float,doc="PF absolute isolation dR=0.3, charged component with dxy,dz match to PV", precision=8),
pfChargedIsoPFPV = Var("chargedHadronPFPVIso()",float,doc="PF absolute isolation dR=0.3, charged component (PF PV only)"),
pfChargedIsoWorstVtx = Var("chargedHadronWorstVtxIso()",float,doc="PF absolute isolation dR=0.3, charged component (Vertex with largest isolation)"),
pfRelIso03_chg_quadratic = Var("userFloat('PFIsoChgQuadratic')/pt",float,doc="PF relative isolation dR=0.3, charged hadron component (with quadraticEA*rho*rho + linearEA*rho Winter22V1 corrections)"),
pfRelIso03_all_quadratic = Var("userFloat('PFIsoAllQuadratic')/pt",float,doc="PF relative isolation dR=0.3, total (with quadraticEA*rho*rho + linearEA*rho Winter22V1 corrections)"),
pfRelIso03_chg_Fall17V2 = Var("userFloat('PFIsoChgFall17V2')/pt",float,doc="PF relative isolation dR=0.3, charged component (with Fall17V2 rho*EA PU corrections)"),
pfRelIso03_all_Fall17V2 = Var("userFloat('PFIsoAllFall17V2')/pt",float,doc="PF relative isolation dR=0.3, total (with Fall17V2 rho*EA PU corrections)"),
hoe = Var("hadronicOverEm()",float,doc="H over E",precision=8),
hoe_PUcorr = Var("userFloat('HoverEQuadratic')",float,doc="PU corrected H/E (cone-based with quadraticEA*rho*rho + linearEA*rho Winter22V1 corrections)",precision=8),
isScEtaEB = Var("abs(superCluster().eta()) < 1.4442",bool,doc="is supercluster eta within barrel acceptance"),
Expand All @@ -254,33 +244,33 @@ def make_bitmapVID_docstring(id_modules_working_points_pset):
)
)

# switch default IDs back to Fall17V2 in Run2, remove Winter22V1 and quadratic iso
run2_egamma.toModify(photonTable.variables,
cutBased = photonTable.variables.cutBased_Fall17V2,
cutBased_Fall17V2 = None,
vidNestedWPBitmap = photonTable.variables.vidNestedWPBitmap_Fall17V2,
vidNestedWPBitmap_Fall17V2 = None,
mvaID = photonTable.variables.mvaID_Fall17V2,
mvaID_Fall17V2 = None,
mvaID_WP90 = photonTable.variables.mvaID_Fall17V2_WP90,
mvaID_Fall17V2_WP90 = None,
mvaID_WP80 = photonTable.variables.mvaID_Fall17V2_WP80,
mvaID_Fall17V2_WP80 = None,
pfRelIso03_chg = photonTable.variables.pfRelIso03_chg_Fall17V2,
pfRelIso03_chg_Fall17V2 = None,
pfRelIso03_all = photonTable.variables.pfRelIso03_all_Fall17V2,
pfRelIso03_all_Fall17V2 = None,
pfRelIso03_chg_quadratic=None,
pfRelIso03_all_quadratic=None,
hoe_PUcorr=None)

#these eras need to make the energy correction, hence the "New"

#these eras need to make the energy correction, hence the "New". Also save only Fall17V2 IDS in Run2, No Run3 Winter22V1 and quadratic iso in Run2
run2_egamma.toModify(
photonTable.variables,
pt = Var("pt*userFloat('ecalEnergyPostCorrNew')/userFloat('ecalEnergyPreCorrNew')", float, precision=-1, doc="p_{T}"),
energyErr = Var("userFloat('ecalEnergyErrPostCorrNew')",float,doc="energy error of the cluster from regression",precision=6),
eCorr = Var("userFloat('ecalEnergyPostCorrNew')/userFloat('ecalEnergyPreCorrNew')",float,doc="ratio of the calibrated energy/miniaod energy"),
hoe = Var("hadTowOverEm()",float,doc="H over E (Run2)",precision=8),
cutBased = Var(
"userInt('cutBasedID_Fall17V2_loose')+userInt('cutBasedID_Fall17V2_medium')+userInt('cutBasedID_Fall17V2_tight')",
"uint8",
doc="cut-based ID bitmap, Fall17V2, (0:fail, 1:loose, 2:medium, 3:tight)",
),
vidNestedWPBitmap = Var(
"userInt('VIDNestedWPBitmapFall17V2')",
int,
doc="Fall17V2 " + _bitmapVIDForPhoRun2_docstring
),
mvaID = Var("userFloat('mvaID_Fall17V2')",float,doc="MVA ID score, Fall17V2",precision=10),
mvaID_WP90 = Var("userInt('mvaID_Fall17V2_WP90')",bool,doc="MVA ID WP90, Fall17V2"),
mvaID_WP80 = Var("userInt('mvaID_Fall17V2_WP80')",bool,doc="MVA ID WP80, Fall17V2"),
pfRelIso03_chg = Var("userFloat('PFIsoChgFall17V2')/pt",float,doc="PF relative isolation dR=0.3, charged component (with Fall17V2rho*EA PUcorrections)"),
pfRelIso03_all = Var("userFloat('PFIsoAllFall17V2')/pt",float,doc="PF relative isolation dR=0.3, total (with Fall17V2 rho*EA PU corrections)"),
pfRelIso03_chg_quadratic=None,
pfRelIso03_all_quadratic=None,
hoe_PUcorr=None

)

photonsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR
Expand Down