CMS 3D CMS Logo

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__ (self, process, labelName=None, postfix=None, btagPrefix=None, jetSource=None, pfCandidates=None, explicitJTA=None, pvSource=None, svSource=None, elSource=None, muSource=None, runIVF=None, tightBTagNTkHits=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)
 
def __init__ (self)
 
def getDefaultParameters (self)
 
def toolCode (self, process)
 

Private Attributes

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

Static Private Attributes

 _defaultParameters
 
 _label
 

Detailed Description

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

Definition at line 481 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 488 of file jetTools.py.

References heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._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(), l1t::TriggerSystem.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

488  def __init__(self):
489  """
490  Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase to be usable in the configEditor.
491  """
492  ## initialization of the base class
493  ConfigToolBase.__init__(self)
494  ## add all parameters that should be known to the class
495  self.addParameter(self._defaultParameters,'labelName', 'UNDEFINED', "Label name of the new patJet collection.", str)
496  self.addParameter(self._defaultParameters,'postfix','', "Postfix from usePF2PAT.", str)
497  self.addParameter(self._defaultParameters,'btagPrefix','', "Prefix to be added to b-tag discriminator and TagInfo names", str)
498  self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag)
499  self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('particleFlow'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag)
500  self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association")
501  self.addParameter(self._defaultParameters,'pvSource',cms.InputTag('offlinePrimaryVertices'), "Label of the input collection for primary vertices used in b-tagging", cms.InputTag)
502  self.addParameter(self._defaultParameters,'svSource',cms.InputTag('inclusiveCandidateSecondaryVertices'), "Label of the input collection for IVF vertices used in b-tagging", cms.InputTag)
503  self.addParameter(self._defaultParameters,'elSource',cms.InputTag('gedGsfElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag)
504  self.addParameter(self._defaultParameters,'muSource',cms.InputTag('muons'), "Label of the input collection for muons used in b-tagging", cms.InputTag)
505  self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction")
506  self.addParameter(self._defaultParameters,'tightBTagNTkHits', False, "Enable legacy tight b-tag track selection")
507  self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules")
508  self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)")
509  self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag)
510  self.addParameter(self._defaultParameters,'groomedFatJets', cms.InputTag(''), "Groomed fat jet collection used for secondary vertex clustering", cms.InputTag)
511  self.addParameter(self._defaultParameters,'algo', 'AK', "Jet algorithm of the input collection from which the new patJet collection should be created")
512  self.addParameter(self._defaultParameters,'rParam', 0.4, "Jet size (distance parameter R used in jet clustering)")
513  self.addParameter(self._defaultParameters,'getJetMCFlavour', True, "Get jet MC truth flavour")
514  self.addParameter(self._defaultParameters,'genJetCollection', cms.InputTag("ak4GenJets"), "GenJet collection to match to", cms.InputTag)
515  self.addParameter(self._defaultParameters,'genParticles', cms.InputTag("genParticles"), "GenParticle collection to be used", cms.InputTag)
516  self.addParameter(self._defaultParameters,'jetCorrections',None, "Add all relevant information about jet energy corrections that you want to be added to your new patJet \
517  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 \
518  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 \
519  new patJet collection. This should be given as a list of strings. Available values are L1Offset, L1FastJet, L1JPTOffset, L2Relative, L3Absolute, L5Falvour, L7Parton; the \
520  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 \
521  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 \
522  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\' \
523  and \'type-2\' are not case sensitive.", tuple, acceptNoneValue=True)
524  self.addParameter(self._defaultParameters,'btagDiscriminators',['None'], "If you are interested in btagging, in most cases just the labels of the btag discriminators that \
525  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. \
526  If this list is empty no btag discriminator information will be added to your new patJet collection.", allowedValues=supportedBtagDiscr.keys(),Type=list)
527  self.addParameter(self._defaultParameters,'btagInfos',['None'], "The btagInfos objects contain all relevant information from which all discriminators of a certain \
528  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 \
529  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 \
530  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 \
531  will be added to your new patJet collection.", allowedValues=supportedBtagInfos,Type=list)
532  self.addParameter(self._defaultParameters,'jetTrackAssociation',False, "Add JetTrackAssociation and JetCharge from reconstructed tracks to your new patJet collection. This \
533  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 \
534  your new patJetCollection. If btag information of any form is added to the new patJet collection this information will be added automatically.")
535  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 \
536  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 \
537  to more than one output module.")
538  ## set defaults
539  self._parameters=copy.deepcopy(self._defaultParameters)
540  ## add comments
541  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\
542  energy correction factors, btag information and generator match information to the new patJet collection depending on the parameters that you pass on to this function. Consult \
543  the descriptions of each parameter for more information."
544 
_parameters
initialization of the base class
Definition: jetTools.py:539
_comment
add comments
Definition: jetTools.py:541

