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

Constructor & Destructor Documentation

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

Definition at line 895 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(), cmspython3::Python11ParameterSet.addParameter(), l1t::TriggerSystem.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), edm::ParameterSet.addParameter(), and list().

895  def __init__(self):
896  """
897  Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase to be usable in the configEditor.
898  """
899  ## initialization of the base class
900  ConfigToolBase.__init__(self)
901  ## add all parameters that should be known to the class
902  self.addParameter(self._defaultParameters,'labelName', 'UNDEFINED', "Label name of the new patJet collection.", str)
903  self.addParameter(self._defaultParameters,'postfix','', "Postfix from usePF2PAT.", str)
904  self.addParameter(self._defaultParameters,'btagPrefix','', "Prefix to be added to b-tag discriminator and TagInfo names", str)
905  self.addParameter(self._defaultParameters,'jetSource','', "Label of the input collection from which the new patJet collection should be created", cms.InputTag)
906  self.addParameter(self._defaultParameters,'pfCandidates',cms.InputTag('particleFlow'), "Label of the input collection for candidatecandidatese used in b-tagging", cms.InputTag)
907  self.addParameter(self._defaultParameters,'explicitJTA', False, "Use explicit jet-track association")
908  self.addParameter(self._defaultParameters,'pvSource',cms.InputTag('offlinePrimaryVertices'), "Label of the input collection for primary vertices used in b-tagging", cms.InputTag)
909  self.addParameter(self._defaultParameters,'svSource',cms.InputTag('inclusiveCandidateSecondaryVertices'), "Label of the input collection for IVF vertices used in b-tagging", cms.InputTag)
910  self.addParameter(self._defaultParameters,'elSource',cms.InputTag('gedGsfElectrons'), "Label of the input collection for electrons used in b-tagging", cms.InputTag)
911  self.addParameter(self._defaultParameters,'muSource',cms.InputTag('muons'), "Label of the input collection for muons used in b-tagging", cms.InputTag)
912  self.addParameter(self._defaultParameters,'runIVF', False, "Re-run IVF secondary vertex reconstruction")
913  self.addParameter(self._defaultParameters,'tightBTagNTkHits', False, "Enable legacy tight b-tag track selection")
914  self.addParameter(self._defaultParameters,'loadStdRecoBTag', False, "Load the standard reconstruction b-tagging modules")
915  self.addParameter(self._defaultParameters,'svClustering', False, "Secondary vertices ghost-associated to jets using jet clustering (mostly intended for subjets)")
916  self.addParameter(self._defaultParameters,'fatJets', cms.InputTag(''), "Fat jet collection used for secondary vertex clustering", cms.InputTag)
917  self.addParameter(self._defaultParameters,'groomedFatJets', cms.InputTag(''), "Groomed fat jet collection used for secondary vertex clustering", cms.InputTag)
918  self.addParameter(self._defaultParameters,'algo', 'AK', "Jet algorithm of the input collection from which the new patJet collection should be created")
919  self.addParameter(self._defaultParameters,'rParam', 0.4, "Jet size (distance parameter R used in jet clustering)")
920  self.addParameter(self._defaultParameters,'getJetMCFlavour', True, "Get jet MC truth flavour")
921  self.addParameter(self._defaultParameters,'genJetCollection', cms.InputTag("ak4GenJets"), "GenJet collection to match to", cms.InputTag)
922  self.addParameter(self._defaultParameters,'genParticles', cms.InputTag("genParticles"), "GenParticle collection to be used", cms.InputTag)
923  self.addParameter(self._defaultParameters,'jetCorrections',None, "Add all relevant information about jet energy corrections that you want to be added to your new patJet \
924  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 \
925  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 \
926  new patJet collection. This should be given as a list of strings. Available values are L1Offset, L1FastJet, L1JPTOffset, L2Relative, L3Absolute, L5Falvour, L7Parton; the \
927  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 \
928  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 \
929  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\' \
930  and \'type-2\' are not case sensitive.", tuple, acceptNoneValue=True)
931  self.addParameter(self._defaultParameters,'btagDiscriminators',['None'], "If you are interested in btagging, in most cases just the labels of the btag discriminators that \
932  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. \
933  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)
934  self.addParameter(self._defaultParameters,'btagInfos',['None'], "The btagInfos objects contain all relevant information from which all discriminators of a certain \
935  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 \
936  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 \
937  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 \
938  will be added to your new patJet collection.", allowedValues=supportedBtagInfos,Type=list)
939  self.addParameter(self._defaultParameters,'jetTrackAssociation',False, "Add JetTrackAssociation and JetCharge from reconstructed tracks to your new patJet collection. This \
940  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 \
941  your new patJetCollection. If btag information of any form is added to the new patJet collection this information will be added automatically.")
942  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 \
943  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 \
944  to more than one output module.")
945  ## set defaults
946  self._parameters=copy.deepcopy(self._defaultParameters)
947  ## add comments
948  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\
949  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 \
950  the descriptions of each parameter for more information."
951 
_parameters
initialization of the base class
Definition: jetTools.py:946
_comment
add comments
Definition: jetTools.py:948
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

Member Function Documentation

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

Definition at line 958 of file jetTools.py.

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

958  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):
959  """
960  Function call wrapper. This will check the parameters and call the actual implementation that
961  can be found in toolCode via the base class function apply.
962  """
963  if labelName is None:
964  labelName=self._defaultParameters['labelName'].value
965  self.setParameter('labelName', labelName)
966  if postfix is None:
967  postfix=self._defaultParameters['postfix'].value
968  self.setParameter('postfix', postfix)
969  if btagPrefix is None:
970  btagPrefix=self._defaultParameters['btagPrefix'].value
971  self.setParameter('btagPrefix', btagPrefix)
972  if jetSource is None:
973  jetSource=self._defaultParameters['jetSource'].value
974  self.setParameter('jetSource', jetSource)
975  if pfCandidates is None:
976  pfCandidates=self._defaultParameters['pfCandidates'].value
977  self.setParameter('pfCandidates', pfCandidates)
978  if explicitJTA is None:
979  explicitJTA=self._defaultParameters['explicitJTA'].value
980  self.setParameter('explicitJTA', explicitJTA)
981  if pvSource is None:
982  pvSource=self._defaultParameters['pvSource'].value
983  self.setParameter('pvSource', pvSource)
984  if svSource is None:
985  svSource=self._defaultParameters['svSource'].value
986  self.setParameter('svSource', svSource)
987  if elSource is None:
988  elSource=self._defaultParameters['elSource'].value
989  self.setParameter('elSource', elSource)
990  if muSource is None:
991  muSource=self._defaultParameters['muSource'].value
992  self.setParameter('muSource', muSource)
993  if runIVF is None:
994  runIVF=self._defaultParameters['runIVF'].value
995  self.setParameter('runIVF', runIVF)
996  if tightBTagNTkHits is None:
997  tightBTagNTkHits=self._defaultParameters['tightBTagNTkHits'].value
998  self.setParameter('tightBTagNTkHits', tightBTagNTkHits)
999  if loadStdRecoBTag is None:
1000  loadStdRecoBTag=self._defaultParameters['loadStdRecoBTag'].value
1001  self.setParameter('loadStdRecoBTag', loadStdRecoBTag)
1002  if svClustering is None:
1003  svClustering=self._defaultParameters['svClustering'].value
1004  self.setParameter('svClustering', svClustering)
1005  if fatJets is None:
1006  fatJets=self._defaultParameters['fatJets'].value
1007  self.setParameter('fatJets', fatJets)
1008  if groomedFatJets is None:
1009  groomedFatJets=self._defaultParameters['groomedFatJets'].value
1010  self.setParameter('groomedFatJets', groomedFatJets)
1011  if algo is None:
1012  algo=self._defaultParameters['algo'].value
1013  self.setParameter('algo', algo)
1014  if rParam is None:
1015  rParam=self._defaultParameters['rParam'].value
1016  self.setParameter('rParam', rParam)
1017  if getJetMCFlavour is None:
1018  getJetMCFlavour=self._defaultParameters['getJetMCFlavour'].value
1019  self.setParameter('getJetMCFlavour', getJetMCFlavour)
1020  if genJetCollection is None:
1021  genJetCollection=self._defaultParameters['genJetCollection'].value
1022  self.setParameter('genJetCollection', genJetCollection)
1023  if genParticles is None:
1024  genParticles=self._defaultParameters['genParticles'].value
1025  self.setParameter('genParticles', genParticles)
1026  if jetCorrections is None:
1027  jetCorrections=self._defaultParameters['jetCorrections'].value
1028  self.setParameter('jetCorrections', jetCorrections)
1029  if btagDiscriminators is None:
1030  btagDiscriminators=self._defaultParameters['btagDiscriminators'].value
1031  self.setParameter('btagDiscriminators', btagDiscriminators)
1032  if btagInfos is None:
1033  btagInfos=self._defaultParameters['btagInfos'].value
1034  self.setParameter('btagInfos', btagInfos)
1035  if jetTrackAssociation is None:
1036  jetTrackAssociation=self._defaultParameters['jetTrackAssociation'].value
1037  self.setParameter('jetTrackAssociation', jetTrackAssociation)
1038  if outputModules is None:
1039  outputModules=self._defaultParameters['outputModules'].value
1040  self.setParameter('outputModules', outputModules)
1041  self.apply(process)
1042 
def __call__(self, process, labelName=None, postfix=None, btagPrefix=None, jetSource=None, pfCandidates=None, explicitJTA=None, pvSource=None, svSource=None, elSource=None, muSource=None, runIVF=None, tightBTagNTkHits=None, loadStdRecoBTag=None, svClustering=None, fatJets=None, groomedFatJets=None, algo=None, rParam=None, getJetMCFlavour=None, genJetCollection=None, genParticles=None, jetCorrections=None, btagDiscriminators=None, btagInfos=None, jetTrackAssociation=None, outputModules=None)
Definition: jetTools.py:958
def jetTools.AddJetCollection.getDefaultParameters (   self)
def jetTools.AddJetCollection.toolCode (   self,
  process 
)
Tool code implementation

