Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:29

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 from RecoBTag.FeatureTools.pfDeepBoostedJetTagInfos_cfi import pfDeepBoostedJetTagInfos
0004 from RecoBTag.ONNXRuntime.boostedJetONNXJetTagsProducer_cfi import boostedJetONNXJetTagsProducer
0005 from RecoBTag.ONNXRuntime.particleNetSonicJetTagsProducer_cfi import particleNetSonicJetTagsProducer as _particleNetSonicJetTagsProducer
0006 from RecoBTag.ONNXRuntime.pfParticleNetAK4DiscriminatorsJetTags_cfi import pfParticleNetAK4DiscriminatorsJetTags
0007 from Configuration.ProcessModifiers.particleNetSonicTriton_cff import particleNetSonicTriton
0008 from Configuration.ProcessModifiers.particleNetPTSonicTriton_cff import particleNetPTSonicTriton
0009 
0010 pfParticleNetAK4TagInfos = pfDeepBoostedJetTagInfos.clone(
0011     jets = "ak4PFJetsCHS",
0012     jet_radius = 0.4,
0013     min_jet_pt = 15,
0014     min_puppi_wgt = -1,
0015     use_puppiP4 = False,
0016 )
0017 
0018 pfParticleNetAK4TagInfosForRECO = pfParticleNetAK4TagInfos.clone(
0019     min_jet_pt = 25,
0020     max_jet_eta = 2.5,
0021 )
0022 
0023 pfParticleNetAK4JetTags = boostedJetONNXJetTagsProducer.clone(
0024     src = 'pfParticleNetAK4TagInfos',
0025     preprocess_json = 'RecoBTag/Combined/data/ParticleNetAK4/CHS/V00/preprocess.json',
0026     model_path = 'RecoBTag/Combined/data/ParticleNetAK4/CHS/V00/modelfile/model.onnx',
0027     flav_names = ["probb",  "probbb",  "probc",   "probcc",  "probuds", "probg", "probundef", "probpu"],
0028 )
0029 
0030 pfParticleNetAK4JetTagsForRECO = pfParticleNetAK4JetTags.clone(
0031     src = 'pfParticleNetAK4TagInfosForRECO',
0032 )
0033 
0034 pfParticleNetAK4DiscriminatorsJetTagsForRECO = pfParticleNetAK4DiscriminatorsJetTags.clone()
0035 for discriminator in pfParticleNetAK4DiscriminatorsJetTagsForRECO.discriminators:
0036     for num in discriminator.numerator:
0037         num.setModuleLabel("pfParticleNetAK4JetTagsForRECO");
0038     for den in discriminator.denominator:
0039         den.setModuleLabel("pfParticleNetAK4JetTagsForRECO");
0040 
0041 particleNetSonicTriton.toReplaceWith(pfParticleNetAK4JetTags, _particleNetSonicJetTagsProducer.clone(
0042     src = 'pfParticleNetAK4TagInfos',
0043     preprocess_json = 'RecoBTag/Combined/data/ParticleNetAK4/CHS/V00/preprocess.json',
0044     Client = cms.PSet(
0045         timeout = cms.untracked.uint32(300),
0046         mode = cms.string("Async"),
0047         modelName = cms.string("particlenet_AK4"),
0048         modelConfigPath = cms.FileInPath("RecoBTag/Combined/data/models/particlenet_AK4/config.pbtxt"),
0049         modelVersion = cms.string(""),
0050         verbose = cms.untracked.bool(False),
0051         allowedTries = cms.untracked.uint32(0),
0052         useSharedMemory = cms.untracked.bool(True),
0053         compression = cms.untracked.string(""),
0054     ),
0055     flav_names = pfParticleNetAK4JetTags.flav_names,
0056 ))
0057 
0058 (particleNetSonicTriton & particleNetPTSonicTriton).toModify(pfParticleNetAK4JetTags,
0059     preprocess_json = 'RecoBTag/Combined/data/ParticleNetAK4/CHS/V00/preprocess_PT.json',
0060     Client = dict(
0061         modelName = "particlenet_AK4_PT",
0062         modelConfigPath = cms.FileInPath("RecoBTag/Combined/data/models/particlenet_AK4_PT/config.pbtxt"),
0063     )
0064 )
0065 
0066 from CommonTools.PileupAlgos.Puppi_cff import puppi
0067 from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation
0068 
0069 # This task is not used, useful only if we run it from RECO jets (RECO/AOD)
0070 pfParticleNetAK4Task = cms.Task(puppi, primaryVertexAssociation, pfParticleNetAK4TagInfos,
0071                                 pfParticleNetAK4JetTags, pfParticleNetAK4DiscriminatorsJetTags)
0072 pfParticleNetAK4TaskForRECO = cms.Task(puppi, primaryVertexAssociation, pfParticleNetAK4TagInfosForRECO,
0073                                 pfParticleNetAK4JetTagsForRECO, pfParticleNetAK4DiscriminatorsJetTagsForRECO)
0074 
0075 # declare all the discriminators
0076 # probs
0077 _pfParticleNetAK4JetTagsProbs = ['pfParticleNetAK4JetTags:' + flav_name
0078                                  for flav_name in pfParticleNetAK4JetTags.flav_names]
0079 # meta-taggers
0080 _pfParticleNetAK4JetTagsMetaDiscrs = ['pfParticleNetAK4DiscriminatorsJetTags:' + disc.name.value()
0081                                       for disc in pfParticleNetAK4DiscriminatorsJetTags.discriminators]
0082 _pfParticleNetAK4JetTagsAll = _pfParticleNetAK4JetTagsProbs + _pfParticleNetAK4JetTagsMetaDiscrs
0083 
0084 
0085 # === Negative tags ===
0086 pfNegativeParticleNetAK4TagInfos = pfParticleNetAK4TagInfos.clone(
0087     flip_ip_sign = True,
0088     sip3dSigMax = 10,
0089     secondary_vertices = 'inclusiveCandidateNegativeSecondaryVertices',
0090 )
0091 
0092 pfNegativeParticleNetAK4JetTags = pfParticleNetAK4JetTags.clone(
0093     src = 'pfNegativeParticleNetAK4TagInfos',
0094 )
0095 
0096 # probs
0097 _pfNegativeParticleNetAK4JetTagsProbs = ['pfNegativeParticleNetAK4JetTags:' + flav_name 
0098                                          for flav_name in pfNegativeParticleNetAK4JetTags.flav_names]