CMS 3D CMS Logo

Functions | Variables
deepTauAtHLT Namespace Reference

Functions

def update (process)
 

Variables

 _ak4dBetaCorrection
 DeltaBeta correction factor. More...
 

Function Documentation

◆ update()

def deepTauAtHLT.update (   process)

Definition at line 17 of file deepTauAtHLT.py.

17 def update(process):
18  process.options.wantSummary = cms.untracked.bool(True)
19 
20  process.hltFixedGridRhoFastjetAllTau = 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.hpsPFTauBasicDiscriminatorsForDeepTau = pfRecoTauDiscriminationByIsolation.clone(
39  PFTauProducer = 'hltHpsL1JetsHLTForDeepTauInput',
40  Prediscriminants = cms.PSet( BooleanOperator = cms.string( "and" ) ),
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.hpsPFTauBasicDiscriminatorsdR03ForDeepTau = process.hpsPFTauBasicDiscriminatorsForDeepTau.clone(
84  customOuterCone = 0.3
85  )
86 
87  process.hpsPFTauPrimaryVertexProducerForDeepTau = 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.hpsPFTauSecondaryVertexProducerForDeepTau = PFTauSecondaryVertexProducer.clone(
104  PFTauTag = "hltHpsPFTauProducerReg"
105  )
106  process.hpsPFTauTransverseImpactParametersForDeepTau = PFTauTransverseImpactParameters.clone(
107  PFTauTag = "hltHpsPFTauProducerReg",
108  PFTauPVATag = "hpsPFTauPrimaryVertexProducerForDeepTau",
109  PFTauSVATag = "hpsPFTauSecondaryVertexProducerForDeepTau",
110  useFullCalculation = True
111  )
112 
113  chargedIsolationQualityCuts = PFTauQualityCuts.clone(
114  isolationQualityCuts = cms.PSet(
115  maxDeltaZ = cms.double( 0.2 ),
116  minTrackPt = cms.double( 0.5 ),
117  minGammaEt = cms.double( 0.5 ),
118  minTrackHits = cms.uint32( 3 ),
119  minTrackPixelHits = cms.uint32( 0 ),
120  maxTrackChi2 = cms.double( 100.0 ),
121  maxTransverseImpactParameter = cms.double( 0.1 ),
122  useTracksInsteadOfPFHadrons = cms.bool( False )
123  ),
124  primaryVertexSrc = "hltPixelVertices",
125  signalQualityCuts = cms.PSet(
126  maxDeltaZ = cms.double( 0.2 ),
127  minTrackPt = cms.double( 0.0 ),
128  minGammaEt = cms.double( 0.5 ),
129  minTrackHits = cms.uint32( 3 ),
130  minTrackPixelHits = cms.uint32( 0 ),
131  maxTrackChi2 = cms.double( 1000.0 ),
132  maxTransverseImpactParameter = cms.double( 0.2 ),
133  useTracksInsteadOfPFHadrons = cms.bool( False ),
134  minNeutralHadronEt = cms.double( 1.0 )
135  ),
136  vxAssocQualityCuts = cms.PSet(
137  minTrackPt = cms.double( 0.0 ),
138  minGammaEt = cms.double( 0.5 ),
139  minTrackHits = cms.uint32( 3 ),
140  minTrackPixelHits = cms.uint32( 0 ),
141  maxTrackChi2 = cms.double( 1000.0 ),
142  maxTransverseImpactParameter = cms.double( 0.2 ),
143  useTracksInsteadOfPFHadrons = cms.bool( False )
144  ),
145  )
146 
147  process.hltHpsL1JetsHLTForDeepTauInput = process.hltHpsL1JetsHLTDoublePFTauTrackPt1MediumChargedIsolationMatchReg.clone(
148  L1TauTrigger = "hltL1sTauVeryBigOR",
149  JetSrc = "hltHpsPFTauProducerReg",
150  ReduceTauContent = False,
151  KeepOriginalVertex = True,
152  )
153 
154  file_names = [
155  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
156  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
157  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
158  ]
159 
160  def getLinExpression(x1, x2, y1, y2):
161  return "(((({3}-{2})/({1}-{0}))*(pt-{0}))+{2})".format(x1, x2, y1, y2)
162 
163  val1, val2 = ("0.49948551", "0.125")
164  working_points = ["{0}*(pt < 35)+".format(val1)+getLinExpression("35", "300", val1, val2)+ "*(35 <= pt && pt < 300) + {0}*(pt >= 300)".format(val2)]
165 
166  process.deepTauProducer = DeepTau.clone(
167  taus = 'hltHpsL1JetsHLTForDeepTauInput',
168  pfcands = 'hltParticleFlowReg',
169  vertices = 'hltPixelVertices',
170  rho = 'hltFixedGridRhoFastjetAllTau',
171  graph_file = file_names,
172  disable_dxy_pca = True,
173  is_online = True,
174  pfTauTransverseImpactParameters = 'hpsPFTauTransverseImpactParametersForDeepTau',
175  basicTauDiscriminators = 'hpsPFTauBasicDiscriminatorsForDeepTau',
176  basicTauDiscriminatorsdR03 = 'hpsPFTauBasicDiscriminatorsdR03ForDeepTau',
177  Prediscriminants = cms.PSet( BooleanOperator = cms.string( "and" ) ),
178  VSeWP = working_points,
179  VSmuWP = working_points,
180  VSjetWP = working_points
181  )
182 
183  # Add DeepTauProducer
184  process.HLTHPSDeepTau35IsoPFTauSequenceReg = cms.Sequence(process.hpsPFTauPrimaryVertexProducerForDeepTau + process.hpsPFTauSecondaryVertexProducerForDeepTau + process.hpsPFTauTransverseImpactParametersForDeepTau + process.hltFixedGridRhoFastjetAllTau + process.hltHpsL1JetsHLTForDeepTauInput + process.hpsPFTauBasicDiscriminatorsForDeepTau + process.hpsPFTauBasicDiscriminatorsdR03ForDeepTau + process.deepTauProducer)
185 
186  process.hltHpsSelectedPFTausTrackPt1DeepTau35IsolationReg = process.hltHpsSelectedPFTausTrackPt1MediumChargedIsolationReg.clone(
187  src = "hltHpsL1JetsHLTForDeepTauInput",
188  discriminators = [
189  # cms.PSet(
190  # discriminator = cms.InputTag( "hltHpsPFTauTrackPt1DiscriminatorReg" ),
191  # selectionCut = cms.double( 0.5 )
192  # )
193  ],
194  discriminatorContainers = [
195  cms.PSet(
196  discriminator = cms.InputTag( "deepTauProducer", "VSjet" ),
197  rawValues = cms.vstring(),
198  selectionCuts = cms.vdouble(),
199  workingPoints = cms.vstring(working_points),
200  )
201  ]
202  )
203 
204  process.hltHpsDoublePFTau35TrackPt1DeepTau35IsolationReg = process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationReg.clone(
205  inputTag = "hltHpsSelectedPFTausTrackPt1DeepTau35IsolationReg",
206  )
207 
208  process.hltHpsL1JetsHLTDoublePFTauTrackPt1DeepTauMatchReg = process.hltHpsL1JetsHLTDoublePFTauTrackPt1MediumChargedIsolationMatchReg.clone(
209  JetSrc = "hltHpsSelectedPFTausTrackPt1DeepTau35IsolationReg",
210  )
211 
212  process.hltHpsDoublePFTau35TrackPt1DeepTauL1HLTMatchedReg = process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationL1HLTMatchedReg.clone(
213  inputTag = "hltHpsL1JetsHLTDoublePFTauTrackPt1DeepTauMatchReg",
214  )
215 
216  process.hltHpsDoublePFTau35TrackPt1DeepTau35IsolationDz02Reg = process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationDz02Reg.clone(
217  JetSrc = "hltHpsL1JetsHLTDoublePFTauTrackPt1DeepTauMatchReg"
218  )
219 
220  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.HLTHPSMediumChargedIsoPFTauSequenceReg)
221  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsSelectedPFTausTrackPt1MediumChargedIsolationReg)
222  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationReg)
223  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsL1JetsHLTDoublePFTauTrackPt1MediumChargedIsolationMatchReg)
224  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationL1HLTMatchedReg)
225  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationDz02Reg)
226  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.HLTEndSequence)
227 
228  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4 += (process.HLTHPSDeepTau35IsoPFTauSequenceReg + process.hltHpsSelectedPFTausTrackPt1DeepTau35IsolationReg + process.hltHpsDoublePFTau35TrackPt1DeepTau35IsolationReg + process.hltHpsL1JetsHLTDoublePFTauTrackPt1DeepTauMatchReg + process.hltHpsDoublePFTau35TrackPt1DeepTauL1HLTMatchedReg + process.hltHpsDoublePFTau35TrackPt1DeepTau35IsolationDz02Reg + process.HLTEndSequence)
229 
230  return process
231 
def update(process)
Definition: deepTauAtHLT.py:17

Variable Documentation

◆ _ak4dBetaCorrection

deepTauAtHLT._ak4dBetaCorrection
private

DeltaBeta correction factor.

Definition at line 15 of file deepTauAtHLT.py.