Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:37:20

0001 import FWCore.ParameterSet.Config as cms
0002 from  PhysicsTools.NanoAOD.common_cff import *
0003 from PhysicsTools.NanoAOD.simpleCandidateFlatTableProducer_cfi import simpleCandidateFlatTableProducer
0004 
0005 ################
0006 # Scouting photons, electrons, muons, tracks, primary vertices, displaced vertices, jets (clustered at HLT), rho and MET
0007 
0008 photonScoutingTable = cms.EDProducer("SimpleRun3ScoutingPhotonFlatTableProducer",
0009      src = cms.InputTag("hltScoutingEgammaPacker"),
0010      cut = cms.string(""),
0011      name = cms.string("ScoutingPhoton"),
0012      doc  = cms.string("Photon scouting information"),
0013      singleton = cms.bool(False),
0014      extension = cms.bool(False),
0015      variables = cms.PSet(
0016          pt = Var('pt', 'float', precision=10, doc='super-cluster (SC) pt'),
0017          eta = Var('eta', 'float', precision=10, doc='SC eta'),
0018          phi = Var('phi', 'float', precision=10, doc='SC phi'),
0019          m = Var('m', 'float', precision=10, doc='SC mass'),
0020          sigmaIetaIeta = Var('sigmaIetaIeta', 'float', precision=10, doc='sigmaIetaIeta of the SC, calculated with full 5x5 region, noise cleaned'),
0021          hOverE = Var('hOverE', 'float', precision=10, doc='Energy in HCAL / Energy in ECAL'),
0022          ecalIso = Var('ecalIso', 'float', precision=10, doc='Isolation of SC in the ECAL'),
0023          hcalIso = Var('hcalIso', 'float', precision=10, doc='Isolation of SC in the HCAL'),
0024          r9 = Var('r9', 'float', precision=10, doc='Photon SC r9 as defined in https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEgammaShowerShape'),
0025          sMin = Var('sMin', 'float', precision=10, doc='minor moment of the SC shower shape'),
0026          sMaj = Var('sMaj', 'float', precision=10, doc='major moment of the SC shower shape'),
0027          seedId = Var('seedId', 'int', doc='ECAL ID of the SC seed'),
0028      )
0029 )
0030 
0031 electronScoutingTable = cms.EDProducer("SimpleRun3ScoutingElectronFlatTableProducer",
0032      src = cms.InputTag("hltScoutingEgammaPacker"),
0033      cut = cms.string(""),
0034      name = cms.string("ScoutingElectron"),
0035      doc  = cms.string("Electron scouting information"),
0036      singleton = cms.bool(False),
0037      extension = cms.bool(False),
0038      variables = cms.PSet(
0039          pt = Var('pt', 'float', precision=10, doc='super-cluster (SC) pt'),
0040          eta = Var('eta', 'float', precision=10, doc='SC eta'),
0041          phi = Var('phi', 'float', precision=10, doc='SC phi'),
0042          m = Var('m', 'float', precision=10, doc='SC mass'),
0043          dEtaIn = Var('dEtaIn', 'float', precision=10, doc='#Delta#eta(SC seed, track pixel seed)'),
0044          dPhiIn = Var('dPhiIn', 'float', precision=10, doc='#Delta#phi(SC seed, track pixel seed)'),
0045          sigmaIetaIeta = Var('sigmaIetaIeta', 'float', precision=10, doc='sigmaIetaIeta of the SC, calculated with full 5x5 region, noise cleaned'),
0046          hOverE = Var('hOverE', 'float', precision=10, doc='Energy in HCAL / Energy in ECAL'),
0047          ooEMOop = Var('ooEMOop', 'float', precision=10, doc='1/E(SC) - 1/p(track momentum)'),
0048          missingHits = Var('missingHits', 'int', doc='missing hits in the tracker'),
0049          ecalIso = Var('ecalIso', 'float', precision=10, doc='Isolation of SC in the ECAL'),
0050          hcalIso = Var('hcalIso', 'float', precision=10, doc='Isolation of SC in the HCAL'),
0051          trackIso = Var('trackIso', 'float', precision=10, doc='Isolation of electron track in the tracker'),
0052          r9 = Var('r9', 'float', precision=10, doc='ELectron SC r9 as defined in https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEgammaShowerShape'),
0053          sMin = Var('sMin', 'float', precision=10, doc='minor moment of the SC shower shape'),
0054          sMaj = Var('sMaj', 'float', precision=10, doc='major moment of the SC shower shape'),
0055          seedId = Var('seedId', 'int', doc='ECAL ID of the SC seed'),
0056      )
0057 )
0058 
0059 muonScoutingTable = cms.EDProducer("SimpleRun3ScoutingMuonFlatTableProducer",
0060      src = cms.InputTag("hltScoutingMuonPacker"),
0061      cut = cms.string(""),
0062      name = cms.string("ScoutingMuon"),
0063      doc  = cms.string("Muon scouting information"),
0064      singleton = cms.bool(False),
0065      extension = cms.bool(False),
0066      variables = cms.PSet(
0067          pt = Var('pt', 'float', precision=10, doc='pt'),
0068          eta = Var('eta', 'float', precision=10, doc='eta'),
0069          phi = Var('phi', 'float', precision=10, doc='phi'),
0070          m = Var('m', 'float', precision=10, doc='mass'),
0071          type = Var('type', 'int', doc='type of muon'),
0072          charge = Var('charge', 'int', doc='track charge'),
0073          normchi2 = Var('normalizedChi2', 'float', precision=10, doc='normalized chi squared'),
0074          ecalIso = Var('ecalIso', 'float', precision=10, doc='PF ECAL isolation'),
0075          hcalIso = Var('hcalIso', 'float', precision=10, doc='PF HCAL isolation'),
0076          trackIso = Var('trackIso', 'float', precision=10, doc='track isolation'),
0077          nValidStandAloneMuonHits = Var('nValidStandAloneMuonHits', 'int', doc='number of valid standalone muon hits'),
0078          nStandAloneMuonMatchedStations = Var('nStandAloneMuonMatchedStations', 'int', doc='number of muon stations with valid hits'),
0079          nValidRecoMuonHits = Var('nValidRecoMuonHits', 'int', doc='number of valid reco muon hits'),
0080          nRecoMuonChambers = Var('nRecoMuonChambers', 'int', doc='number of reco muon chambers'),
0081          nRecoMuonChambersCSCorDT = Var('nRecoMuonChambersCSCorDT', 'int', doc='number of reco muon chambers CSC or DT'),
0082          nRecoMuonMatches = Var('nRecoMuonMatches', 'int', doc='number of reco muon matches'),
0083          nRecoMuonMatchedStations = Var('nRecoMuonMatchedStations', 'int', doc='number of reco muon matched stations'),
0084          nRecoMuonExpectedMatchedStations = Var('nRecoMuonExpectedMatchedStations', 'int', doc='number of reco muon expected matched stations'),
0085          recoMuonStationMask = Var('recoMuonStationMask', 'int', doc='reco muon station mask'),
0086          nRecoMuonMatchedRPCLayers = Var('nRecoMuonMatchedRPCLayers', 'int', doc='number of reco muon matched RPC layers'),
0087          recoMuonRPClayerMask = Var('recoMuonRPClayerMask', 'int', doc='reco muon RPC layer mask'),
0088          nValidPixelHits = Var('nValidPixelHits', 'int', doc='number of valid pixel hits'),
0089          nValidStripHits = Var('nValidStripHits', 'int', doc='number of valid strip hits'),
0090          nPixelLayersWithMeasurement = Var('nPixelLayersWithMeasurement', 'int', doc='number of pixel layers with measurement'),
0091          nTrackerLayersWithMeasurement = Var('nTrackerLayersWithMeasurement', 'int', doc='number of tracker layer with measurements'),
0092          trk_chi2 = Var('trk_chi2', 'float', precision=10, doc='track chi squared'),
0093          trk_ndof = Var('trk_ndof', 'float', precision=10, doc='track number of degrees of freedom'),
0094          trk_dxy = Var('trk_dxy', 'float', precision=10, doc='track dxy'),
0095          trk_dz = Var('trk_dz', 'float', precision=10, doc='track dz'),
0096          trk_qoverp = Var('trk_qoverp', 'float', precision=10, doc='track qoverp'),
0097          trk_lambda = Var('trk_lambda', 'float', precision=10, doc='track lambda'),
0098          trk_pt = Var('trk_pt', 'float', precision=10, doc='track pt'),
0099          trk_phi = Var('trk_phi', 'float', precision=10, doc='track phi'),
0100          trk_eta = Var('trk_eta', 'float', precision=10, doc='track eta'),
0101          trk_dxyError = Var('trk_dxyError', 'float', precision=10, doc='track dxyError'),
0102          trk_dzError = Var('trk_dzError', 'float', precision=10, doc='tracl dzError'),
0103          trk_qoverpError = Var('trk_qoverpError', 'float', precision=10, doc='track qoverpError'),
0104          trk_lambdaError = Var('trk_lambdaError', 'float', precision=10, doc='track lambdaError'),
0105          trk_phiError = Var('trk_phiError', 'float', precision=10, doc='track phiError'),
0106          trk_dsz = Var('trk_dsz', 'float', precision=10, doc='track dsz'),
0107          trk_dszError = Var('trk_dszError', 'float', precision=10, doc='track dszError'),
0108          trk_qoverp_lambda_cov = Var('trk_qoverp_lambda_cov', 'float', precision=10, doc='track qoverp lambda covariance ((0,1) element of covariance matrix)'),
0109          trk_qoverp_phi_cov = Var('trk_qoverp_phi_cov', 'float', precision=10, doc='track qoverp phi covariance ((0,2) element of covariance matrix)'),
0110          trk_qoverp_dxy_cov = Var('trk_qoverp_dxy_cov', 'float', precision=10, doc='track qoverp dxy covariance ((0,3) element of covariance matrix)'),
0111          trk_qoverp_dsz_cov = Var('trk_qoverp_dsz_cov', 'float', precision=10, doc='track qoverp dsz covariance ((0,4) element of covariance matrix)'),
0112          trk_lambda_phi_cov = Var('trk_lambda_phi_cov', 'float', precision=10, doc='track lambda phi covariance ((1,2) element of covariance matrix)'),
0113          trk_lambda_dxy_cov = Var('trk_lambda_dxy_cov', 'float', precision=10, doc='track lambda dxy covariance ((1,3) element of covariance matrix)'),
0114          trk_lambda_dsz_cov = Var('trk_lambda_dsz_cov', 'float', precision=10, doc='track lambda dsz covariance ((1,4) element of covariance matrix)'),
0115          trk_phi_dxy_cov = Var('trk_phi_dxy_cov', 'float', precision=10, doc='track phi dxy covariance ((2,3) element of covariance matrix)'),
0116          trk_phi_dsz_cov = Var('trk_phi_dsz_cov', 'float', precision=10, doc='track phi dsz covariance ((2,4) element of covariance matrix)'),
0117          trk_dxy_dsz_cov = Var('trk_dxy_dsz_cov', 'float', precision=10, doc='track dxy dsz covariance ((3,4) element of covariance matrix)'),
0118          trk_vx = Var('trk_vx', 'float', precision=10, doc='track vx'),
0119          trk_vy = Var('trk_vy', 'float', precision=10, doc='track vy'),
0120          trk_vz = Var('trk_vz', 'float', precision=10, doc='track vz'),
0121      )
0122 )
0123 
0124 trackScoutingTable = cms.EDProducer("SimpleRun3ScoutingTrackFlatTableProducer",
0125      src = cms.InputTag("hltScoutingTrackPacker"),
0126      cut = cms.string(""),
0127      name = cms.string("ScoutingTrack"),
0128      doc  = cms.string("Track scouting information"),
0129      singleton = cms.bool(False),
0130      extension = cms.bool(False),
0131      variables = cms.PSet(
0132          pt = Var('tk_pt', 'float', precision=10, doc='pt'),
0133          eta = Var('tk_eta', 'float', precision=10, doc='eta'),
0134          phi = Var('tk_phi', 'float', precision=10, doc='phi'),
0135          chi2 = Var('tk_chi2', 'float', precision=10, doc='chi squared'),
0136          ndof = Var('tk_ndof', 'float', precision=10, doc='number of degrees of freedom'),
0137          charge = Var('tk_charge', 'int', doc='charge'),
0138          dxy = Var('tk_dxy', 'float', precision=10, doc='dxy'),
0139          dz = Var('tk_dz', 'float', precision=10, doc='dz'),
0140          nValidPixelHits = Var('tk_nValidPixelHits', 'int', doc='number of valid pixel hits'),
0141          nValidStripHits = Var('tk_nValidStripHits', 'int', doc='number of valid strip hits'),
0142          nTrackerLayersWithMeasurement = Var('tk_nTrackerLayersWithMeasurement', 'int', doc='number of tracker layers with measurements'),
0143          qoverp = Var('tk_qoverp', 'float', precision=10, doc='qoverp'),
0144          lambda_ = Var('tk_lambda', 'float', precision=10, doc='lambda'),
0145          dxyError = Var('tk_dxy_Error', 'float', precision=10, doc='dxyError'),
0146          dzError = Var('tk_dz_Error', 'float', precision=10, doc='dzError'),
0147          qoverpError = Var('tk_qoverp_Error', 'float', precision=10, doc='qoverpError'),
0148          lambdaError = Var('tk_lambda_Error', 'float', precision=10, doc='lambdaError'),
0149          phiError = Var('tk_phi_Error', 'float', precision=10, doc='phiError'),
0150          dsz = Var('tk_dsz', 'float', precision=10, doc='dsz'),
0151          dszError = Var('tk_dsz_Error', 'float', precision=10, doc='dszError'),
0152          qoverp_lambda_cov = Var('tk_qoverp_lambda_cov', 'float', precision=10, doc='qoverp lambda covariance ((0,1) element of covariance matrix)'),
0153          qoverp_phi_cov = Var('tk_qoverp_phi_cov', 'float', precision=10, doc='qoverp phi covariance ((0,2) element of covariance matrix)'),
0154          qoverp_dxy_cov = Var('tk_qoverp_dxy_cov', 'float', precision=10, doc='qoverp dxy covariance ((0,3) element of covariance matrix)'),
0155          qoverp_dsz_cov = Var('tk_qoverp_dsz_cov', 'float', precision=10, doc='qoverp dsz covariance ((0,4) element of covariance matrix)'),
0156          lambda_phi_cov = Var('tk_lambda_phi_cov', 'float', precision=10, doc='lambda phi covariance ((1,2) element of covariance matrix)'),
0157          lambda_dxy_cov = Var('tk_lambda_dxy_cov', 'float', precision=10, doc='lambda dxy covariance ((1,3) element of covariance matrix)'),
0158          lambda_dsz_cov = Var('tk_lambda_dsz_cov', 'float', precision=10, doc='lambd dsz covariance ((1,4) element of covariance matrix)'),
0159          phi_dxy_cov = Var('tk_phi_dxy_cov', 'float', precision=10, doc='phi dxy covariance ((2,3) element of covariance matrix)'),
0160          phi_dsz_cov = Var('tk_phi_dsz_cov', 'float', precision=10, doc='phi dsz covariance ((2,4) element of covariance matrix)'),
0161          dxy_dsz_cov = Var('tk_dxy_dsz_cov', 'float', precision=10, doc='dxy dsz covariance ((3,4) element of covariance matrix)'),
0162          vtxInd = Var('tk_vtxInd', 'int', doc='vertex index'),
0163          vx = Var('tk_vx', 'float', precision=10, doc='vx'),
0164          vy = Var('tk_vy', 'float', precision=10, doc='vy'),
0165          vz = Var('tk_vz', 'float', precision=10, doc='vz'),
0166      )
0167 )
0168 
0169 primaryvertexScoutingTable = cms.EDProducer("SimpleRun3ScoutingVertexFlatTableProducer",
0170      src = cms.InputTag("hltScoutingPrimaryVertexPacker", "primaryVtx"),
0171      cut = cms.string(""),
0172      name = cms.string("ScoutingPrimaryVertex"),
0173      doc  = cms.string("PrimaryVertex scouting information"),
0174      singleton = cms.bool(False),
0175      extension = cms.bool(False),
0176      variables = cms.PSet(
0177          x = Var('x', 'float', precision=10, doc='position x coordinate'),
0178          y = Var('y', 'float', precision=10, doc='position y coordinate'),
0179          z = Var('z', 'float', precision=10, doc='position z coordinate'),
0180          xError = Var('xError', 'float', precision=10, doc='x error'),
0181          yError = Var('yError', 'float', precision=10, doc='y error'),
0182          zError = Var('zError', 'float', precision=10, doc='z error'),
0183          tracksSize = Var('tracksSize', 'int', doc='number of tracks'),
0184          chi2 = Var('chi2', 'float', precision=10, doc='chi squared'),
0185          ndof = Var('ndof', 'int', doc='number of degrees of freedom'),
0186          isValidVtx = Var('isValidVtx', 'bool', doc='is valid'),
0187      )
0188 )
0189 
0190 displacedvertexScoutingTable = cms.EDProducer("SimpleRun3ScoutingVertexFlatTableProducer",
0191      src = cms.InputTag("hltScoutingMuonPacker","displacedVtx"),
0192      cut = cms.string(""),
0193      name = cms.string("ScoutingDisplacedVertex"),
0194      doc  = cms.string("DisplacedVertex scouting information"),
0195      singleton = cms.bool(False),
0196      extension = cms.bool(False),
0197      variables = cms.PSet(
0198          x = Var('x', 'float', precision=10, doc='position x coordinate'),
0199          y = Var('y', 'float', precision=10, doc='position y coordinate'),
0200          z = Var('z', 'float', precision=10, doc='position z coordinate'),
0201          xError = Var('xError', 'float', precision=10, doc='x error'),
0202          yError = Var('yError', 'float', precision=10, doc='y error'),
0203          zError = Var('zError', 'float', precision=10, doc='z error'),
0204          tracksSize = Var('tracksSize', 'int', doc='number of tracks'),
0205          chi2 = Var('chi2', 'float', precision=10, doc='chi squared'),
0206          ndof = Var('ndof', 'int', doc='number of degrees of freedom'),
0207          isValidVtx = Var('isValidVtx', 'bool', doc='is valid'),
0208      )
0209 )
0210 
0211 jetScoutingTable = cms.EDProducer("SimpleRun3ScoutingPFJetFlatTableProducer",
0212     src = cms.InputTag("hltScoutingPFPacker"),
0213     cut = cms.string(""),
0214     name = cms.string("ScoutingPFJet"),
0215     doc  = cms.string("PFJet scouting information"),
0216     singleton = cms.bool(False),
0217     extension = cms.bool(False),
0218     variables = cms.PSet(
0219         P3Vars,
0220         m = Var('m', 'float', precision=10, doc='mass'),
0221         jetArea = Var('jetArea', 'float', precision=10, doc='jet area'),
0222         chargedHadronEnergy = Var('chargedHadronEnergy', 'float', precision=10, doc='charged hadron energy'),
0223         neutralHadronEnergy = Var('neutralHadronEnergy', 'float', precision=10, doc='neutral hadron energy'),
0224         photonEnergy = Var('photonEnergy', 'float', precision=10, doc='photon energy'),
0225         electronEnergy = Var('electronEnergy', 'float', precision=10, doc='electron energy'),
0226         muonEnergy = Var('muonEnergy', 'float', precision=10, doc='muon energy'),
0227         HFHadronEnergy = Var('HFHadronEnergy', 'float', precision=10, doc='hadronic energy in HF'),
0228         HFEMEnergy = Var('HFEMEnergy', 'float', precision=10, doc='electromagnetic energy in HF'),
0229         chargedHadronMultiplicity = Var('chargedHadronMultiplicity', 'int', doc='number of charged hadrons in the jet'),
0230         neutralHadronMultiplicity = Var('neutralHadronMultiplicity', 'int', doc='number of neutral hadrons in the jet'),
0231         photonMultiplicity = Var('photonMultiplicity', 'int', doc='number of photons in the jet'),
0232         electronMultiplicity = Var('electronMultiplicity', 'int', doc='number of electrons in the jet'),
0233         muonMultiplicity = Var('muonMultiplicity', 'int', doc='number of muons in the jet'),
0234         HFHadronMultiplicity = Var('HFHadronMultiplicity', 'int', doc='number of HF hadronic particles in the jet'),
0235         HFEMMultiplicity = Var('HFEMMultiplicity', 'int', doc='number of HF electromagnetic particles in the jet'),
0236         HOEnergy = Var('HOEnergy', 'float', precision=10, doc='hadronic energy in HO'),
0237     )
0238 )
0239 
0240 rhoScoutingTable = cms.EDProducer("GlobalVariablesTableProducer",
0241     name = cms.string(""),
0242     variables = cms.PSet(
0243         ScoutingRho = ExtVar( cms.InputTag("hltScoutingPFPacker", "rho"), "double", doc = "rho from all scouting PF Candidates, used e.g. for JECs" ),
0244     )
0245 )
0246 
0247 metScoutingTable = cms.EDProducer("GlobalVariablesTableProducer",
0248     name = cms.string("ScoutingMET"),
0249     variables = cms.PSet(
0250         pt = ExtVar( cms.InputTag("hltScoutingPFPacker", "pfMetPt"), "double", doc = "scouting MET pt"),
0251         phi = ExtVar( cms.InputTag("hltScoutingPFPacker", "pfMetPhi"), "double", doc = "scouting MET phi"),
0252     )
0253 )
0254 
0255 # from 2024, there are two scouting muon collections
0256 
0257 # muonVtx
0258 muonVtxScoutingTable = muonScoutingTable.clone(
0259     src = cms.InputTag("hltScoutingMuonPackerVtx"),
0260     name = cms.string("ScoutingMuonVtx"),
0261     doc  = cms.string("Scouting Muon Vtx information"),
0262 )
0263 displacedvertexVtxScoutingTable = displacedvertexScoutingTable.clone(
0264     src = cms.InputTag("hltScoutingMuonPackerVtx", "displacedVtx"),
0265     name = cms.string("ScoutingMuonVtxDisplacedVertex"),
0266     doc  = cms.string("Scouting Muon Vtx DisplacedVertex information"),
0267 )
0268 
0269 # muonNoVtx
0270 muonNoVtxScoutingTable = muonScoutingTable.clone(
0271     src = cms.InputTag("hltScoutingMuonPackerNoVtx"),
0272     name = cms.string("ScoutingMuonNoVtx"),
0273     doc  = cms.string("Scouting Muon NoVtx information"),
0274 )
0275 displacedvertexNoVtxScoutingTable = displacedvertexScoutingTable.clone(
0276     src = cms.InputTag("hltScoutingMuonPackerNoVtx", "displacedVtx"),
0277     name = cms.string("ScoutingMuonNoVtxDisplacedVertex"),
0278     doc  = cms.string("Scouting Muon NoVtx DisplacedVertex information"),
0279 )
0280 
0281 ################
0282 # Scouting particles
0283 
0284 scoutingPFCands = cms.EDProducer(
0285      "Run3ScoutingParticleToRecoPFCandidateProducer",
0286      scoutingparticle=cms.InputTag("hltScoutingPFPacker"),
0287 )
0288 
0289 particleScoutingTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0290     src = cms.InputTag("scoutingPFCands"),
0291     name = cms.string("ScoutingParticle"),
0292     cut = cms.string(""),
0293     doc = cms.string("ScoutingParticle"),
0294     singleton = cms.bool(False),
0295     extension = cms.bool(False), # this is the main table
0296     externalVariables = cms.PSet(
0297        vertexIndex = ExtVar(cms.InputTag("scoutingPFCands", "vertexIndex"), int, doc="vertex index"),
0298        trkNormchi2 = ExtVar(cms.InputTag("scoutingPFCands", "normchi2"), float, doc="normalized chi squared of best track", precision=6),
0299        trkDz = ExtVar(cms.InputTag("scoutingPFCands", "dz"), float, doc="dz of best track", precision=6),
0300        trkDxy = ExtVar(cms.InputTag("scoutingPFCands", "dxy"), float, doc="dxy of best track", precision=6),
0301        trkDzsig = ExtVar(cms.InputTag("scoutingPFCands", "dzsig"), float, doc="dzsig of best track", precision=6),
0302        trkDxysig = ExtVar(cms.InputTag("scoutingPFCands", "dxysig"), float, doc="dxysig of best track", precision=6),
0303        trkLostInnerHits = ExtVar(cms.InputTag("scoutingPFCands", "lostInnerHits"), int, doc="lostInnerHits of best track"),
0304        trkQuality = ExtVar(cms.InputTag("scoutingPFCands", "quality"), int, doc="quality of best track"),
0305        trkPt = ExtVar(cms.InputTag("scoutingPFCands", "trkPt"), float, doc="pt of best track", precision=6),
0306        trkEta = ExtVar(cms.InputTag("scoutingPFCands", "trkEta"), float, doc="eta of best track", precision=6),
0307        trkPhi = ExtVar(cms.InputTag("scoutingPFCands", "trkPhi"), float, doc="phi of best track", precision=6),
0308     ),
0309     variables = cms.PSet(
0310        CandVars,
0311     ),
0312   )
0313 
0314 ################
0315 # Scouting AK4 jets
0316 
0317 from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets
0318 ak4ScoutingJets = ak4PFJets.clone(
0319      src = ("scoutingPFCands"),
0320      jetPtMin = 20,
0321 )
0322 
0323 ak4ScoutingJetParticleNetJetTagInfos = cms.EDProducer("DeepBoostedJetTagInfoProducer",
0324       jet_radius = cms.double( 0.4 ),
0325       min_jet_pt = cms.double( 5.0 ),
0326       max_jet_eta = cms.double( 2.5 ),
0327       min_pt_for_track_properties = cms.double( 0.95 ),
0328       min_pt_for_pfcandidates = cms.double( 0.1 ),
0329       use_puppiP4 = cms.bool( False ),
0330       include_neutrals = cms.bool( True ),
0331       sort_by_sip2dsig = cms.bool( False ),
0332       min_puppi_wgt = cms.double( -1.0 ),
0333       flip_ip_sign = cms.bool( False ),
0334       sip3dSigMax = cms.double( -1.0 ),
0335       use_hlt_features = cms.bool( False ),
0336       pf_candidates = cms.InputTag( "scoutingPFCands" ),
0337       jets = cms.InputTag( "ak4ScoutingJets" ),
0338       puppi_value_map = cms.InputTag( "" ),
0339       use_scouting_features = cms.bool( True ),
0340       normchi2_value_map = cms.InputTag("scoutingPFCands", "normchi2"),
0341       dz_value_map = cms.InputTag("scoutingPFCands", "dz"),
0342       dxy_value_map = cms.InputTag("scoutingPFCands", "dxy"),
0343       dzsig_value_map = cms.InputTag("scoutingPFCands", "dzsig"),
0344       dxysig_value_map = cms.InputTag("scoutingPFCands", "dxysig"),
0345       lostInnerHits_value_map = cms.InputTag("scoutingPFCands", "lostInnerHits"),
0346       quality_value_map = cms.InputTag("scoutingPFCands", "quality"),
0347       trkPt_value_map = cms.InputTag("scoutingPFCands", "trkPt"),
0348       trkEta_value_map = cms.InputTag("scoutingPFCands", "trkEta"),
0349       trkPhi_value_map = cms.InputTag("scoutingPFCands", "trkPhi"),
0350 )
0351 
0352 from RecoBTag.ONNXRuntime.boostedJetONNXJetTagsProducer_cfi import boostedJetONNXJetTagsProducer
0353 
0354 ak4ScoutingJetParticleNetJetTags = cms.EDProducer("BoostedJetONNXJetTagsProducer",
0355       jets = cms.InputTag("ak4ScoutingJets"),
0356       produceValueMap = cms.untracked.bool(True),
0357       src = cms.InputTag("ak4ScoutingJetParticleNetJetTagInfos"),
0358       preprocess_json = cms.string("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK4/V00/preprocess.json"),
0359       model_path = cms.FileInPath("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK4/V00/particle-net.onnx"),
0360       flav_names = cms.vstring(["probb", "probbb","probc", "probcc", "probuds", "probg", "probundef"]),
0361       debugMode = cms.untracked.bool(False),
0362 )
0363 
0364 ak4ScoutingJetTable = cms.EDProducer("SimplePFJetFlatTableProducer",
0365       src = cms.InputTag("ak4ScoutingJets"),
0366       name = cms.string("ScoutingPFJetRecluster"),
0367       cut = cms.string(""),
0368       doc = cms.string("ak4 jets from re-clustering scouting PF candidates"),
0369       singleton = cms.bool(False),
0370       extension = cms.bool(False), # this is the main table
0371       externalVariables = cms.PSet(
0372          particleNet_prob_b = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probb'), float, doc="ParticleNet probability of b", precision=10),
0373          particleNet_prob_bb = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probbb'), float, doc="ParticleNet probability of bb", precision=10),
0374          particleNet_prob_c = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probc'), float, doc="ParticleNet probability of c", precision=10),
0375          particleNet_prob_cc = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probcc'), float, doc="ParticleNet probability of cc", precision=10),
0376          particleNet_prob_uds = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probuds'), float, doc="particlenet probability of uds", precision=10),
0377          particleNet_prob_g = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probg'), float, doc="ParticleNet probability of g", precision=10),
0378          particleNet_prob_undef = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probundef'), float, doc="ParticleNet probability of undef", precision=10),
0379       ),
0380       variables = cms.PSet(
0381          P4Vars,
0382          area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
0383          chHEF = Var("chargedHadronEnergy()/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="charged Hadron Energy Fraction", precision= 6),
0384          neHEF = Var("neutralHadronEnergy()/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="neutral Hadron Energy Fraction", precision= 6),
0385          chEmEF = Var("(electronEnergy()+muonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="charged Electromagnetic Energy Fraction", precision= 6),
0386          neEmEF = Var("(photonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="neutral Electromagnetic Energy Fraction", precision= 6),
0387          muEF = Var("(muonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="muon Energy Fraction", precision= 6),
0388          nCh = Var("chargedHadronMultiplicity()", int, doc="number of charged hadrons in the jet"),
0389          nNh = Var("neutralHadronMultiplicity()", int, doc="number of neutral hadrons in the jet"),
0390          nMuons = Var("muonMultiplicity()", int, doc="number of muons in the jet"),
0391          nElectrons = Var("electronMultiplicity()", int, doc="number of electrons in the jet"),
0392          nPhotons = Var("photonMultiplicity()", int, doc="number of photons in the jet"),
0393          nConstituents = Var("numberOfDaughters()", "uint8", doc="number of particles in the jet")
0394       ),
0395 )
0396 
0397 ak4ScoutingJetMatchGen = cms.EDProducer("RecoJetToGenJetDeltaRValueMapProducer",
0398       src = cms.InputTag("ak4ScoutingJets"),
0399       matched = cms.InputTag("slimmedGenJets"),
0400       distMax = cms.double(0.4),
0401       value = cms.string("index"),
0402   )
0403 
0404 ak4ScoutingJetExtTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0405       src = cms.InputTag("ak4ScoutingJets"),
0406       name = cms.string("ScoutingPFJetRecluster"),
0407       cut = cms.string(""),
0408       singleton = cms.bool(False),
0409       extension = cms.bool(True),
0410       externalVariables = cms.PSet(
0411          genJetIdx = ExtVar(cms.InputTag("ak4ScoutingJetMatchGen"), int, doc="gen jet idx"),
0412       ),
0413       variables = cms.PSet(),
0414   )
0415 
0416 ################
0417 # Scouting AK8 jets
0418 
0419 ak8ScoutingJets = ak4PFJets.clone(
0420      src = ("scoutingPFCands"),
0421      rParam   = 0.8,
0422      jetPtMin = 170.0,
0423 )
0424 
0425 ak8ScoutingJetsSoftDrop = ak4PFJets.clone(
0426      src = ("scoutingPFCands"),
0427      rParam   = 0.8,
0428      jetPtMin = 170.0,
0429      useSoftDrop = cms.bool(True),
0430      zcut = cms.double(0.1),
0431      beta = cms.double(0.0),
0432      R0   = cms.double(0.8),
0433      useExplicitGhosts = cms.bool(True),
0434      writeCompound = cms.bool(True),
0435      jetCollInstanceName=cms.string("SubJets"),
0436   )
0437 
0438 ak8ScoutingJetsSoftDropMass = cms.EDProducer("RecoJetDeltaRValueMapProducer",
0439      src = cms.InputTag("ak8ScoutingJets"),
0440      matched = cms.InputTag("ak8ScoutingJetsSoftDrop"),
0441      distMax = cms.double(0.8),
0442      value = cms.string('mass')
0443   )
0444 
0445 from RecoJets.JetProducers.ECF_cff import ecfNbeta1
0446 ak8ScoutingJetEcfNbeta1 = ecfNbeta1.clone(src = cms.InputTag("ak8ScoutingJets"), srcWeights="")
0447 
0448 from RecoJets.JetProducers.nJettinessAdder_cfi import Njettiness
0449 ak8ScoutingJetNjettiness = Njettiness.clone(src = cms.InputTag("ak8ScoutingJets"), srcWeights="")
0450 
0451 ak8ScoutingJetParticleNetJetTagInfos = cms.EDProducer("DeepBoostedJetTagInfoProducer",
0452       jet_radius = cms.double( 0.8 ),
0453       min_jet_pt = cms.double( 50 ),
0454       max_jet_eta = cms.double( 2.5 ),
0455       min_pt_for_track_properties = cms.double( 0.95 ),
0456       min_pt_for_pfcandidates = cms.double( 0.1 ),
0457       use_puppiP4 = cms.bool( False ),
0458       include_neutrals = cms.bool( True ),
0459       sort_by_sip2dsig = cms.bool( False ),
0460       min_puppi_wgt = cms.double( -1.0 ),
0461       flip_ip_sign = cms.bool( False ),
0462       sip3dSigMax = cms.double( -1.0 ),
0463       use_hlt_features = cms.bool( False ),
0464       pf_candidates = cms.InputTag( "scoutingPFCands" ),
0465       jets = cms.InputTag( "ak8ScoutingJets" ),
0466       puppi_value_map = cms.InputTag( "" ),
0467       use_scouting_features = cms.bool( True ),
0468       normchi2_value_map = cms.InputTag("scoutingPFCands", "normchi2"),
0469       dz_value_map = cms.InputTag("scoutingPFCands", "dz"),
0470       dxy_value_map = cms.InputTag("scoutingPFCands", "dxy"),
0471       dzsig_value_map = cms.InputTag("scoutingPFCands", "dzsig"),
0472       dxysig_value_map = cms.InputTag("scoutingPFCands", "dxysig"),
0473       lostInnerHits_value_map = cms.InputTag("scoutingPFCands", "lostInnerHits"),
0474       quality_value_map = cms.InputTag("scoutingPFCands", "quality"),
0475       trkPt_value_map = cms.InputTag("scoutingPFCands", "trkPt"),
0476       trkEta_value_map = cms.InputTag("scoutingPFCands", "trkEta"),
0477       trkPhi_value_map = cms.InputTag("scoutingPFCands", "trkPhi"),
0478   )
0479 
0480 from RecoBTag.ONNXRuntime.boostedJetONNXJetTagsProducer_cfi import boostedJetONNXJetTagsProducer
0481 ak8ScoutingJetParticleNetJetTags = cms.EDProducer("BoostedJetONNXJetTagsProducer",
0482       jets = cms.InputTag("ak8ScoutingJets"),
0483       produceValueMap = cms.untracked.bool(True),
0484       src = cms.InputTag("ak8ScoutingJetParticleNetJetTagInfos"),
0485       preprocess_json = cms.string("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK8/General/V00/preprocess.json"),
0486       model_path = cms.FileInPath("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK8/General/V00/particle-net.onnx"),
0487       flav_names = cms.vstring([ "probQCDall", "probHbb", "probHcc", "probHqq"]),
0488       debugMode = cms.untracked.bool(False),
0489   )
0490 
0491 ak8ScoutingJetParticleNetMassRegressionJetTags = cms.EDProducer("BoostedJetONNXJetTagsProducer",
0492       jets = cms.InputTag("ak8ScoutingJets"),
0493       produceValueMap = cms.untracked.bool(True),
0494       src = cms.InputTag("ak8ScoutingJetParticleNetJetTagInfos"),
0495       preprocess_json = cms.string("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK8/MassRegression/V00/preprocess.json"),
0496       model_path = cms.FileInPath("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK8/MassRegression/V00/particle-net.onnx"),
0497       flav_names = cms.vstring(["mass"]),
0498       debugMode = cms.untracked.bool(False),
0499   )
0500 
0501 ak8ScoutingJetTable = cms.EDProducer("SimplePFJetFlatTableProducer",
0502       src = cms.InputTag("ak8ScoutingJets"),
0503       name = cms.string("ScoutingFatPFJetRecluster"),
0504       cut = cms.string(""),
0505       doc = cms.string("ak8 jets from re-clustering scouting PF candidates"),
0506       singleton = cms.bool(False),
0507       extension = cms.bool(False), # this is the main table
0508       externalVariables = cms.PSet(
0509          #genJetAK8Idx = ExtVar(cms.InputTag("ak8ScoutingJetMatchGen"), int, doc="gen jet idx"),
0510          msoftdrop = ExtVar(cms.InputTag('ak8ScoutingJetsSoftDropMass'), float, doc="Softdrop mass", precision=10),
0511          n2b1 = ExtVar(cms.InputTag('ak8ScoutingJetEcfNbeta1:ecfN2'), float, doc="N2 with beta=1", precision=10),
0512          n3b1 = ExtVar(cms.InputTag('ak8ScoutingJetEcfNbeta1:ecfN3'), float, doc="N3 with beta=1", precision=10),
0513          tau1 = ExtVar(cms.InputTag('ak8ScoutingJetNjettiness:tau1'), float, doc="Nsubjettiness (1 axis)", precision=10),
0514          tau2 = ExtVar(cms.InputTag('ak8ScoutingJetNjettiness:tau2'), float, doc="Nsubjettiness (2 axis)", precision=10),
0515          tau3 = ExtVar(cms.InputTag('ak8ScoutingJetNjettiness:tau3'), float, doc="Nsubjettiness (3 axis)", precision=10),
0516          tau4 = ExtVar(cms.InputTag('ak8ScoutingJetNjettiness:tau4'), float, doc="Nsubjettiness (4 axis)", precision=10),
0517          particleNet_mass = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetMassRegressionJetTags:mass'), float, doc="ParticleNet regressed mass", precision=10),
0518          particleNet_prob_QCD = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetJetTags:probQCDall'), float, doc="ParticleNet probability of QCD", precision=10),
0519          particleNet_prob_Hbb = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetJetTags:probHbb'), float, doc="ParticleNet probability of Hbb", precision=10),
0520          particleNet_prob_Hcc = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetJetTags:probHcc'), float, doc="ParticleNet probability of Hcc", precision=10),
0521          particleNet_prob_Hqq = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetJetTags:probHqq'), float, doc="ParticleNet probability of Hqq", precision=10),
0522       ),
0523       variables = cms.PSet(
0524          P4Vars,
0525          area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
0526          chHEF = Var("chargedHadronEnergy()/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="charged Hadron Energy Fraction", precision= 6),
0527          neHEF = Var("neutralHadronEnergy()/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="neutral Hadron Energy Fraction", precision= 6),
0528          chEmEF = Var("(electronEnergy()+muonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="charged Electromagnetic Energy Fraction", precision= 6),
0529          neEmEF = Var("(photonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="neutral Electromagnetic Energy Fraction", precision= 6),
0530          muEF = Var("(muonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="muon Energy Fraction", precision= 6),
0531          nCh = Var("chargedHadronMultiplicity()", int, doc="number of charged hadrons in the jet"),
0532          nNh = Var("neutralHadronMultiplicity()", int, doc="number of neutral hadrons in the jet"),
0533          nMuons = Var("muonMultiplicity()", int, doc="number of muons in the jet"),
0534          nElectrons = Var("electronMultiplicity()", int, doc="number of electrons in the jet"),
0535          nPhotons = Var("photonMultiplicity()", int, doc="number of photons in the jet"),
0536          nConstituents = Var("numberOfDaughters()", "uint8", doc="number of particles in the jet")
0537       ),
0538   )
0539 
0540 ak8ScoutingJetMatchGen = cms.EDProducer("RecoJetToGenJetDeltaRValueMapProducer",
0541       src = cms.InputTag("ak8ScoutingJets"),
0542       matched = cms.InputTag("slimmedGenJetsAK8"),
0543       distMax = cms.double(0.8),
0544       value = cms.string("index"),
0545   )
0546 
0547 ak8ScoutingJetExtTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0548       src = cms.InputTag("ak8ScoutingJets"),
0549       name = cms.string("ScoutingFatPFJetRecluster"),
0550       cut = cms.string(""),
0551       singleton = cms.bool(False),
0552       extension = cms.bool(True),
0553       externalVariables = cms.PSet(
0554          genJetAK8Idx = ExtVar(cms.InputTag("ak8ScoutingJetMatchGen"), int, doc="gen jet idx"),
0555       ),
0556       variables = cms.PSet(),
0557   )