CMS 3D CMS Logo

pfParticleNetAK4_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 from RecoBTag.FeatureTools.pfDeepBoostedJetTagInfos_cfi import pfDeepBoostedJetTagInfos
4 from RecoBTag.ONNXRuntime.boostedJetONNXJetTagsProducer_cfi import boostedJetONNXJetTagsProducer
5 from RecoBTag.ONNXRuntime.particleNetSonicJetTagsProducer_cfi import particleNetSonicJetTagsProducer as _particleNetSonicJetTagsProducer
6 from RecoBTag.ONNXRuntime.pfParticleNetAK4DiscriminatorsJetTags_cfi import pfParticleNetAK4DiscriminatorsJetTags
7 from Configuration.ProcessModifiers.particleNetSonicTriton_cff import particleNetSonicTriton
8 from Configuration.ProcessModifiers.particleNetPTSonicTriton_cff import particleNetPTSonicTriton
9 
10 pfParticleNetAK4TagInfos = pfDeepBoostedJetTagInfos.clone(
11  jets = "ak4PFJetsCHS",
12  jet_radius = 0.4,
13  min_jet_pt = 15,
14  min_puppi_wgt = -1,
15  use_puppiP4 = False,
16 )
17 
18 pfParticleNetAK4TagInfosForRECO = pfParticleNetAK4TagInfos.clone(
19  min_jet_pt = 25,
20  max_jet_eta = 2.5,
21 )
22 
23 pfParticleNetAK4JetTags = boostedJetONNXJetTagsProducer.clone(
24  src = 'pfParticleNetAK4TagInfos',
25  preprocess_json = 'RecoBTag/Combined/data/ParticleNetAK4/CHS/V00/preprocess.json',
26  model_path = 'RecoBTag/Combined/data/ParticleNetAK4/CHS/V00/modelfile/model.onnx',
27  flav_names = ["probb", "probbb", "probc", "probcc", "probuds", "probg", "probundef", "probpu"],
28 )
29 
30 pfParticleNetAK4JetTagsForRECO = pfParticleNetAK4JetTags.clone(
31  src = 'pfParticleNetAK4TagInfosForRECO',
32 )
33 
34 pfParticleNetAK4DiscriminatorsJetTagsForRECO = pfParticleNetAK4DiscriminatorsJetTags.clone()
35 for discriminator in pfParticleNetAK4DiscriminatorsJetTagsForRECO.discriminators:
36  for num in discriminator.numerator:
37  num.setModuleLabel("pfParticleNetAK4JetTagsForRECO");
38  for den in discriminator.denominator:
39  den.setModuleLabel("pfParticleNetAK4JetTagsForRECO");
40 
41 particleNetSonicTriton.toReplaceWith(pfParticleNetAK4JetTags, _particleNetSonicJetTagsProducer.clone(
42  src = 'pfParticleNetAK4TagInfos',
43  preprocess_json = 'RecoBTag/Combined/data/ParticleNetAK4/CHS/V00/preprocess.json',
44  Client = cms.PSet(
45  timeout = cms.untracked.uint32(300),
46  mode = cms.string("Async"),
47  modelName = cms.string("particlenet_AK4"),
48  modelConfigPath = cms.FileInPath("RecoBTag/Combined/data/models/particlenet_AK4/config.pbtxt"),
49  modelVersion = cms.string(""),
50  verbose = cms.untracked.bool(False),
51  allowedTries = cms.untracked.uint32(0),
52  useSharedMemory = cms.untracked.bool(True),
53  compression = cms.untracked.string(""),
54  ),
55  flav_names = pfParticleNetAK4JetTags.flav_names,
56 ))
57 
58 (particleNetSonicTriton & particleNetPTSonicTriton).toModify(pfParticleNetAK4JetTags,
59  preprocess_json = 'RecoBTag/Combined/data/ParticleNetAK4/CHS/V00/preprocess_PT.json',
60  Client = dict(
61  modelName = "particlenet_AK4_PT",
62  modelConfigPath = cms.FileInPath("RecoBTag/Combined/data/models/particlenet_AK4_PT/config.pbtxt"),
63  )
64 )
65 
66 from CommonTools.PileupAlgos.Puppi_cff import puppi
67 from CommonTools.RecoAlgos.primaryVertexAssociation_cfi import primaryVertexAssociation
68 
69 # This task is not used, useful only if we run it from RECO jets (RECO/AOD)
70 pfParticleNetAK4Task = cms.Task(puppi, primaryVertexAssociation, pfParticleNetAK4TagInfos,
71  pfParticleNetAK4JetTags, pfParticleNetAK4DiscriminatorsJetTags)
72 pfParticleNetAK4TaskForRECO = cms.Task(puppi, primaryVertexAssociation, pfParticleNetAK4TagInfosForRECO,
73  pfParticleNetAK4JetTagsForRECO, pfParticleNetAK4DiscriminatorsJetTagsForRECO)
74 
75 # declare all the discriminators
76 # probs
77 _pfParticleNetAK4JetTagsProbs = ['pfParticleNetAK4JetTags:' + flav_name
78  for flav_name in pfParticleNetAK4JetTags.flav_names]
79 # meta-taggers
80 _pfParticleNetAK4JetTagsMetaDiscrs = ['pfParticleNetAK4DiscriminatorsJetTags:' + disc.name.value()
81  for disc in pfParticleNetAK4DiscriminatorsJetTags.discriminators]
82 _pfParticleNetAK4JetTagsAll = _pfParticleNetAK4JetTagsProbs + _pfParticleNetAK4JetTagsMetaDiscrs
83 
84 
85 # === Negative tags ===
86 pfNegativeParticleNetAK4TagInfos = pfParticleNetAK4TagInfos.clone(
87  flip_ip_sign = True,
88  sip3dSigMax = 10,
89  secondary_vertices = 'inclusiveCandidateNegativeSecondaryVertices',
90 )
91 
92 pfNegativeParticleNetAK4JetTags = pfParticleNetAK4JetTags.clone(
93  src = 'pfNegativeParticleNetAK4TagInfos',
94 )
95 
96 # probs
97 _pfNegativeParticleNetAK4JetTagsProbs = ['pfNegativeParticleNetAK4JetTags:' + flav_name
98  for flav_name in pfNegativeParticleNetAK4JetTags.flav_names]