test
CMS 3D CMS Logo

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

Classes

class  AddJetCollection
 
class  AddJetID
 
class  SetTagInfos
 
class  SwitchJetCollection
 
class  UpdateJetCollection
 

Functions

def checkJetCorrectionsFormat
 
def deprecatedOptionOutputModule
 
def jetAlgo
 
def rerunningIVF
 
def setupBTagging
 
def setupJetCorrections
 
def setupSVClustering
 
def undefinedLabelName
 
def unsupportedJetAlgorithm
 

Variables

dictionary supportedJetAlgos
 dictionary with supported jet clustering algorithms More...
 

Function Documentation

def jetTools.checkJetCorrectionsFormat (   jetCorrections)

Definition at line 16 of file jetTools.py.

Referenced by jetTools.AddJetCollection.toolCode(), and jetTools.UpdateJetCollection.toolCode().

16 
17 def checkJetCorrectionsFormat(jetCorrections):
18  ## check for the correct format
19  if type(jetCorrections) != type(('PAYLOAD-LABEL',['CORRECTION-LEVEL-A','CORRECTION-LEVEL-B'], 'MET-LABEL')):
20  raise ValueError("In addJetCollection: 'jetCorrections' must be 'None' (as a python value w/o quotation marks), or of type ('PAYLOAD-LABEL', ['CORRECTION-LEVEL-A', \
21  'CORRECTION-LEVEL-B', ...], 'MET-LABEL'). Note that 'MET-LABEL' can be set to 'None' (as a string in quotation marks) in case you do not want to apply MET(Type1) \
22  corrections.")
23 
def checkJetCorrectionsFormat
Definition: jetTools.py:16
def jetTools.deprecatedOptionOutputModule (   obj)

Definition at line 1277 of file jetTools.py.

1279  print "-------------------------------------------------------"
1280  print " Error: the option 'outputModule' is not supported"
1281  print " anymore by:"
1282  print " ", obj._label
1283  print " please use 'outputModules' now and specify the"
1284  print " names of all needed OutModules in there"
1285  print " (default: ['out'])"
1286  print "-------------------------------------------------------"
1287  raise KeyError("Unsupported option 'outputModule' used in '"+obj._label+"'")
def deprecatedOptionOutputModule
Definition: jetTools.py:1277
def jetTools.jetAlgo (   algo)

Definition at line 3 of file jetTools.py.

Referenced by pfTools.switchToPFJets().

3 
4 def jetAlgo( algo ):
5 
6  # print 'PF2PAT: selecting jet algorithm ', algo
7 
8  if algo == 'IC5':
9  import RecoJets.JetProducers.ic5PFJets_cfi as jetConfig
10  jetAlgo = jetConfig.iterativeCone5PFJets.clone()
11  elif algo == 'AK4':
12  import RecoJets.JetProducers.ak4PFJets_cfi as jetConfig
13  jetAlgo = jetConfig.ak4PFJets.clone()
14  elif algo == 'AK7':
15  import RecoJets.JetProducers.ak4PFJets_cfi as jetConfig
16  jetAlgo = jetConfig.ak4PFJets.clone()
17  jetAlgo.rParam = cms.double(0.7)
18  jetAlgo.doAreaFastjet = cms.bool(False)
19 
20  jetAlgo.src = 'pfNoElectronJME'
21  jetAlgo.doPVCorrection = True
22  jetAlgo.srcPVs = cms.InputTag("goodOfflinePrimaryVertices")
23  return jetAlgo
def jetAlgo
Definition: jetTools.py:3
def jetTools.rerunningIVF ( )

Definition at line 1304 of file jetTools.py.

Referenced by setupBTagging().

1305 def rerunningIVF():
1306  print "-------------------------------------------------------------------"
1307  print " Warning: You are attempting to remake the IVF secondary vertices"
1308  print " already produced by the standard reconstruction. If that"
1309  print " was your intention, note that they should be remade only"
1310  print " from RECO and AOD, i.e., MiniAOD should not be used."
1311  print "-------------------------------------------------------------------"
def rerunningIVF
Definition: jetTools.py:1304
def jetTools.setupBTagging (   process,
  jetSource,
  pfCandidates,
  explicitJTA,
  pvSource,
  svSource,
  elSource,
  muSource,
  runIVF,
  loadStdRecoBTag,
  svClustering,
  fatJets,
  groomedFatJets,
  algo,
  rParam,
  btagDiscriminators,
  btagInfos,
  patJets,
  labelName,
  postfix 
)

