diff --git a/Configuration/Eras/python/Era_Run3_2023_cff.py b/Configuration/Eras/python/Era_Run3_2023_cff.py index 8b14afa323e92..8b0911446723b 100644 --- a/Configuration/Eras/python/Era_Run3_2023_cff.py +++ b/Configuration/Eras/python/Era_Run3_2023_cff.py @@ -2,5 +2,6 @@ from Configuration.Eras.Era_Run3_cff import Run3 from Configuration.Eras.Modifier_run3_egamma_2023_cff import run3_egamma_2023 +from Configuration.Eras.Modifier_run3_scouting_nanoAOD_2023_cff import run3_scouting_nanoAOD_2023 -Run3_2023 = cms.ModifierChain(Run3, run3_egamma_2023) +Run3_2023 = cms.ModifierChain(Run3, run3_egamma_2023, run3_scouting_nanoAOD_2023) diff --git a/Configuration/Eras/python/Era_Run3_2024_cff.py b/Configuration/Eras/python/Era_Run3_2024_cff.py index ef55fc7c4ebce..8d597707c5330 100644 --- a/Configuration/Eras/python/Era_Run3_2024_cff.py +++ b/Configuration/Eras/python/Era_Run3_2024_cff.py @@ -2,6 +2,6 @@ from Configuration.Eras.Era_Run3_cff import Run3 from Configuration.Eras.Modifier_stage2L1Trigger_2024_cff import stage2L1Trigger_2024 -from Configuration.Eras.Modifier_run3_scouting_nanoAOD_post2023_cff import run3_scouting_nanoAOD_post2023 +from Configuration.Eras.Modifier_run3_scouting_nanoAOD_2024_cff import run3_scouting_nanoAOD_2024 -Run3_2024 = cms.ModifierChain(Run3, stage2L1Trigger_2024, run3_scouting_nanoAOD_post2023) +Run3_2024 = cms.ModifierChain(Run3, stage2L1Trigger_2024, run3_scouting_nanoAOD_2024) diff --git a/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_2023_cff.py b/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_2023_cff.py new file mode 100644 index 0000000000000..6f93e9aae37ff --- /dev/null +++ b/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_2023_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +run3_scouting_nanoAOD_2023 = cms.Modifier() diff --git a/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_2024_cff.py b/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_2024_cff.py new file mode 100644 index 0000000000000..c468cc109c616 --- /dev/null +++ b/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_2024_cff.py @@ -0,0 +1,3 @@ +import FWCore.ParameterSet.Config as cms + +run3_scouting_nanoAOD_2024 = cms.Modifier() diff --git a/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_post2023_cff.py b/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_post2023_cff.py deleted file mode 100644 index b7606c383dd13..0000000000000 --- a/Configuration/Eras/python/Modifier_run3_scouting_nanoAOD_post2023_cff.py +++ /dev/null @@ -1,3 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -run3_scouting_nanoAOD_post2023 = cms.Modifier() diff --git a/PhysicsTools/NanoAOD/plugins/SimpleScoutingFlatTableProducerPlugins.cc b/PhysicsTools/NanoAOD/plugins/SimpleScoutingFlatTableProducerPlugins.cc index 4e7afe4cd2757..39511a79d5630 100644 --- a/PhysicsTools/NanoAOD/plugins/SimpleScoutingFlatTableProducerPlugins.cc +++ b/PhysicsTools/NanoAOD/plugins/SimpleScoutingFlatTableProducerPlugins.cc @@ -8,13 +8,18 @@ typedef SimpleFlatTableProducer SimpleRun3ScoutingPhotonFlat #include "DataFormats/Scouting/interface/Run3ScoutingMuon.h" typedef SimpleFlatTableProducer SimpleRun3ScoutingMuonFlatTableProducer; +typedef SimpleCollectionFlatTableProducer SimpleRun3ScoutingMuonCollectionFlatTableProducer; #include "DataFormats/Scouting/interface/Run3ScoutingElectron.h" typedef SimpleFlatTableProducer SimpleRun3ScoutingElectronFlatTableProducer; +typedef SimpleCollectionFlatTableProducer SimpleRun3ScoutingElectronCollectionFlatTableProducer; #include "DataFormats/Scouting/interface/Run3ScoutingTrack.h" typedef SimpleFlatTableProducer SimpleRun3ScoutingTrackFlatTableProducer; +#include "DataFormats/Scouting/interface/Run3ScoutingParticle.h" +typedef SimpleFlatTableProducer SimpleRun3ScoutingParticleFlatTableProducer; + #include "DataFormats/Scouting/interface/Run3ScoutingPFJet.h" typedef SimpleFlatTableProducer SimpleRun3ScoutingPFJetFlatTableProducer; @@ -22,6 +27,9 @@ typedef SimpleFlatTableProducer SimpleRun3ScoutingPFJetFlatTa DEFINE_FWK_MODULE(SimpleRun3ScoutingVertexFlatTableProducer); DEFINE_FWK_MODULE(SimpleRun3ScoutingPhotonFlatTableProducer); DEFINE_FWK_MODULE(SimpleRun3ScoutingMuonFlatTableProducer); +DEFINE_FWK_MODULE(SimpleRun3ScoutingMuonCollectionFlatTableProducer); DEFINE_FWK_MODULE(SimpleRun3ScoutingElectronFlatTableProducer); +DEFINE_FWK_MODULE(SimpleRun3ScoutingElectronCollectionFlatTableProducer); DEFINE_FWK_MODULE(SimpleRun3ScoutingTrackFlatTableProducer); +DEFINE_FWK_MODULE(SimpleRun3ScoutingParticleFlatTableProducer); DEFINE_FWK_MODULE(SimpleRun3ScoutingPFJetFlatTableProducer); diff --git a/PhysicsTools/NanoAOD/python/custom_run3scouting_cff.py b/PhysicsTools/NanoAOD/python/custom_run3scouting_cff.py index 095b45dc23031..60214b033bca5 100644 --- a/PhysicsTools/NanoAOD/python/custom_run3scouting_cff.py +++ b/PhysicsTools/NanoAOD/python/custom_run3scouting_cff.py @@ -19,11 +19,19 @@ scoutingMuonTableTask = cms.Task(scoutingMuonTable) scoutingMuonDisplacedVertexTableTask = cms.Task(scoutingMuonDisplacedVertexTable) -# from 2024, there are two muon collections -from Configuration.Eras.Modifier_run3_scouting_nanoAOD_post2023_cff import run3_scouting_nanoAOD_post2023 -run3_scouting_nanoAOD_post2023.toReplaceWith(scoutingMuonTableTask, cms.Task(scoutingMuonVtxTable, scoutingMuonNoVtxTable))\ +# from 2024, there are two muon collections (https://its.cern.ch/jira/browse/CMSHLT-3089) +run3_scouting_nanoAOD_2024.toReplaceWith(scoutingMuonTableTask, cms.Task(scoutingMuonVtxTable, scoutingMuonNoVtxTable))\ .toReplaceWith(scoutingMuonDisplacedVertexTableTask, cms.Task(scoutingMuonVtxDisplacedVertexTable, scoutingMuonNoVtxDisplacedVertexTable)) +# Scouting Electron +scoutingElectronTableTask = cms.Task(scoutingElectronTable) + +# from 2023, scouting electron's tracks are added as std::vector since multiple tracks can be associated to a scouting electron +# plugin to select the best track to reduce to a single track per scouting electron is added +(run3_scouting_nanoAOD_2023 | run3_scouting_nanoAOD_2024).toReplaceWith( + scoutingElectronTableTask, cms.Task(scoutingElectronBestTrack, scoutingElectronTable) +) + # other collections are directly from original Run3Scouting objects, so unnessary to define tasks ############################ @@ -90,7 +98,7 @@ def prepareScoutingNanoTaskCommon(): # all scouting objects are saved except PF Candidate and Track scoutingNanoTaskCommon = cms.Task() scoutingNanoTaskCommon.add(scoutingMuonTableTask, scoutingMuonDisplacedVertexTableTask) - scoutingNanoTaskCommon.add(scoutingElectronTable) + scoutingNanoTaskCommon.add(scoutingElectronTableTask) scoutingNanoTaskCommon.add(scoutingPhotonTable) scoutingNanoTaskCommon.add(scoutingPrimaryVertexTable) scoutingNanoTaskCommon.add(scoutingPFJetTable) @@ -243,3 +251,37 @@ def addScoutingPFCandidate(process): # PF candidate after translation to reco::PFCandidate process.scoutingNanoSequence.associate(scoutingPFCandidateTask) return process + +# this adds all electron tracks in addition to best track selected +# this should be only used with ScoutingElectron format from 2023 +def addScoutingElectronTrack(process): + process.scoutingElectronTable.externalVariables.bestTrack_index\ + = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronBestTrackIndex"), int, doc="best track index") + + process.scoutingElectronTable.collectionVariables = cms.PSet( + ScoutingElectronTrack = cms.PSet( + name = cms.string("ScoutingElectronTrack"), + doc = cms.string("Scouting Electron Track"), + useCount = cms.bool(True), + useOffset = cms.bool(True), + variables = cms.PSet( + d0 = Var("trkd0", "float", doc="track d0"), + dz = Var("trkdz", "float", doc="track dz"), + pt = Var("trkpt", "float", doc="track pt"), + eta = Var("trketa", "float", doc="track eta"), + phi = Var("trkphi", "float", doc="track phi"), + chi2overndf = Var("trkchi2overndf", "float", doc="track normalized chi squared"), + charge = Var("trkcharge", "int", doc="track charge"), + ), + ), + ) + + # additional electron track variables added in 2024 in https://github.com/cms-sw/cmssw/pull/43744 + run3_scouting_nanoAOD_2024.toModify( + process.scoutingElectronTable.collectionVariables.variables, + pMode = Var("trkpMode", "float", doc="track pMode"), + etaMode = Var("trketaMode", "float", doc="track etaMode"), + phiMode = Var("trkphiMode", "float", doc="track phiMode"), + qoverpModeError = Var("trkqoverpModeError", "float", doc="track qoverpModeError"), + ) + return process diff --git a/PhysicsTools/NanoAOD/python/run3scouting_cff.py b/PhysicsTools/NanoAOD/python/run3scouting_cff.py index 00253f22319b5..a590ffac8f7c8 100644 --- a/PhysicsTools/NanoAOD/python/run3scouting_cff.py +++ b/PhysicsTools/NanoAOD/python/run3scouting_cff.py @@ -1,6 +1,8 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.common_cff import * from PhysicsTools.NanoAOD.simpleCandidateFlatTableProducer_cfi import simpleCandidateFlatTableProducer +from Configuration.Eras.Modifier_run3_scouting_nanoAOD_2023_cff import run3_scouting_nanoAOD_2023 +from Configuration.Eras.Modifier_run3_scouting_nanoAOD_2024_cff import run3_scouting_nanoAOD_2024 ##################################### ##### Scouting Original Objects ##### @@ -10,7 +12,7 @@ # Scouting Muon # https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingMuon.h -scoutingMuonTable = cms.EDProducer("SimpleRun3ScoutingMuonFlatTableProducer", +scoutingMuonTable = cms.EDProducer("SimpleRun3ScoutingMuonCollectionFlatTableProducer", src = cms.InputTag("hltScoutingMuonPacker"), cut = cms.string(""), name = cms.string("ScoutingMuon"), @@ -72,10 +74,65 @@ trk_vx = Var('trk_vx', 'float', precision=10, doc='track vx'), trk_vy = Var('trk_vy', 'float', precision=10, doc='track vy'), trk_vz = Var('trk_vz', 'float', precision=10, doc='track vz'), + trk_hitPattern_hitCount = Var("trk_hitPattern().hitCount", "uint8", doc="track hitPattern hitCount"), + trk_hitPattern_beginTrackHits = Var("trk_hitPattern().beginTrackHits", "uint8", doc="track hitPattern beginTrackHits"), + trk_hitPattern_endTrackHits = Var("trk_hitPattern().endTrackHits", "uint8", doc="track hitPattern endTrackHits"), + trk_hitPattern_beginInner = Var("trk_hitPattern().beginInner", "uint8", doc="track hitPattern beginInner"), + trk_hitPattern_endInner = Var("trk_hitPattern().endInner", "uint8", doc="track hitPattern endInner"), + trk_hitPattern_beginOuter = Var("trk_hitPattern().beginOuter", "uint8", doc="track hitPattern beginOuter"), + trk_hitPattern_endOuter = Var("trk_hitPattern().endOuter", "uint8", doc="track hitPattern endOuter"), ), + collectionVariables = cms.PSet( + ScoutingMuonVtxIndx = cms.PSet( + name = cms.string("ScoutingMuonVtxIndx"), + doc = cms.string("Scouting Muon Displaced Vertex Index"), + useCount = cms.bool(True), + useOffset = cms.bool(True), + variables = cms.PSet( + vtxIndx = Var('vtxIndx', 'int', doc='vertex indices'), + ), + ), + ScoutingMuonHitPattern = cms.PSet( + name = cms.string("ScoutingMuonHitPattern"), + doc = cms.string("Scouting Muon HitPattern"), + useCount = cms.bool(True), + useOffset = cms.bool(True), + variables = cms.PSet( + hitPattern = Var('trk_hitPattern().hitPattern', 'uint16', doc='track hitPattern hitPattern'), + ), + ) + ) +) + +# Scouting Vertex +# format during 2022-23 data-taking used for both primary vertex and dimuon displaced vertex +# https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingVertex.h + +scoutingVertexVariables = cms.PSet( + x = Var('x', 'float', precision=10, doc='position x coordinate'), + y = Var('y', 'float', precision=10, doc='position y coordinate'), + z = Var('z', 'float', precision=10, doc='position z coordinate'), + xError = Var('xError', 'float', precision=10, doc='x error'), + yError = Var('yError', 'float', precision=10, doc='y error'), + zError = Var('zError', 'float', precision=10, doc='z error'), + tracksSize = Var('tracksSize', 'int', doc='number of tracks'), + chi2 = Var('chi2', 'float', precision=10, doc='chi squared'), + ndof = Var('ndof', 'int', doc='number of degrees of freedom'), + isValidVtx = Var('isValidVtx', 'bool', doc='is valid'), +) + +# scouting vertex format changed for 2024 data-taking in https://github.com/cms-sw/cmssw/pull/43758 +# used for both primary vertex and dimuon displaced vertex +# https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingVertex.h + +run3_scouting_nanoAOD_2024.toModify( + scoutingVertexVariables, + xyCov = Var('xyCov', 'float', precision=10, doc='xy covariance'), + xzCov = Var('xzCov', 'float', precision=10, doc='xz covariance'), + yzCov = Var('yzCov', 'float', precision=10, doc='yz covariance'), ) -# Scouting Displaced Vertex (Muon) +# Scouting Displaced Vertex (from dimuon) # https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingVertex.h scoutingMuonDisplacedVertexTable = cms.EDProducer("SimpleRun3ScoutingVertexFlatTableProducer", @@ -85,21 +142,9 @@ doc = cms.string("Scouting Muon Displaced Vertex"), singleton = cms.bool(False), extension = cms.bool(False), - variables = cms.PSet( - x = Var('x', 'float', precision=10, doc='position x coordinate'), - y = Var('y', 'float', precision=10, doc='position y coordinate'), - z = Var('z', 'float', precision=10, doc='position z coordinate'), - xError = Var('xError', 'float', precision=10, doc='x error'), - yError = Var('yError', 'float', precision=10, doc='y error'), - zError = Var('zError', 'float', precision=10, doc='z error'), - tracksSize = Var('tracksSize', 'int', doc='number of tracks'), - chi2 = Var('chi2', 'float', precision=10, doc='chi squared'), - ndof = Var('ndof', 'int', doc='number of degrees of freedom'), - isValidVtx = Var('isValidVtx', 'bool', doc='is valid'), - ), + variables = scoutingVertexVariables, ) - # from 2024, there are two scouting muon collections # muonVtx @@ -108,6 +153,11 @@ name = cms.string("ScoutingMuonVtx"), doc = cms.string("Scouting Muon Vtx"), ) +scoutingMuonVtxTable.collectionVariables.ScoutingMuonVtxIndx.name = cms.string("ScoutingMuonVtxVtxIndx") +scoutingMuonVtxTable.collectionVariables.ScoutingMuonVtxIndx.doc = cms.string("ScoutingMuonVtx VtxIndx") +scoutingMuonVtxTable.collectionVariables.ScoutingMuonHitPattern.name = cms.string("ScoutingMuonVtxHitPattern") +scoutingMuonVtxTable.collectionVariables.ScoutingMuonHitPattern.doc = cms.string("ScoutingMuonVtx HitPattern") + scoutingMuonVtxDisplacedVertexTable = scoutingMuonDisplacedVertexTable.clone( src = cms.InputTag("hltScoutingMuonPackerVtx", "displacedVtx"), name = cms.string("ScoutingMuonVtxDisplacedVertex"), @@ -120,6 +170,11 @@ name = cms.string("ScoutingMuonNoVtx"), doc = cms.string("Scouting Muon NoVtx"), ) +scoutingMuonNoVtxTable.collectionVariables.ScoutingMuonVtxIndx.name = cms.string("ScoutingMuonNoVtxVtxIndx") +scoutingMuonNoVtxTable.collectionVariables.ScoutingMuonVtxIndx.doc = cms.string("ScoutingMuonNoVtx VtxIndx") +scoutingMuonNoVtxTable.collectionVariables.ScoutingMuonHitPattern.name = cms.string("ScoutingMuonNoVtxHitPattern") +scoutingMuonNoVtxTable.collectionVariables.ScoutingMuonHitPattern.doc = cms.string("ScoutingMuonNoVtx HitPattern") + scoutingMuonNoVtxDisplacedVertexTable = scoutingMuonDisplacedVertexTable.clone( src = cms.InputTag("hltScoutingMuonPackerNoVtx", "displacedVtx"), name = cms.string("ScoutingMuonNoVtxDisplacedVertex"), @@ -127,9 +182,11 @@ ) # Scouting Electron -# https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingElectron.h +# format during 2022 data-taking +# for accessing d0, dz, and charge, use changes from https://github.com/cms-sw/cmssw/pull/41025 +# https://github.com/cms-sw/cmssw/blob/CMSSW_12_4_X/DataFormats/Scouting/interface/Run3ScoutingElectron.h -scoutingElectronTable = cms.EDProducer("SimpleRun3ScoutingElectronFlatTableProducer", +scoutingElectronTable = cms.EDProducer("SimpleRun3ScoutingElectronCollectionFlatTableProducer", src = cms.InputTag("hltScoutingEgammaPacker"), cut = cms.string(""), name = cms.string("ScoutingElectron"), @@ -138,27 +195,83 @@ extension = cms.bool(False), variables = cms.PSet( pt = Var('pt', 'float', precision=10, doc='super-cluster (SC) pt'), - eta = Var('eta', 'float', precision=10, doc='SC eta'), - phi = Var('phi', 'float', precision=10, doc='SC phi'), - m = Var('m', 'float', precision=10, doc='SC mass'), + eta = Var('eta', 'float', precision=10, doc='super-cluster (SC) eta'), + phi = Var('phi', 'float', precision=10, doc='super-cluster (SC) phi'), + m = Var('m', 'float', precision=10, doc='super-cluster (SC) mass'), + d0 = Var('trkd0[0]', 'float', precision=10, doc='track d0'), + dz = Var('trkdz[0]', 'float', precision=10, doc='track dz'), dEtaIn = Var('dEtaIn', 'float', precision=10, doc='#Delta#eta(SC seed, track pixel seed)'), dPhiIn = Var('dPhiIn', 'float', precision=10, doc='#Delta#phi(SC seed, track pixel seed)'), sigmaIetaIeta = Var('sigmaIetaIeta', 'float', precision=10, doc='sigmaIetaIeta of the SC, calculated with full 5x5 region, noise cleaned'), hOverE = Var('hOverE', 'float', precision=10, doc='Energy in HCAL / Energy in ECAL'), ooEMOop = Var('ooEMOop', 'float', precision=10, doc='1/E(SC) - 1/p(track momentum)'), missingHits = Var('missingHits', 'int', doc='missing hits in the tracker'), + charge = Var('trkcharge[0]', 'int', doc='track charge'), ecalIso = Var('ecalIso', 'float', precision=10, doc='Isolation of SC in the ECAL'), hcalIso = Var('hcalIso', 'float', precision=10, doc='Isolation of SC in the HCAL'), trackIso = Var('trackIso', 'float', precision=10, doc='Isolation of electron track in the tracker'), - r9 = Var('r9', 'float', precision=10, doc='ELectron SC r9 as defined in https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEgammaShowerShape'), + r9 = Var('r9', 'float', precision=10, doc='Electron SC r9 as defined in https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEgammaShowerShape'), sMin = Var('sMin', 'float', precision=10, doc='minor moment of the SC shower shape'), sMaj = Var('sMaj', 'float', precision=10, doc='major moment of the SC shower shape'), - seedId = Var('seedId', 'int', doc='ECAL ID of the SC seed'), + seedId = Var('seedId', 'uint', doc='ECAL ID of the SC seed'), + rechitZeroSuppression = Var('rechitZeroSuppression', 'bool', doc='rechit zero suppression'), ), + externalVariables = cms.PSet(), +) + +# scouting electron format changed for 2023 data-taking in https://github.com/cms-sw/cmssw/pull/41025 +# https://github.com/cms-sw/cmssw/blob/CMSSW_13_0_X/DataFormats/Scouting/interface/Run3ScoutingElectron.h + +# from 2023, scouting electron's tracks are added as std::vector since multiple tracks are associated to scouting electrons +# this plugin selects the best track to reduce to a single track per scouting electron, which is more suitable for NanoAOD format +# https://github.com/cms-sw/cmssw/pull/47726 + +scoutingElectronBestTrack = cms.EDProducer("Run3ScoutingElectronBestTrackProducer", + Run3ScoutingElectron = cms.InputTag("hltScoutingEgammaPacker"), + TrackPtMin = cms.vdouble(12.0, 12.0), + TrackChi2OverNdofMax = cms.vdouble(3.0, 2.0), + RelativeEnergyDifferenceMax = cms.vdouble(1.0, 1.0), + DeltaPhiMax = cms.vdouble(0.06, 0.06) +) + +(run3_scouting_nanoAOD_2023 | run3_scouting_nanoAOD_2024).toModify( + scoutingElectronTable.variables, + d0 = None, # replaced with trkd0 (std::vector) + dz = None, # replaced with trkdz (std::vector) + charge = None, # replaced with trkcharge (std::vector) +).toModify( + scoutingElectronTable.externalVariables, + bestTrack_d0 = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackd0"), float, doc="best track d0"), + bestTrack_dz = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackdz"), float, doc="best track dz"), + bestTrack_pt = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackpt"), float, doc="best track pt"), + bestTrack_eta = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTracketa"), float, doc="best track eta"), + bestTrack_phi = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackphi"), float, doc="best track phi"), + bestTrack_chi2overndf = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackchi2overndf"), float, doc="best track chi2overndf"), + bestTrack_charge = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackcharge"), int, doc="best track charge"), +) + +# scouting electron format changed for 2024 data-taking in https://github.com/cms-sw/cmssw/pull/43744 +# https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingElectron.h + +run3_scouting_nanoAOD_2024.toModify( + scoutingElectronTable.variables, + rawEnergy = Var("rawEnergy", "float", precision=10, doc="raw energy"), + preshowerEnergy = Var("preshowerEnergy", "float", precision=10, doc='preshower energy'), + corrEcalEnergyError = Var("corrEcalEnergyError", "float", precision=10, doc='corrEcalEnergyError'), + trackfbrem = Var("trackfbrem", "float", precision=10, doc="trackfbrem"), + nClusters = Var("nClusters", "uint", precision=10, doc="number of clusters"), + nCrystals = Var("nCrystals", "uint", precision=10, doc="number of crystals"), +).toModify( + scoutingElectronTable.externalVariables, + bestTrack_pMode = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackpMode"), float, doc="best track pMode"), + bestTrack_etaMode = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTracketaMode"), float, doc="best track etaMode"), + bestTrack_phiMode = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackphiMode"), float, doc="best track phiMode"), + bestTrack_qoverpModeError = ExtVar(cms.InputTag("scoutingElectronBestTrack", "Run3ScoutingElectronTrackqoverpModeError"), float, doc="best track qoverpModeError"), ) # Scouting Photon -# https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingPhoton.h +# format during 2022-23 data-taking +# https://github.com/cms-sw/cmssw/blob/CMSSW_13_0_X/DataFormats/Scouting/interface/Run3ScoutingPhoton.h scoutingPhotonTable = cms.EDProducer("SimpleRun3ScoutingPhotonFlatTableProducer", src = cms.InputTag("hltScoutingEgammaPacker"), @@ -180,10 +293,23 @@ r9 = Var('r9', 'float', precision=10, doc='Photon SC r9 as defined in https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEgammaShowerShape'), sMin = Var('sMin', 'float', precision=10, doc='minor moment of the SC shower shape'), sMaj = Var('sMaj', 'float', precision=10, doc='major moment of the SC shower shape'), - seedId = Var('seedId', 'int', doc='ECAL ID of the SC seed'), + seedId = Var('seedId', 'uint', doc='ECAL ID of the SC seed'), + rechitZeroSuppression = Var('rechitZeroSuppression', 'bool', doc='rechit zero suppression'), ), ) +# scouting photon format changed for 2024 data-taking in https://github.com/cms-sw/cmssw/pull/43744 +# https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingPhoton.h + +run3_scouting_nanoAOD_2024.toModify( + scoutingPhotonTable.variables, + rawEnergy = Var("rawEnergy", "float", precision=10, doc="raw energy"), + preshowerEnergy = Var("preshowerEnergy", "float", precision=10, doc='preshower energy'), + corrEcalEnergyError = Var("corrEcalEnergyError", "float", precision=10, doc='corrEcalEnergyError'), + nClusters = Var("nClusters", "uint", precision=10, doc="number of clusters"), + nCrystals = Var("nCrystals", "uint", precision=10, doc="number of crystals"), +) + # Scouting Track # https://github.com/cms-sw/cmssw/blob/CMSSW_14_0_X/DataFormats/Scouting/interface/Run3ScoutingTrack.h @@ -242,18 +368,7 @@ doc = cms.string("Scouting Primary Vertex"), singleton = cms.bool(False), extension = cms.bool(False), - variables = cms.PSet( - x = Var('x', 'float', precision=10, doc='position x coordinate'), - y = Var('y', 'float', precision=10, doc='position y coordinate'), - z = Var('z', 'float', precision=10, doc='position z coordinate'), - xError = Var('xError', 'float', precision=10, doc='x error'), - yError = Var('yError', 'float', precision=10, doc='y error'), - zError = Var('zError', 'float', precision=10, doc='z error'), - tracksSize = Var('tracksSize', 'int', doc='number of tracks'), - chi2 = Var('chi2', 'float', precision=10, doc='chi squared'), - ndof = Var('ndof', 'int', doc='number of degrees of freedom'), - isValidVtx = Var('isValidVtx', 'bool', doc='is valid'), - ), + variables = scoutingVertexVariables, ) # Scouting Particle (PF candidate) @@ -320,8 +435,8 @@ scoutingMETTable = cms.EDProducer("GlobalVariablesTableProducer", name = cms.string("ScoutingMET"), variables = cms.PSet( - pt = ExtVar( cms.InputTag("hltScoutingPFPacker", "pfMetPt"), "double", doc = "scouting MET pt"), - phi = ExtVar( cms.InputTag("hltScoutingPFPacker", "pfMetPhi"), "double", doc = "scouting MET phi"), + pt = ExtVar( cms.InputTag("hltScoutingPFPacker", "pfMetPt"), "double", doc = "pt"), + phi = ExtVar( cms.InputTag("hltScoutingPFPacker", "pfMetPhi"), "double", doc = "phi"), ), )