CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
deepTauAtHLT Namespace Reference

Functions

def update
 

Variables

float _ak4dBetaCorrection = 0.20
 DeltaBeta correction factor. More...
 

Function Documentation

def deepTauAtHLT.update (   process)

Definition at line 17 of file deepTauAtHLT.py.

17 
18 def update(process):
19  process.options.wantSummary = cms.untracked.bool(True)
20 
21  process.hltFixedGridRhoFastjetAllTau = cms.EDProducer( "FixedGridRhoProducerFastjet",
22  gridSpacing = cms.double( 0.55 ),
23  maxRapidity = cms.double( 5.0 ),
24  pfCandidatesTag = cms.InputTag( "hltParticleFlowReg" )
25  )
26 
27  PFTauQualityCuts.primaryVertexSrc = cms.InputTag("hltPixelVertices")
28 
29  ## Decay mode prediscriminant
30  requireDecayMode = cms.PSet(
31  BooleanOperator = cms.string("and"),
32  decayMode = cms.PSet(
33  Producer = cms.InputTag('hltHpsPFTauDiscriminationByDecayModeFindingNewDMsReg'),
34  cut = cms.double(0.5)
35  )
36  )
37 
38  ## Cut based isolations dR=0.5
39  process.hpsPFTauBasicDiscriminatorsForDeepTau = pfRecoTauDiscriminationByIsolation.clone(
40  PFTauProducer = 'hltHpsL1JetsHLTForDeepTauInput',
41  Prediscriminants = cms.PSet( BooleanOperator = cms.string( "and" ) ),
42  deltaBetaPUTrackPtCutOverride = True, # Set the boolean = True to override.
43  deltaBetaPUTrackPtCutOverride_val = 0.5, # Set the value for new value.
44  particleFlowSrc = 'hltParticleFlowReg',
45  vertexSrc = PFTauQualityCuts.primaryVertexSrc,
46  customOuterCone = PFRecoTauPFJetInputs.isolationConeSize,
47  isoConeSizeForDeltaBeta = 0.8,
48  deltaBetaFactor = "%0.4f"%(_ak4dBetaCorrection),
49  qualityCuts = dict(isolationQualityCuts = dict(minTrackHits = 3, minGammaEt = 1.0, minTrackPt = 0.5)),
50  IDdefinitions = [
51  cms.PSet(
52  IDname = cms.string("ChargedIsoPtSum"),
53  ApplyDiscriminationByTrackerIsolation = cms.bool(True),
54  storeRawSumPt = cms.bool(True)
55  ),
56  cms.PSet(
57  IDname = cms.string("NeutralIsoPtSum"),
58  ApplyDiscriminationByECALIsolation = cms.bool(True),
59  storeRawSumPt = cms.bool(True)
60  ),
61  cms.PSet(
62  IDname = cms.string("NeutralIsoPtSumWeight"),
63  ApplyDiscriminationByWeightedECALIsolation = cms.bool(True),
64  storeRawSumPt = cms.bool(True),
65  UseAllPFCandsForWeights = cms.bool(True)
66  ),
67  cms.PSet(
68  IDname = cms.string("TauFootprintCorrection"),
69  storeRawFootprintCorrection = cms.bool(True)
70  ),
71  cms.PSet(
72  IDname = cms.string("PhotonPtSumOutsideSignalCone"),
73  storeRawPhotonSumPt_outsideSignalCone = cms.bool(True)
74  ),
75  cms.PSet(
76  IDname = cms.string("PUcorrPtSum"),
77  applyDeltaBetaCorrection = cms.bool(True),
78  storeRawPUsumPt = cms.bool(True)
79  ),
80  ],
81  )
82 
83  ## Cut based isolations dR=0.3
84  process.hpsPFTauBasicDiscriminatorsdR03ForDeepTau = process.hpsPFTauBasicDiscriminatorsForDeepTau.clone(
85  customOuterCone = 0.3
86  )
87 
88  process.hpsPFTauPrimaryVertexProducerForDeepTau = PFTauPrimaryVertexProducer.clone(
89  PFTauTag = "hltHpsPFTauProducerReg",
90  ElectronTag = "hltEgammaCandidates",
91  MuonTag = "hltMuonsReg",
92  PVTag = "hltPixelVertices",
93  beamSpot = "hltOnlineBeamSpot",
94  discriminators = [
95  cms.PSet(
96  discriminator = cms.InputTag('hltHpsPFTauDiscriminationByDecayModeFindingNewDMsReg'),
97  selectionCut = cms.double(0.5)
98  )
99  ],
100  cut = "pt > 18.0 & abs(eta) < 2.4",
101  qualityCuts = PFTauQualityCuts
102  )
103 
104  process.hpsPFTauSecondaryVertexProducerForDeepTau = PFTauSecondaryVertexProducer.clone(
105  PFTauTag = "hltHpsPFTauProducerReg"
106  )
107  process.hpsPFTauTransverseImpactParametersForDeepTau = PFTauTransverseImpactParameters.clone(
108  PFTauTag = "hltHpsPFTauProducerReg",
109  PFTauPVATag = "hpsPFTauPrimaryVertexProducerForDeepTau",
110  PFTauSVATag = "hpsPFTauSecondaryVertexProducerForDeepTau",
111  useFullCalculation = True
112  )
113 
114  chargedIsolationQualityCuts = PFTauQualityCuts.clone(
115  isolationQualityCuts = cms.PSet(
116  maxDeltaZ = cms.double( 0.2 ),
117  minTrackPt = cms.double( 0.5 ),
118  minGammaEt = cms.double( 0.5 ),
119  minTrackHits = cms.uint32( 3 ),
120  minTrackPixelHits = cms.uint32( 0 ),
121  maxTrackChi2 = cms.double( 100.0 ),
122  maxTransverseImpactParameter = cms.double( 0.1 ),
123  useTracksInsteadOfPFHadrons = cms.bool( False )
124  ),
125  primaryVertexSrc = "hltPixelVertices",
126  signalQualityCuts = cms.PSet(
127  maxDeltaZ = cms.double( 0.2 ),
128  minTrackPt = cms.double( 0.0 ),
129  minGammaEt = cms.double( 0.5 ),
130  minTrackHits = cms.uint32( 3 ),
131  minTrackPixelHits = cms.uint32( 0 ),
132  maxTrackChi2 = cms.double( 1000.0 ),
133  maxTransverseImpactParameter = cms.double( 0.2 ),
134  useTracksInsteadOfPFHadrons = cms.bool( False ),
135  minNeutralHadronEt = cms.double( 1.0 )
136  ),
137  vxAssocQualityCuts = cms.PSet(
138  minTrackPt = cms.double( 0.0 ),
139  minGammaEt = cms.double( 0.5 ),
140  minTrackHits = cms.uint32( 3 ),
141  minTrackPixelHits = cms.uint32( 0 ),
142  maxTrackChi2 = cms.double( 1000.0 ),
143  maxTransverseImpactParameter = cms.double( 0.2 ),
144  useTracksInsteadOfPFHadrons = cms.bool( False )
145  ),
146  )
147 
148  process.hltHpsL1JetsHLTForDeepTauInput = process.hltHpsL1JetsHLTDoublePFTauTrackPt1MediumChargedIsolationMatchReg.clone(
149  L1TauTrigger = "hltL1sTauVeryBigOR",
150  JetSrc = "hltHpsPFTauProducerReg",
151  ReduceTauContent = False,
152  KeepOriginalVertex = True,
153  )
154 
155  file_names = [
156  'core:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_core.pb',
157  'inner:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_inner.pb',
158  'outer:RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6_outer.pb',
159  ]
160 
161  def getLinExpression(x1, x2, y1, y2):
162  return "(((({3}-{2})/({1}-{0}))*(pt-{0}))+{2})".format(x1, x2, y1, y2)
163 
164  val1, val2 = ("0.49948551", "0.125")
165  working_points = ["{0}*(pt < 35)+".format(val1)+getLinExpression("35", "300", val1, val2)+ "*(35 <= pt && pt < 300) + {0}*(pt >= 300)".format(val2)]
166 
167  process.deepTauProducer = DeepTau.clone(
168  taus = 'hltHpsL1JetsHLTForDeepTauInput',
169  pfcands = 'hltParticleFlowReg',
170  vertices = 'hltPixelVertices',
171  rho = 'hltFixedGridRhoFastjetAllTau',
172  graph_file = file_names,
173  disable_dxy_pca = True,
174  is_online = True,
175  pfTauTransverseImpactParameters = 'hpsPFTauTransverseImpactParametersForDeepTau',
176  basicTauDiscriminators = 'hpsPFTauBasicDiscriminatorsForDeepTau',
177  basicTauDiscriminatorsdR03 = 'hpsPFTauBasicDiscriminatorsdR03ForDeepTau',
178  Prediscriminants = cms.PSet( BooleanOperator = cms.string( "and" ) ),
179  VSeWP = working_points,
180  VSmuWP = working_points,
181  VSjetWP = working_points
182  )
183 
184  # Add DeepTauProducer
185  process.HLTHPSDeepTau35IsoPFTauSequenceReg = cms.Sequence(process.hpsPFTauPrimaryVertexProducerForDeepTau + process.hpsPFTauSecondaryVertexProducerForDeepTau + process.hpsPFTauTransverseImpactParametersForDeepTau + process.hltFixedGridRhoFastjetAllTau + process.hltHpsL1JetsHLTForDeepTauInput + process.hpsPFTauBasicDiscriminatorsForDeepTau + process.hpsPFTauBasicDiscriminatorsdR03ForDeepTau + process.deepTauProducer)
186 
187  process.hltHpsSelectedPFTausTrackPt1DeepTau35IsolationReg = process.hltHpsSelectedPFTausTrackPt1MediumChargedIsolationReg.clone(
188  src = "hltHpsL1JetsHLTForDeepTauInput",
189  discriminators = [
190  # cms.PSet(
191  # discriminator = cms.InputTag( "hltHpsPFTauTrackPt1DiscriminatorReg" ),
192  # selectionCut = cms.double( 0.5 )
193  # )
194  ],
195  discriminatorContainers = [
196  cms.PSet(
197  discriminator = cms.InputTag( "deepTauProducer", "VSjet" ),
198  rawValues = cms.vstring(),
199  selectionCuts = cms.vdouble(),
200  workingPoints = cms.vstring(working_points),
201  )
202  ]
203  )
204 
205  process.hltHpsDoublePFTau35TrackPt1DeepTau35IsolationReg = process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationReg.clone(
206  inputTag = "hltHpsSelectedPFTausTrackPt1DeepTau35IsolationReg",
207  )
208 
209  process.hltHpsL1JetsHLTDoublePFTauTrackPt1DeepTauMatchReg = process.hltHpsL1JetsHLTDoublePFTauTrackPt1MediumChargedIsolationMatchReg.clone(
210  JetSrc = "hltHpsSelectedPFTausTrackPt1DeepTau35IsolationReg",
211  )
212 
213  process.hltHpsDoublePFTau35TrackPt1DeepTauL1HLTMatchedReg = process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationL1HLTMatchedReg.clone(
214  inputTag = "hltHpsL1JetsHLTDoublePFTauTrackPt1DeepTauMatchReg",
215  )
216 
217  process.hltHpsDoublePFTau35TrackPt1DeepTau35IsolationDz02Reg = process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationDz02Reg.clone(
218  JetSrc = "hltHpsL1JetsHLTDoublePFTauTrackPt1DeepTauMatchReg"
219  )
220 
221  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.HLTHPSMediumChargedIsoPFTauSequenceReg)
222  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsSelectedPFTausTrackPt1MediumChargedIsolationReg)
223  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationReg)
224  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsL1JetsHLTDoublePFTauTrackPt1MediumChargedIsolationMatchReg)
225  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationL1HLTMatchedReg)
226  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.hltHpsDoublePFTau35TrackPt1MediumChargedIsolationDz02Reg)
227  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4.remove(process.HLTEndSequence)
228 
229  process.HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4 += (process.HLTHPSDeepTau35IsoPFTauSequenceReg + process.hltHpsSelectedPFTausTrackPt1DeepTau35IsolationReg + process.hltHpsDoublePFTau35TrackPt1DeepTau35IsolationReg + process.hltHpsL1JetsHLTDoublePFTauTrackPt1DeepTauMatchReg + process.hltHpsDoublePFTau35TrackPt1DeepTauL1HLTMatchedReg + process.hltHpsDoublePFTau35TrackPt1DeepTau35IsolationDz02Reg + process.HLTEndSequence)
230 
231  return process

Variable Documentation

float deepTauAtHLT._ak4dBetaCorrection = 0.20

DeltaBeta correction factor.

Definition at line 15 of file deepTauAtHLT.py.