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 905 of file jetTools.py.

Constructor & Destructor Documentation

◆ __init__()

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 912 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(), Python11ParameterSet.addParameter(), l1t::TriggerSystem.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

912  def __init__(self):
913  """
914  Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase to be usable in the configEditor.
915  """
916 
917  ConfigToolBase.__init__(self)
918 
919  self.addParameter(self._defaultParameters,'labelName', 'UNDEFINED', "Label name of the new patJet collection.", str)
920  self.addParameter(self._defaultParameters,'postfix','', "Postfix from usePF2PAT.", str)
921  self.addParameter(self._defaultParameters,'btagPrefix','', "Prefix to be added to b-tag discriminator and TagInfo names", str)
922  self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag)
923  self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('particleFlow'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag)
924  self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association")
925  self.addParameter(self._defaultParameters,'pvSource',cms.InputTag('offlinePrimaryVertices'), "Label of the input collection for primary vertices used in b-tagging", cms.InputTag)
926  self.addParameter(self._defaultParameters,'svSource',cms.InputTag('inclusiveCandidateSecondaryVertices'), "Label of the input collection for IVF vertices used in b-tagging", cms.InputTag)
927  self.addParameter(self._defaultParameters,'elSource',cms.InputTag('gedGsfElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag)
928  self.addParameter(self._defaultParameters,'muSource',cms.InputTag('muons'), "Label of the input collection for muons used in b-tagging", cms.InputTag)
929  self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction")
930  self.addParameter(self._defaultParameters,'tightBTagNTkHits', False, "Enable legacy tight b-tag track selection")
931  self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules")
932  self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)")
933  self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag)
934  self.addParameter(self._defaultParameters,'groomedFatJets', cms.InputTag(''), "Groomed fat jet collection used for secondary vertex clustering", cms.InputTag)
935  self.addParameter(self._defaultParameters,'algo', 'AK', "Jet algorithm of the input collection from which the new patJet collection should be created")
936  self.addParameter(self._defaultParameters,'rParam', 0.4, "Jet size (distance parameter R used in jet clustering)")
937  self.addParameter(self._defaultParameters,'getJetMCFlavour', True, "Get jet MC truth flavour")
938  self.addParameter(self._defaultParameters,'genJetCollection', cms.InputTag("ak4GenJets"), "GenJet collection to match to", cms.InputTag)
939  self.addParameter(self._defaultParameters,'genParticles', cms.InputTag("genParticles"), "GenParticle collection to be used", cms.InputTag)
940  self.addParameter(self._defaultParameters,'jetCorrections',None, "Add all relevant information about jet energy corrections that you want to be added to your new patJet \
941  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 \
942  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 \
943  new patJet collection. This should be given as a list of strings. Available values are L1Offset, L1FastJet, L1JPTOffset, L2Relative, L3Absolute, L5Falvour, L7Parton; the \
944  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 \
945  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 \
946  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\' \
947  and \'type-2\' are not case sensitive.", tuple, acceptNoneValue=True)
948  self.addParameter(self._defaultParameters,'btagDiscriminators',['None'], "If you are interested in btagging, in most cases just the labels of the btag discriminators that \
949  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. \
950  If this list is empty no btag discriminator information will be added to your new patJet collection.", allowedValues=(list(set().union(supportedBtagDiscr.keys(),supportedMetaDiscr.keys()))),Type=list)
951  self.addParameter(self._defaultParameters,'btagInfos',['None'], "The btagInfos objects contain all relevant information from which all discriminators of a certain \
952  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 \
953  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 \
954  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 \
955  will be added to your new patJet collection.", allowedValues=supportedBtagInfos,Type=list)
956  self.addParameter(self._defaultParameters,'jetTrackAssociation',False, "Add JetTrackAssociation and JetCharge from reconstructed tracks to your new patJet collection. This \
957  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 \
958  your new patJetCollection. If btag information of any form is added to the new patJet collection this information will be added automatically.")
959  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 \
960  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 \
961  to more than one output module.")
962 
963  self._parameters=copy.deepcopy(self._defaultParameters)
964 
965  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\
966  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 \
967  the descriptions of each parameter for more information."
968 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ __call__()

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 975 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, ProcessAcceleratorCUDA.ProcessAcceleratorCUDA.apply(), SignedImpactParameter3D.apply(), SignedDecayLength3D.apply(), SignedTransverseImpactParameter.apply(), gen::PhotosInterfaceBase.apply(), SurveyParameters.apply(), DummyOOTPileupCorrection.apply(), MatrixReader.MatrixReader.apply, gen::PhotosppInterface.apply(), FWPSetCellEditor.apply(), BeamSpotAlignmentParameters.apply(), RigidBodyAlignmentParameters.apply(), DeviationsFromFileSensor2D.apply(), FWGUIEventFilter.apply(), AlignmentParameters.apply(), ConfigToolBase.ConfigToolBase.apply(), BowedSurfaceAlignmentParameters.apply(), OOTPileupCorrData.apply(), AbsOOTPileupCorrection.apply(), TwoBowedSurfacesAlignmentParameters.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), models.RegExp.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), npstat::ArrayND< Numeric >.apply(), Config.ProcessModifier.apply(), Config.ProcessAccelerator.apply(), Config.ProcessAcceleratorTest.apply(), Config.ProcessAcceleratorTest2.apply(), HGCalCassette.setParameter(), PedeReader.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), SiStripLorentzAngleCalibration.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), IntegratedCalibrationBase.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

