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 1155 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 1162 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().

1162  def __init__(self):
1163  """
1164  Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase to be usable in the configEditor.
1165  """
1166 
1167  ConfigToolBase.__init__(self)
1168 
1169  self.addParameter(self._defaultParameters,'labelName', 'UNDEFINED', "Label name of the new patJet collection.", str)
1170  self.addParameter(self._defaultParameters,'postfix','', "Postfix from usePF2PAT.", str)
1171  self.addParameter(self._defaultParameters,'btagPrefix','', "Prefix to be added to b-tag discriminator and TagInfo names", str)
1172  self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag)
1173  self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('particleFlow'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag)
1174  self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association")
1175  self.addParameter(self._defaultParameters,'pvSource',cms.InputTag('offlinePrimaryVertices'), "Label of the input collection for primary vertices used in b-tagging", cms.InputTag)
1176  self.addParameter(self._defaultParameters,'svSource',cms.InputTag('inclusiveCandidateSecondaryVertices'), "Label of the input collection for IVF vertices used in b-tagging", cms.InputTag)
1177  self.addParameter(self._defaultParameters,'elSource',cms.InputTag('gedGsfElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag)
1178  self.addParameter(self._defaultParameters,'muSource',cms.InputTag('muons'), "Label of the input collection for muons used in b-tagging", cms.InputTag)
1179  self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction")
1180  self.addParameter(self._defaultParameters,'tightBTagNTkHits', False, "Enable legacy tight b-tag track selection")
1181  self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules")
1182  self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)")
1183  self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag)
1184  self.addParameter(self._defaultParameters,'groomedFatJets', cms.InputTag(''), "Groomed fat jet collection used for secondary vertex clustering", cms.InputTag)
1185  self.addParameter(self._defaultParameters,'algo', 'AK', "Jet algorithm of the input collection from which the new patJet collection should be created")
1186  self.addParameter(self._defaultParameters,'rParam', 0.4, "Jet size (distance parameter R used in jet clustering)")
1187  self.addParameter(self._defaultParameters,'getJetMCFlavour', True, "Get jet MC truth flavour")
1188  self.addParameter(self._defaultParameters,'genJetCollection', cms.InputTag("ak4GenJets"), "GenJet collection to match to", cms.InputTag)
1189  self.addParameter(self._defaultParameters,'genParticles', cms.InputTag("genParticles"), "GenParticle collection to be used", cms.InputTag)
1190  self.addParameter(self._defaultParameters,'jetCorrections',None, "Add all relevant information about jet energy corrections that you want to be added to your new patJet \
1191  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 \
1192  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 \
1193  new patJet collection. This should be given as a list of strings. Available values are L1Offset, L1FastJet, L1JPTOffset, L2Relative, L3Absolute, L5Falvour, L7Parton; the \
1194  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 \
1195  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 \
1196  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\' \
1197  and \'type-2\' are not case sensitive.", tuple, acceptNoneValue=True)
1198  self.addParameter(self._defaultParameters,'btagDiscriminators',['None'], "If you are interested in btagging, in most cases just the labels of the btag discriminators that \
1199  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. \
1200  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)
1201  self.addParameter(self._defaultParameters,'btagInfos',['None'], "The btagInfos objects contain all relevant information from which all discriminators of a certain \
1202  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 \
1203  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 \
1204  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 \
1205  will be added to your new patJet collection.", allowedValues=supportedBtagInfos,Type=list)
1206  self.addParameter(self._defaultParameters,'jetTrackAssociation',False, "Add JetTrackAssociation and JetCharge from reconstructed tracks to your new patJet collection. This \
1207  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 \
1208  your new patJetCollection. If btag information of any form is added to the new patJet collection this information will be added automatically.")
1209  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 \
1210  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 \
1211  to more than one output module.")
1212 
1213  self._parameters=copy.deepcopy(self._defaultParameters)
1214 
1215  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\
1216  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 \
1217  the descriptions of each parameter for more information."
1218 
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 1225 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(), SignedDecayLength3D.apply(), SignedTransverseImpactParameter.apply(), ProcessAcceleratorCUDA.ProcessAcceleratorCUDA.apply(), ProcessAcceleratorROCm.ProcessAcceleratorROCm.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(), ProcessAcceleratorAlpaka.ProcessAcceleratorAlpaka.apply(), AbsOOTPileupCorrection.apply(), TwoBowedSurfacesAlignmentParameters.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), models.RegExp.apply(), npstat::ArrayND< Numeric >.apply(), npstat::ArrayND< Numeric, StackLen, StackDim >.apply(), Config.ProcessModifier.apply(), Config.ProcessAccelerator.apply(), Config.ProcessAcceleratorTest.apply(), Config.ProcessAcceleratorTest2.apply(), HGCalCassette.setParameter(), PedeReader.setParameter(), QIE8Simulator.setParameter(), AbsElectronicODERHS.setParameter(), SiStripLorentzAngleCalibration.setParameter(), IntegratedCalibrationBase.setParameter(), SiPixelLorentzAngleCalibration.setParameter(), SiStripBackplaneCalibration.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

