CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
jetTools.AddJetCollection Class Reference
Inheritance diagram for jetTools.AddJetCollection:

Public Member Functions

def __call__
 
def __init__
 
def getDefaultParameters
 
def toolCode
 

Private Attributes

 _comment
 add comments More...
 
 _parameters
 initialization of the base class More...
 

Static Private Attributes

tuple _defaultParameters = dicttypes.SortedKeysDict()
 
string _label = 'addJetCollection'
 

Detailed Description

Tool to add a new jet collection to your PAT Tuple or to modify an existing one.

Definition at line 334 of file jetTools.py.

Constructor & Destructor Documentation

def jetTools.AddJetCollection.__init__ (   self)
Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase to be usable in the configEditor.

Definition at line 341 of file jetTools.py.

References editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, jetTools.AddJetCollection._defaultParameters, root::helper::RootFunctionAdapter< F, args >.addParameter(), root::helper::RootFunctionHelper< F, args, Tag >.addParameter(), ParameterMgr.addParameter(), fit::RootMinuit< Function >.addParameter(), DropBoxMetadata::Parameters.addParameter(), PythonParameterSet.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

342  def __init__(self):
343  """
344  Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase to be usable in the configEditor.
345  """
346  ## initialization of the base class
347  ConfigToolBase.__init__(self)
348  ## add all parameters that should be known to the class
349  self.addParameter(self._defaultParameters,'labelName', 'UNDEFINED', "Label name of the new patJet collection.", str)
350  self.addParameter(self._defaultParameters,'postfix','', "Postfix from usePF2PAT.", str)
351  self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag)
352  self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('particleFlow'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag)
353  self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association")
354  self.addParameter(self._defaultParameters,'pvSource',cms.InputTag('offlinePrimaryVertices'), "Label of the input collection for primary vertices used in b-tagging", cms.InputTag)
355  self.addParameter(self._defaultParameters,'svSource',cms.InputTag('inclusiveCandidateSecondaryVertices'), "Label of the input collection for IVF vertices used in b-tagging", cms.InputTag)
356  self.addParameter(self._defaultParameters,'elSource',cms.InputTag('gedGsfElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag)
357  self.addParameter(self._defaultParameters,'muSource',cms.InputTag('muons'), "Label of the input collection for muons used in b-tagging", cms.InputTag)
358  self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction")
359  self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules")
360  self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)")
361  self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag)
362  self.addParameter(self._defaultParameters,'groomedFatJets', cms.InputTag(''), "Groomed fat jet collection used for secondary vertex clustering", cms.InputTag)
363  self.addParameter(self._defaultParameters,'algo', 'AK', "Jet algorithm of the input collection from which the new patJet collection should be created")
364  self.addParameter(self._defaultParameters,'rParam', 0.4, "Jet size (distance parameter R used in jet clustering)")
365  self.addParameter(self._defaultParameters,'getJetMCFlavour', True, "Get jet MC truth flavour")
366  self.addParameter(self._defaultParameters,'genJetCollection', cms.InputTag("ak4GenJets"), "GenJet collection to match to", cms.InputTag)
367  self.addParameter(self._defaultParameters,'genParticles', cms.InputTag("genParticles"), "GenParticle collection to be used", cms.InputTag)
368  self.addParameter(self._defaultParameters,'jetCorrections',None, "Add all relevant information about jet energy corrections that you want to be added to your new patJet \
369  collection. The format has to be given in a python tuple of type: (\'AK4Calo\',[\'L2Relative\', \'L3Absolute\'], patMet). Here the first argument corresponds to the payload \
370  in the CMS Conditions database for the given jet collection; the second argument corresponds to the jet energy correction levels that you want to be embedded into your \
371  new patJet collection. This should be given as a list of strings. Available values are L1Offset, L1FastJet, L1JPTOffset, L2Relative, L3Absolute, L5Falvour, L7Parton; the \
372  third argument indicates whether MET(Type1/2) corrections should be applied corresponding to the new patJetCollection. If so a new patMet collection will be added to your PAT \
373  Tuple in addition to the raw patMet. This new patMet collection will have the MET(Type1/2) corrections applied. The argument can have the following types: \'type-1\' for \
374  type-1 corrected MET; \'type-2\' for type-1 plus type-2 corrected MET; \'\' or \'none\' if no further MET corrections should be applied to your MET. The arguments \'type-1\' \
375  and \'type-2\' are not case sensitive.", tuple, acceptNoneValue=True)
376  self.addParameter(self._defaultParameters,'btagDiscriminators',['None'], "If you are interested in btagging, in most cases just the labels of the btag discriminators that \
377  you are interested in is all relevant information that you need for a high level analysis. Add here all btag discriminators, that you are interested in as a list of strings. \
378  If this list is empty no btag discriminator information will be added to your new patJet collection.", allowedValues=supportedBtagDiscr.keys(),Type=list)
379  self.addParameter(self._defaultParameters,'btagInfos',['None'], "The btagInfos objects contain all relevant information from which all discriminators of a certain \
380  type have been calculated. You might be interested in keeping this information for low level tests or to re-calculate some discriminators from hand. Note that this information \
381  on the one hand can be very space consuming and that it is not necessary to access the pre-calculated btag discriminator information that has been derived from it. Only in very \
382  special cases the btagInfos might really be needed in your analysis. Add here all btagInfos, that you are interested in as a list of strings. If this list is empty no btagInfos \
383  will be added to your new patJet collection.", allowedValues=supportedBtagInfos,Type=list)
384  self.addParameter(self._defaultParameters,'jetTrackAssociation',False, "Add JetTrackAssociation and JetCharge from reconstructed tracks to your new patJet collection. This \
385  switch is only of relevance if you don\'t add any btag information to your new patJet collection (btagDiscriminators or btagInfos) and still want this information added to \
386  your new patJetCollection. If btag information of any form is added to the new patJet collection this information will be added automatically.")
387  self.addParameter(self._defaultParameters,'outputModules',['out'],"Add a list of all output modules to which you would like the new jet collection to be added. Usually this is \
388  just one single output module with name \'out\', which corresponds also the default configuration of the tool. There is cases though where you might want to add this collection \
389  to more than one output module.")
390  ## set defaults
391  self._parameters=copy.deepcopy(self._defaultParameters)
392  ## add comments
393  self._comment = "This is a tool to add more patJet collectinos to your PAT Tuple or to re-configure the default collection. You can add and embed additional information like jet\
394  energy correction factors, btag infomration and generator match information to the new patJet collection depending on the parameters that you pass on to this function. Consult \
395  the descriptions of each parameter for more information."
_parameters
initialization of the base class
Definition: jetTools.py:390
_comment
add comments
Definition: jetTools.py:392