975  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):
976  """
977  Function call wrapper. This will check the parameters and call the actual implementation that
978  can be found in toolCode via the base class function apply.
979  """
980  if labelName is None:
981  labelName=self._defaultParameters['labelName'].value
982  self.setParameter('labelName', labelName)
983  if postfix is None:
984  postfix=self._defaultParameters['postfix'].value
985  self.setParameter('postfix', postfix)
986  if btagPrefix is None:
987  btagPrefix=self._defaultParameters['btagPrefix'].value
988  self.setParameter('btagPrefix', btagPrefix)
989  if jetSource is None:
990  jetSource=self._defaultParameters['jetSource'].value
991  self.setParameter('jetSource', jetSource)
992  if pfCandidates is None:
993  pfCandidates=self._defaultParameters['pfCandidates'].value
994  self.setParameter('pfCandidates', pfCandidates)
995  if explicitJTA is None:
996  explicitJTA=self._defaultParameters['explicitJTA'].value
997  self.setParameter('explicitJTA', explicitJTA)
998  if pvSource is None:
999  pvSource=self._defaultParameters['pvSource'].value
1000  self.setParameter('pvSource', pvSource)
1001  if svSource is None:
1002  svSource=self._defaultParameters['svSource'].value
1003  self.setParameter('svSource', svSource)
1004  if elSource is None:
1005  elSource=self._defaultParameters['elSource'].value
1006  self.setParameter('elSource', elSource)
1007  if muSource is None:
1008  muSource=self._defaultParameters['muSource'].value
1009  self.setParameter('muSource', muSource)
1010  if runIVF is None:
1011  runIVF=self._defaultParameters['runIVF'].value
1012  self.setParameter('runIVF', runIVF)
1013  if tightBTagNTkHits is None:
1014  tightBTagNTkHits=self._defaultParameters['tightBTagNTkHits'].value
1015  self.setParameter('tightBTagNTkHits', tightBTagNTkHits)
1016  if loadStdRecoBTag is None:
1017  loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value
1018  self.setParameter('loadStdRecoBTag', loadStdRecoBTag)
1019  if svClustering is None:
1020  svClustering=self._defaultParameters['svClustering'].value
1021  self.setParameter('svClustering', svClustering)
1022  if fatJets is None:
1023  fatJets=self._defaultParameters['fatJets'].value
1024  self.setParameter('fatJets', fatJets)
1025  if groomedFatJets is None:
1026  groomedFatJets=self._defaultParameters['groomedFatJets'].value
1027  self.setParameter('groomedFatJets', groomedFatJets)
1028  if algo is None:
1029  algo=self._defaultParameters['algo'].value
1030  self.setParameter('algo', algo)
1031  if rParam is None:
1032  rParam=self._defaultParameters['rParam'].value
1033  self.setParameter('rParam', rParam)
1034  if getJetMCFlavour is None:
1035  getJetMCFlavour=self._defaultParameters['getJetMCFlavour'].value
1036  self.setParameter('getJetMCFlavour', getJetMCFlavour)
1037  if genJetCollection is None:
1038  genJetCollection=self._defaultParameters['genJetCollection'].value
1039  self.setParameter('genJetCollection', genJetCollection)
1040  if genParticles is None:
1041  genParticles=self._defaultParameters['genParticles'].value
1042  self.setParameter('genParticles', genParticles)
1043  if jetCorrections is None:
1044  jetCorrections=self._defaultParameters['jetCorrections'].value
1045  self.setParameter('jetCorrections', jetCorrections)
1046  if btagDiscriminators is None:
1047  btagDiscriminators=self._defaultParameters['btagDiscriminators'].value
1048  self.setParameter('btagDiscriminators', btagDiscriminators)
1049  if btagInfos is None:
1050  btagInfos=self._defaultParameters['btagInfos'].value
1051  self.setParameter('btagInfos', btagInfos)
1052  if jetTrackAssociation is None:
1053  jetTrackAssociation=self._defaultParameters['jetTrackAssociation'].value
1054  self.setParameter('jetTrackAssociation', jetTrackAssociation)
1055  if outputModules is None:
1056  outputModules=self._defaultParameters['outputModules'].value
1057  self.setParameter('outputModules', outputModules)
1058  self.apply(process)
1059 