Member Function Documentation

def jetTools.AddJetCollection.__call__ (   self,
  process,
  labelName = None,
  postfix = None,
  btagPrefix = None,
  jetSource = None,
  pfCandidates = None,
  explicitJTA = None,
  pvSource = None,
  svSource = None,
  elSource = None,
  muSource = None,
  runIVF = None,
  tightBTagNTkHits = 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 551 of file jetTools.py.

References heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RunOnData._defaultParameters, heavyIonTools.ProductionDefaults._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(), DummyOOTPileupCorrection.apply(), HcalDeterministicFit.apply(), gen::PhotosppInterface.apply(), gen::PhotosInterface.apply(), SurveyParameters.apply(), FWPSetCellEditor.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), ConfigToolBase.ConfigToolBase.apply(), AlignmentParameters.apply(), BowedSurfaceAlignmentParameters.apply(), OOTPileupCorrData.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(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog.apply(), PulseShapeFitOOTPileupCorrection.apply(), reco::Add< T >.apply(), reco::Sub< T >.apply(), reco::Mul< T >.apply(), reco::Div< T >.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), reco::And< bool >.apply(), models.RegExp.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(), PedeReader.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

551  def __call__(self,process,labelName=None,postfix=None,btagPrefix=None,jetSource=None,pfCandidates=None,explicitJTA=None,pvSource=None,svSource=None,elSource=None,muSource=None,runIVF=None,tightBTagNTkHits=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):
552  """
553  Function call wrapper. This will check the parameters and call the actual implementation that
554  can be found in toolCode via the base class function apply.
555  """
556  if labelName is None:
557  labelName=self._defaultParameters['labelName'].value
558  self.setParameter('labelName', labelName)
559  if postfix is None:
560  postfix=self._defaultParameters['postfix'].value
561  self.setParameter('postfix', postfix)
562  if btagPrefix is None:
563  btagPrefix=self._defaultParameters['btagPrefix'].value
564  self.setParameter('btagPrefix', btagPrefix)
565  if jetSource is None:
566  jetSource=self._defaultParameters['jetSource'].value
567  self.setParameter('jetSource', jetSource)
568  if pfCandidates is None:
569  pfCandidates=self._defaultParameters['pfCandidates'].value
570  self.setParameter('pfCandidates', pfCandidates)
571  if explicitJTA is None:
572  explicitJTA=self._defaultParameters['explicitJTA'].value
573  self.setParameter('explicitJTA', explicitJTA)
574  if pvSource is None:
575  pvSource=self._defaultParameters['pvSource'].value
576  self.setParameter('pvSource', pvSource)
577  if svSource is None:
578  svSource=self._defaultParameters['svSource'].value
579  self.setParameter('svSource', svSource)
580  if elSource is None:
581  elSource=self._defaultParameters['elSource'].value
582  self.setParameter('elSource', elSource)
583  if muSource is None:
584  muSource=self._defaultParameters['muSource'].value
585  self.setParameter('muSource', muSource)
586  if runIVF is None:
587  runIVF=self._defaultParameters['runIVF'].value
588  self.setParameter('runIVF', runIVF)
589  if tightBTagNTkHits is None:
590  tightBTagNTkHits=self._defaultParameters['tightBTagNTkHits'].value
591  self.setParameter('tightBTagNTkHits', tightBTagNTkHits)
592  if loadStdRecoBTag is None:
593  loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value
594  self.setParameter('loadStdRecoBTag', loadStdRecoBTag)
595  if svClustering is None:
596  svClustering=self._defaultParameters['svClustering'].value
597  self.setParameter('svClustering', svClustering)
598  if fatJets is None:
599  fatJets=self._defaultParameters['fatJets'].value
600  self.setParameter('fatJets', fatJets)
601  if groomedFatJets is None:
602  groomedFatJets=self._defaultParameters['groomedFatJets'].value
603  self.setParameter('groomedFatJets', groomedFatJets)
604  if algo is None:
605  algo=self._defaultParameters['algo'].value
606  self.setParameter('algo', algo)
607  if rParam is None:
608  rParam=self._defaultParameters['rParam'].value
609  self.setParameter('rParam', rParam)
610  if getJetMCFlavour is None:
611  getJetMCFlavour=self._defaultParameters['getJetMCFlavour'].value
612  self.setParameter('getJetMCFlavour', getJetMCFlavour)
613  if genJetCollection is None:
614  genJetCollection=self._defaultParameters['genJetCollection'].value
615  self.setParameter('genJetCollection', genJetCollection)
616  if genParticles is None:
617  genParticles=self._defaultParameters['genParticles'].value
618  self.setParameter('genParticles', genParticles)
619  if jetCorrections is None:
620  jetCorrections=self._defaultParameters['jetCorrections'].value
621  self.setParameter('jetCorrections', jetCorrections)
622  if btagDiscriminators is None:
623  btagDiscriminators=self._defaultParameters['btagDiscriminators'].value
624  self.setParameter('btagDiscriminators', btagDiscriminators)
625  if btagInfos is None:
626  btagInfos=self._defaultParameters['btagInfos'].value
627  self.setParameter('btagInfos', btagInfos)
628  if jetTrackAssociation is None:
629  jetTrackAssociation=self._defaultParameters['jetTrackAssociation'].value
630  self.setParameter('jetTrackAssociation', jetTrackAssociation)
631  if outputModules is None:
632  outputModules=self._defaultParameters['outputModules'].value
633  self.setParameter('outputModules', outputModules)
634  self.apply(process)
635 
def __call__(self, process, labelName=None, postfix=None, btagPrefix=None, jetSource=None, pfCandidates=None, explicitJTA=None, pvSource=None, svSource=None, elSource=None, muSource=None, runIVF=None, tightBTagNTkHits=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)
Definition: jetTools.py:551
def jetTools.AddJetCollection.getDefaultParameters (   self)
def jetTools.AddJetCollection.toolCode (   self,
  process 
)
Tool code implementation