Member Function Documentation

def jetTools.AddJetCollection.__call__ (   self,
  process,
  labelName = None,
  postfix = None,
  jetSource = None,
  pfCandidates = None,
  explicitJTA = None,
  pvSource = None,
  svSource = None,
  elSource = None,
  muSource = None,
  runIVF = None,
  loadStdRecoBTag = None,
  svClustering = None,
  fatJets = None,
  groomedFatJets = None,
  algo = None,
  rParam = None,
  getJetMCFlavour = None,
  genJetCollection = None,
  genParticles = None,
  jetCorrections = None,
  btagDiscriminators = None,
  btagInfos = None,
  jetTrackAssociation = None,
  outputModules = None 
)
Function call wrapper. This will check the parameters and call the actual implementation that
can be found in toolCode via the base class function apply.

Definition at line 402 of file jetTools.py.

References editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, jetTools.AddJetCollection._defaultParameters, SignedImpactParameter3D.apply(), gen::PhotosInterfaceBase.apply(), SignedTransverseImpactParameter.apply(), MatrixReader.MatrixReader.apply, SignedDecayLength3D.apply(), HcalDeterministicFit.apply(), DummyOOTPileupCorrection.apply(), gen::PhotosppInterface.apply(), FWPSetCellEditor.apply(), gen::PhotosInterface.apply(), SurveyParameters.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), ConfigToolBase.ConfigToolBase.apply(), OOTPileupCorrData.apply(), BowedSurfaceAlignmentParameters.apply(), AlignmentParameters.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.apply(), AbsOOTPileupCorrection.apply(), TwoBowedSurfacesAlignmentParameters.apply(), Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), PulseShapeFitOOTPileupCorrection.apply(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog.apply(), reco::Add< T >.apply(), reco::Sub< T >.apply(), reco::Mul< T >.apply(), reco::Div< T >.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), reco::And< bool >.apply(), reco::Or< bool >.apply(), reco::Less< T >.apply(), reco::LessEqual< T >.apply(), reco::More< T >.apply(), reco::MoreEqual< T >.apply(), reco::Equal< T >.apply(), npstat::ArrayND< Numeric >.apply(), npstat::ArrayND< Num1, Len1, Dim1 >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), Config.ProcessModifier.apply(), ora::OraMainTable.setParameter(), ora::IMainTable.setParameter(), PedeReader.setParameter(), ora::PoolMainTable.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

