Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:58:07

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, 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 rhoScoutingTable = cms.EDProducer("GlobalVariablesTableProducer",
0212     name = cms.string(""),
0213     variables = cms.PSet(
0214         ScoutingRho = ExtVar( cms.InputTag("hltScoutingPFPacker", "rho"), "double", doc = "rho from all scouting PF Candidates, used e.g. for JECs" ),
0215     )
0216 )
0217 
0218 metScoutingTable = cms.EDProducer("GlobalVariablesTableProducer",
0219     name = cms.string("ScoutingMET"),
0220     variables = cms.PSet(
0221         pt = ExtVar( cms.InputTag("hltScoutingPFPacker", "pfMetPt"), "double", doc = "scouting MET pt"),
0222         phi = ExtVar( cms.InputTag("hltScoutingPFPacker", "pfMetPhi"), "double", doc = "scouting MET phi"),
0223     )
0224 )
0225 
0226 ################
0227 # Scouting particles
0228 
0229 scoutingPFCands = cms.EDProducer(
0230      "Run3ScoutingParticleToRecoPFCandidateProducer",
0231      scoutingparticle=cms.InputTag("hltScoutingPFPacker"),
0232 )
0233 
0234 particleScoutingTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0235     src = cms.InputTag("scoutingPFCands"),
0236     name = cms.string("ScoutingParticle"),
0237     cut = cms.string(""),
0238     doc = cms.string("ScoutingParticle"),
0239     singleton = cms.bool(False),
0240     extension = cms.bool(False), # this is the main table
0241     externalVariables = cms.PSet(
0242        vertexIndex = ExtVar(cms.InputTag("scoutingPFCands", "vertexIndex"), int, doc="vertex index"),
0243        trkNormchi2 = ExtVar(cms.InputTag("scoutingPFCands", "normchi2"), float, doc="normalized chi squared of best track", precision=6),
0244        trkDz = ExtVar(cms.InputTag("scoutingPFCands", "dz"), float, doc="dz of best track", precision=6),
0245        trkDxy = ExtVar(cms.InputTag("scoutingPFCands", "dxy"), float, doc="dxy of best track", precision=6),
0246        trkDzsig = ExtVar(cms.InputTag("scoutingPFCands", "dzsig"), float, doc="dzsig of best track", precision=6),
0247        trkDxysig = ExtVar(cms.InputTag("scoutingPFCands", "dxysig"), float, doc="dxysig of best track", precision=6),
0248        trkLostInnerHits = ExtVar(cms.InputTag("scoutingPFCands", "lostInnerHits"), int, doc="lostInnerHits of best track"),
0249        trkQuality = ExtVar(cms.InputTag("scoutingPFCands", "quality"), int, doc="quality of best track"),
0250        trkPt = ExtVar(cms.InputTag("scoutingPFCands", "trkPt"), float, doc="pt of best track", precision=6),
0251        trkEta = ExtVar(cms.InputTag("scoutingPFCands", "trkEta"), float, doc="eta of best track", precision=6),
0252        trkPhi = ExtVar(cms.InputTag("scoutingPFCands", "trkPhi"), float, doc="phi of best track", precision=6),
0253     ),
0254     variables = cms.PSet(
0255        CandVars,
0256     ),
0257   )
0258 
0259 ################
0260 # Scouting AK4 jets
0261 
0262 from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets
0263 ak4ScoutingJets = ak4PFJets.clone(
0264      src = ("scoutingPFCands"),
0265      jetPtMin = 20,
0266 )
0267 
0268 ak4ScoutingJetParticleNetJetTagInfos = cms.EDProducer("DeepBoostedJetTagInfoProducer",
0269       jet_radius = cms.double( 0.4 ),
0270       min_jet_pt = cms.double( 5.0 ),
0271       max_jet_eta = cms.double( 2.5 ),
0272       min_pt_for_track_properties = cms.double( 0.95 ),
0273       min_pt_for_pfcandidates = cms.double( 0.1 ),
0274       use_puppiP4 = cms.bool( False ),
0275       include_neutrals = cms.bool( True ),
0276       sort_by_sip2dsig = cms.bool( False ),
0277       min_puppi_wgt = cms.double( -1.0 ),
0278       flip_ip_sign = cms.bool( False ),
0279       sip3dSigMax = cms.double( -1.0 ),
0280       use_hlt_features = cms.bool( False ),
0281       pf_candidates = cms.InputTag( "scoutingPFCands" ),
0282       jets = cms.InputTag( "ak4ScoutingJets" ),
0283       puppi_value_map = cms.InputTag( "" ),
0284       use_scouting_features = cms.bool( True ),
0285       normchi2_value_map = cms.InputTag("scoutingPFCands", "normchi2"),
0286       dz_value_map = cms.InputTag("scoutingPFCands", "dz"),
0287       dxy_value_map = cms.InputTag("scoutingPFCands", "dxy"),
0288       dzsig_value_map = cms.InputTag("scoutingPFCands", "dzsig"),
0289       dxysig_value_map = cms.InputTag("scoutingPFCands", "dxysig"),
0290       lostInnerHits_value_map = cms.InputTag("scoutingPFCands", "lostInnerHits"),
0291       quality_value_map = cms.InputTag("scoutingPFCands", "quality"),
0292       trkPt_value_map = cms.InputTag("scoutingPFCands", "trkPt"),
0293       trkEta_value_map = cms.InputTag("scoutingPFCands", "trkEta"),
0294       trkPhi_value_map = cms.InputTag("scoutingPFCands", "trkPhi"),
0295 )
0296 
0297 from RecoBTag.ONNXRuntime.boostedJetONNXJetTagsProducer_cfi import boostedJetONNXJetTagsProducer
0298 
0299 ak4ScoutingJetParticleNetJetTags = cms.EDProducer("BoostedJetONNXJetTagsProducer",
0300       jets = cms.InputTag("ak4ScoutingJets"),
0301       produceValueMap = cms.untracked.bool(True),
0302       src = cms.InputTag("ak4ScoutingJetParticleNetJetTagInfos"),
0303       preprocess_json = cms.string("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK4/V00/preprocess.json"),
0304       model_path = cms.FileInPath("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK4/V00/particle-net.onnx"),
0305       flav_names = cms.vstring(["probb", "probbb","probc", "probcc", "probuds", "probg", "probundef"]),
0306       debugMode = cms.untracked.bool(False),
0307 )
0308 
0309 ak4ScoutingJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0310       src = cms.InputTag("ak4ScoutingJets"),
0311       name = cms.string("ScoutingJet"),
0312       cut = cms.string(""),
0313       doc = cms.string("ScoutingJet"),
0314       singleton = cms.bool(False),
0315       extension = cms.bool(False), # this is the main table
0316       externalVariables = cms.PSet(
0317          particleNet_prob_b = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probb'), float, doc="ParticleNet probability of b", precision=10),
0318          particleNet_prob_bb = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probbb'), float, doc="ParticleNet probability of bb", precision=10),
0319          particleNet_prob_c = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probc'), float, doc="ParticleNet probability of c", precision=10),
0320          particleNet_prob_cc = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probcc'), float, doc="ParticleNet probability of cc", precision=10),
0321          particlenet_prob_uds = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probuds'), float, doc="particlenet probability of uds", precision=10),
0322          particleNet_prob_g = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probg'), float, doc="ParticleNet probability of g", precision=10),
0323          particleNet_prob_undef = ExtVar(cms.InputTag('ak4ScoutingJetParticleNetJetTags:probundef'), float, doc="ParticleNet probability of undef", precision=10),
0324       ),
0325       variables = cms.PSet(
0326          P4Vars,
0327          area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
0328          chHEF = Var("chargedHadronEnergy()/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="charged Hadron Energy Fraction", precision= 6),
0329          neHEF = Var("neutralHadronEnergy()/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="neutral Hadron Energy Fraction", precision= 6),
0330          chEmEF = Var("(electronEnergy()+muonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="charged Electromagnetic Energy Fraction", precision= 6),
0331          neEmEF = Var("(photonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="neutral Electromagnetic Energy Fraction", precision= 6),
0332          muEF = Var("(muonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="muon Energy Fraction", precision= 6),
0333          nCh = Var("chargedHadronMultiplicity()", int, doc="number of charged hadrons in the jet"),
0334          nNh = Var("neutralHadronMultiplicity()", int, doc="number of neutral hadrons in the jet"),
0335          nMuons = Var("muonMultiplicity()", int, doc="number of muons in the jet"),
0336          nElectrons = Var("electronMultiplicity()", int, doc="number of electrons in the jet"),
0337          nPhotons = Var("photonMultiplicity()", int, doc="number of photons in the jet"),
0338          nConstituents = Var("numberOfDaughters()", "uint8", doc="number of particles in the jet")
0339       ),
0340 )
0341 
0342 ak4ScoutingJetMatchGen = cms.EDProducer("RecoJetToGenJetDeltaRValueMapProducer",
0343       src = cms.InputTag("ak4ScoutingJets"),
0344       matched = cms.InputTag("slimmedGenJets"),
0345       distMax = cms.double(0.4),
0346       value = cms.string("index"),
0347   )
0348 
0349 ak4ScoutingJetExtTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0350       src = cms.InputTag("ak4ScoutingJets"),
0351       name = cms.string("ScoutingJet"),
0352       cut = cms.string(""),
0353       singleton = cms.bool(False),
0354       extension = cms.bool(True),
0355       externalVariables = cms.PSet(
0356          genJetIdx = ExtVar(cms.InputTag("ak4ScoutingJetMatchGen"), int, doc="gen jet idx"),
0357       ),
0358       variables = cms.PSet(),
0359   )
0360 
0361 ################
0362 # Scouting AK8 jets
0363 
0364 ak8ScoutingJets = ak4PFJets.clone(
0365      src = ("scoutingPFCands"),
0366      rParam   = 0.8,
0367      jetPtMin = 170.0,
0368 )
0369 
0370 ak8ScoutingJetsSoftDrop = ak4PFJets.clone(
0371      src = ("scoutingPFCands"),
0372      rParam   = 0.8,
0373      jetPtMin = 170.0,
0374      useSoftDrop = cms.bool(True),
0375      zcut = cms.double(0.1),
0376      beta = cms.double(0.0),
0377      R0   = cms.double(0.8),
0378      useExplicitGhosts = cms.bool(True),
0379      writeCompound = cms.bool(True),
0380      jetCollInstanceName=cms.string("SubJets"),
0381   )
0382 
0383 ak8ScoutingJetsSoftDropMass = cms.EDProducer("RecoJetDeltaRValueMapProducer",
0384      src = cms.InputTag("ak8ScoutingJets"),
0385      matched = cms.InputTag("ak8ScoutingJetsSoftDrop"),
0386      distMax = cms.double(0.8),
0387      value = cms.string('mass')
0388   )
0389 
0390 from RecoJets.JetProducers.ECF_cff import ecfNbeta1
0391 ak8ScoutingJetEcfNbeta1 = ecfNbeta1.clone(src = cms.InputTag("ak8ScoutingJets"), srcWeights="")
0392 
0393 from RecoJets.JetProducers.nJettinessAdder_cfi import Njettiness
0394 ak8ScoutingJetNjettiness = Njettiness.clone(src = cms.InputTag("ak8ScoutingJets"), srcWeights="")
0395 
0396 ak8ScoutingJetParticleNetJetTagInfos = cms.EDProducer("DeepBoostedJetTagInfoProducer",
0397       jet_radius = cms.double( 0.8 ),
0398       min_jet_pt = cms.double( 50 ),
0399       max_jet_eta = cms.double( 2.5 ),
0400       min_pt_for_track_properties = cms.double( 0.95 ),
0401       min_pt_for_pfcandidates = cms.double( 0.1 ),
0402       use_puppiP4 = cms.bool( False ),
0403       include_neutrals = cms.bool( True ),
0404       sort_by_sip2dsig = cms.bool( False ),
0405       min_puppi_wgt = cms.double( -1.0 ),
0406       flip_ip_sign = cms.bool( False ),
0407       sip3dSigMax = cms.double( -1.0 ),
0408       use_hlt_features = cms.bool( False ),
0409       pf_candidates = cms.InputTag( "scoutingPFCands" ),
0410       jets = cms.InputTag( "ak8ScoutingJets" ),
0411       puppi_value_map = cms.InputTag( "" ),
0412       use_scouting_features = cms.bool( True ),
0413       normchi2_value_map = cms.InputTag("scoutingPFCands", "normchi2"),
0414       dz_value_map = cms.InputTag("scoutingPFCands", "dz"),
0415       dxy_value_map = cms.InputTag("scoutingPFCands", "dxy"),
0416       dzsig_value_map = cms.InputTag("scoutingPFCands", "dzsig"),
0417       dxysig_value_map = cms.InputTag("scoutingPFCands", "dxysig"),
0418       lostInnerHits_value_map = cms.InputTag("scoutingPFCands", "lostInnerHits"),
0419       quality_value_map = cms.InputTag("scoutingPFCands", "quality"),
0420       trkPt_value_map = cms.InputTag("scoutingPFCands", "trkPt"),
0421       trkEta_value_map = cms.InputTag("scoutingPFCands", "trkEta"),
0422       trkPhi_value_map = cms.InputTag("scoutingPFCands", "trkPhi"),
0423   )
0424 
0425 from RecoBTag.ONNXRuntime.boostedJetONNXJetTagsProducer_cfi import boostedJetONNXJetTagsProducer
0426 ak8ScoutingJetParticleNetJetTags = cms.EDProducer("BoostedJetONNXJetTagsProducer",
0427       jets = cms.InputTag("ak8ScoutingJets"),
0428       produceValueMap = cms.untracked.bool(True),
0429       src = cms.InputTag("ak8ScoutingJetParticleNetJetTagInfos"),
0430       preprocess_json = cms.string("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK8/General/V00/preprocess.json"),
0431       model_path = cms.FileInPath("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK8/General/V00/particle-net.onnx"),
0432       flav_names = cms.vstring(["probHbb", "probHcc","probHqq", "probQCDall"]),
0433       debugMode = cms.untracked.bool(False),
0434   )
0435 
0436 ak8ScoutingJetParticleNetMassRegressionJetTags = cms.EDProducer("BoostedJetONNXJetTagsProducer",
0437       jets = cms.InputTag("ak8ScoutingJets"),
0438       produceValueMap = cms.untracked.bool(True),
0439       src = cms.InputTag("ak8ScoutingJetParticleNetJetTagInfos"),
0440       preprocess_json = cms.string("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK8/MassRegression/V00/preprocess.json"),
0441       model_path = cms.FileInPath("RecoBTag/Combined/data/Run3Scouting/ParticleNetAK8/MassRegression/V00/particle-net.onnx"),
0442       flav_names = cms.vstring(["mass"]),
0443       debugMode = cms.untracked.bool(False),
0444   )
0445 
0446 ak8ScoutingJetTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0447       src = cms.InputTag("ak8ScoutingJets"),
0448       name = cms.string("ScoutingFatJet"),
0449       cut = cms.string(""),
0450       doc = cms.string("ScoutingFatJet"),
0451       singleton = cms.bool(False),
0452       extension = cms.bool(False), # this is the main table
0453       externalVariables = cms.PSet(
0454          #genJetAK8Idx = ExtVar(cms.InputTag("ak8ScoutingJetMatchGen"), int, doc="gen jet idx"),
0455          msoftdrop = ExtVar(cms.InputTag('ak8ScoutingJetsSoftDropMass'), float, doc="Softdrop mass", precision=10),
0456          n2b1 = ExtVar(cms.InputTag('ak8ScoutingJetEcfNbeta1:ecfN2'), float, doc="N2 with beta=1", precision=10),
0457          n3b1 = ExtVar(cms.InputTag('ak8ScoutingJetEcfNbeta1:ecfN3'), float, doc="N3 with beta=1", precision=10),
0458          tau1 = ExtVar(cms.InputTag('ak8ScoutingJetNjettiness:tau1'), float, doc="Nsubjettiness (1 axis)", precision=10),
0459          tau2 = ExtVar(cms.InputTag('ak8ScoutingJetNjettiness:tau2'), float, doc="Nsubjettiness (2 axis)", precision=10),
0460          tau3 = ExtVar(cms.InputTag('ak8ScoutingJetNjettiness:tau3'), float, doc="Nsubjettiness (3 axis)", precision=10),
0461          tau4 = ExtVar(cms.InputTag('ak8ScoutingJetNjettiness:tau4'), float, doc="Nsubjettiness (4 axis)", precision=10),
0462          particleNet_mass = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetMassRegressionJetTags:mass'), float, doc="ParticleNet regressed mass", precision=10),
0463          particleNet_prob_Hbb = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetJetTags:probHbb'), float, doc="ParticleNet probability of Hbb", precision=10),
0464          particleNet_prob_Hcc = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetJetTags:probHcc'), float, doc="ParticleNet probability of Hcc", precision=10),
0465          particleNet_prob_Hqq = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetJetTags:probHqq'), float, doc="ParticleNet probability of Hqq", precision=10),
0466          particleNet_prob_QCD = ExtVar(cms.InputTag('ak8ScoutingJetParticleNetJetTags:probQCDall'), float, doc="ParticleNet probability of QCD", precision=10),
0467       ),
0468       variables = cms.PSet(
0469          P4Vars,
0470          area = Var("jetArea()", float, doc="jet catchment area, for JECs",precision=10),
0471          chHEF = Var("chargedHadronEnergy()/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="charged Hadron Energy Fraction", precision= 6),
0472          neHEF = Var("neutralHadronEnergy()/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="neutral Hadron Energy Fraction", precision= 6),
0473          chEmEF = Var("(electronEnergy()+muonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="charged Electromagnetic Energy Fraction", precision= 6),
0474          neEmEF = Var("(photonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="neutral Electromagnetic Energy Fraction", precision= 6),
0475          muEF = Var("(muonEnergy())/(chargedHadronEnergy()+neutralHadronEnergy()+photonEnergy()+electronEnergy()+muonEnergy())", float, doc="muon Energy Fraction", precision= 6),
0476          nCh = Var("chargedHadronMultiplicity()", int, doc="number of charged hadrons in the jet"),
0477          nNh = Var("neutralHadronMultiplicity()", int, doc="number of neutral hadrons in the jet"),
0478          nMuons = Var("muonMultiplicity()", int, doc="number of muons in the jet"),
0479          nElectrons = Var("electronMultiplicity()", int, doc="number of electrons in the jet"),
0480          nPhotons = Var("photonMultiplicity()", int, doc="number of photons in the jet"),
0481          nConstituents = Var("numberOfDaughters()", "uint8", doc="number of particles in the jet")
0482       ),
0483   )
0484 
0485 ak8ScoutingJetMatchGen = cms.EDProducer("RecoJetToGenJetDeltaRValueMapProducer",
0486       src = cms.InputTag("ak8ScoutingJets"),
0487       matched = cms.InputTag("slimmedGenJetsAK8"),
0488       distMax = cms.double(0.8),
0489       value = cms.string("index"),
0490   )
0491 
0492 ak8ScoutingJetExtTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
0493       src = cms.InputTag("ak8ScoutingJets"),
0494       name = cms.string("ScoutingFatJet"),
0495       cut = cms.string(""),
0496       singleton = cms.bool(False),
0497       extension = cms.bool(True),
0498       externalVariables = cms.PSet(
0499          genJetAK8Idx = ExtVar(cms.InputTag("ak8ScoutingJetMatchGen"), int, doc="gen jet idx"),
0500       ),
0501       variables = cms.PSet(),
0502   )