Definition at line 1043 of file jetTools.py.

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

1043  def toolCode(self, process):
1044  """
1045  Tool code implementation
1046  """
1047  task = getPatAlgosToolsTask(process)
1048 
1049  ## initialize parameters
1050  labelName=self._parameters['labelName'].value
1051  postfix=self._parameters['postfix'].value
1052  btagPrefix=self._parameters['btagPrefix'].value
1053  jetSource=self._parameters['jetSource'].value
1054  pfCandidates=self._parameters['pfCandidates'].value
1055  explicitJTA=self._parameters['explicitJTA'].value
1056  pvSource=self._parameters['pvSource'].value
1057  svSource=self._parameters['svSource'].value
1058  elSource=self._parameters['elSource'].value
1059  muSource=self._parameters['muSource'].value
1060  runIVF=self._parameters['runIVF'].value
1061  tightBTagNTkHits=self._parameters['tightBTagNTkHits'].value
1062  loadStdRecoBTag=self._parameters['loadStdRecoBTag'].value
1063  svClustering=self._parameters['svClustering'].value
1064  fatJets=self._parameters['fatJets'].value
1065  groomedFatJets=self._parameters['groomedFatJets'].value
1066  algo=self._parameters['algo'].value
1067  rParam=self._parameters['rParam'].value
1068  getJetMCFlavour=self._parameters['getJetMCFlavour'].value
1069  genJetCollection=self._parameters['genJetCollection'].value
1070  genParticles=self._parameters['genParticles'].value
1071  jetCorrections=self._parameters['jetCorrections'].value
1072  btagDiscriminators=list(self._parameters['btagDiscriminators'].value)
1073  btagInfos=list(self._parameters['btagInfos'].value)
1074  jetTrackAssociation=self._parameters['jetTrackAssociation'].value
1075  outputModules=list(self._parameters['outputModules'].value)
1076 
1077  ## added jets must have a defined 'labelName'
1078  if labelName=='UNDEFINED':
1079  undefinedLabelName(self)
1080 
1081  ## a list of all producer modules, which are already known to process
1082  knownModules = process.producerNames().split()
1083  ## determine whether btagging information is required or not
1084  if btagDiscriminators.count('None')>0:
1085  btagDiscriminators.remove('None')
1086  if btagInfos.count('None')>0:
1087  btagInfos.remove('None')
1088  bTagging=(len(btagDiscriminators)>0 or len(btagInfos)>0)
1089  ## check if any legacy btag discriminators are being used
1090  infos = 0
1091  for info in btagInfos:
1092  if info.startswith('pf'): infos = infos + 1
1093  if 'softpf' in info.lower(): infos = infos + 1
1094  tags = 0
1095  for tag in btagDiscriminators:
1096  if tag.startswith('pf'): tags = tags + 1
1097  if 'softpf' in tag.lower(): tags = tags + 1
1098  bTaggingLegacy=(len(btagDiscriminators)>tags or len(btagInfos)>infos)
1099  ## construct postfix label for auxiliary modules; this postfix
1100  ## label will start with a capitalized first letter following
1101  ## the CMS naming conventions and for improved readablility
1102  _labelName=labelName[:1].upper()+labelName[1:]
1103 
1104  ## supported algo types are ak, ca, and kt
1105  _algo=''
1106  for x in ["ak", "ca", "kt"]:
1107  if x in algo.lower():
1108  _algo=supportedJetAlgos[x]
1109  break
1110  if _algo=='':
1112  ## add new patJets to process (keep instance for later further modifications)
1113  from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import _patJets as patJets
1114  if 'patJets'+_labelName+postfix in knownModules :
1115  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
1116  _newPatJets.jetSource=jetSource
1117  else :
1118  addToProcessAndTask('patJets'+_labelName+postfix, patJets.clone(jetSource=jetSource), process, task)
1119  _newPatJets=getattr(process, 'patJets'+_labelName+postfix)
1120  knownModules.append('patJets'+_labelName+postfix)
1121  ## add new selectedPatJets to process
1122  from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets
1123  if 'selectedPatJets'+_labelName+postfix in knownModules :
1124  _newSelectedPatJets=getattr(process, 'selectedPatJets'+_labelName+postfix)
1125  _newSelectedPatJets.src='patJets'+_labelName+postfix
1126  else :
1127  addToProcessAndTask('selectedPatJets'+_labelName+postfix,
1128  selectedPatJets.clone(src='patJets'+_labelName+postfix),
1129  process, task)
1130  knownModules.append('selectedPatJets'+_labelName+postfix)
1131 
1132  ## add new patJetPartonMatch to process
1133  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetPartonMatch
1134  if 'patJetPartonMatch'+_labelName+postfix in knownModules :
1135  _newPatJetPartonMatch=getattr(process, 'patJetPartonMatch'+_labelName+postfix)
1136  _newPatJetPartonMatch.src=jetSource
1137  _newPatJetPartonMatch.matched=genParticles
1138  else :
1139  addToProcessAndTask('patJetPartonMatch'+_labelName+postfix,
1140  patJetPartonMatch.clone(src=jetSource, matched=genParticles),
1141  process, task)
1142  knownModules.append('patJetPartonMatch'+_labelName+postfix)
1143  ## add new patJetGenJetMatch to process
1144  from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetGenJetMatch
1145  if 'patJetGenJetMatch'+_labelName+postfix in knownModules :
1146  _newPatJetGenJetMatch=getattr(process, 'patJetGenJetMatch'+_labelName+postfix)
1147  _newPatJetGenJetMatch.src=jetSource
1148  _newPatJetGenJetMatch.maxDeltaR=rParam
1149  _newPatJetGenJetMatch.matched=genJetCollection
1150  else :
1151  addToProcessAndTask('patJetGenJetMatch'+_labelName+postfix,
1152  patJetGenJetMatch.clone(src=jetSource, maxDeltaR=rParam, matched=genJetCollection),
1153  process, task)
1154  knownModules.append('patJetGenJetMatch'+_labelName+postfix)
1155  ## modify new patJets collection accordingly
1156  _newPatJets.genJetMatch.setModuleLabel('patJetGenJetMatch'+_labelName+postfix)
1157  _newPatJets.genPartonMatch.setModuleLabel('patJetPartonMatch'+_labelName+postfix)
1158  ## get jet MC truth flavour if required by user
1159  if (getJetMCFlavour):
1160  ## legacy jet flavour (see https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools)
1161  ## add new patJetPartonsLegacy to process
1162  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonsLegacy
1163  if 'patJetPartonsLegacy'+postfix not in knownModules :
1164  addToProcessAndTask('patJetPartonsLegacy'+postfix, patJetPartonsLegacy.clone(src=genParticles),
1165  process, task)
1166  knownModules.append('patJetPartonsLegacy'+postfix)
1167  else:
1168  getattr(process, 'patJetPartonsLegacy'+postfix).src=genParticles
1169  ## add new patJetPartonAssociationLegacy to process
1170  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonAssociationLegacy
1171  if 'patJetPartonAssociationLegacy'+_labelName+postfix in knownModules :
1172  _newPatJetPartonAssociation=getattr(process, 'patJetPartonAssociationLegacy'+_labelName+postfix)
1173  _newPatJetPartonAssociation.jets=jetSource
1174  else :
1175  addToProcessAndTask('patJetPartonAssociationLegacy'+_labelName+postfix,
1176  patJetPartonAssociationLegacy.clone(jets=jetSource), process, task)
1177  knownModules.append('patJetPartonAssociationLegacy'+_labelName+postfix)
1178  ## add new patJetPartonAssociationLegacy to process
1179  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociationLegacy
1180  if 'patJetFlavourAssociationLegacy'+_labelName+postfix in knownModules :
1181  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociationLegacy'+_labelName+postfix)
1182  _newPatJetFlavourAssociation.srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix
1183  else:
1184  addToProcessAndTask('patJetFlavourAssociationLegacy'+_labelName+postfix,
1185  patJetFlavourAssociationLegacy.clone(
1186  srcByReference='patJetPartonAssociationLegacy'+_labelName+postfix),
1187  process, task)
1188  knownModules.append('patJetFlavourAssociationLegacy'+_labelName+postfix)
1189  ## modify new patJets collection accordingly
1190  _newPatJets.JetPartonMapSource.setModuleLabel('patJetFlavourAssociationLegacy'+_labelName+postfix)
1191  ## new jet flavour (see https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideBTagMCTools)
1192  ## add new patJetPartons to process
1194  if 'patJetPartons'+postfix not in knownModules :
1195  addToProcessAndTask('patJetPartons'+postfix, patJetPartons.clone(particles=genParticles), process, task)
1196  knownModules.append('patJetPartons'+postfix)
1197  else:
1198  getattr(process, 'patJetPartons'+postfix).particles=genParticles
1199  ## add new patJetFlavourAssociation to process
1200  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociation
1201  if 'patJetFlavourAssociation'+_labelName+postfix in knownModules :
1202  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1203  _newPatJetFlavourAssociation.jets=jetSource
1204  _newPatJetFlavourAssociation.jetAlgorithm=_algo
1205  _newPatJetFlavourAssociation.rParam=rParam
1206  _newPatJetFlavourAssociation.bHadrons=cms.InputTag("patJetPartons"+postfix,"bHadrons")
1207  _newPatJetFlavourAssociation.cHadrons=cms.InputTag("patJetPartons"+postfix,"cHadrons")
1208  _newPatJetFlavourAssociation.partons=cms.InputTag("patJetPartons"+postfix,"physicsPartons")
1209  _newPatJetFlavourAssociation.leptons=cms.InputTag("patJetPartons"+postfix,"leptons")
1210  else :
1211  addToProcessAndTask('patJetFlavourAssociation'+_labelName+postfix,
1212  patJetFlavourAssociation.clone(
1213  jets=jetSource,
1214  jetAlgorithm=_algo,
1215  rParam=rParam,
1216  bHadrons = cms.InputTag("patJetPartons"+postfix,"bHadrons"),
1217  cHadrons = cms.InputTag("patJetPartons"+postfix,"cHadrons"),
1218  partons = cms.InputTag("patJetPartons"+postfix,"physicsPartons"),
1219  leptons = cms.InputTag("patJetPartons"+postfix,"leptons")),
1220  process, task)
1221 
1222  knownModules.append('patJetFlavourAssociation'+_labelName+postfix)
1223  ## modify new patJets collection accordingly
1224  _newPatJets.JetFlavourInfoSource.setModuleLabel('patJetFlavourAssociation'+_labelName+postfix)
1225  ## if the jets is actually a subjet
1226  if fatJets != cms.InputTag('') and groomedFatJets != cms.InputTag(''):
1227  _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName+postfix)
1228  _newPatJetFlavourAssociation.jets=fatJets
1229  _newPatJetFlavourAssociation.groomedJets=groomedFatJets
1230  _newPatJetFlavourAssociation.subjets=jetSource
1231  _newPatJets.JetFlavourInfoSource=cms.InputTag('patJetFlavourAssociation'+_labelName+postfix,'SubJets')
1232  else:
1233  _newPatJets.getJetMCFlavour = False
1234 
1235  ## add jetTrackAssociation for legacy btagging (or jetTracksAssociation only) if required by user
1236  if (jetTrackAssociation or bTaggingLegacy):
1237  ## add new jetTracksAssociationAtVertex to process
1238  from RecoJets.JetAssociationProducers.ak4JTA_cff import ak4JetTracksAssociatorAtVertex, ak4JetTracksAssociatorExplicit
1239  if 'jetTracksAssociationAtVertex'+_labelName+postfix in knownModules :
1240  _newJetTracksAssociationAtVertex=getattr(process, 'jetTracksAssociatorAtVertex'+_labelName+postfix)
1241  _newJetTracksAssociationAtVertex.jets=jetSource
1242  _newJetTracksAssociationAtVertex.pvSrc=pvSource
1243  else:
1244  jetTracksAssociator=ak4JetTracksAssociatorAtVertex
1245  if explicitJTA:
1246  jetTracksAssociator=ak4JetTracksAssociatorExplicit
1247  addToProcessAndTask('jetTracksAssociatorAtVertex'+_labelName+postfix,
1248  jetTracksAssociator.clone(jets=jetSource,pvSrc=pvSource),
1249  process, task)
1250  knownModules.append('jetTracksAssociationAtVertex'+_labelName+postfix)
1251  ## add new patJetCharge to process
1253  if 'patJetCharge'+_labelName+postfix in knownModules :
1254  _newPatJetCharge=getattr(process, 'patJetCharge'+_labelName+postfix)
1255  _newPatJetCharge.src='jetTracksAssociatorAtVertex'+_labelName+postfix
1256  else:
1257  addToProcessAndTask('patJetCharge'+_labelName+postfix,
1258  patJetCharge.clone(src = 'jetTracksAssociatorAtVertex'+_labelName+postfix),
1259  process, task)
1260  knownModules.append('patJetCharge'+_labelName+postfix)
1261  ## modify new patJets collection accordingly
1262  _newPatJets.addAssociatedTracks=True
1263  _newPatJets.trackAssociationSource=cms.InputTag('jetTracksAssociatorAtVertex'+_labelName+postfix)
1264  _newPatJets.addJetCharge=True
1265  _newPatJets.jetChargeSource=cms.InputTag('patJetCharge'+_labelName+postfix)
1266  else:
1267  ## modify new patJets collection accordingly
1268  _newPatJets.addAssociatedTracks=False
1269  _newPatJets.trackAssociationSource=''
1270  _newPatJets.addJetCharge=False
1271  _newPatJets.jetChargeSource=''
1272  ## run btagging if required by user
1273  if (bTagging):
1274  setupBTagging(process, jetSource, pfCandidates, explicitJTA, pvSource, svSource, elSource, muSource, runIVF, tightBTagNTkHits, loadStdRecoBTag, svClustering, fatJets, groomedFatJets,
1275  _algo, rParam, btagDiscriminators, btagInfos, _newPatJets, _labelName, btagPrefix, postfix)
1276  else:
1277  _newPatJets.addBTagInfo = False
1278  _newPatJets.addTagInfos = False
1279  ## adjust output module; these collections will be empty anyhow, but we do it to stay clean
1280  for outputModule in outputModules:
1281  if hasattr(process,outputModule):
1282  getattr(process,outputModule).outputCommands.append("drop *_"+'selected'+_labelName+postfix+"_tagInfos_*")
1283 
1284  ## add jet correction factors if required by user
1285  if (jetCorrections != None):
1286  ## check the jet corrections format
1287  checkJetCorrectionsFormat(jetCorrections)
1288  ## setup jet energy corrections and MET corrections
1289  setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, _newPatJets, _labelName, postfix)
1290  else:
1291  ## switch jetCorrFactors off
1292  _newPatJets.addJetCorrFactors=False
1293 
1294 addJetCollection=AddJetCollection()
1295 
def undefinedLabelName(obj)
Definition: jetTools.py:1908
def toolCode(self, process)
Definition: jetTools.py:1043
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:29
def setupJetCorrections(process, knownModules, jetCorrections, jetSource, pvSource, patJets, labelName, postfix)
Definition: jetTools.py:26
_parameters
initialization of the base class
Definition: jetTools.py:946
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:237
def checkJetCorrectionsFormat(jetCorrections)
Definition: jetTools.py:18
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
double split
Definition: MVATrainer.cc:139
def unsupportedJetAlgorithm(obj)
Definition: jetTools.py:1915
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