403  def __call__(self,process,labelName=None,postfix=None,jetSource=None,pfCandidates=None,explicitJTA=None,pvSource=None,svSource=None,elSource=None,muSource=None,runIVF=None,loadStdRecoBTag=None,svClustering=None,fatJets=None,groomedFatJets=None,algo=None,rParam=None,getJetMCFlavour=None,genJetCollection=None,genParticles=None,jetCorrections=None,btagDiscriminators=None,btagInfos=None,jetTrackAssociation=None,outputModules=None):
404  """
405  Function call wrapper. This will check the parameters and call the actual implementation that
406  can be found in toolCode via the base class function apply.
407  """
408  if labelName is None:
409  labelName=self._defaultParameters['labelName'].value
410  self.setParameter('labelName', labelName)
411  if postfix is None:
412  postfix=self._defaultParameters['postfix'].value
413  self.setParameter('postfix', postfix)
414  if jetSource is None:
415  jetSource=self._defaultParameters['jetSource'].value
416  self.setParameter('jetSource', jetSource)
417  if pfCandidates is None:
418  pfCandidates=self._defaultParameters['pfCandidates'].value
419  self.setParameter('pfCandidates', pfCandidates)
420  if explicitJTA is None:
421  explicitJTA=self._defaultParameters['explicitJTA'].value
422  self.setParameter('explicitJTA', explicitJTA)
423  if pvSource is None:
424  pvSource=self._defaultParameters['pvSource'].value
425  self.setParameter('pvSource', pvSource)
426  if svSource is None:
427  svSource=self._defaultParameters['svSource'].value
428  self.setParameter('svSource', svSource)
429  if elSource is None:
430  elSource=self._defaultParameters['elSource'].value
431  self.setParameter('elSource', elSource)
432  if muSource is None:
433  muSource=self._defaultParameters['muSource'].value
434  self.setParameter('muSource', muSource)
435  if runIVF is None:
436  runIVF=self._defaultParameters['runIVF'].value
437  self.setParameter('runIVF', runIVF)
438  if loadStdRecoBTag is None:
439  loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value
440  self.setParameter('loadStdRecoBTag', loadStdRecoBTag)
441  if svClustering is None:
442  svClustering=self._defaultParameters['svClustering'].value
443  self.setParameter('svClustering', svClustering)
444  if fatJets is None:
445  fatJets=self._defaultParameters['fatJets'].value
446  self.setParameter('fatJets', fatJets)
447  if groomedFatJets is None:
448  groomedFatJets=self._defaultParameters['groomedFatJets'].value
449  self.setParameter('groomedFatJets', groomedFatJets)
450  if algo is None:
451  algo=self._defaultParameters['algo'].value
452  self.setParameter('algo', algo)
453  if rParam is None:
454  rParam=self._defaultParameters['rParam'].value
455  self.setParameter('rParam', rParam)
456  if getJetMCFlavour is None:
457  getJetMCFlavour=self._defaultParameters['getJetMCFlavour'].value
458  self.setParameter('getJetMCFlavour', getJetMCFlavour)
459  if genJetCollection is None:
460  genJetCollection=self._defaultParameters['genJetCollection'].value
461  self.setParameter('genJetCollection', genJetCollection)
462  if genParticles is None:
463  genParticles=self._defaultParameters['genParticles'].value
464  self.setParameter('genParticles', genParticles)
465  if jetCorrections is None:
466  jetCorrections=self._defaultParameters['jetCorrections'].value
467  self.setParameter('jetCorrections', jetCorrections)
468  if btagDiscriminators is None:
469  btagDiscriminators=self._defaultParameters['btagDiscriminators'].value
470  self.setParameter('btagDiscriminators', btagDiscriminators)
471  if btagInfos is None:
472  btagInfos=self._defaultParameters['btagInfos'].value
473  self.setParameter('btagInfos', btagInfos)
474  if jetTrackAssociation is None:
475  jetTrackAssociation=self._defaultParameters['jetTrackAssociation'].value
476  self.setParameter('jetTrackAssociation', jetTrackAssociation)
477  if outputModules is None:
478  outputModules=self._defaultParameters['outputModules'].value
479  self.setParameter('outputModules', outputModules)
480  self.apply(process)
def jetTools.AddJetCollection.getDefaultParameters (   self)
Return default parameters of the class