1225  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):
1226  """
1227  Function call wrapper. This will check the parameters and call the actual implementation that
1228  can be found in toolCode via the base class function apply.
1229  """
1230  if labelName is None:
1231  labelName=self._defaultParameters['labelName'].value
1232  self.setParameter('labelName', labelName)
1233  if postfix is None:
1234  postfix=self._defaultParameters['postfix'].value
1235  self.setParameter('postfix', postfix)
1236  if btagPrefix is None:
1237  btagPrefix=self._defaultParameters['btagPrefix'].value
1238  self.setParameter('btagPrefix', btagPrefix)
1239  if jetSource is None:
1240  jetSource=self._defaultParameters['jetSource'].value
1241  self.setParameter('jetSource', jetSource)
1242  if pfCandidates is None:
1243  pfCandidates=self._defaultParameters['pfCandidates'].value
1244  self.setParameter('pfCandidates', pfCandidates)
1245  if explicitJTA is None:
1246  explicitJTA=self._defaultParameters['explicitJTA'].value
1247  self.setParameter('explicitJTA', explicitJTA)
1248  if pvSource is None:
1249  pvSource=self._defaultParameters['pvSource'].value
1250  self.setParameter('pvSource', pvSource)
1251  if svSource is None:
1252  svSource=self._defaultParameters['svSource'].value
1253  self.setParameter('svSource', svSource)
1254  if elSource is None:
1255  elSource=self._defaultParameters['elSource'].value
1256  self.setParameter('elSource', elSource)
1257  if muSource is None:
1258  muSource=self._defaultParameters['muSource'].value
1259  self.setParameter('muSource', muSource)
1260  if runIVF is None:
1261  runIVF=self._defaultParameters['runIVF'].value
1262  self.setParameter('runIVF', runIVF)
1263  if tightBTagNTkHits is None:
1264  tightBTagNTkHits=self._defaultParameters['tightBTagNTkHits'].value
1265  self.setParameter('tightBTagNTkHits', tightBTagNTkHits)
1266  if loadStdRecoBTag is None:
1267  loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value
1268  self.setParameter('loadStdRecoBTag', loadStdRecoBTag)
1269  if svClustering is None:
1270  svClustering=self._defaultParameters['svClustering'].value
1271  self.setParameter('svClustering', svClustering)
1272  if fatJets is None:
1273  fatJets=self._defaultParameters['fatJets'].value
1274  self.setParameter('fatJets', fatJets)
1275  if groomedFatJets is None:
1276  groomedFatJets=self._defaultParameters['groomedFatJets'].value
1277  self.setParameter('groomedFatJets', groomedFatJets)
1278  if algo is None:
1279  algo=self._defaultParameters['algo'].value
1280  self.setParameter('algo', algo)
1281  if rParam is None:
1282  rParam=self._defaultParameters['rParam'].value
1283  self.setParameter('rParam', rParam)
1284  if getJetMCFlavour is None:
1285  getJetMCFlavour=self._defaultParameters['getJetMCFlavour'].value
1286  self.setParameter('getJetMCFlavour', getJetMCFlavour)
1287  if genJetCollection is None:
1288  genJetCollection=self._defaultParameters['genJetCollection'].value
1289  self.setParameter('genJetCollection', genJetCollection)
1290  if genParticles is None:
1291  genParticles=self._defaultParameters['genParticles'].value
1292  self.setParameter('genParticles', genParticles)
1293  if jetCorrections is None:
1294  jetCorrections=self._defaultParameters['jetCorrections'].value
1295  self.setParameter('jetCorrections', jetCorrections)
1296  if btagDiscriminators is None:
1297  btagDiscriminators=self._defaultParameters['btagDiscriminators'].value
1298  self.setParameter('btagDiscriminators', btagDiscriminators)
1299  if btagInfos is None:
1300  btagInfos=self._defaultParameters['btagInfos'].value
1301  self.setParameter('btagInfos', btagInfos)
1302  if jetTrackAssociation is None:
1303  jetTrackAssociation=self._defaultParameters['jetTrackAssociation'].value
1304  self.setParameter('jetTrackAssociation', jetTrackAssociation)
1305  if outputModules is None:
1306  outputModules=self._defaultParameters['outputModules'].value
1307  self.setParameter('outputModules', outputModules)
1308  self.apply(process)
1309 