Definition at line 173 of file jetTools.py.

References clone(), list(), rerunningIVF(), and setupSVClustering().

Referenced by setupSVClustering(), jetTools.AddJetCollection.toolCode(), and jetTools.UpdateJetCollection.toolCode().

174  algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, postfix):
175  ## expand tagInfos to what is explicitely required by user + implicit
176  ## requirements that come in from one or the other discriminator
177  requiredTagInfos = list(btagInfos)
178  for btagDiscr in btagDiscriminators :
179  for requiredTagInfo in supportedBtagDiscr[btagDiscr] :
180  tagInfoCovered = False
181  for tagInfo in requiredTagInfos :
182  if requiredTagInfo == tagInfo :
183  tagInfoCovered = True
184  break
185  if not tagInfoCovered :
186  requiredTagInfos.append(requiredTagInfo)
187  ## load sequences and setups needed for btagging
188  if hasattr( process, 'candidateJetProbabilityComputer' ) == False :
189  if loadStdRecoBTag: # also loading modules already run in the standard reconstruction
190  process.load("RecoBTag.ImpactParameter.impactParameter_cff")
191  process.load("RecoBTag.SecondaryVertex.secondaryVertex_cff")
192  process.load("RecoBTag.SoftLepton.softLepton_cff")
193  process.load("RecoBTag.Combined.combinedMVA_cff")
194  process.load("RecoBTag.CTagging.cTagging_cff")
195  else: # to prevent loading of modules already run in the standard reconstruction
196  process.load("RecoBTag.ImpactParameter.impactParameter_EventSetup_cff")
197  process.load("RecoBTag.SecondaryVertex.secondaryVertex_EventSetup_cff")
198  process.load("RecoBTag.SoftLepton.softLepton_EventSetup_cff")
199  process.load("RecoBTag.Combined.combinedMVA_EventSetup_cff")
200  process.load("RecoBTag.CTagging.cTagging_EventSetup_cff")
203 
204  ## setup all required btagInfos : we give a dedicated treatment for different
205  ## types of tagInfos here. A common treatment is possible but might require a more
206  ## general approach anyway in coordination with the btagging POG.
207  acceptedTagInfos = list()
208  for btagInfo in requiredTagInfos:
209  if hasattr(btag,btagInfo):
210  if btagInfo == 'pfImpactParameterTagInfos':
211  setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterTagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates))
212  if explicitJTA:
213  _btagInfo = getattr(process, btagInfo+labelName+postfix)
214  _btagInfo.explicitJTA = cms.bool(explicitJTA)
215  if btagInfo == 'pfImpactParameterAK8TagInfos':
216  setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterAK8TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates))
217  if explicitJTA:
218  _btagInfo = getattr(process, btagInfo+labelName+postfix)
219  _btagInfo.explicitJTA = cms.bool(explicitJTA)
220  if btagInfo == 'pfImpactParameterCA15TagInfos':
221  setattr(process, btagInfo+labelName+postfix, btag.pfImpactParameterCA15TagInfos.clone(jets = jetSource,primaryVertex=pvSource,candidates=pfCandidates))
222  if explicitJTA:
223  _btagInfo = getattr(process, btagInfo+labelName+postfix)
224  _btagInfo.explicitJTA = cms.bool(explicitJTA)
225  if btagInfo == 'pfSecondaryVertexTagInfos':
226  setattr(process, btagInfo+labelName+postfix, btag.pfSecondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix)))
227  if btagInfo == 'pfInclusiveSecondaryVertexFinderTagInfos':
228  setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource))
229  if svClustering:
230  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
231  if btagInfo == 'pfInclusiveSecondaryVertexFinderAK8TagInfos':
232  setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderAK8TagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterAK8TagInfos'+labelName+postfix), extSVCollection=svSource))
233  if svClustering:
234  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
235  if btagInfo == 'pfInclusiveSecondaryVertexFinderCA15TagInfos':
236  setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderCA15TagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterCA15TagInfos'+labelName+postfix), extSVCollection=svSource))
237  if svClustering:
238  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
239  if btagInfo == 'pfInclusiveSecondaryVertexFinderCvsLTagInfos':
240  setattr(
241  process,
242  btagInfo+labelName+postfix,
243  btag.pfInclusiveSecondaryVertexFinderCvsLTagInfos.clone(
244  trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix),
245  extSVCollection=svSource
246  )
247  )
248  if svClustering:
249  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
250  if btagInfo == 'pfInclusiveSecondaryVertexFinderCvsBTagInfos':
251  setattr(
252  process,
253  btagInfo+labelName+postfix,
254  btag.pfInclusiveSecondaryVertexFinderCvsBTagInfos.clone(
255  trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix),
256  extSVCollection=svSource
257  )
258  )
259  if svClustering:
260  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
261  if btagInfo == 'pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos':
262  setattr(
263  process,
264  btagInfo+labelName+postfix,
265  btag.pfInclusiveSecondaryVertexFinderNegativeCvsLTagInfos.clone(
266  trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix),
267  extSVCollection=svSource
268  )
269  )
270  if svClustering:
271  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
272  if btagInfo == 'pfSecondaryVertexNegativeTagInfos':
273  setattr(process, btagInfo+labelName+postfix, btag.pfSecondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix)))
274  if btagInfo == 'pfInclusiveSecondaryVertexFinderNegativeTagInfos':
275  setattr(process, btagInfo+labelName+postfix, btag.pfInclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('pfImpactParameterTagInfos'+labelName+postfix), extSVCollection=svSource))
276  if svClustering:
277  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
278  if btagInfo == 'impactParameterTagInfos':
279  setattr(process, btagInfo+labelName+postfix, btag.impactParameterTagInfos.clone(jetTracks = cms.InputTag('jetTracksAssociatorAtVertex'+labelName+postfix), primaryVertex=pvSource))
280  if btagInfo == 'secondaryVertexTagInfos':
281  setattr(process, btagInfo+labelName+postfix, btag.secondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix)))
282  if btagInfo == 'inclusiveSecondaryVertexFinderTagInfos':
283  setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix)))
284  if svClustering:
285  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
286  if btagInfo == 'inclusiveSecondaryVertexFinderFilteredTagInfos':
287  setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix)))
288  if svClustering:
289  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
290  if btagInfo == 'secondaryVertexNegativeTagInfos':
291  setattr(process, btagInfo+labelName+postfix, btag.secondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix)))
292  if btagInfo == 'inclusiveSecondaryVertexFinderNegativeTagInfos':
293  setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix)))
294  if svClustering:
295  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
296  if btagInfo == 'inclusiveSecondaryVertexFinderFilteredNegativeTagInfos':
297  setattr(process, btagInfo+labelName+postfix, btag.inclusiveSecondaryVertexFinderFilteredNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+labelName+postfix)))
298  if svClustering:
299  setupSVClustering(getattr(process, btagInfo+labelName+postfix), algo, rParam, fatJets, groomedFatJets)
300  if btagInfo == 'softMuonTagInfos':
301  setattr(process, btagInfo+labelName+postfix, btag.softMuonTagInfos.clone(jets = jetSource, primaryVertex=pvSource))
302  if btagInfo == 'softPFMuonsTagInfos':
303  setattr(process, btagInfo+labelName+postfix, btag.softPFMuonsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, muons=muSource))
304  if btagInfo == 'softPFElectronsTagInfos':
305  setattr(process, btagInfo+labelName+postfix, btag.softPFElectronsTagInfos.clone(jets = jetSource, primaryVertex=pvSource, electrons=elSource))
306  acceptedTagInfos.append(btagInfo)
307  elif hasattr(toptag, btagInfo) :
308  acceptedTagInfos.append(btagInfo)
309  else:
310  print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagInfo)
311  ## setup all required btagDiscriminators
312  acceptedBtagDiscriminators = list()
313  for btagDiscr in btagDiscriminators :
314  if hasattr(btag,btagDiscr):
315  setattr(process, btagDiscr+labelName+postfix, getattr(btag, btagDiscr).clone(tagInfos = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix) for x in supportedBtagDiscr[btagDiscr] ] )))
316  acceptedBtagDiscriminators.append(btagDiscr)
317  else:
318  print ' --> %s ignored, since not available via RecoBTag.Configuration.RecoBTag_cff!'%(btagDiscr)
319  ## replace corresponding tags for pat jet production
320  patJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix) for x in acceptedTagInfos ] )
321  patJets.discriminatorSources = cms.VInputTag( *[ cms.InputTag(x+labelName+postfix) for x in acceptedBtagDiscriminators ] )
322  if len(acceptedBtagDiscriminators) > 0 :
323  patJets.addBTagInfo = True
324  if runIVF:
325  rerunningIVF()
326  if 'pfInclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
327  if not hasattr( process, 'inclusiveCandidateVertexing' ):
328  process.load( 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
329  if 'inclusiveSecondaryVertexFinderTagInfos' in acceptedTagInfos:
330  if not hasattr( process, 'inclusiveVertexing' ):
331  process.load( 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
332  if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
333  if not hasattr( process, 'inclusiveVertexing' ):
334  process.load( 'RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff' )
335  if 'inclusiveSecondaryVertexFinderFilteredTagInfos' in acceptedTagInfos:
336  if not hasattr( process, 'inclusiveSecondaryVerticesFiltered' ):
337  process.load( 'RecoBTag.SecondaryVertex.inclusiveSecondaryVerticesFiltered_cfi' )
338  if not hasattr( process, 'bToCharmDecayVertexMerged' ):
339  process.load( 'RecoBTag.SecondaryVertex.bToCharmDecayVertexMerger_cfi' )
340  if 'caTopTagInfos' in acceptedTagInfos :
341  patJets.addTagInfos = True
342  if not hasattr( process, 'caTopTagInfos' ) and not hasattr( process, 'caTopTagInfosAK8' ):
343  process.load( 'RecoJets.JetProducers.caTopTaggers_cff' )
344 
def setupSVClustering
Definition: jetTools.py:162
def rerunningIVF
Definition: jetTools.py:1304
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def jetTools.setupJetCorrections (   process,
  knownModules,
  jetCorrections,
  jetSource,
  pvSource,
  patJets,
  labelName,
  postfix 
)

Definition at line 24 of file jetTools.py.

References clone(), KineDebug3.count(), and split.

Referenced by jetTools.AddJetCollection.toolCode(), and jetTools.UpdateJetCollection.toolCode().

24 
25 def setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, patJets, labelName, postfix):
26  ## determine type of jet constituents from jetSource; supported
27  ## jet constituent types are calo, pf, jpt, for pf also particleflow
28  ## is aloowed as part of the jetSource label, which might be used
29  ## in CommonTools.ParticleFlow
30  _type="NONE"
31  if jetCorrections[0].count('PF')>0:
32  _type='PF'
33  elif jetCorrections[0].count('Calo')>0:
34  _type='Calo'
35  elif jetCorrections[0].count('JPT')>0:
36  _type='JPT'
37  else:
38  raise TypeError("In addJetCollection: Jet energy corrections are only supported for PF, JPT and Calo jets.")
39  from PhysicsTools.PatAlgos.recoLayer0.jetCorrFactors_cfi import patJetCorrFactors
40  if 'patJetCorrFactors'+labelName+postfix in knownModules :
41  _newPatJetCorrFactors=getattr(process, 'patJetCorrFactors'+labelName+postfix)
42  _newPatJetCorrFactors.src=jetSource
43  _newPatJetCorrFactors.primaryVertices=pvSource
44  else:
45  setattr(process, 'patJetCorrFactors'+labelName+postfix, patJetCorrFactors.clone(src=jetSource, primaryVertices=pvSource))
46  _newPatJetCorrFactors=getattr(process, "patJetCorrFactors"+labelName+postfix)
47  _newPatJetCorrFactors.payload=jetCorrections[0]
48  _newPatJetCorrFactors.levels=jetCorrections[1]
49  ## check whether L1Offset or L1FastJet is part of levels
50  error=False
51  for x in jetCorrections[1]:
52  if x == 'L1Offset' :
53  if not error :
54  _newPatJetCorrFactors.useNPV=True
55  _newPatJetCorrFactors.primaryVertices='offlinePrimaryVertices'
56  _newPatJetCorrFactors.useRho=False
57  ## we set this to True now as a L1 correction type should appear only once
58  ## otherwise levels is miss configured
59  error=True
60  else:
61  raise ValueError, "In addJetCollection: Correction levels for jet energy corrections are miss configured. An L1 correction type should appear not more than \
62  once. Check the list of correction levels you requested to be applied: ", jetCorrections[1]
63  if x == 'L1FastJet' :
64  if not error :
65  if _type == "JPT" :
66  raise TypeError("In addJetCollection: L1FastJet corrections are only supported for PF and Calo jets.")
67  ## configure module
68  _newPatJetCorrFactors.useRho=True
69  if "PF" in _type :
70  _newPatJetCorrFactors.rho=cms.InputTag('fixedGridRhoFastjetAll')
71  else :
72  _newPatJetCorrFactors.rho=cms.InputTag('fixedGridRhoFastjetAllCalo')
73  ## we set this to True now as a L1 correction type should appear only once
74  ## otherwise levels is miss configured
75  error=True
76  else:
77  raise ValueError, "In addJetCollection: Correction levels for jet energy corrections are miss configured. An L1 correction type should appear not more than \
78  once. Check the list of correction levels you requested to be applied: ", jetCorrections[1]
79  patJets.jetCorrFactorsSource=cms.VInputTag(cms.InputTag('patJetCorrFactors'+labelName+postfix))
80  ## configure MET(Type1) corrections
81  if jetCorrections[2].lower() != 'none' and jetCorrections[2] != '':
82  if not jetCorrections[2].lower() == 'type-1' and not jetCorrections[2].lower() == 'type-2':
83  raise valueError, "In addJetCollection: Wrong choice of MET corrections for new jet collection. Possible choices are None (or empty string), Type-1, Type-2 (i.e.\
84  Type-1 and Type-2 corrections applied). This choice is not case sensitive. Your choice was: ", jetCorrections[2]
85  if _type == "JPT":
86  raise ValueError("In addJecCollection: MET(type1) corrections are not supported for JPTJets. Please set the MET-LABEL to \"None\" (as string in quatiation \
87  marks) and use raw tcMET together with JPTJets.")
88  ## set up jet correctors for MET corrections
89  process.load( "JetMETCorrections.Configuration.JetCorrectorsAllAlgos_cff") # FIXME: This adds a lot of garbage
90 
91  _payloadType = jetCorrections[0].split(_type)[0].lower()+_type
92  if "PF" in _type :
93  setattr(process, jetCorrections[0]+'L1FastJet', getattr(process, _payloadType+'L1FastjetCorrector').clone(srcRho=cms.InputTag('fixedGridRhoFastjetAll')))
94  else :
95  setattr(process, jetCorrections[0]+'L1FastJet', getattr(process, _payloadType+'L1FastjetCorrector').clone(srcRho=cms.InputTag('fixedGridRhoFastjetAllCalo')))
96  setattr(process, jetCorrections[0]+'L1Offset', getattr(process, _payloadType+'L1OffsetCorrector').clone())
97  setattr(process, jetCorrections[0]+'L2Relative', getattr(process, _payloadType+'L2RelativeCorrector').clone())
98  setattr(process, jetCorrections[0]+'L3Absolute', getattr(process, _payloadType+'L3AbsoluteCorrector').clone())
99  setattr(process, jetCorrections[0]+'L2L3Residual', getattr(process, _payloadType+'ResidualCorrector').clone())
100  setattr(process, jetCorrections[0]+'CombinedCorrector', cms.EDProducer( 'ChainedJetCorrectorProducer', correctors = cms.VInputTag()))
101  for x in jetCorrections[1]:
102  if x != 'L1FastJet' and x != 'L1Offset' and x != 'L2Relative' and x != 'L3Absolute' and x != 'L2L3Residual':
103  raise ValueError('In addJetCollection: Unsupported JEC for MET(Type1). Currently supported jet correction levels are L1FastJet, L1Offset, L2Relative, L3Asolute, L2L3Residual. Requested was: %s'%(x))
104  else:
105  _corrector = _payloadType
106  if x == 'L1FastJet':
107  _corrector += 'L1Fastjet'
108  elif x == 'L2L3Residual':
109  _corrector += 'Residual'
110  else:
111  _corrector += x
112  _corrector += 'Corrector'
113  getattr(process, jetCorrections[0]+'CombinedCorrector').correctors.append(cms.InputTag(_corrector))
114 
115  ## set up MET(Type1) correction modules
116  _labelCorrName = labelName
117  if labelName != '':
118  _labelCorrName = 'For' + labelName
119  if _type == 'Calo':
120  from JetMETCorrections.Type1MET.correctionTermsCaloMet_cff import corrCaloMetType1
121  from JetMETCorrections.Type1MET.correctionTermsCaloMet_cff import corrCaloMetType2
122  from JetMETCorrections.Type1MET.correctedMet_cff import caloMetT1
123  from JetMETCorrections.Type1MET.correctedMet_cff import caloMetT1T2
124  setattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, corrCaloMetType1.clone(src=jetSource,srcMET = "caloMetM",jetCorrLabel = cms.InputTag(jetCorrections[0]+'CombinedCorrector')))
125  setattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr2'+postfix, corrCaloMetType2.clone(srcUnclEnergySums = cms.VInputTag(cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type2'),cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'offset'),cms.InputTag('muCaloMetCorr'))))
126  setattr(process,jetCorrections[0]+_labelCorrName+'Type1CorMet'+postfix, caloMetT1.clone(src = "caloMetM", srcCorrections = cms.VInputTag(cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type1'))))
127  setattr(process,jetCorrections[0]+_labelCorrName+'Type1p2CorMet'+postfix, caloMetT1T2.clone(src = "caloMetM", srcCorrections = cms.VInputTag(cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type1'), cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr2'+postfix))))
128 
129  elif _type == 'PF':
131  from JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff import pfCandsNotInJetsPtrForMetCorr
132  from JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff import pfCandsNotInJetsForMetCorr
137  from JetMETCorrections.Type1MET.correctedMet_cff import pfMetT1T2
138  setattr(process,jetCorrections[0]+_labelCorrName+'pfJetsPtrForMetCorr'+postfix,pfJetsPtrForMetCorr.clone(src = jetSource))
139  setattr(process,jetCorrections[0]+_labelCorrName+'pfCandsNotInJetsPtrForMetCorr'+postfix,pfCandsNotInJetsPtrForMetCorr.clone(topCollection = jetCorrections[0]+_labelCorrName+'pfJetsPtrForMetCorr'+postfix))
140  setattr(process,jetCorrections[0]+_labelCorrName+'pfCandsNotInJetsForMetCorr'+postfix,pfCandsNotInJetsForMetCorr.clone(src = jetCorrections[0]+_labelCorrName+'pfCandsNotInJetsPtrForMetCorr'+postfix))
141  setattr(process,jetCorrections[0]+_labelCorrName+'CandMETcorr'+postfix, pfCandMETcorr.clone(src = cms.InputTag(jetCorrections[0]+_labelCorrName+'pfCandsNotInJetsForMetCorr'+postfix)))
142  setattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, corrPfMetType1.clone(src = jetSource, jetCorrLabel = cms.InputTag(jetCorrections[0]+'CombinedCorrector'))) # FIXME: Originally w/o jet corrections?
143  setattr(process,jetCorrections[0]+_labelCorrName+'corrPfMetType2'+postfix, corrPfMetType2.clone(srcUnclEnergySums = cms.VInputTag(cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type2'),cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'offset'),cms.InputTag(jetCorrections[0]+_labelCorrName+'CandMETcorr'+postfix))))
144  setattr(process,jetCorrections[0]+_labelCorrName+'Type1CorMet'+postfix, pfMetT1.clone(srcCorrections = cms.VInputTag(cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type1'))))
145  setattr(process,jetCorrections[0]+_labelCorrName+'Type1p2CorMet'+postfix, pfMetT1T2.clone(srcCorrections = cms.VInputTag(cms.InputTag(jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix, 'type1'), jetCorrections[0]+_labelCorrName+'corrPfMetType2'+postfix)))
146 
147  ## common configuration for Calo and PF
148  if ('L1FastJet' in jetCorrections[1] or 'L1Fastjet' in jetCorrections[1]):
149  getattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix).offsetCorrLabel = cms.InputTag(jetCorrections[0]+'L1FastJet')
150  #FIXME: What is wrong here?
151  #elif ('L1Offset' in jetCorrections[1]):
152  #getattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix).offsetCorrLabel = cms.InputTag(jetCorrections[0]+'L1Offset')
153  else:
154  getattr(process,jetCorrections[0]+_labelCorrName+'JetMETcorr'+postfix).offsetCorrLabel = cms.InputTag('')
155 
157  if jetCorrections[2].lower() == 'type-1':
158  setattr(process, 'patMETs'+labelName+postfix, patMETs.clone(metSource = cms.InputTag(jetCorrections[0]+_labelCorrName+'Type1CorMet'+postfix), addMuonCorrections = False))
159  elif jetCorrections[2].lower() == 'type-2':
160  setattr(process, 'patMETs'+labelName+postfix, patMETs.clone(metSource = cms.InputTag(jetCorrections[0]+_labelCorrName+'Type1p2CorMet'+postfix), addMuonCorrections = False))
161 
def setupJetCorrections
Definition: jetTools.py:24
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
double split
Definition: MVATrainer.cc:139
def jetTools.setupSVClustering (   btagInfo,
  algo,
  rParam,
  fatJets = cms.InputTag(''),
  groomedFatJets = cms.InputTag('') 
)

Definition at line 162 of file jetTools.py.

References setupBTagging().

Referenced by setupBTagging().

163 def setupSVClustering(btagInfo, algo, rParam, fatJets=cms.InputTag(''), groomedFatJets=cms.InputTag('')):
164  btagInfo.useSVClustering = cms.bool(True)
165  btagInfo.jetAlgorithm = cms.string(algo)
166  btagInfo.rParam = cms.double(rParam)
167  ## if the jets is actually a subjet
168  if fatJets != cms.InputTag('') and groomedFatJets != cms.InputTag(''):
169  btagInfo.fatJets = fatJets
170  btagInfo.groomedFatJets = groomedFatJets
171 
def setupSVClustering
Definition: jetTools.py:162
def jetTools.undefinedLabelName (   obj)

Definition at line 1288 of file jetTools.py.

Referenced by jetTools.AddJetCollection.toolCode().

1289 def undefinedLabelName(obj):
1290  print "-------------------------------------------------------"
1291  print " Error: the jet 'labelName' is not defined."
1292  print " All added jets must have 'labelName' defined."
1293  print "-------------------------------------------------------"
1294  raise KeyError("Undefined jet 'labelName' used in '"+obj._label+"'")
def undefinedLabelName
Definition: jetTools.py:1288
def jetTools.unsupportedJetAlgorithm (   obj)

Definition at line 1295 of file jetTools.py.

Referenced by jetTools.AddJetCollection.toolCode(), and jetTools.UpdateJetCollection.toolCode().

1296 def unsupportedJetAlgorithm(obj):
1297  print "-------------------------------------------------------"
1298  print " Error: Unsupported jet algorithm detected."
1299  print " The supported algorithms are:"
1300  for key in supportedJetAlgos.keys():
1301  print " " + key.upper() + ", " + key.lower() + ": " + supportedJetAlgos[key]
1302  print "-------------------------------------------------------"
1303  raise KeyError("Unsupported jet algorithm used in '"+obj._label+"'")
def unsupportedJetAlgorithm
Definition: jetTools.py:1295

Variable Documentation

dictionary jetTools.supportedJetAlgos
Initial value:
1 = {
2  'ak' : 'AntiKt'
3  , 'ca' : 'CambridgeAachen'
4  , 'kt' : 'Kt'
5 }

dictionary with supported jet clustering algorithms

Definition at line 10 of file jetTools.py.