Definition at line 636 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, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._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.

636  def toolCode(self, process):
637  """
638  Tool code implementation
639  """
640  ## initialize parameters
641  labelName=self._parameters['labelName'].value
642  postfix=self._parameters['postfix'].value
643  btagPrefix=self._parameters['btagPrefix'].value
644  jetSource=self._parameters['jetSource'].value
645  pfCandidates=self._parameters['pfCandidates'].value
646  explicitJTA=self._parameters['explicitJTA'].value
647  pvSource=self._parameters['pvSource'].value
648  svSource=self._parameters['svSource'].value
649  elSource=self._parameters['elSource'].value
650  muSource=self._parameters['muSource'].value
651  runIVF=self._parameters['runIVF'].value
652  tightBTagNTkHits=self._parameters['tightBTagNTkHits'].value
653  loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value
654  svClustering=self._parameters['svClustering'].value
655  fatJets=self._parameters['fatJets'].value
656  groomedFatJets=self._parameters['groomedFatJets'].value
657  algo=self._parameters['algo'].value
658  rParam=self._parameters['rParam'].value
659  getJetMCFlavour=self._parameters['getJetMCFlavour'].value
660  genJetCollection=self._parameters['genJetCollection'].value
661  genParticles=self._parameters['genParticles'].value
662  jetCorrections=self._parameters['jetCorrections'].value
663  btagDiscriminators=list(self._parameters['btagDiscriminators'].value)
664  btagInfos=list(self._parameters['btagInfos'].value)
665  jetTrackAssociation=self._parameters['jetTrackAssociation'].value
666  outputModules=list(self._parameters['outputModules'].value)
667 
668  ## added jets must have a defined 'labelName'
669  if labelName=='UNDEFINED':
670  undefinedLabelName(self)
671 
672  ## a list of all producer modules, which are already known to process
673  knownModules = process.producerNames().split()
674  ## determine whether btagging information is required or not
675  if btagDiscriminators.count('None')>0:
676  btagDiscriminators.remove('None')
677  if btagInfos.count('None')>0:
678  btagInfos.remove('None')
679  bTagging=(len(btagDiscriminators)>0 or len(btagInfos)>0)
680  ## check if any legacy btag discriminators are being used
681  infos = 0
682  for info in btagInfos:
683  if info.startswith('pf'): infos = infos + 1
684  if 'softpf' in info.lower(): infos = infos + 1
685  tags = 0
686  for tag in btagDiscriminators:
687  if tag.startswith('pf'): tags = tags + 1
688  if 'softpf' in tag.lower(): tags = tags + 1
689  bTaggingLegacy=(len(btagDiscriminators)>tags or len(btagInfos)>infos)
690  ## construct postfix label for auxiliary modules; this postfix
691  ## label will start with a capitalized first letter following
692  ## the CMS naming conventions and for improved readablility
693  _labelName=labelName[:1].upper()+labelName[1:]
694 
695  ## supported algo types are ak, ca, and kt
696  _algo=''
697  for x in ["ak", "ca", "kt"]:
698  if x in algo.lower():
699  _algo=supportedJetAlgos[x]
700  break
701  if _algo=='':
703  ## add new patJets to process (keep instance for later further modifications)
704  from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import _patJets as patJets
705  if 'patJets'+_labelName+postfix in knownModules :
706  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
707  _newPatJets.jetSource=jetSource
708  else :
709  setattr(process, 'patJets'+_labelName+postfix, patJets.clone(jetSource=jetSource))
710  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
711  knownModules.append('patJets'+_labelName+postfix)
712  ## add new selectedPatJets to process
714  if 'selectedPatJets'+_labelName+postfix in knownModules :
715  _newSelectedPatJets=getattr(process, 'selectedPatJets'+_labelName+postfix)
716  _newSelectedPatJets.src='patJets'+_labelName+postfix
717  else :
718  setattr(process, 'selectedPatJets'+_labelName+postfix, selectedPatJets.clone(src='patJets'+_labelName+postfix))
719  knownModules.append('selectedPatJets'+_labelName+postfix)
720 
721  ## add new patJetPartonMatch to process
722  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetPartonMatch
723  if 'patJetPartonMatch'+_labelName+postfix in knownModules :
724  _newPatJetPartonMatch=getattr(process, 'patJetPartonMatch'+_labelName+postfix)
725  _newPatJetPartonMatch.src=jetSource
726  _newPatJetPartonMatch.matched=genParticles
727  else :
728  setattr(process, 'patJetPartonMatch'+_labelName+postfix, patJetPartonMatch.clone(src=jetSource, matched=genParticles))
729  knownModules.append('patJetPartonMatch'+_labelName+postfix)
730  ## add new patJetGenJetMatch to process
731  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetGenJetMatch
732  if 'patJetGenJetMatch'+_labelName+postfix in knownModules :
733  _newPatJetGenJetMatch=getattr(process, 'patJetGenJetMatch'+_labelName+postfix)
734  _newPatJetGenJetMatch.src=jetSource
735  _newPatJetGenJetMatch.maxDeltaR=rParam
736  _newPatJetGenJetMatch.matched=genJetCollection
737  else :
738  setattr(process, 'patJetGenJetMatch'+_labelName+postfix, patJetGenJetMatch.clone(src=jetSource, maxDeltaR=rParam, matched=genJetCollection))
739  knownModules.append('patJetGenJetMatch'+_labelName+postfix)
740  ## modify new patJets collection accordingly
741  _newPatJets.genJetMatch.setModuleLabel('patJetGenJetMatch'+_labelName+postfix)
742  _newPatJets.genPartonMatch.setModuleLabel('patJetPartonMatch'+_labelName+postfix)
743  ## get jet MC truth flavour if required by user
744  if (getJetMCFlavour):
745  ## legacy jet flavour (see https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools)
746  ## add new patJetPartonsLegacy to process
747  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonsLegacy
748  if 'patJetPartonsLegacy'+postfix not in knownModules :
749  setattr(process, 'patJetPartonsLegacy'+postfix, patJetPartonsLegacy.clone(src=genParticles))
750  knownModules.append('patJetPartonsLegacy'+postfix)
751  else:
752  getattr(process, 'patJetPartonsLegacy'+postfix).src=genParticles
753  ## add new patJetPartonAssociationLegacy to process
754  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonAssociationLegacy
755  if 'patJetPartonAssociationLegacy'+_labelName+postfix in knownModules :
756  _newPatJetPartonAssociation=getattr(process, 'patJetPartonAssociationLegacy'+_labelName+postfix)
757  _newPatJetPartonAssociation.jets=jetSource
758  else :
759  setattr(process, 'patJetPartonAssociationLegacy'+_labelName+postfix, patJetPartonAssociationLegacy.clone(jets=jetSource))
760  knownModules.append('patJetPartonAssociationLegacy'+_labelName+postfix)
761  ## add new patJetPartonAssociationLegacy to process
762  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociationLegacy
763  if 'patJetFlavourAssociationLegacy'+_labelName+postfix in knownModules :
764  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociationLegacy'+_labelName+postfix)
765  _newPatJetFlavourAssociation.srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix
766  else:
767  setattr(process, 'patJetFlavourAssociationLegacy'+_labelName+postfix, patJetFlavourAssociationLegacy.clone(srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix))
768  knownModules.append('patJetFlavourAssociationLegacy'+_labelName+postfix)
769  ## modify new patJets collection accordingly
770  _newPatJets.JetPartonMapSource.setModuleLabel('patJetFlavourAssociationLegacy'+_labelName+postfix)
771  ## new jet flavour (see https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools)
772  ## add new patJetPartons to process
774  if 'patJetPartons'+postfix not in knownModules :
775  setattr(process, 'patJetPartons'+postfix, patJetPartons.clone(particles=genParticles))
776  knownModules.append('patJetPartons'+postfix)
777  else:
778  getattr(process, 'patJetPartons'+postfix).particles=genParticles
779  ## add new patJetFlavourAssociation to process
780  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociation
781  if 'patJetFlavourAssociation'+_labelName+postfix in knownModules :
782  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
783  _newPatJetFlavourAssociation.jets=jetSource
784  _newPatJetFlavourAssociation.jetAlgorithm=_algo
785  _newPatJetFlavourAssociation.rParam=rParam
786  _newPatJetFlavourAssociation.bHadrons=cms.InputTag("patJetPartons"+postfix,"bHadrons")
787  _newPatJetFlavourAssociation.cHadrons=cms.InputTag("patJetPartons"+postfix,"cHadrons")
788  _newPatJetFlavourAssociation.partons=cms.InputTag("patJetPartons"+postfix,"algorithmicPartons")
789  _newPatJetFlavourAssociation.leptons=cms.InputTag("patJetPartons"+postfix,"leptons")
790  else :
791  setattr(process, 'patJetFlavourAssociation'+_labelName+postfix,
792  patJetFlavourAssociation.clone(
793  jets=jetSource,
794  jetAlgorithm=_algo,
795  rParam=rParam,
796  bHadrons = cms.InputTag("patJetPartons"+postfix,"bHadrons"),
797  cHadrons = cms.InputTag("patJetPartons"+postfix,"cHadrons"),
798  partons = cms.InputTag("patJetPartons"+postfix,"algorithmicPartons"),
799  leptons = cms.InputTag("patJetPartons"+postfix,"leptons")
800  )
801  )
802  knownModules.append('patJetFlavourAssociation'+_labelName+postfix)
803  ## modify new patJets collection accordingly
804  _newPatJets.JetFlavourInfoSource.setModuleLabel('patJetFlavourAssociation'+_labelName+postfix)
805  ## if the jets is actually a subjet
806  if fatJets != cms.InputTag('') and groomedFatJets != cms.InputTag(''):
807  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
808  _newPatJetFlavourAssociation.jets=fatJets
809  _newPatJetFlavourAssociation.groomedJets=groomedFatJets
810  _newPatJetFlavourAssociation.subjets=jetSource
811  _newPatJets.JetFlavourInfoSource=cms.InputTag('patJetFlavourAssociation'+_labelName+postfix,'SubJets')
812  else:
813  _newPatJets.getJetMCFlavour = False
814 
815  ## add jetTrackAssociation for legacy btagging (or jetTracksAssociation only) if required by user
816  if (jetTrackAssociation or bTaggingLegacy):
817  ## add new jetTracksAssociationAtVertex to process
818  from RecoJets.JetAssociationProducers.ak4JTA_cff import ak4JetTracksAssociatorAtVertex, ak4JetTracksAssociatorExplicit
819  if 'jetTracksAssociationAtVertex'+_labelName+postfix in knownModules :
820  _newJetTracksAssociationAtVertex=getattr(process, 'jetTracksAssociatorAtVertex'+_labelName+postfix)
821  _newJetTracksAssociationAtVertex.jets=jetSource
822  _newJetTracksAssociationAtVertex.pvSrc=pvSource
823  else:
824  jetTracksAssociator=ak4JetTracksAssociatorAtVertex
825  if explicitJTA:
826  jetTracksAssociator=ak4JetTracksAssociatorExplicit
827  setattr(process, 'jetTracksAssociatorAtVertex'+_labelName+postfix, jetTracksAssociator.clone(jets=jetSource,pvSrc=pvSource))
828  knownModules.append('jetTracksAssociationAtVertex'+_labelName+postfix)
829  ## add new patJetCharge to process
831  if 'patJetCharge'+_labelName+postfix in knownModules :
832  _newPatJetCharge=getattr(process, 'patJetCharge'+_labelName+postfix)
833  _newPatJetCharge.src='jetTracksAssociatorAtVertex'+_labelName+postfix
834  else:
835  setattr(process, 'patJetCharge'+_labelName+postfix, patJetCharge.clone(src = 'jetTracksAssociatorAtVertex'+_labelName+postfix))
836  knownModules.append('patJetCharge'+_labelName+postfix)
837  ## modify new patJets collection accordingly
838  _newPatJets.addAssociatedTracks=True
839  _newPatJets.trackAssociationSource=cms.InputTag('jetTracksAssociatorAtVertex'+_labelName+postfix)
840  _newPatJets.addJetCharge=True
841  _newPatJets.jetChargeSource=cms.InputTag('patJetCharge'+_labelName+postfix)
842  else:
843  ## modify new patJets collection accordingly
844  _newPatJets.addAssociatedTracks=False
845  _newPatJets.trackAssociationSource=''
846  _newPatJets.addJetCharge=False
847  _newPatJets.jetChargeSource=''
848  ## run btagging if required by user
849  if (bTagging):
850  setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets,
851  _algo, rParam, btagDiscriminators, btagInfos, _newPatJets, _labelName, btagPrefix, postfix)
852  else:
853  _newPatJets.addBTagInfo = False
854  _newPatJets.addTagInfos = False
855  ## adjust output module; these collections will be empty anyhow, but we do it to stay clean
856  for outputModule in outputModules:
857  if hasattr(process,outputModule):
858  getattr(process,outputModule).outputCommands.append("drop *_"+'selected'+_labelName+postfix+"_tagInfos_*")
859 
860  ## add jet correction factors if required by user
861  if (jetCorrections != None):
862  ## check the jet corrections format
863  checkJetCorrectionsFormat(jetCorrections)
864  ## setup jet energy corrections and MET corrections
865  setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, _newPatJets, _labelName, postfix)
866  else:
867  ## switch jetCorrFactors off
868  _newPatJets.addJetCorrFactors=False
869 
870 addJetCollection=AddJetCollection()
871 
def undefinedLabelName(obj)
Definition: jetTools.py:1458
def toolCode(self, process)
Definition: jetTools.py:636
def setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, patJets, labelName, postfix)
Definition: jetTools.py:24
_parameters
initialization of the base class
Definition: jetTools.py:539
def setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets, algo, rParam, btagDiscriminators, btagInfos, patJets, labelName, btagPrefix, postfix)
Definition: jetTools.py:174
def checkJetCorrectionsFormat(jetCorrections)
Definition: jetTools.py:16
double split
Definition: MVATrainer.cc:139
def unsupportedJetAlgorithm(obj)
Definition: jetTools.py:1465
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 541 of file jetTools.py.

