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 1258 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 1265 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().

1265  def __init__(self):
1266  """
1267  Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase to be usable in the configEditor.
1268  """
1269 
1270  ConfigToolBase.__init__(self)
1271 
1272  self.addParameter(self._defaultParameters,'labelName', 'UNDEFINED', "Label name of the new patJet collection.", str)
1273  self.addParameter(self._defaultParameters,'postfix','', "Postfix from usePF2PAT.", str)
1274  self.addParameter(self._defaultParameters,'btagPrefix','', "Prefix to be added to b-tag discriminator and TagInfo names", str)
1275  self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag)
1276  self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('particleFlow'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag)
1277  self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association")
1278  self.addParameter(self._defaultParameters,'pvSource',cms.InputTag('offlinePrimaryVertices'), "Label of the input collection for primary vertices used in b-tagging", cms.InputTag)
1279  self.addParameter(self._defaultParameters,'svSource',cms.InputTag('inclusiveCandidateSecondaryVertices'), "Label of the input collection for IVF vertices used in b-tagging", cms.InputTag)
1280  self.addParameter(self._defaultParameters,'elSource',cms.InputTag('gedGsfElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag)
1281  self.addParameter(self._defaultParameters,'muSource',cms.InputTag('muons'), "Label of the input collection for muons used in b-tagging", cms.InputTag)
1282  self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction")
1283  self.addParameter(self._defaultParameters,'tightBTagNTkHits', False, "Enable legacy tight b-tag track selection")
1284  self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules")
1285  self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)")
1286  self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag)
1287  self.addParameter(self._defaultParameters,'groomedFatJets', cms.InputTag(''), "Groomed fat jet collection used for secondary vertex clustering", cms.InputTag)
1288  self.addParameter(self._defaultParameters,'algo', 'AK', "Jet algorithm of the input collection from which the new patJet collection should be created")
1289  self.addParameter(self._defaultParameters,'rParam', 0.4, "Jet size (distance parameter R used in jet clustering)")
1290  self.addParameter(self._defaultParameters,'getJetMCFlavour', True, "Get jet MC truth flavour")
1291  self.addParameter(self._defaultParameters,'genJetCollection', cms.InputTag("ak4GenJets"), "GenJet collection to match to", cms.InputTag)
1292  self.addParameter(self._defaultParameters,'genParticles', cms.InputTag("genParticles"), "GenParticle collection to be used", cms.InputTag)
1293  self.addParameter(self._defaultParameters,'jetCorrections',None, "Add all relevant information about jet energy corrections that you want to be added to your new patJet \
1294  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 \
1295  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 \
1296  new patJet collection. This should be given as a list of strings. Available values are L1Offset, L1FastJet, L1JPTOffset, L2Relative, L3Absolute, L5Falvour, L7Parton; the \
1297  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 \
1298  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 \
1299  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\' \
1300  and \'type-2\' are not case sensitive.", tuple, acceptNoneValue=True)
1301  self.addParameter(self._defaultParameters,'btagDiscriminators',['None'], "If you are interested in btagging, in most cases just the labels of the btag discriminators that \
1302  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. \
1303  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)
1304  self.addParameter(self._defaultParameters,'btagInfos',['None'], "The btagInfos objects contain all relevant information from which all discriminators of a certain \
1305  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 \
1306  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 \
1307  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 \
1308  will be added to your new patJet collection.", allowedValues=supportedBtagInfos,Type=list)
1309  self.addParameter(self._defaultParameters,'jetTrackAssociation',False, "Add JetTrackAssociation and JetCharge from reconstructed tracks to your new patJet collection. This \
1310  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 \
1311  your new patJetCollection. If btag information of any form is added to the new patJet collection this information will be added automatically.")
1312  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 \
1313  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 \
1314  to more than one output module.")
1315 
1316  self._parameters=copy.deepcopy(self._defaultParameters)
1317 
1318  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\
1319  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 \
1320  the descriptions of each parameter for more information."
1321 
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 1328 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, emtf::phase2::algo::HitmapLayer.apply(), SlidingPeakFinder.apply(), emtf::phase2::algo::DuplicateRemovalLayer.apply(), emtf::phase2::algo::OutputLayer.apply(), emtf::phase2::algo::ParameterAssignmentLayer.apply(), emtf::phase2::algo::PatternMatchingLayer.apply(), emtf::phase2::algo::RoadSortingLayer.apply(), SignedImpactParameter3D.apply(), SignedDecayLength3D.apply(), SignedTransverseImpactParameter.apply(), ProcessAcceleratorROCm.ProcessAcceleratorROCm.apply(), ProcessAcceleratorCUDA.ProcessAcceleratorCUDA.apply(), gen::PhotosInterfaceBase.apply(), emtf::phase2::algo::TrackBuildingLayer.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().

1328  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):
1329  """
1330  Function call wrapper. This will check the parameters and call the actual implementation that
1331  can be found in toolCode via the base class function apply.
1332  """
1333  if labelName is None:
1334  labelName=self._defaultParameters['labelName'].value
1335  self.setParameter('labelName', labelName)
1336  if postfix is None:
1337  postfix=self._defaultParameters['postfix'].value
1338  self.setParameter('postfix', postfix)
1339  if btagPrefix is None:
1340  btagPrefix=self._defaultParameters['btagPrefix'].value
1341  self.setParameter('btagPrefix', btagPrefix)
1342  if jetSource is None:
1343  jetSource=self._defaultParameters['jetSource'].value
1344  self.setParameter('jetSource', jetSource)
1345  if pfCandidates is None:
1346  pfCandidates=self._defaultParameters['pfCandidates'].value
1347  self.setParameter('pfCandidates', pfCandidates)
1348  if explicitJTA is None:
1349  explicitJTA=self._defaultParameters['explicitJTA'].value
1350  self.setParameter('explicitJTA', explicitJTA)
1351  if pvSource is None:
1352  pvSource=self._defaultParameters['pvSource'].value
1353  self.setParameter('pvSource', pvSource)
1354  if svSource is None:
1355  svSource=self._defaultParameters['svSource'].value
1356  self.setParameter('svSource', svSource)
1357  if elSource is None:
1358  elSource=self._defaultParameters['elSource'].value
1359  self.setParameter('elSource', elSource)
1360  if muSource is None:
1361  muSource=self._defaultParameters['muSource'].value
1362  self.setParameter('muSource', muSource)
1363  if runIVF is None:
1364  runIVF=self._defaultParameters['runIVF'].value
1365  self.setParameter('runIVF', runIVF)
1366  if tightBTagNTkHits is None:
1367  tightBTagNTkHits=self._defaultParameters['tightBTagNTkHits'].value
1368  self.setParameter('tightBTagNTkHits', tightBTagNTkHits)
1369  if loadStdRecoBTag is None:
1370  loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value
1371  self.setParameter('loadStdRecoBTag', loadStdRecoBTag)
1372  if svClustering is None:
1373  svClustering=self._defaultParameters['svClustering'].value
1374  self.setParameter('svClustering', svClustering)
1375  if fatJets is None:
1376  fatJets=self._defaultParameters['fatJets'].value
1377  self.setParameter('fatJets', fatJets)
1378  if groomedFatJets is None:
1379  groomedFatJets=self._defaultParameters['groomedFatJets'].value
1380  self.setParameter('groomedFatJets', groomedFatJets)
1381  if algo is None:
1382  algo=self._defaultParameters['algo'].value
1383  self.setParameter('algo', algo)
1384  if rParam is None:
1385  rParam=self._defaultParameters['rParam'].value
1386  self.setParameter('rParam', rParam)
1387  if getJetMCFlavour is None:
1388  getJetMCFlavour=self._defaultParameters['getJetMCFlavour'].value
1389  self.setParameter('getJetMCFlavour', getJetMCFlavour)
1390  if genJetCollection is None:
1391  genJetCollection=self._defaultParameters['genJetCollection'].value
1392  self.setParameter('genJetCollection', genJetCollection)
1393  if genParticles is None:
1394  genParticles=self._defaultParameters['genParticles'].value
1395  self.setParameter('genParticles', genParticles)
1396  if jetCorrections is None:
1397  jetCorrections=self._defaultParameters['jetCorrections'].value
1398  self.setParameter('jetCorrections', jetCorrections)
1399  if btagDiscriminators is None:
1400  btagDiscriminators=self._defaultParameters['btagDiscriminators'].value
1401  self.setParameter('btagDiscriminators', btagDiscriminators)
1402  if btagInfos is None:
1403  btagInfos=self._defaultParameters['btagInfos'].value
1404  self.setParameter('btagInfos', btagInfos)
1405  if jetTrackAssociation is None:
1406  jetTrackAssociation=self._defaultParameters['jetTrackAssociation'].value
1407  self.setParameter('jetTrackAssociation', jetTrackAssociation)
1408  if outputModules is None:
1409  outputModules=self._defaultParameters['outputModules'].value
1410  self.setParameter('outputModules', outputModules)
1411  self.apply(process)
1412 