Member Data Documentation

jetTools.AddJetCollection._comment
private

add comments

Definition at line 948 of file jetTools.py.

jetTools.AddJetCollection._defaultParameters
staticprivate

Definition at line 893 of file jetTools.py.

Referenced by HiCoreTools.RestrictInputToAOD.__call__(), trackTools.MakeAODTrackCandidates.__call__(), runJetUncertainties.RunJetUncertainties.__call__(), metTools.AddMETCollection.__call__(), editorTools.ChangeSource.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), trigTools.SwitchOnTriggerStandAlone.__call__(), trackTools.MakeTrackCandidates.__call__(), tauTools.AddTauCollection.__call__(), trigTools.SwitchOnTriggerMatching.__call__(), HiCoreTools.RemoveCleaning.__call__(), HiCoreTools.AddCleaning.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), jetTools.AddJetCollection.__call__(), jetTools.SwitchJetCollection.__call__(), jetTools.UpdateJetCollection.__call__(), jetTools.AddJetID.__call__(), jetTools.SetTagInfos.__call__(), editorTools.UserCodeTool.__init__(), metTools.AddMETCollection.__init__(), trackTools.MakeAODTrackCandidates.__init__(), HiCoreTools.RestrictInputToAOD.__init__(), runJetUncertainties.RunJetUncertainties.__init__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__init__(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.__init__(), editorTools.ChangeSource.__init__(), HiCoreTools.RemoveMCMatching.__init__(), trackTools.MakePATTrackCandidates.__init__(), trigTools.SwitchOnTrigger.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), trigTools.SwitchOnTriggerStandAlone.__init__(), trackTools.MakeTrackCandidates.__init__(), tauTools.AddTauCollection.__init__(), trigTools.SwitchOnTriggerMatching.__init__(), HiCoreTools.RemoveCleaning.__init__(), HiCoreTools.AddCleaning.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), trigTools.SwitchOnTriggerMatchEmbedding.__init__(), jetTools.AddJetCollection.__init__(), jetTools.SwitchJetCollection.__init__(), jetTools.UpdateJetCollection.__init__(), jetTools.AddJetID.__init__(), jetTools.SetTagInfos.__init__(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), trackTools.MakeAODTrackCandidates.getDefaultParameters(), metTools.AddMETCollection.getDefaultParameters(), editorTools.ChangeSource.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), trigTools.SwitchOnTriggerStandAlone.getDefaultParameters(), trackTools.MakeTrackCandidates.getDefaultParameters(), tauTools.AddTauCollection.getDefaultParameters(), trigTools.SwitchOnTriggerMatching.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), 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().

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

initialization of the base class

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

Definition at line 946 of file jetTools.py.

Referenced by runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.ak4JetReclustering(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createMVAMETModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.createSmearedJetModule(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.extractMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getCorrectedMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getMETUncertainties(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getUnclusteredVariationsForMVAMET(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.getVariations(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetCleaning(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.jetConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfiguration(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.miniAODConfigurationPost(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.recomputeRawMetFromPfcs(), HiCoreTools.RestrictInputToAOD.toolCode(), trackTools.MakeAODTrackCandidates.toolCode(), metTools.AddMETCollection.toolCode(), runJetUncertainties.RunJetUncertainties.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), trigTools.SwitchOnTrigger.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.toolCode(), trackTools.MakeTrackCandidates.toolCode(), tauTools.AddTauCollection.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), jetTools.AddJetCollection.toolCode(), jetTools.SwitchJetCollection.toolCode(), jetTools.UpdateJetCollection.toolCode(), jetTools.AddJetID.toolCode(), jetTools.SetTagInfos.toolCode(), and runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties.updateJECs().