◆ getDefaultParameters()

def jetTools.AddJetCollection.getDefaultParameters (   self)

◆ toolCode()

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

Definition at line 1310 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().

1310  def toolCode(self, process):
1311  """
1312  Tool code implementation
1313  """
1314  task = getPatAlgosToolsTask(process)
1315 
1316 
1317  labelName=self._parameters['labelName'].value
1318  postfix=self._parameters['postfix'].value
1319  btagPrefix=self._parameters['btagPrefix'].value
1320  jetSource=self._parameters['jetSource'].value
1321  pfCandidates=self._parameters['pfCandidates'].value
1322  explicitJTA=self._parameters['explicitJTA'].value
1323  pvSource=self._parameters['pvSource'].value
1324  svSource=self._parameters['svSource'].value
1325  elSource=self._parameters['elSource'].value
1326  muSource=self._parameters['muSource'].value
1327  runIVF=self._parameters['runIVF'].value
1328  tightBTagNTkHits=self._parameters['tightBTagNTkHits'].value
1329  loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value
1330  svClustering=self._parameters['svClustering'].value
1331  fatJets=self._parameters['fatJets'].value
1332  groomedFatJets=self._parameters['groomedFatJets'].value
1333  algo=self._parameters['algo'].value
1334  rParam=self._parameters['rParam'].value
1335  getJetMCFlavour=self._parameters['getJetMCFlavour'].value
1336  genJetCollection=self._parameters['genJetCollection'].value
1337  genParticles=self._parameters['genParticles'].value
1338  jetCorrections=self._parameters['jetCorrections'].value
1339  btagDiscriminators=list(self._parameters['btagDiscriminators'].value)
1340  btagInfos=list(self._parameters['btagInfos'].value)
1341  jetTrackAssociation=self._parameters['jetTrackAssociation'].value
1342  outputModules=list(self._parameters['outputModules'].value)
1343 
1344 
1345  if labelName=='UNDEFINED':
1346  undefinedLabelName(self)
1347 
1348 
1349  knownModules = process.producerNames().split()
1350 
1351  if btagDiscriminators.count('None')>0:
1352  btagDiscriminators.remove('None')
1353  if btagInfos.count('None')>0:
1354  btagInfos.remove('None')
1355  bTagging=(len(btagDiscriminators)>0 or len(btagInfos)>0)
1356 
1357  infos = 0
1358  for info in btagInfos:
1359  if info.startswith('pf'): infos = infos + 1
1360  if 'softpf' in info.lower(): infos = infos + 1
1361  tags = 0
1362  for tag in btagDiscriminators:
1363  if tag.startswith('pf'): tags = tags + 1
1364  if 'softpf' in tag.lower(): tags = tags + 1
1365  bTaggingLegacy=(len(btagDiscriminators)>tags or len(btagInfos)>infos)
1366 
1369  _labelName=labelName[:1].upper()+labelName[1:]
1370 
1371 
1372  _algo=''
1373  for x in ["ak", "ca", "kt"]:
1374  if x in algo.lower():
1375  _algo=supportedJetAlgos[x]
1376  break
1377  if _algo=='':
1379 
1380  from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import _patJets as patJets
1381  if 'patJets'+_labelName+postfix in knownModules :
1382  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
1383  _newPatJets.jetSource=jetSource
1384  else :
1385  addToProcessAndTask('patJets'+_labelName+postfix, patJets.clone(jetSource=jetSource), process, task)
1386  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
1387  knownModules.append('patJets'+_labelName+postfix)
1388 
1389  from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets
1390  if 'selectedPatJets'+_labelName+postfix in knownModules :
1391  _newSelectedPatJets=getattr(process, 'selectedPatJets'+_labelName+postfix)
1392  _newSelectedPatJets.src='patJets'+_labelName+postfix
1393  else :
1394  addToProcessAndTask('selectedPatJets'+_labelName+postfix,
1395  selectedPatJets.clone(src='patJets'+_labelName+postfix),
1396  process, task)
1397  knownModules.append('selectedPatJets'+_labelName+postfix)
1398 
1399 
1400  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetPartonMatch
1401  if 'patJetPartonMatch'+_labelName+postfix in knownModules :
1402  _newPatJetPartonMatch=getattr(process, 'patJetPartonMatch'+_labelName+postfix)
1403  _newPatJetPartonMatch.src=jetSource
1404  _newPatJetPartonMatch.matched=genParticles
1405  else :
1406  addToProcessAndTask('patJetPartonMatch'+_labelName+postfix,
1407  patJetPartonMatch.clone(src=jetSource, matched=genParticles),
1408  process, task)
1409  knownModules.append('patJetPartonMatch'+_labelName+postfix)
1410 
1411  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetGenJetMatch
1412  if 'patJetGenJetMatch'+_labelName+postfix in knownModules :
1413  _newPatJetGenJetMatch=getattr(process, 'patJetGenJetMatch'+_labelName+postfix)
1414  _newPatJetGenJetMatch.src=jetSource
1415  _newPatJetGenJetMatch.maxDeltaR=rParam
1416  _newPatJetGenJetMatch.matched=genJetCollection
1417  else :
1418  addToProcessAndTask('patJetGenJetMatch'+_labelName+postfix,
1419  patJetGenJetMatch.clone(src=jetSource, maxDeltaR=rParam, matched=genJetCollection),
1420  process, task)
1421  knownModules.append('patJetGenJetMatch'+_labelName+postfix)
1422 
1423  _newPatJets.genJetMatch.setModuleLabel('patJetGenJetMatch'+_labelName+postfix)
1424  _newPatJets.genPartonMatch.setModuleLabel('patJetPartonMatch'+_labelName+postfix)
1425 
1426  if (getJetMCFlavour):
1427 
1429  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonsLegacy
1430  if 'patJetPartonsLegacy'+postfix not in knownModules :
1431  addToProcessAndTask('patJetPartonsLegacy'+postfix, patJetPartonsLegacy.clone(src=genParticles),
1432  process, task)
1433  knownModules.append('patJetPartonsLegacy'+postfix)
1434  else:
1435  getattr(process, 'patJetPartonsLegacy'+postfix).src=genParticles
1436 
1437  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonAssociationLegacy
1438  if 'patJetPartonAssociationLegacy'+_labelName+postfix in knownModules :
1439  _newPatJetPartonAssociation=getattr(process, 'patJetPartonAssociationLegacy'+_labelName+postfix)
1440  _newPatJetPartonAssociation.jets=jetSource
1441  else :
1442  addToProcessAndTask('patJetPartonAssociationLegacy'+_labelName+postfix,
1443  patJetPartonAssociationLegacy.clone(jets=jetSource), process, task)
1444  knownModules.append('patJetPartonAssociationLegacy'+_labelName+postfix)
1445 
1446  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociationLegacy
1447  if 'patJetFlavourAssociationLegacy'+_labelName+postfix in knownModules :
1448  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociationLegacy'+_labelName+postfix)
1449  _newPatJetFlavourAssociation.srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix
1450  else:
1451  addToProcessAndTask('patJetFlavourAssociationLegacy'+_labelName+postfix,
1452  patJetFlavourAssociationLegacy.clone(
1453  srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix),
1454  process, task)
1455  knownModules.append('patJetFlavourAssociationLegacy'+_labelName+postfix)
1456 
1457  _newPatJets.JetPartonMapSource.setModuleLabel('patJetFlavourAssociationLegacy'+_labelName+postfix)
1458 
1461  if 'patJetPartons'+postfix not in knownModules :
1462  addToProcessAndTask('patJetPartons'+postfix, patJetPartons.clone(particles=genParticles), process, task)
1463  knownModules.append('patJetPartons'+postfix)
1464  else:
1465  getattr(process, 'patJetPartons'+postfix).particles=genParticles
1466 
1467  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociation
1468  if 'patJetFlavourAssociation'+_labelName+postfix in knownModules :
1469  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1470  _newPatJetFlavourAssociation.jets=jetSource
1471  _newPatJetFlavourAssociation.jetAlgorithm=_algo
1472  _newPatJetFlavourAssociation.rParam=rParam
1473  _newPatJetFlavourAssociation.bHadrons=cms.InputTag("patJetPartons"+postfix,"bHadrons")
1474  _newPatJetFlavourAssociation.cHadrons=cms.InputTag("patJetPartons"+postfix,"cHadrons")
1475  _newPatJetFlavourAssociation.partons=cms.InputTag("patJetPartons"+postfix,"physicsPartons")
1476  _newPatJetFlavourAssociation.leptons=cms.InputTag("patJetPartons"+postfix,"leptons")
1477  else :
1478  addToProcessAndTask('patJetFlavourAssociation'+_labelName+postfix,
1479  patJetFlavourAssociation.clone(
1480  jets=jetSource,
1481  jetAlgorithm=_algo,
1482  rParam=rParam,
1483  bHadrons = cms.InputTag("patJetPartons"+postfix,"bHadrons"),
1484  cHadrons = cms.InputTag("patJetPartons"+postfix,"cHadrons"),
1485  partons = cms.InputTag("patJetPartons"+postfix,"physicsPartons"),
1486  leptons = cms.InputTag("patJetPartons"+postfix,"leptons")),
1487  process, task)
1488 
1489  knownModules.append('patJetFlavourAssociation'+_labelName+postfix)
1490  if 'Puppi' in jetSource.value() and pfCandidates.value() == 'particleFlow':
1491  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1492  _newPatJetFlavourAssociation.weights = cms.InputTag("puppi")
1493 
1494  _newPatJets.JetFlavourInfoSource.setModuleLabel('patJetFlavourAssociation'+_labelName+postfix)
1495 
1496  if fatJets != cms.InputTag('') and groomedFatJets != cms.InputTag(''):
1497  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1498  _newPatJetFlavourAssociation.jets=fatJets
1499  _newPatJetFlavourAssociation.groomedJets=groomedFatJets
1500  _newPatJetFlavourAssociation.subjets=jetSource
1501  _newPatJets.JetFlavourInfoSource=cms.InputTag('patJetFlavourAssociation'+_labelName+postfix,'SubJets')
1502  else:
1503  _newPatJets.getJetMCFlavour = False
1504  _newPatJets.addJetFlavourInfo = False
1505 
1506 
1507  if (jetTrackAssociation or bTaggingLegacy):
1508 
1509  from RecoJets.JetAssociationProducers.ak4JTA_cff import ak4JetTracksAssociatorAtVertex, ak4JetTracksAssociatorExplicit
1510  if 'jetTracksAssociationAtVertex'+_labelName+postfix in knownModules :
1511  _newJetTracksAssociationAtVertex=getattr(process, 'jetTracksAssociatorAtVertex'+_labelName+postfix)
1512  _newJetTracksAssociationAtVertex.jets=jetSource
1513  _newJetTracksAssociationAtVertex.pvSrc=pvSource
1514  else:
1515  jetTracksAssociator=ak4JetTracksAssociatorAtVertex
1516  if explicitJTA:
1517  jetTracksAssociator=ak4JetTracksAssociatorExplicit
1518  addToProcessAndTask('jetTracksAssociatorAtVertex'+_labelName+postfix,
1519  jetTracksAssociator.clone(jets=jetSource,pvSrc=pvSource),
1520  process, task)
1521  knownModules.append('jetTracksAssociationAtVertex'+_labelName+postfix)
1522 
1524  if 'patJetCharge'+_labelName+postfix in knownModules :
1525  _newPatJetCharge=getattr(process, 'patJetCharge'+_labelName+postfix)
1526  _newPatJetCharge.src='jetTracksAssociatorAtVertex'+_labelName+postfix
1527  else:
1528  addToProcessAndTask('patJetCharge'+_labelName+postfix,
1529  patJetCharge.clone(src = 'jetTracksAssociatorAtVertex'+_labelName+postfix),
1530  process, task)
1531  knownModules.append('patJetCharge'+_labelName+postfix)
1532 
1533  _newPatJets.addAssociatedTracks=True
1534  _newPatJets.trackAssociationSource=cms.InputTag('jetTracksAssociatorAtVertex'+_labelName+postfix)
1535  _newPatJets.addJetCharge=True
1536  _newPatJets.jetChargeSource=cms.InputTag('patJetCharge'+_labelName+postfix)
1537  else:
1538 
1539  _newPatJets.addAssociatedTracks=False
1540  _newPatJets.trackAssociationSource=''
1541  _newPatJets.addJetCharge=False
1542  _newPatJets.jetChargeSource=''
1543 
1544  if (bTagging):
1545  setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets,
1546  _algo, rParam, btagDiscriminators, btagInfos, _newPatJets, _labelName, btagPrefix, postfix)
1547  else:
1548  _newPatJets.addBTagInfo = False
1549  _newPatJets.addTagInfos = False
1550 
1551  for outputModule in outputModules:
1552  if hasattr(process,outputModule):
1553  getattr(process,outputModule).outputCommands.append("drop *_"+'selected'+_labelName+postfix+"_tagInfos_*")
1554 
1555 
1556  if (jetCorrections != None):
1557 
1558  checkJetCorrectionsFormat(jetCorrections)
1559 
1560  setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, _newPatJets, _labelName, postfix)
1561  else:
1562 
1563  _newPatJets.addJetCorrFactors=False
1564 
1565 addJetCollection=AddJetCollection()
1566 
def undefinedLabelName(obj)
Definition: jetTools.py:2179
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:28
def setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, patJets, labelName, postfix)
Definition: jetTools.py:31
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:254
def checkJetCorrectionsFormat(jetCorrections)
Definition: jetTools.py:23
def getPatAlgosToolsTask(process)
Definition: helpers.py:13
def unsupportedJetAlgorithm(obj)
Definition: jetTools.py:2186

Member Data Documentation

◆ _comment

jetTools.AddJetCollection._comment
private

add comments

Definition at line 1215 of file jetTools.py.

◆ _defaultParameters

jetTools.AddJetCollection._defaultParameters
staticprivate

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

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