◆ getDefaultParameters()

def jetTools.AddJetCollection.getDefaultParameters (   self)

◆ toolCode()

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

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

1413  def toolCode(self, process):
1414  """
1415  Tool code implementation
1416  """
1417  task = getPatAlgosToolsTask(process)
1418 
1419 
1420  labelName=self._parameters['labelName'].value
1421  postfix=self._parameters['postfix'].value
1422  btagPrefix=self._parameters['btagPrefix'].value
1423  jetSource=self._parameters['jetSource'].value
1424  pfCandidates=self._parameters['pfCandidates'].value
1425  explicitJTA=self._parameters['explicitJTA'].value
1426  pvSource=self._parameters['pvSource'].value
1427  svSource=self._parameters['svSource'].value
1428  elSource=self._parameters['elSource'].value
1429  muSource=self._parameters['muSource'].value
1430  runIVF=self._parameters['runIVF'].value
1431  tightBTagNTkHits=self._parameters['tightBTagNTkHits'].value
1432  loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value
1433  svClustering=self._parameters['svClustering'].value
1434  fatJets=self._parameters['fatJets'].value
1435  groomedFatJets=self._parameters['groomedFatJets'].value
1436  algo=self._parameters['algo'].value
1437  rParam=self._parameters['rParam'].value
1438  getJetMCFlavour=self._parameters['getJetMCFlavour'].value
1439  genJetCollection=self._parameters['genJetCollection'].value
1440  genParticles=self._parameters['genParticles'].value
1441  jetCorrections=self._parameters['jetCorrections'].value
1442  btagDiscriminators=list(self._parameters['btagDiscriminators'].value)
1443  btagInfos=list(self._parameters['btagInfos'].value)
1444  jetTrackAssociation=self._parameters['jetTrackAssociation'].value
1445  outputModules=list(self._parameters['outputModules'].value)
1446 
1447 
1448  if labelName=='UNDEFINED':
1449  undefinedLabelName(self)
1450 
1451 
1452  knownModules = process.producerNames().split()
1453 
1454  if btagDiscriminators.count('None')>0:
1455  btagDiscriminators.remove('None')
1456  if btagInfos.count('None')>0:
1457  btagInfos.remove('None')
1458  bTagging=(len(btagDiscriminators)>0 or len(btagInfos)>0)
1459 
1460  infos = 0
1461  for info in btagInfos:
1462  if info.startswith('pf'): infos = infos + 1
1463  if 'softpf' in info.lower(): infos = infos + 1
1464  tags = 0
1465  for tag in btagDiscriminators:
1466  if tag.startswith('pf'): tags = tags + 1
1467  if 'softpf' in tag.lower(): tags = tags + 1
1468  bTaggingLegacy=(len(btagDiscriminators)>tags or len(btagInfos)>infos)
1469 
1472  _labelName=labelName[:1].upper()+labelName[1:]
1473 
1474 
1475  _algo=''
1476  for x in ["ak", "ca", "kt"]:
1477  if x in algo.lower():
1478  _algo=supportedJetAlgos[x]
1479  break
1480  if _algo=='':
1482 
1483  from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import _patJets as patJets
1484  if 'patJets'+_labelName+postfix in knownModules :
1485  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
1486  _newPatJets.jetSource=jetSource
1487  else :
1488  addToProcessAndTask('patJets'+_labelName+postfix, patJets.clone(jetSource=jetSource), process, task)
1489  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
1490  knownModules.append('patJets'+_labelName+postfix)
1491 
1492  from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets
1493  if 'selectedPatJets'+_labelName+postfix in knownModules :
1494  _newSelectedPatJets=getattr(process, 'selectedPatJets'+_labelName+postfix)
1495  _newSelectedPatJets.src='patJets'+_labelName+postfix
1496  else :
1497  addToProcessAndTask('selectedPatJets'+_labelName+postfix,
1498  selectedPatJets.clone(src='patJets'+_labelName+postfix),
1499  process, task)
1500  knownModules.append('selectedPatJets'+_labelName+postfix)
1501 
1502 
1503  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetPartonMatch
1504  if 'patJetPartonMatch'+_labelName+postfix in knownModules :
1505  _newPatJetPartonMatch=getattr(process, 'patJetPartonMatch'+_labelName+postfix)
1506  _newPatJetPartonMatch.src=jetSource
1507  _newPatJetPartonMatch.matched=genParticles
1508  else :
1509  addToProcessAndTask('patJetPartonMatch'+_labelName+postfix,
1510  patJetPartonMatch.clone(src=jetSource, matched=genParticles),
1511  process, task)
1512  knownModules.append('patJetPartonMatch'+_labelName+postfix)
1513 
1514  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetGenJetMatch
1515  if 'patJetGenJetMatch'+_labelName+postfix in knownModules :
1516  _newPatJetGenJetMatch=getattr(process, 'patJetGenJetMatch'+_labelName+postfix)
1517  _newPatJetGenJetMatch.src=jetSource
1518  _newPatJetGenJetMatch.maxDeltaR=rParam
1519  _newPatJetGenJetMatch.matched=genJetCollection
1520  else :
1521  addToProcessAndTask('patJetGenJetMatch'+_labelName+postfix,
1522  patJetGenJetMatch.clone(src=jetSource, maxDeltaR=rParam, matched=genJetCollection),
1523  process, task)
1524  knownModules.append('patJetGenJetMatch'+_labelName+postfix)
1525 
1526  _newPatJets.genJetMatch.setModuleLabel('patJetGenJetMatch'+_labelName+postfix)
1527  _newPatJets.genPartonMatch.setModuleLabel('patJetPartonMatch'+_labelName+postfix)
1528 
1529  if (getJetMCFlavour):
1530 
1532  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonsLegacy
1533  if 'patJetPartonsLegacy'+postfix not in knownModules :
1534  addToProcessAndTask('patJetPartonsLegacy'+postfix, patJetPartonsLegacy.clone(src=genParticles),
1535  process, task)
1536  knownModules.append('patJetPartonsLegacy'+postfix)
1537  else:
1538  getattr(process, 'patJetPartonsLegacy'+postfix).src=genParticles
1539 
1540  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonAssociationLegacy
1541  if 'patJetPartonAssociationLegacy'+_labelName+postfix in knownModules :
1542  _newPatJetPartonAssociation=getattr(process, 'patJetPartonAssociationLegacy'+_labelName+postfix)
1543  _newPatJetPartonAssociation.jets=jetSource
1544  else :
1545  addToProcessAndTask('patJetPartonAssociationLegacy'+_labelName+postfix,
1546  patJetPartonAssociationLegacy.clone(jets=jetSource), process, task)
1547  knownModules.append('patJetPartonAssociationLegacy'+_labelName+postfix)
1548 
1549  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociationLegacy
1550  if 'patJetFlavourAssociationLegacy'+_labelName+postfix in knownModules :
1551  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociationLegacy'+_labelName+postfix)
1552  _newPatJetFlavourAssociation.srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix
1553  else:
1554  addToProcessAndTask('patJetFlavourAssociationLegacy'+_labelName+postfix,
1555  patJetFlavourAssociationLegacy.clone(
1556  srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix),
1557  process, task)
1558  knownModules.append('patJetFlavourAssociationLegacy'+_labelName+postfix)
1559 
1560  _newPatJets.JetPartonMapSource.setModuleLabel('patJetFlavourAssociationLegacy'+_labelName+postfix)
1561 
1564  if 'patJetPartons'+postfix not in knownModules :
1565  addToProcessAndTask('patJetPartons'+postfix, patJetPartons.clone(particles=genParticles), process, task)
1566  knownModules.append('patJetPartons'+postfix)
1567  else:
1568  getattr(process, 'patJetPartons'+postfix).particles=genParticles
1569 
1570  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociation
1571  if 'patJetFlavourAssociation'+_labelName+postfix in knownModules :
1572  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1573  _newPatJetFlavourAssociation.jets=jetSource
1574  _newPatJetFlavourAssociation.jetAlgorithm=_algo
1575  _newPatJetFlavourAssociation.rParam=rParam
1576  _newPatJetFlavourAssociation.bHadrons=cms.InputTag("patJetPartons"+postfix,"bHadrons")
1577  _newPatJetFlavourAssociation.cHadrons=cms.InputTag("patJetPartons"+postfix,"cHadrons")
1578  _newPatJetFlavourAssociation.partons=cms.InputTag("patJetPartons"+postfix,"physicsPartons")
1579  _newPatJetFlavourAssociation.leptons=cms.InputTag("patJetPartons"+postfix,"leptons")
1580  else :
1581  addToProcessAndTask('patJetFlavourAssociation'+_labelName+postfix,
1582  patJetFlavourAssociation.clone(
1583  jets=jetSource,
1584  jetAlgorithm=_algo,
1585  rParam=rParam,
1586  bHadrons = cms.InputTag("patJetPartons"+postfix,"bHadrons"),
1587  cHadrons = cms.InputTag("patJetPartons"+postfix,"cHadrons"),
1588  partons = cms.InputTag("patJetPartons"+postfix,"physicsPartons"),
1589  leptons = cms.InputTag("patJetPartons"+postfix,"leptons")),
1590  process, task)
1591 
1592  knownModules.append('patJetFlavourAssociation'+_labelName+postfix)
1593  if 'Puppi' in jetSource.value() and pfCandidates.value() == 'particleFlow':
1594  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1595  _newPatJetFlavourAssociation.weights = cms.InputTag("puppi")
1596 
1597  _newPatJets.JetFlavourInfoSource.setModuleLabel('patJetFlavourAssociation'+_labelName+postfix)
1598 
1599  if fatJets != cms.InputTag('') and groomedFatJets != cms.InputTag(''):
1600  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1601  _newPatJetFlavourAssociation.jets=fatJets
1602  _newPatJetFlavourAssociation.groomedJets=groomedFatJets
1603  _newPatJetFlavourAssociation.subjets=jetSource
1604  _newPatJets.JetFlavourInfoSource=cms.InputTag('patJetFlavourAssociation'+_labelName+postfix,'SubJets')
1605  else:
1606  _newPatJets.getJetMCFlavour = False
1607  _newPatJets.addJetFlavourInfo = False
1608 
1609 
1610  if (jetTrackAssociation or bTaggingLegacy):
1611 
1612  from RecoJets.JetAssociationProducers.ak4JTA_cff import ak4JetTracksAssociatorAtVertex, ak4JetTracksAssociatorExplicit
1613  if 'jetTracksAssociationAtVertex'+_labelName+postfix in knownModules :
1614  _newJetTracksAssociationAtVertex=getattr(process, 'jetTracksAssociatorAtVertex'+_labelName+postfix)
1615  _newJetTracksAssociationAtVertex.jets=jetSource
1616  _newJetTracksAssociationAtVertex.pvSrc=pvSource
1617  else:
1618  jetTracksAssociator=ak4JetTracksAssociatorAtVertex
1619  if explicitJTA:
1620  jetTracksAssociator=ak4JetTracksAssociatorExplicit
1621  addToProcessAndTask('jetTracksAssociatorAtVertex'+_labelName+postfix,
1622  jetTracksAssociator.clone(jets=jetSource,pvSrc=pvSource),
1623  process, task)
1624  knownModules.append('jetTracksAssociationAtVertex'+_labelName+postfix)
1625 
1627  if 'patJetCharge'+_labelName+postfix in knownModules :
1628  _newPatJetCharge=getattr(process, 'patJetCharge'+_labelName+postfix)
1629  _newPatJetCharge.src='jetTracksAssociatorAtVertex'+_labelName+postfix
1630  else:
1631  addToProcessAndTask('patJetCharge'+_labelName+postfix,
1632  patJetCharge.clone(src = 'jetTracksAssociatorAtVertex'+_labelName+postfix),
1633  process, task)
1634  knownModules.append('patJetCharge'+_labelName+postfix)
1635 
1636  _newPatJets.addAssociatedTracks=True
1637  _newPatJets.trackAssociationSource=cms.InputTag('jetTracksAssociatorAtVertex'+_labelName+postfix)
1638  _newPatJets.addJetCharge=True
1639  _newPatJets.jetChargeSource=cms.InputTag('patJetCharge'+_labelName+postfix)
1640  else:
1641 
1642  _newPatJets.addAssociatedTracks=False
1643  _newPatJets.trackAssociationSource=''
1644  _newPatJets.addJetCharge=False
1645  _newPatJets.jetChargeSource=''
1646 
1647  if (bTagging):
1648  setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets,
1649  _algo, rParam, btagDiscriminators, btagInfos, _newPatJets, _labelName, btagPrefix, postfix)
1650  else:
1651  _newPatJets.addBTagInfo = False
1652  _newPatJets.addTagInfos = False
1653 
1654  for outputModule in outputModules:
1655  if hasattr(process,outputModule):
1656  getattr(process,outputModule).outputCommands.append("drop *_"+'selected'+_labelName+postfix+"_tagInfos_*")
1657 
1658 
1659  if (jetCorrections != None):
1660 
1661  checkJetCorrectionsFormat(jetCorrections)
1662 
1663  setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, _newPatJets, _labelName, postfix)
1664  else:
1665 
1666  _newPatJets.addJetCorrFactors=False
1667 
1668 addJetCollection=AddJetCollection()
1669 
def undefinedLabelName(obj)
Definition: jetTools.py:2282
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:271
def checkJetCorrectionsFormat(jetCorrections)
Definition: jetTools.py:23
def getPatAlgosToolsTask(process)
Definition: helpers.py:13
def unsupportedJetAlgorithm(obj)
Definition: jetTools.py:2289

Member Data Documentation

◆ _comment

jetTools.AddJetCollection._comment
private

add comments

Definition at line 1318 of file jetTools.py.

◆ _defaultParameters

jetTools.AddJetCollection._defaultParameters
staticprivate

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

Referenced by runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.ak4JetReclustering(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createShiftedModules(), 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.produceMET(), 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().