Definition at line 396 of file jetTools.py.

References editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, and jetTools.AddJetCollection._defaultParameters.

397  def getDefaultParameters(self):
398  """
399  Return default parameters of the class
400  """
401  return self._defaultParameters
def jetTools.AddJetCollection.toolCode (   self,
  process 
)
Tool code implementation

Definition at line 481 of file jetTools.py.

References editorTools.UserCodeTool._parameters, heavyIonTools.ConfigureHeavyIons._parameters, coreTools.RunOnData._parameters, Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._parameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, editorTools.ChangeSource._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._parameters, coreTools.RemoveMCMatching._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, jetTools.AddJetCollection._parameters, jetTools.checkJetCorrectionsFormat(), list(), jetTools.setupBTagging(), jetTools.setupJetCorrections(), split, jetTools.undefinedLabelName(), jetTools.unsupportedJetAlgorithm(), and pileupCalc.upper.

482  def toolCode(self, process):
483  """
484  Tool code implementation
485  """
486  ## initialize parameters
487  labelName=self._parameters['labelName'].value
488  postfix=self._parameters['postfix'].value
489  jetSource=self._parameters['jetSource'].value
490  pfCandidates=self._parameters['pfCandidates'].value
491  explicitJTA=self._parameters['explicitJTA'].value
492  pvSource=self._parameters['pvSource'].value
493  svSource=self._parameters['svSource'].value
494  elSource=self._parameters['elSource'].value
495  muSource=self._parameters['muSource'].value
496  runIVF=self._parameters['runIVF'].value
497  loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value
498  svClustering=self._parameters['svClustering'].value
499  fatJets=self._parameters['fatJets'].value
500  groomedFatJets=self._parameters['groomedFatJets'].value
501  algo=self._parameters['algo'].value
502  rParam=self._parameters['rParam'].value
503  getJetMCFlavour=self._parameters['getJetMCFlavour'].value
504  genJetCollection=self._parameters['genJetCollection'].value
505  genParticles=self._parameters['genParticles'].value
506  jetCorrections=self._parameters['jetCorrections'].value
507  btagDiscriminators=list(self._parameters['btagDiscriminators'].value)
508  btagInfos=list(self._parameters['btagInfos'].value)
509  jetTrackAssociation=self._parameters['jetTrackAssociation'].value
510  outputModules=list(self._parameters['outputModules'].value)
511 
512  ## added jets must have a defined 'labelName'
513  if labelName=='UNDEFINED':
514  undefinedLabelName(self)
515 
516  ## a list of all producer modules, which are already known to process
517  knownModules = process.producerNames().split()
518  ## determine whether btagging information is required or not
519  if btagDiscriminators.count('None')>0:
520  btagDiscriminators.remove('None')
521  if btagInfos.count('None')>0:
522  btagInfos.remove('None')
523  bTagging=(len(btagDiscriminators)>0 or len(btagInfos)>0)
524  ## check if any legacy btag discriminators are being used
525  infos = 0
526  for info in btagInfos:
527  if info.startswith('pf'): infos = infos + 1
528  if 'softpf' in info.lower(): infos = infos + 1
529  tags = 0
530  for tag in btagDiscriminators:
531  if tag.startswith('pf'): tags = tags + 1
532  if 'softpf' in tag.lower(): tags = tags + 1
533  bTaggingLegacy=(len(btagDiscriminators)>tags or len(btagInfos)>infos)
534  ## construct postfix label for auxiliary modules; this postfix
535  ## label will start with a capitalized first letter following
536  ## the CMS naming conventions and for improved readablility
537  _labelName=labelName[:1].upper()+labelName[1:]
538 
539  ## supported algo types are ak, ca, and kt
540  _algo=''
541  for x in ["ak", "ca", "kt"]:
542  if x in algo.lower():
543  _algo=supportedJetAlgos[x]
544  break
545  if _algo=='':
547  ## add new patJets to process (keep instance for later further modifications)
549  if 'patJets'+_labelName+postfix in knownModules :
550  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
551  _newPatJets.jetSource=jetSource
552  else :
553  setattr(process, 'patJets'+_labelName+postfix, patJets.clone(jetSource=jetSource))
554  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
555  knownModules.append('patJets'+_labelName+postfix)
556  ## add new selectedPatJets to process
558  if 'selectedPatJets'+_labelName+postfix in knownModules :
559  _newSelectedPatJets=getattr(process, 'selectedPatJets'+_labelName+postfix)
560  _newSelectedPatJets.src='patJets'+_labelName+postfix
561  else :
562  setattr(process, 'selectedPatJets'+_labelName+postfix, selectedPatJets.clone(src='patJets'+_labelName+postfix))
563  knownModules.append('selectedPatJets'+_labelName+postfix)
564 
565  ## add new patJetPartonMatch to process
566  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetPartonMatch
567  if 'patJetPartonMatch'+_labelName+postfix in knownModules :
568  _newPatJetPartonMatch=getattr(process, 'patJetPartonMatch'+_labelName+postfix)
569  _newPatJetPartonMatch.src=jetSource
570  _newPatJetPartonMatch.matched=genParticles
571  else :
572  setattr(process, 'patJetPartonMatch'+_labelName+postfix, patJetPartonMatch.clone(src=jetSource, matched=genParticles))
573  knownModules.append('patJetPartonMatch'+_labelName+postfix)
574  ## add new patJetGenJetMatch to process
575  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetGenJetMatch
576  if 'patJetGenJetMatch'+_labelName+postfix in knownModules :
577  _newPatJetGenJetMatch=getattr(process, 'patJetGenJetMatch'+_labelName+postfix)
578  _newPatJetGenJetMatch.src=jetSource
579  _newPatJetGenJetMatch.maxDeltaR=rParam
580  _newPatJetGenJetMatch.matched=genJetCollection
581  else :
582  setattr(process, 'patJetGenJetMatch'+_labelName+postfix, patJetGenJetMatch.clone(src=jetSource, maxDeltaR=rParam, matched=genJetCollection))
583  knownModules.append('patJetGenJetMatch'+_labelName+postfix)
584  ## modify new patJets collection accordingly
585  _newPatJets.genJetMatch.setModuleLabel('patJetGenJetMatch'+_labelName+postfix)
586  _newPatJets.genPartonMatch.setModuleLabel('patJetPartonMatch'+_labelName+postfix)
587  ## get jet MC truth flavour if required by user
588  if (getJetMCFlavour):
589  ## legacy jet flavour (see https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools)
590  ## add new patJetPartonsLegacy to process
591  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonsLegacy
592  if 'patJetPartonsLegacy'+postfix not in knownModules :
593  setattr(process, 'patJetPartonsLegacy'+postfix, patJetPartonsLegacy.clone(src=genParticles))
594  knownModules.append('patJetPartonsLegacy'+postfix)
595  else:
596  getattr(process, 'patJetPartonsLegacy'+postfix).src=genParticles
597  ## add new patJetPartonAssociationLegacy to process
598  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonAssociationLegacy
599  if 'patJetPartonAssociationLegacy'+_labelName+postfix in knownModules :
600  _newPatJetPartonAssociation=getattr(process, 'patJetPartonAssociationLegacy'+_labelName+postfix)
601  _newPatJetPartonAssociation.jets=jetSource
602  else :
603  setattr(process, 'patJetPartonAssociationLegacy'+_labelName+postfix, patJetPartonAssociationLegacy.clone(jets=jetSource))
604  knownModules.append('patJetPartonAssociationLegacy'+_labelName+postfix)
605  ## add new patJetPartonAssociationLegacy to process
606  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociationLegacy
607  if 'patJetFlavourAssociationLegacy'+_labelName+postfix in knownModules :
608  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociationLegacy'+_labelName+postfix)
609  _newPatJetFlavourAssociation.srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix
610  else:
611  setattr(process, 'patJetFlavourAssociationLegacy'+_labelName+postfix, patJetFlavourAssociationLegacy.clone(srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix))
612  knownModules.append('patJetFlavourAssociationLegacy'+_labelName+postfix)
613  ## modify new patJets collection accordingly
614  _newPatJets.JetPartonMapSource.setModuleLabel('patJetFlavourAssociationLegacy'+_labelName+postfix)
615  ## new jet flavour (see https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools)
616  ## add new patJetPartons to process
618  if 'patJetPartons'+postfix not in knownModules :
619  setattr(process, 'patJetPartons'+postfix, patJetPartons.clone(particles=genParticles))
620  knownModules.append('patJetPartons'+postfix)
621  else:
622  getattr(process, 'patJetPartons'+postfix).particles=genParticles
623  ## add new patJetFlavourAssociation to process
624  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociation
625  if 'patJetFlavourAssociation'+_labelName+postfix in knownModules :
626  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
627  _newPatJetFlavourAssociation.jets=jetSource
628  _newPatJetFlavourAssociation.jetAlgorithm=_algo
629  _newPatJetFlavourAssociation.rParam=rParam
630  _newPatJetFlavourAssociation.bHadrons=cms.InputTag("patJetPartons"+postfix,"bHadrons")
631  _newPatJetFlavourAssociation.cHadrons=cms.InputTag("patJetPartons"+postfix,"cHadrons")
632  _newPatJetFlavourAssociation.partons=cms.InputTag("patJetPartons"+postfix,"algorithmicPartons")
633  _newPatJetFlavourAssociation.leptons=cms.InputTag("patJetPartons"+postfix,"leptons")
634  else :
635  setattr(process, 'patJetFlavourAssociation'+_labelName+postfix,
636  patJetFlavourAssociation.clone(
637  jets=jetSource,
638  jetAlgorithm=_algo,
639  rParam=rParam,
640  bHadrons = cms.InputTag("patJetPartons"+postfix,"bHadrons"),
641  cHadrons = cms.InputTag("patJetPartons"+postfix,"cHadrons"),
642  partons = cms.InputTag("patJetPartons"+postfix,"algorithmicPartons"),
643  leptons = cms.InputTag("patJetPartons"+postfix,"leptons")
644  )
645  )
646  knownModules.append('patJetFlavourAssociation'+_labelName+postfix)
647  ## modify new patJets collection accordingly
648  _newPatJets.JetFlavourInfoSource.setModuleLabel('patJetFlavourAssociation'+_labelName+postfix)
649  ## if the jets is actually a subjet
650  if fatJets != cms.InputTag('') and groomedFatJets != cms.InputTag(''):
651  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
652  _newPatJetFlavourAssociation.jets=fatJets
653  _newPatJetFlavourAssociation.groomedJets=groomedFatJets
654  _newPatJetFlavourAssociation.subjets=jetSource
655  _newPatJets.JetFlavourInfoSource=cms.InputTag('patJetFlavourAssociation'+_labelName+postfix,'SubJets')
656  else:
657  _newPatJets.getJetMCFlavour = False
658 
659  ## add jetTrackAssociation for legacy btagging (or jetTracksAssociation only) if required by user
660  if (jetTrackAssociation or bTaggingLegacy):
661  ## add new jetTracksAssociationAtVertex to process
662  from RecoJets.JetAssociationProducers.ak4JTA_cff import ak4JetTracksAssociatorAtVertex, ak4JetTracksAssociatorExplicit
663  if 'jetTracksAssociationAtVertex'+_labelName+postfix in knownModules :
664  _newJetTracksAssociationAtVertex=getattr(process, 'jetTracksAssociatorAtVertex'+_labelName+postfix)
665  _newJetTracksAssociationAtVertex.jets=jetSource
666  _newJetTracksAssociationAtVertex.pvSrc=pvSource
667  else:
668  jetTracksAssociator=ak4JetTracksAssociatorAtVertex
669  if explicitJTA:
670  jetTracksAssociator=ak4JetTracksAssociatorExplicit
671  setattr(process, 'jetTracksAssociatorAtVertex'+_labelName+postfix, jetTracksAssociator.clone(jets=jetSource,pvSrc=pvSource))
672  knownModules.append('jetTracksAssociationAtVertex'+_labelName+postfix)
673  ## add new patJetCharge to process
675  if 'patJetCharge'+_labelName+postfix in knownModules :
676  _newPatJetCharge=getattr(process, 'patJetCharge'+_labelName+postfix)
677  _newPatJetCharge.src='jetTracksAssociatorAtVertex'+_labelName+postfix
678  else:
679  setattr(process, 'patJetCharge'+_labelName+postfix, patJetCharge.clone(src = 'jetTracksAssociatorAtVertex'+_labelName+postfix))
680  knownModules.append('patJetCharge'+_labelName+postfix)
681  ## modify new patJets collection accordingly
682  _newPatJets.addAssociatedTracks=True
683  _newPatJets.trackAssociationSource=cms.InputTag('jetTracksAssociatorAtVertex'+_labelName+postfix)
684  _newPatJets.addJetCharge=True
685  _newPatJets.jetChargeSource=cms.InputTag('patJetCharge'+_labelName+postfix)
686  else:
687  ## modify new patJets collection accordingly
688  _newPatJets.addAssociatedTracks=False
689  _newPatJets.trackAssociationSource=''
690  _newPatJets.addJetCharge=False
691  _newPatJets.jetChargeSource=''
692  ## run btagging if required by user
693  if (bTagging):
694  setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, loadStdRecoBTag, svClustering, fatJets, groomedFatJets,
695  _algo, rParam, btagDiscriminators, btagInfos, _newPatJets, _labelName, postfix)
696  else:
697  _newPatJets.addBTagInfo = False
698  _newPatJets.addTagInfos = False
699  ## adjust output module; these collections will be empty anyhow, but we do it to stay clean
700  for outputModule in outputModules:
701  if hasattr(process,outputModule):
702  getattr(process,outputModule).outputCommands.append("drop *_"+'selected'+_labelName+postfix+"_tagInfos_*")
703 
704  ## add jet correction factors if required by user
705  if (jetCorrections != None):
706  ## check the jet corrections format
707  checkJetCorrectionsFormat(jetCorrections)
708  ## setup jet energy corrections and MET corrections
709  setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, _newPatJets, _labelName, postfix)
710  else:
711  ## switch jetCorrFactors off
712  _newPatJets.addJetCorrFactors=False
713 
714 addJetCollection=AddJetCollection()
def setupJetCorrections
Definition: jetTools.py:24
def undefinedLabelName
Definition: jetTools.py:1277
_parameters
initialization of the base class
Definition: jetTools.py:390
def setupBTagging
Definition: jetTools.py:173
def checkJetCorrectionsFormat
Definition: jetTools.py:16
def unsupportedJetAlgorithm
Definition: jetTools.py:1284
double split
Definition: MVATrainer.cc:139
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