◆ getDefaultParameters()

def jetTools.AddJetCollection.getDefaultParameters (   self)

◆ toolCode()

def jetTools.AddJetCollection.toolCode (   self,
  process 
)
Tool code implementation

Definition at line 1060 of file jetTools.py.

References heavyIonTools.ConfigureHeavyIons._parameters, coreTools.RunOnData._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, jetTools.AddJetCollection._parameters, helpers.addToProcessAndTask(), jetTools.checkJetCorrectionsFormat(), helpers.getPatAlgosToolsTask(), jetTools.setupBTagging(), jetTools.setupJetCorrections(), submitPVValidationJobs.split(), jetTools.undefinedLabelName(), and jetTools.unsupportedJetAlgorithm().

1060  def toolCode(self, process):
1061  """
1062  Tool code implementation
1063  """
1064  task = getPatAlgosToolsTask(process)
1065 
1066 
1067  labelName=self._parameters['labelName'].value
1068  postfix=self._parameters['postfix'].value
1069  btagPrefix=self._parameters['btagPrefix'].value
1070  jetSource=self._parameters['jetSource'].value
1071  pfCandidates=self._parameters['pfCandidates'].value
1072  explicitJTA=self._parameters['explicitJTA'].value
1073  pvSource=self._parameters['pvSource'].value
1074  svSource=self._parameters['svSource'].value
1075  elSource=self._parameters['elSource'].value
1076  muSource=self._parameters['muSource'].value
1077  runIVF=self._parameters['runIVF'].value
1078  tightBTagNTkHits=self._parameters['tightBTagNTkHits'].value
1079  loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value
1080  svClustering=self._parameters['svClustering'].value
1081  fatJets=self._parameters['fatJets'].value
1082  groomedFatJets=self._parameters['groomedFatJets'].value
1083  algo=self._parameters['algo'].value
1084  rParam=self._parameters['rParam'].value
1085  getJetMCFlavour=self._parameters['getJetMCFlavour'].value
1086  genJetCollection=self._parameters['genJetCollection'].value
1087  genParticles=self._parameters['genParticles'].value
1088  jetCorrections=self._parameters['jetCorrections'].value
1089  btagDiscriminators=list(self._parameters['btagDiscriminators'].value)
1090  btagInfos=list(self._parameters['btagInfos'].value)
1091  jetTrackAssociation=self._parameters['jetTrackAssociation'].value
1092  outputModules=list(self._parameters['outputModules'].value)
1093 
1094 
1095  if labelName=='UNDEFINED':
1096  undefinedLabelName(self)
1097 
1098 
1099  knownModules = process.producerNames().split()
1100 
1101  if btagDiscriminators.count('None')>0:
1102  btagDiscriminators.remove('None')
1103  if btagInfos.count('None')>0:
1104  btagInfos.remove('None')
1105  bTagging=(len(btagDiscriminators)>0 or len(btagInfos)>0)
1106 
1107  infos = 0
1108  for info in btagInfos:
1109  if info.startswith('pf'): infos = infos + 1
1110  if 'softpf' in info.lower(): infos = infos + 1
1111  tags = 0
1112  for tag in btagDiscriminators:
1113  if tag.startswith('pf'): tags = tags + 1
1114  if 'softpf' in tag.lower(): tags = tags + 1
1115  bTaggingLegacy=(len(btagDiscriminators)>tags or len(btagInfos)>infos)
1116 
1119  _labelName=labelName[:1].upper()+labelName[1:]
1120 
1121 
1122  _algo=''
1123  for x in ["ak", "ca", "kt"]:
1124  if x in algo.lower():
1125  _algo=supportedJetAlgos[x]
1126  break
1127  if _algo=='':
1129 
1130  from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import _patJets as patJets
1131  if 'patJets'+_labelName+postfix in knownModules :
1132  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
1133  _newPatJets.jetSource=jetSource
1134  else :
1135  addToProcessAndTask('patJets'+_labelName+postfix, patJets.clone(jetSource=jetSource), process, task)
1136  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
1137  knownModules.append('patJets'+_labelName+postfix)
1138 
1139  from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets
1140  if 'selectedPatJets'+_labelName+postfix in knownModules :
1141  _newSelectedPatJets=getattr(process, 'selectedPatJets'+_labelName+postfix)
1142  _newSelectedPatJets.src='patJets'+_labelName+postfix
1143  else :
1144  addToProcessAndTask('selectedPatJets'+_labelName+postfix,
1145  selectedPatJets.clone(src='patJets'+_labelName+postfix),
1146  process, task)
1147  knownModules.append('selectedPatJets'+_labelName+postfix)
1148 
1149 
1150  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetPartonMatch
1151  if 'patJetPartonMatch'+_labelName+postfix in knownModules :
1152  _newPatJetPartonMatch=getattr(process, 'patJetPartonMatch'+_labelName+postfix)
1153  _newPatJetPartonMatch.src=jetSource
1154  _newPatJetPartonMatch.matched=genParticles
1155  else :
1156  addToProcessAndTask('patJetPartonMatch'+_labelName+postfix,
1157  patJetPartonMatch.clone(src=jetSource, matched=genParticles),
1158  process, task)
1159  knownModules.append('patJetPartonMatch'+_labelName+postfix)
1160 
1161  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetGenJetMatch
1162  if 'patJetGenJetMatch'+_labelName+postfix in knownModules :
1163  _newPatJetGenJetMatch=getattr(process, 'patJetGenJetMatch'+_labelName+postfix)
1164  _newPatJetGenJetMatch.src=jetSource
1165  _newPatJetGenJetMatch.maxDeltaR=rParam
1166  _newPatJetGenJetMatch.matched=genJetCollection
1167  else :
1168  addToProcessAndTask('patJetGenJetMatch'+_labelName+postfix,
1169  patJetGenJetMatch.clone(src=jetSource, maxDeltaR=rParam, matched=genJetCollection),
1170  process, task)
1171  knownModules.append('patJetGenJetMatch'+_labelName+postfix)
1172 
1173  _newPatJets.genJetMatch.setModuleLabel('patJetGenJetMatch'+_labelName+postfix)
1174  _newPatJets.genPartonMatch.setModuleLabel('patJetPartonMatch'+_labelName+postfix)
1175 
1176  if (getJetMCFlavour):
1177 
1179  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonsLegacy
1180  if 'patJetPartonsLegacy'+postfix not in knownModules :
1181  addToProcessAndTask('patJetPartonsLegacy'+postfix, patJetPartonsLegacy.clone(src=genParticles),
1182  process, task)
1183  knownModules.append('patJetPartonsLegacy'+postfix)
1184  else:
1185  getattr(process, 'patJetPartonsLegacy'+postfix).src=genParticles
1186 
1187  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonAssociationLegacy
1188  if 'patJetPartonAssociationLegacy'+_labelName+postfix in knownModules :
1189  _newPatJetPartonAssociation=getattr(process, 'patJetPartonAssociationLegacy'+_labelName+postfix)
1190  _newPatJetPartonAssociation.jets=jetSource
1191  else :
1192  addToProcessAndTask('patJetPartonAssociationLegacy'+_labelName+postfix,
1193  patJetPartonAssociationLegacy.clone(jets=jetSource), process, task)
1194  knownModules.append('patJetPartonAssociationLegacy'+_labelName+postfix)
1195 
1196  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociationLegacy
1197  if 'patJetFlavourAssociationLegacy'+_labelName+postfix in knownModules :
1198  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociationLegacy'+_labelName+postfix)
1199  _newPatJetFlavourAssociation.srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix
1200  else:
1201  addToProcessAndTask('patJetFlavourAssociationLegacy'+_labelName+postfix,
1202  patJetFlavourAssociationLegacy.clone(
1203  srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix),
1204  process, task)
1205  knownModules.append('patJetFlavourAssociationLegacy'+_labelName+postfix)
1206 
1207  _newPatJets.JetPartonMapSource.setModuleLabel('patJetFlavourAssociationLegacy'+_labelName+postfix)
1208 
1211  if 'patJetPartons'+postfix not in knownModules :
1212  addToProcessAndTask('patJetPartons'+postfix, patJetPartons.clone(particles=genParticles), process, task)
1213  knownModules.append('patJetPartons'+postfix)
1214  else:
1215  getattr(process, 'patJetPartons'+postfix).particles=genParticles
1216 
1217  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociation
1218  if 'patJetFlavourAssociation'+_labelName+postfix in knownModules :
1219  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1220  _newPatJetFlavourAssociation.jets=jetSource
1221  _newPatJetFlavourAssociation.jetAlgorithm=_algo
1222  _newPatJetFlavourAssociation.rParam=rParam
1223  _newPatJetFlavourAssociation.bHadrons=cms.InputTag("patJetPartons"+postfix,"bHadrons")
1224  _newPatJetFlavourAssociation.cHadrons=cms.InputTag("patJetPartons"+postfix,"cHadrons")
1225  _newPatJetFlavourAssociation.partons=cms.InputTag("patJetPartons"+postfix,"physicsPartons")
1226  _newPatJetFlavourAssociation.leptons=cms.InputTag("patJetPartons"+postfix,"leptons")
1227  else :
1228  addToProcessAndTask('patJetFlavourAssociation'+_labelName+postfix,
1229  patJetFlavourAssociation.clone(
1230  jets=jetSource,
1231  jetAlgorithm=_algo,
1232  rParam=rParam,
1233  bHadrons = cms.InputTag("patJetPartons"+postfix,"bHadrons"),
1234  cHadrons = cms.InputTag("patJetPartons"+postfix,"cHadrons"),
1235  partons = cms.InputTag("patJetPartons"+postfix,"physicsPartons"),
1236  leptons = cms.InputTag("patJetPartons"+postfix,"leptons")),
1237  process, task)
1238 
1239  knownModules.append('patJetFlavourAssociation'+_labelName+postfix)
1240  if 'Puppi' in jetSource.value() and pfCandidates.value() == 'particleFlow':
1241  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1242  _newPatJetFlavourAssociation.weights = cms.InputTag("puppi")
1243 
1244  _newPatJets.JetFlavourInfoSource.setModuleLabel('patJetFlavourAssociation'+_labelName+postfix)
1245 
1246  if fatJets != cms.InputTag('') and groomedFatJets != cms.InputTag(''):
1247  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1248  _newPatJetFlavourAssociation.jets=fatJets
1249  _newPatJetFlavourAssociation.groomedJets=groomedFatJets
1250  _newPatJetFlavourAssociation.subjets=jetSource
1251  _newPatJets.JetFlavourInfoSource=cms.InputTag('patJetFlavourAssociation'+_labelName+postfix,'SubJets')
1252  else:
1253  _newPatJets.getJetMCFlavour = False
1254  _newPatJets.addJetFlavourInfo = False
1255 
1256 
1257  if (jetTrackAssociation or bTaggingLegacy):
1258 
1259  from RecoJets.JetAssociationProducers.ak4JTA_cff import ak4JetTracksAssociatorAtVertex, ak4JetTracksAssociatorExplicit
1260  if 'jetTracksAssociationAtVertex'+_labelName+postfix in knownModules :
1261  _newJetTracksAssociationAtVertex=getattr(process, 'jetTracksAssociatorAtVertex'+_labelName+postfix)
1262  _newJetTracksAssociationAtVertex.jets=jetSource
1263  _newJetTracksAssociationAtVertex.pvSrc=pvSource
1264  else:
1265  jetTracksAssociator=ak4JetTracksAssociatorAtVertex
1266  if explicitJTA:
1267  jetTracksAssociator=ak4JetTracksAssociatorExplicit
1268  addToProcessAndTask('jetTracksAssociatorAtVertex'+_labelName+postfix,
1269  jetTracksAssociator.clone(jets=jetSource,pvSrc=pvSource),
1270  process, task)
1271  knownModules.append('jetTracksAssociationAtVertex'+_labelName+postfix)
1272 
1274  if 'patJetCharge'+_labelName+postfix in knownModules :
1275  _newPatJetCharge=getattr(process, 'patJetCharge'+_labelName+postfix)
1276  _newPatJetCharge.src='jetTracksAssociatorAtVertex'+_labelName+postfix
1277  else:
1278  addToProcessAndTask('patJetCharge'+_labelName+postfix,
1279  patJetCharge.clone(src = 'jetTracksAssociatorAtVertex'+_labelName+postfix),
1280  process, task)
1281  knownModules.append('patJetCharge'+_labelName+postfix)
1282 
1283  _newPatJets.addAssociatedTracks=True
1284  _newPatJets.trackAssociationSource=cms.InputTag('jetTracksAssociatorAtVertex'+_labelName+postfix)
1285  _newPatJets.addJetCharge=True
1286  _newPatJets.jetChargeSource=cms.InputTag('patJetCharge'+_labelName+postfix)
1287  else:
1288 
1289  _newPatJets.addAssociatedTracks=False
1290  _newPatJets.trackAssociationSource=''
1291  _newPatJets.addJetCharge=False
1292  _newPatJets.jetChargeSource=''
1293 
1294  if (bTagging):
1295  setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets,
1296  _algo, rParam, btagDiscriminators, btagInfos, _newPatJets, _labelName, btagPrefix, postfix)
1297  else:
1298  _newPatJets.addBTagInfo = False
1299  _newPatJets.addTagInfos = False
1300 
1301  for outputModule in outputModules:
1302  if hasattr(process,outputModule):
1303  getattr(process,outputModule).outputCommands.append("drop *_"+'selected'+_labelName+postfix+"_tagInfos_*")
1304 
1305 
1306  if (jetCorrections != None):
1307 
1308  checkJetCorrectionsFormat(jetCorrections)
1309 
1310  setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, _newPatJets, _labelName, postfix)
1311  else:
1312 
1313  _newPatJets.addJetCorrFactors=False
1314 
1315 addJetCollection=AddJetCollection()
1316 
def undefinedLabelName(obj)
Definition: jetTools.py:1929
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:28
def setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, patJets, labelName, postfix)
Definition: jetTools.py:26
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:239
def checkJetCorrectionsFormat(jetCorrections)
Definition: jetTools.py:18
def getPatAlgosToolsTask(process)
Definition: helpers.py:13
def unsupportedJetAlgorithm(obj)
Definition: jetTools.py:1936

Member Data Documentation

◆ _comment

jetTools.AddJetCollection._comment
private

add comments

Definition at line 965 of file jetTools.py.

◆ _defaultParameters

jetTools.AddJetCollection._defaultParameters
staticprivate

Definition at line 910 of file jetTools.py.

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

◆ _label

jetTools.AddJetCollection._label
staticprivate

◆ _parameters

jetTools.AddJetCollection._parameters
private

initialization of the base class

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

Definition at line 963 of file jetTools.py.

Referenced by runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.ak4JetReclustering(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createMVAMETModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createSmearedJetModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.extractMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getCorrectedMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getMETUncertainties(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getUnclusteredVariationsForMVAMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getVariations(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetCleaning(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfigurationPost(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.recomputeRawMetFromPfcs(), trackTools.MakeAODTrackCandidates.toolCode(), metTools.AddMETCollection.toolCode(), runJetUncertainties.RunJetUncertainties.toolCode(), trigTools.SwitchOnTrigger.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), tauTools.AddTauCollection.toolCode(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), trackTools.MakeTrackCandidates.toolCode(), trigTools.SwitchOnTriggerMatching.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().