jetTools.AddJetCollection._defaultParameters
staticprivate

Definition at line 486 of file jetTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), trackTools.MakeAODTrackCandidates.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), metTools.AddMETCollection.__call__(), editorTools.ChangeSource.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__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__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), jetTools.AddJetCollection.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), jetTools.SwitchJetCollection.__call__(), jetTools.UpdateJetCollection.__call__(), jetTools.AddJetID.__call__(), jetTools.SetTagInfos.__call__(), editorTools.UserCodeTool.__init__(), metTools.AddMETCollection.__init__(), trackTools.MakeAODTrackCandidates.__init__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.__init__(), editorTools.ChangeSource.__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__(), HiCoreTools.AddCleaning.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), jetTools.AddJetCollection.__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(), editorTools.ChangeSource.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.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(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), jetTools.AddJetCollection.getDefaultParameters(), trigTools.SwitchOnTriggerMatchEmbedding.getDefaultParameters(), jetTools.SwitchJetCollection.getDefaultParameters(), jetTools.UpdateJetCollection.getDefaultParameters(), jetTools.AddJetID.getDefaultParameters(), jetTools.SetTagInfos.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.initializeInputTag(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

jetTools.AddJetCollection._label
staticprivate
jetTools.AddJetCollection._parameters
private

initialization of the base class

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

Definition at line 539 of file jetTools.py.

Referenced by runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.ak4JetReclustering(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createMVAMETModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createSmearedJetModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.extractMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getCorrectedMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getUnclusteredVariationsForMVAMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getVariations(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetCleaning(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfigurationPost(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfigurationPre(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.produceMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.recomputeRawMetFromPfcs(), 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(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), trackTools.MakeTrackCandidates.toolCode(), tauTools.AddTauCollection.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), jetTools.AddJetCollection.toolCode(), jetTools.SwitchJetCollection.toolCode(), jetTools.UpdateJetCollection.toolCode(), jetTools.AddJetID.toolCode(), jetTools.SetTagInfos.toolCode(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.updateJECs().