CMS 3D CMS Logo

deepTauAtHLT.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
4 from RecoTauTag.RecoTau.PFRecoTauQualityCuts_cfi import PFTauQualityCuts
5 from RecoTauTag.RecoTau.PFRecoTauDiscriminationByHPSSelection_cfi import hpsSelectionDiscriminator
6 
10 
12 
13 from RecoTauTag.RecoTau.PFRecoTauPFJetInputs_cfi import PFRecoTauPFJetInputs
14 
15 ak4dBetaCorrection = 0.20
16 
17 def update(process):
18  process.options.wantSummary = cms.untracked.bool(True)
19 
20  process.hltFixedGridRhoFastjetAll = cms.EDProducer( "FixedGridRhoProducerFastjet",
21  gridSpacing = cms.double( 0.55 ),
22  maxRapidity = cms.double( 5.0 ),
23  pfCandidatesTag = cms.InputTag( "hltParticleFlowReg" )
24  )
25 
26  PFTauQualityCuts.primaryVertexSrc = cms.InputTag("hltPixelVertices")
27 
28 
29  requireDecayMode = cms.PSet(
30  BooleanOperator = cms.string("and"),
31  decayMode = cms.PSet(
32  Producer = cms.InputTag('hltHpsPFTauDiscriminationByDecayModeFindingNewDMsReg'),
33  cut = cms.double(0.5)
34  )
35  )
36 
37 
38  process.hpsPFTauBasicDiscriminators = pfRecoTauDiscriminationByIsolation.clone(
39  PFTauProducer = 'hltHpsPFTauProducerReg',
40  Prediscriminants = requireDecayMode.clone(),
41  deltaBetaPUTrackPtCutOverride = True, # Set the boolean = True to override.
42  deltaBetaPUTrackPtCutOverride_val = 0.5, # Set the value for new value.
43  particleFlowSrc = 'hltParticleFlowReg',
44  vertexSrc = PFTauQualityCuts.primaryVertexSrc,
45  customOuterCone = PFRecoTauPFJetInputs.isolationConeSize,
46  isoConeSizeForDeltaBeta = 0.8,
47  deltaBetaFactor = "%0.4f"%(ak4dBetaCorrection),
48  qualityCuts = dict(isolationQualityCuts = dict(minTrackHits = 3, minGammaEt = 1.0, minTrackPt = 0.5)),
49  IDdefinitions = [
50  cms.PSet(
51  IDname = cms.string("ChargedIsoPtSum"),
52  ApplyDiscriminationByTrackerIsolation = cms.bool(True),
53  storeRawSumPt = cms.bool(True)
54  ),
55  cms.PSet(
56  IDname = cms.string("NeutralIsoPtSum"),
57  ApplyDiscriminationByECALIsolation = cms.bool(True),
58  storeRawSumPt = cms.bool(True)
59  ),
60  cms.PSet(
61  IDname = cms.string("NeutralIsoPtSumWeight"),
62  ApplyDiscriminationByWeightedECALIsolation = cms.bool(True),
63  storeRawSumPt = cms.bool(True),
64  UseAllPFCandsForWeights = cms.bool(True)
65  ),
66  cms.PSet(
67  IDname = cms.string("TauFootprintCorrection"),
68  storeRawFootprintCorrection = cms.bool(True)
69  ),
70  cms.PSet(
71  IDname = cms.string("PhotonPtSumOutsideSignalCone"),
72  storeRawPhotonSumPt_outsideSignalCone = cms.bool(True)
73  ),
74  cms.PSet(
75  IDname = cms.string("PUcorrPtSum"),
76  applyDeltaBetaCorrection = cms.bool(True),
77  storeRawPUsumPt = cms.bool(True)
78  ),
79  ],
80  )
81 
82 
83  process.hpsPFTauBasicDiscriminatorsdR03 = process.hpsPFTauBasicDiscriminators.clone(
84  customOuterCone = 0.3
85  )
86 
87  process.hpsPFTauPrimaryVertexProducer = PFTauPrimaryVertexProducer.clone(
88  PFTauTag = "hltHpsPFTauProducerReg",
89  ElectronTag = "hltEgammaCandidates",
90  MuonTag = "hltMuonsReg",
91  PVTag = "hltPixelVertices",
92  beamSpot = "hltOnlineBeamSpot",
93  discriminators = [
94  cms.PSet(
95  discriminator = cms.InputTag('hltHpsPFTauDiscriminationByDecayModeFindingNewDMsReg'),
96  selectionCut = cms.double(0.5)
97  )
98  ],
99  cut = "pt > 18.0 & abs(eta) < 2.4",
100  qualityCuts = PFTauQualityCuts
101  )
102 
103  process.hpsPFTauSecondaryVertexProducer = PFTauSecondaryVertexProducer.clone(
104  PFTauTag = "hltHpsPFTauProducerReg"
105  )
106  process.hpsPFTauTransverseImpactParameters = PFTauTransverseImpactParameters.clone(
107  PFTauTag = "hltHpsPFTauProducerReg",
108  PFTauPVATag = "hpsPFTauPrimaryVertexProducer",
109  PFTauSVATag = "hpsPFTauSecondaryVertexProducer",
110  useFullCalculation = True
111  )
112 
113  file_names = [
114  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
115  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
116  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
117  ]
118 
119  working_points = ["0.", "0.92"]
120 
121  process.deepTauProducer = DeepTau.clone(
122  taus = 'hltHpsPFTauProducerReg',
123  pfcands = 'hltParticleFlowReg',
124  vertices = 'hltPixelVertices',
125  rho = 'hltFixedGridRhoFastjetAll',
126  graph_file = file_names,
127  disable_dxy_pca = cms.bool(True),
128  is_online = cms.bool(True),
129  basicTauDiscriminators = 'hpsPFTauBasicDiscriminators',
130  basicTauDiscriminatorsdR03 = 'hpsPFTauBasicDiscriminatorsdR03',
131  Prediscriminants = requireDecayMode.clone(),
132  VSeWP = working_points,
133  VSmuWP = working_points,
134  VSjetWP = working_points
135  )
136 
137  # Add DeepTauProducer
138  process.HLTHPSMediumChargedIsoPFTauSequenceReg += (process.hpsPFTauPrimaryVertexProducer + process.hpsPFTauSecondaryVertexProducer + process.hpsPFTauTransverseImpactParameters + process.hltFixedGridRhoFastjetAll + process.hpsPFTauBasicDiscriminators + process.hpsPFTauBasicDiscriminatorsdR03 + process.deepTauProducer)
139 
140  return process
DeepTau_cfi
PFTauSecondaryVertexProducer_cfi
PFRecoTauDiscriminationByIsolation_cfi
PFTauPrimaryVertexProducer_cfi
PFTauTransverseImpactParameters_cfi
PFRecoTauQualityCuts_cfi
deepTauAtHLT.update
def update(process)
Definition: deepTauAtHLT.py:17