Member Data Documentation

jetTools.AddJetCollection._comment
private

add comments

Definition at line 392 of file jetTools.py.

Referenced by runJetUncertainties.RunJetUncertainties.__init__(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__().

tuple jetTools.AddJetCollection._defaultParameters = dicttypes.SortedKeysDict()
staticprivate

Definition at line 339 of file jetTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), trackTools.MakeAODTrackCandidates.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), metTools.AddMETCollection.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), trigTools.SwitchOnTriggerStandAlone.__call__(), trackTools.MakeTrackCandidates.__call__(), tauTools.AddTauCollection.__call__(), trigTools.SwitchOnTriggerMatching.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), jetTools.AddJetCollection.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), jetTools.SwitchJetCollection.__call__(), jetTools.UpdateJetCollection.__call__(), jetTools.AddJetID.__call__(), jetTools.SetTagInfos.__call__(), metTools.AddMETCollection.__init__(), trackTools.MakeAODTrackCandidates.__init__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), HiCoreTools.RemoveMCMatching.__init__(), trackTools.MakePATTrackCandidates.__init__(), trigTools.SwitchOnTrigger.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), trigTools.SwitchOnTriggerStandAlone.__init__(), trackTools.MakeTrackCandidates.__init__(), tauTools.AddTauCollection.__init__(), trigTools.SwitchOnTriggerMatching.__init__(), HiCoreTools.RemoveCleaning.__init__(), jetTools.AddJetCollection.__init__(), HiCoreTools.AddCleaning.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), trigTools.SwitchOnTriggerMatchEmbedding.__init__(), jetTools.SwitchJetCollection.__init__(), jetTools.UpdateJetCollection.__init__(), jetTools.AddJetID.__init__(), jetTools.SetTagInfos.__init__(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), trackTools.MakeAODTrackCandidates.getDefaultParameters(), metTools.AddMETCollection.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), trigTools.SwitchOnTriggerStandAlone.getDefaultParameters(), trackTools.MakeTrackCandidates.getDefaultParameters(), tauTools.AddTauCollection.getDefaultParameters(), trigTools.SwitchOnTriggerMatching.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), jetTools.AddJetCollection.getDefaultParameters(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), trigTools.SwitchOnTriggerMatchEmbedding.getDefaultParameters(), jetTools.SwitchJetCollection.getDefaultParameters(), jetTools.UpdateJetCollection.getDefaultParameters(), jetTools.AddJetID.getDefaultParameters(), jetTools.SetTagInfos.getDefaultParameters(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

string jetTools.AddJetCollection._label = 'addJetCollection'
staticprivate

Definition at line 338 of file jetTools.py.

Referenced by validation.SimpleSample.digest(), validation.SimpleSample.label(), trigTools.SwitchOnTrigger.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), and trigTools.SwitchOnTriggerMatchEmbedding.toolCode().

jetTools.AddJetCollection._parameters
private

initialization of the base class

add all parameters that should be known to the class set defaults

Definition at line 390 of file jetTools.py.

Referenced by runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), HiCoreTools.RestrictInputToAOD.toolCode(), trackTools.MakeAODTrackCandidates.toolCode(), metTools.AddMETCollection.toolCode(), runJetUncertainties.RunJetUncertainties.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), trigTools.SwitchOnTrigger.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trackTools.MakeTrackCandidates.toolCode(), tauTools.AddTauCollection.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), jetTools.AddJetCollection.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), jetTools.SwitchJetCollection.toolCode(), jetTools.UpdateJetCollection.toolCode(), jetTools.AddJetID.toolCode(), and jetTools.SetTagInfos.toolCode().