CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
jetTools.SwitchJetCollection Class Reference
Inheritance diagram for jetTools.SwitchJetCollection:

Public Member Functions

def __call__
 
def __init__
 
def getDefaultParameters
 
def toolCode
 

Private Attributes

 _comment
 
 _parameters
 

Static Private Attributes

tuple _defaultParameters = dicttypes.SortedKeysDict()
 
string _label = 'switchJetCollection'
 

Detailed Description

Switch the collection of jets in PAT from the default value to a
new jet collection

Definition at line 943 of file jetTools.py.

Constructor & Destructor Documentation

def jetTools.SwitchJetCollection.__init__ (   self)

Definition at line 950 of file jetTools.py.

References electronTools.AddElectronUserIsolation._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RestrictInputToAOD._defaultParameters, cmsswVersionTools.Run52xOn51xTrigger._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, coreTools.RunOnData._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, jetTools.RunBTagging._defaultParameters, coreTools.RemoveAllPATObjectsBut._defaultParameters, coreTools.RemoveSpecificPATObjects._defaultParameters, coreTools.RemoveCleaning._defaultParameters, coreTools.AddCleaning._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, ConfigToolBase.ConfigToolBase._defaultValue, GenObject.GenObject._defaultValue, root::helper::RootFunctionAdapter< F, args >.addParameter(), root::helper::RootFunctionHelper< F, args, Tag >.addParameter(), ParameterMgr.addParameter(), fit::RootMinuit< Function >.addParameter(), DropBoxMetadata::Parameters.addParameter(), PythonParameterSet.addParameter(), LutXml.addParameter(), ConfigToolBase.ConfigToolBase.addParameter(), and edm::ParameterSet.addParameter().

951  def __init__(self):
952  ConfigToolBase.__init__(self)
953  self.addParameter(self._defaultParameters,'jetCollection',self._defaultValue,'Input jet collection', cms.InputTag)
954  self.addParameter(self._defaultParameters,'btagInfo',_defaultBTagInfos,"input btag info",allowedValues=_allowedBTagInfos,Type=list)
955  self.addParameter(self._defaultParameters,'btagdiscriminators',_defaultBTagDiscriminators,"input btag discriminators",allowedValues=_allowedBTagDiscriminators,Type=list)
956  self.addParameter(self._defaultParameters,'doJTA',True, "run b tagging sequence for new jet collection and add it to the new pat jet collection")
957  self.addParameter(self._defaultParameters,'doBTagging',True, 'run JetTracksAssociation and JetCharge and add it to the new pat jet collection (will autom. be true if doBTagging is set to true)')
958  self.addParameter(self._defaultParameters,'jetCorrLabel',None, "payload and list of new jet correction labels, such as (\'AK5Calo\',[\'L2Relative\', \'L3Absolute\'])", tuple,acceptNoneValue=True )
959  self.addParameter(self._defaultParameters,'doType1MET',True, "if jetCorrLabel is not 'None', set this to 'True' to redo the Type1 MET correction for the new jet colleection; at the moment it must be 'False' for non CaloJets otherwise the JetMET POG module crashes. ")
960  self.addParameter(self._defaultParameters,'rParam', 0.5, "Jet size (distance parameter R used in jet clustering)")
961  self.addParameter(self._defaultParameters,'getJetMCFlavour', True, "Get jet MC truth flavour")
962  self.addParameter(self._defaultParameters,'useLegacyFlavour', True, "Use legacy jet MC truth flavour")
963  self.addParameter(self._defaultParameters,'genJetCollection',cms.InputTag("ak5GenJets"), "GenJet collection to match to")
964  self.addParameter(self._defaultParameters,'doJetID',True, "add jetId variables to the added jet collection")
965  self.addParameter(self._defaultParameters,'jetIdLabel',"ak5", " specify the label prefix of the xxxJetID object; in general it is the jet collection tag like ak5, kt4 sc5, aso. For more information have a look to SWGuidePATTools#add_JetCollection")
966  self.addParameter(self._defaultParameters,'postfix',"", "postfix of default sequence")
967  self.addParameter(self._defaultParameters, 'outputModules', ['out'], "Output module labels, empty list of label indicates no output, default: ['out']")
969  self._parameters=copy.deepcopy(self._defaultParameters)
970  self._comment = ""

Member Function Documentation

def jetTools.SwitchJetCollection.__call__ (   self,
  process,
  jetCollection = None,
  doJTA = None,
  doBTagging = None,
  jetCorrLabel = None,
  doType1MET = None,
  rParam = None,
  getJetMCFlavour = None,
  useLegacyFlavour = None,
  genJetCollection = None,
  doJetID = None,
  jetIdLabel = None,
  postfix = None,
  outputModule = None,
  outputModules = None,
  btagInfo = None,
  btagdiscriminators = None 
)

Definition at line 991 of file jetTools.py.

References electronTools.AddElectronUserIsolation._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RestrictInputToAOD._defaultParameters, cmsswVersionTools.Run52xOn51xTrigger._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, coreTools.RunOnData._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, jetTools.RunBTagging._defaultParameters, coreTools.RemoveAllPATObjectsBut._defaultParameters, coreTools.RemoveSpecificPATObjects._defaultParameters, coreTools.RemoveCleaning._defaultParameters, coreTools.AddCleaning._defaultParameters, jetTools.AddJetCollection._defaultParameters, jetTools.SwitchJetCollection._defaultParameters, SignedImpactParameter3D.apply(), gen::PhotosInterfaceBase.apply(), SignedTransverseImpactParameter.apply(), SignedDecayLength3D.apply(), SurveyParameters.apply(), FWPSetCellEditor.apply(), gen::PhotosInterface.apply(), gen::PhotosInterface53XLegacy.apply(), cmsswVersionTools.Run52xOn51xTrigger.apply(), FWGUIEventFilter.apply(), DeviationsFromFileSensor2D.apply(), RigidBodyAlignmentParameters.apply(), BeamSpotAlignmentParameters.apply(), ConfigToolBase.ConfigToolBase.apply(), AlignmentParameters.apply(), BowedSurfaceAlignmentParameters.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool.apply(), Vispa.Plugins.ConfigEditor.ToolDataAccessor.ApplyTool.apply(), TwoBowedSurfacesAlignmentParameters.apply(), Vispa.Gui.BoxContentDialog.BoxContentDialog.apply(), reco::modules::TrackerTrackHitFilter::Rule.apply(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog.apply(), reco::Add< T >.apply(), reco::Sub< T >.apply(), reco::Mul< T >.apply(), reco::Div< T >.apply(), reco::And< bool >.apply(), reco::Or< bool >.apply(), reco::Less< T >.apply(), cmsswVersionTools.PickRelValInputFiles.apply(), reco::LessEqual< T >.apply(), reco::More< T >.apply(), reco::MoreEqual< T >.apply(), reco::Equal< T >.apply(), jetTools.RunBTagging.apply(), jetTools.deprecatedOptionOutputModule(), ora::OraMainTable.setParameter(), ora::IMainTable.setParameter(), PedeReader.setParameter(), ora::PoolMainTable.setParameter(), fit::RootMinuit< Function >.setParameter(), and ConfigToolBase.ConfigToolBase.setParameter().

Referenced by jetTools.SwitchJetCollection.getDefaultParameters().

992  ):
993 
994 
995 
996 
997  ## stop processing if 'outputModule' exists and show the new alternative
998  if not outputModule is None:
1000  if jetCollection is None:
1001  jetCollection=self._defaultParameters['jetCollection'].value
1002  if doJTA is None:
1003  doJTA=self._defaultParameters['doJTA'].value
1004  if doBTagging is None:
1005  doBTagging=self._defaultParameters['doBTagging'].value
1006  if jetCorrLabel is None:
1007  jetCorrLabel=self._defaultParameters['jetCorrLabel'].value
1008  if doType1MET is None:
1009  doType1MET=self._defaultParameters['doType1MET'].value
1010  if rParam is None:
1011  rParam=self._defaultParameters['rParam'].value
1012  if getJetMCFlavour is None:
1013  getJetMCFlavour=self._defaultParameters['getJetMCFlavour'].value
1014  if useLegacyFlavour is None:
1015  useLegacyFlavour=self._defaultParameters['useLegacyFlavour'].value
1016  if genJetCollection is None:
1017  genJetCollection=self._defaultParameters['genJetCollection'].value
1018  if doJetID is None:
1019  doJetID=self._defaultParameters['doJetID'].value
1020  if jetIdLabel is None:
1021  jetIdLabel=self._defaultParameters['jetIdLabel'].value
1022  if outputModules is None:
1023  outputModules=self._defaultParameters['outputModules'].value
1024  if postfix is None:
1025  postfix=self._defaultParameters['postfix'].value
1026  if btagInfo is None:
1027  btagInfo=self._defaultParameters['btagInfo'].value
1028  if btagdiscriminators is None:
1029  btagdiscriminators=self._defaultParameters['btagdiscriminators'].value
1030 
1031 
1032 
1033 
1034  self.setParameter('jetCollection',jetCollection)
1035  self.setParameter('doJTA',doJTA)
1036  self.setParameter('doBTagging',doBTagging)
1037  self.setParameter('jetCorrLabel',jetCorrLabel)
1038  self.setParameter('doType1MET',doType1MET)
1039  self.setParameter('rParam',rParam)
1040  self.setParameter('getJetMCFlavour',getJetMCFlavour)
1041  self.setParameter('useLegacyFlavour',useLegacyFlavour)
1042  self.setParameter('genJetCollection',genJetCollection)
1043  self.setParameter('doJetID',doJetID)
1044  self.setParameter('jetIdLabel',jetIdLabel)
1045  self.setParameter('outputModules',outputModules)
1046  self.setParameter('postfix',postfix)
1047  self.setParameter('btagInfo',btagInfo)
1048  self.setParameter('btagdiscriminators',btagdiscriminators)
1049 
1050  self.apply(process)
def deprecatedOptionOutputModule
Definition: jetTools.py:1512
def jetTools.SwitchJetCollection.getDefaultParameters (   self)

Definition at line 971 of file jetTools.py.

References jetTools.SwitchJetCollection.__call__(), electronTools.AddElectronUserIsolation._defaultParameters, editorTools.UserCodeTool._defaultParameters, heavyIonTools.ConfigureHeavyIons._defaultParameters, coreTools.RestrictInputToAOD._defaultParameters, cmsswVersionTools.Run52xOn51xTrigger._defaultParameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._defaultParameters, heavyIonTools.ProductionDefaults._defaultParameters, editorTools.ChangeSource._defaultParameters, coreTools.RunOnData._defaultParameters, cmsswVersionTools.PickRelValInputFiles._defaultParameters, coreTools.RemoveMCMatching._defaultParameters, heavyIonTools.SelectionDefaults._defaultParameters, heavyIonTools.DisbaleMonteCarloDeps._defaultParameters, jetTools.RunBTagging._defaultParameters, coreTools.RemoveAllPATObjectsBut._defaultParameters, coreTools.RemoveSpecificPATObjects._defaultParameters, coreTools.RemoveCleaning._defaultParameters, coreTools.AddCleaning._defaultParameters, jetTools.AddJetCollection._defaultParameters, and jetTools.SwitchJetCollection._defaultParameters.

Referenced by trigTools.SwitchOnTrigger.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), and trigTools.SwitchOnTriggerMatchingStandAlone.toolCode().

972  def getDefaultParameters(self):
973  return self._defaultParameters
def jetTools.SwitchJetCollection.toolCode (   self,
  process 
)

Definition at line 1051 of file jetTools.py.

References editorTools.UserCodeTool._parameters, electronTools.AddElectronUserIsolation._parameters, heavyIonTools.ConfigureHeavyIons._parameters, coreTools.RestrictInputToAOD._parameters, Vispa.Plugins.ConfigEditor.ConfigDataAccessor.ConfigFolder._parameters, cmsswVersionTools.Run52xOn51xTrigger._parameters, Vispa.Plugins.ConfigEditor.ToolDataAccessor.ImportTool._parameters, heavyIonTools.ProductionDefaults._parameters, ConfigToolBase.ConfigToolBase._parameters, editorTools.ChangeSource._parameters, TAbsFitConstraint._parameters, TAbsFitParticle._parameters, coreTools.RunOnData._parameters, cmsswVersionTools.PickRelValInputFiles._parameters, coreTools.RemoveMCMatching._parameters, heavyIonTools.SelectionDefaults._parameters, heavyIonTools.DisbaleMonteCarloDeps._parameters, jetTools.RunBTagging._parameters, coreTools.RemoveAllPATObjectsBut._parameters, coreTools.RemoveSpecificPATObjects._parameters, coreTools.RemoveCleaning._parameters, coreTools.AddCleaning._parameters, jetTools.AddJetCollection._parameters, jetTools.SwitchJetCollection._parameters, helpers.applyPostfix(), spr.find(), python.multivaluedict.remove(), helpers.removeIfInSequence(), python.rootplot.root2matplotlib.replace(), and jetTools.unsupportedJetAlgorithm().

1052  def toolCode(self, process):
1053  jetCollection=self._parameters['jetCollection'].value
1054  doJTA=self._parameters['doJTA'].value
1055  doBTagging=self._parameters['doBTagging'].value
1056  jetCorrLabel=self._parameters['jetCorrLabel'].value
1057  doType1MET =self._parameters['doType1MET'].value
1058  rParam=self._parameters['rParam'].value
1059  getJetMCFlavour=self._parameters['getJetMCFlavour'].value
1060  useLegacyFlavour=self._parameters['useLegacyFlavour'].value
1061  genJetCollection=self._parameters['genJetCollection'].value
1062  doJetID=self._parameters['doJetID'].value
1063  jetIdLabel=self._parameters['jetIdLabel'].value
1064  outputModules=self._parameters['outputModules'].value
1065  postfix=self._parameters['postfix'].value
1066  btagInfo=self._parameters['btagInfo'].value
1067  btagdiscriminators=self._parameters['btagdiscriminators'].value
1068 
1069  _algo=''
1070  if not useLegacyFlavour:
1071  ## supported algo types are ak, ca, and kt
1072  for x in ["ak", "ca", "kt"]:
1073  if jetIdLabel.lower().find(x)>-1:
1074  _algo=supportedJetAlgos[x]
1075  break
1076  if _algo=='':
1078 
1079  ## save label of old input jet collection
1080  oldLabel = applyPostfix(process, "patJets", postfix).jetSource;
1081 
1082  ## replace input jet collection for generator matches if the
1083  ## genJetCollection is no empty
1084  if (process.patJets.addGenPartonMatch):
1085  applyPostfix(process, "patJetPartonMatch", postfix).src = jetCollection
1086  if (process.patJets.addGenJetMatch):
1087  applyPostfix(process, "patJetGenJetMatch", postfix).src = jetCollection
1088  applyPostfix(process, "patJetGenJetMatch", postfix).matched = genJetCollection
1089  if (getJetMCFlavour):
1090  applyPostfix(process, "patJets", postfix).getJetMCFlavour = True
1091  applyPostfix(process, "patJets", postfix).useLegacyJetMCFlavour = useLegacyFlavour
1092  applyPostfix(process, "patJetPartonAssociationLegacy", postfix).jets = jetCollection
1093  if not useLegacyFlavour:
1094  from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociation
1095  setattr(process, "patJetFlavourAssociation"+postfix,
1096  patJetFlavourAssociation.clone(
1097  jets=jetCollection,
1098  jetAlgorithm=_algo,
1099  rParam=rParam,
1100  bHadrons=cms.InputTag("patJetPartons"+postfix,"bHadrons"),
1101  cHadrons=cms.InputTag("patJetPartons"+postfix,"cHadrons"),
1102  partons=cms.InputTag("patJetPartons"+postfix,"partons")
1103  )
1104  )
1105  getattr(process, "patDefaultSequence"+postfix).replace(
1106  applyPostfix(process, "patJetPartons", postfix),
1107  applyPostfix(process, "patJetPartons", postfix)
1108  + getattr(process, "patJetFlavourAssociation" + postfix) #module with postfix that is not in patDefaultSequence
1109  )
1110  applyPostfix(process, "patJets", postfix).JetFlavourInfoSource = "patJetFlavourAssociation" + postfix
1111  else:
1112  applyPostfix(process, "patJets", postfix).getJetMCFlavour = False
1113 
1114  ## replace input jet collection for pat jet production
1115  applyPostfix(process, "patJets", postfix).jetSource = jetCollection
1116 
1117  ## make VInputTag from strings
1118  def vit(*args) : return cms.VInputTag( *[ cms.InputTag(x) for x in args ] )
1119 
1120  if (doJTA or doBTagging):
1121  ## replace jet track association
1122  ###process.load("RecoJets.JetAssociationProducers.ak5JTA_cff")
1123  from RecoJets.JetAssociationProducers.ak5JTA_cff import ak5JetTracksAssociatorAtVertex
1124  if not hasattr(process, "jetTracksAssociatorAtVertex"+postfix):
1125  setattr(process, "jetTracksAssociatorAtVertex"+postfix, ak5JetTracksAssociatorAtVertex.clone(jets = jetCollection))
1126  else:
1127  getattr(process, "jetTracksAssociatorAtVertex"+postfix).jets = jetCollection
1128  getattr(process, "patDefaultSequence"+postfix).replace(
1129  applyPostfix(process, "patJetCharge", postfix),
1130  getattr(process, "jetTracksAssociatorAtVertex" + postfix) #module with postfix that is not in patDefaultSequence
1131  + applyPostfix(process, "patJetCharge", postfix)
1132  )
1133 
1134  applyPostfix(process, "patJetCharge", postfix).src = 'jetTracksAssociatorAtVertex'+postfix
1135  applyPostfix(process, "patJets", postfix).trackAssociationSource = 'jetTracksAssociatorAtVertex'+postfix
1136  else:
1137  ## remove the jet track association from the std
1138  ## sequence
1139  removeIfInSequence(process, "patJetCharge", "patDefaultSequence", postfix)
1140  ## switch embedding of track association and jet
1141  ## charge estimate to 'False'
1142  applyPostfix(process, "patJets", postfix).addAssociatedTracks = False
1143  applyPostfix(process, "patJets", postfix).addJetCharge = False
1144 
1145  if (doBTagging):
1146  ## replace b tagging sequence; add postfix label 'AOD' as crab will
1147  ## crash when confronted with empy labels
1148  (btagSeq, btagLabels) = runBTagging(process, jetCollection,"AOD",postfix,btagInfo,btagdiscriminators)
1149  ## add b tagging sequence before running the allLayer1Jets modules
1150  ## nedded only after first call to runBTagging(), existing sequence modified in place otherwise
1151  if not btagSeq == None:
1152  getattr(process, "patDefaultSequence"+postfix).replace(
1153  getattr( process,"jetTracksAssociatorAtVertex"+postfix),
1154  getattr( process,"jetTracksAssociatorAtVertex"+postfix) + btagSeq
1155  )
1156 
1157  ## replace corresponding tags for pat jet production
1158  applyPostfix(process, "patJets", postfix).trackAssociationSource = btagLabels['jta']
1159  applyPostfix(process, "patJets", postfix).tagInfoSources = cms.VInputTag( *[ cms.InputTag(x) for x in btagLabels['tagInfos'] ] )
1160  applyPostfix(process, "patJets", postfix).discriminatorSources = cms.VInputTag( *[ cms.InputTag(x) for x in btagLabels['jetTags'] ] )
1161  ## switch embedding of b tagging for pat
1162  ## jet production to 'True'
1163  applyPostfix(process, "patJets", postfix).addBTagInfo = True
1164  else:
1165  ## remove b tagging from the std sequence
1166  removeIfInSequence(process, "secondaryVertexNegativeTagInfos", "patDefaultSequence", postfix)
1167  removeIfInSequence(process, "simpleSecondaryVertexNegativeBJetTags", "patDefaultSequence", postfix)
1168  ## switch embedding of b tagging for pat
1169  ## jet production to 'False'
1170  applyPostfix(process, "patJets", postfix).addBTagInfo = False
1171  ## adjust output
1172  if len(outputModules) > 0:
1173  for outMod in outputModules:
1174  if hasattr(process,outMod):
1175  getattr(process,outMod).outputCommands.append("drop *_selectedPatJets_tagInfos_*")
1176  else:
1177  raise KeyError, "process has no OutModule named", outMod
1178 
1179  if (doJetID):
1180  jetIdLabelNew = jetIdLabel + 'JetID'
1181  applyPostfix(process, "patJets", postfix).jetIDMap = cms.InputTag( jetIdLabelNew )
1182  else:
1183  applyPostfix(process, "patJets", postfix).addJetID = cms.bool(False)
1184 
1185  if (jetCorrLabel!=None):
1186  ## replace jet energy corrections; catch
1187  ## a couple of exceptions first
1188  if (jetCorrLabel == False ):
1189  raise ValueError, "In switchJetCollection 'jetCorrLabel' must be set to 'None', not 'False'"
1190  if (jetCorrLabel == "None"):
1191  raise ValueError, "In switchJetCollection 'jetCorrLabel' must be set to 'None' (without quotes)"
1192  ## check for the correct format
1193  if type(jetCorrLabel) != type(('AK5Calo',['L2Relative'])):
1194  raise ValueError, "In addJetCollection 'jetCorrLabel' must be 'None', or of type ('payload',['correction1', 'correction2'])"
1195 
1196  ## switch JEC parameters to the new jet collection
1197  applyPostfix(process, "patJetCorrFactors", postfix).src = jetCollection
1198  switchJetCorrLevels(process, jetCorrLabel = jetCorrLabel, postfix=postfix)
1199  getattr( process, "patJets" + postfix).jetCorrFactorsSource = cms.VInputTag( cms.InputTag("patJetCorrFactors" + postfix ) )
1200 
1201  ## find out type of jet collection, switch type1MET corrections off for JPTJets
1202  jetCollType = ''
1203  if ( 'CaloJets' in jetCollection.getModuleLabel() ):
1204  jetCollType = 'Calo'
1205  elif ( 'PFJets' in jetCollection.getModuleLabel() or jetCollection.getModuleLabel().startswith('pfNo') or jetCollection.getModuleLabel() == 'particleFlow'):
1206  jetCollType = 'PF'
1207  else:
1208  print '============================================='
1209  print 'Type1MET corrections are switched off for '
1210  print 'JPT Jets. Users are recommened to use tcMET '
1211  print 'together with JPT jets. '
1212  print '============================================='
1213  doType1MET=False
1214 
1215  ## add a clone of the type1MET correction for the new jet collection
1216  if (doType1MET):
1217  ## create jet correctors for MET corrections
1218  from JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff import ak5PFL1Fastjet, ak5PFL1Offset, ak5PFL2Relative, ak5PFL3Absolute, ak5PFResidual
1219  setattr(process, jetCorrLabel[0]+'L1FastJet' , ak5PFL1Fastjet.clone ( algorithm=jetCorrLabel[0]
1220  , srcRho=cms.InputTag('kt6' + jetCollType + 'Jets','rho') ) )
1221  setattr(process, jetCorrLabel[0]+'L1Offset' , ak5PFL1Offset.clone ( algorithm=jetCorrLabel[0] ) )
1222  setattr(process, jetCorrLabel[0]+'L2Relative' , ak5PFL2Relative.clone( algorithm=jetCorrLabel[0] ) )
1223  setattr(process, jetCorrLabel[0]+'L3Absolute' , ak5PFL3Absolute.clone( algorithm=jetCorrLabel[0] ) )
1224  setattr(process, jetCorrLabel[0]+'L2L3Residual', ak5PFResidual.clone ( algorithm=jetCorrLabel[0] ) )
1225  ## combinded corrections
1226  setattr(process, jetCorrLabel[0]+'CombinedCorrector', cms.ESProducer( 'JetCorrectionESChain'
1227  , correctors = cms.vstring() ) )
1228  for corrLbl in jetCorrLabel[1]:
1229  if corrLbl != 'L1FastJet' and corrLbl != 'L1Offset' and corrLbl != 'L2Relative' and corrLbl != 'L3Absolute' and corrLbl != 'L2L3Residual':
1230  print '========================================='
1231  print ' Type1MET corrections are currently only '
1232  print ' supported for the following corrections: '
1233  print ' - L1FastJet'
1234  print ' - L1Offset'
1235  print ' - L2Relative'
1236  print ' - L3Absolute'
1237  print ' - L2L3Residual'
1238  print ' But given was:'
1239  print ' -', corrLbl
1240  print '============================================='
1241  raise ValueError, 'unsupported JEC for TypeI MET correction: '+corrLbl
1242  else:
1243  getattr(process, jetCorrLabel[0]+'CombinedCorrector').correctors.append(jetCorrLabel[0]+corrLbl)
1244 
1245  ## configuration of MET corrections
1246  if jetCollType == 'Calo':
1247  getattr(process, "patMETCorrections"+postfix).remove(getattr(process,"producePFMETCorrections"+postfix))
1248  getattr(process,'caloJetMETcorr'+postfix).src = cms.InputTag(jetCollection.getModuleLabel())
1249 
1250  if ('L1FastJet' in jetCorrLabel[1] or 'L1Fastjet' in jetCorrLabel[1]):
1251  getattr(process,'caloJetMETcorr'+postfix ).offsetCorrLabel = cms.string(jetCorrLabel[0]+'L1FastJet')
1252  elif ('L1Offset' in jetCorrLabel[1]):
1253  getattr(process,'caloJetMETcorr'+postfix ).offsetCorrLabel = cms.string(jetCorrLabel[0]+'L1Offset')
1254  else:
1255  getattr(process,'caloJetMETcorr'+postfix ).offsetCorrLabel = cms.string('')
1256  getattr(process,'caloJetMETcorr'+postfix ).jetCorrLabel = cms.string(jetCorrLabel[0]+'CombinedCorrector')
1257 
1258  getattr(process,'caloType1CorrectedMet'+postfix ).srcType1Corrections = cms.VInputTag(
1259  cms.InputTag('caloJetMETcorr'+postfix, 'type1')
1260  )
1261 
1262  getattr(process,'caloType1p2CorrectedMet'+postfix).srcType1Corrections = cms.VInputTag(
1263  cms.InputTag('caloJetMETcorr'+postfix, 'type1')
1264  )
1265  getattr(process,'caloType1p2CorrectedMet'+postfix).srcUnclEnergySums = cms.VInputTag(
1266  cms.InputTag('caloJetMETcorr'+postfix, 'type2'),
1267  cms.InputTag('caloJetMETcorr'+postfix, 'offset'),
1268  cms.InputTag('muonCaloMETcorr')
1269  )
1270 
1271  ## add MET corrections to sequence
1272  getattr(process, 'patMETs'+ postfix).metSource = cms.InputTag('caloType1CorrectedMet'+postfix)
1273  getattr(process,'produceCaloMETCorrections'+postfix)
1274  getattr(process,"patDefaultSequence"+postfix).replace( getattr(process,'patMETs'+postfix),
1275  getattr(process,'produceCaloMETCorrections'+postfix)
1276  *getattr(process,'patMETs'+postfix) )
1277  elif jetCollType == 'PF':
1278  getattr(process, "patMETCorrections"+postfix).remove(getattr(process,"produceCaloMETCorrections"+postfix))
1279 
1280  if ('L1FastJet' in jetCorrLabel[1] or 'L1Fastjet' in jetCorrLabel[1]):
1281  getattr(process,'pfJetMETcorr' +postfix).offsetCorrLabel = cms.string(jetCorrLabel[0]+'L1FastJet')
1282  elif ('L1Offset' in jetCorrLabel[1]):
1283  getattr(process,'pfJetMETcorr' +postfix).offsetCorrLabel = cms.string(jetCorrLabel[0]+'L1Offset')
1284  else:
1285  getattr(process,'pfJetMETcorr'+postfix).offsetCorrLabel = cms.string('')
1286  getattr(process,'pfJetMETcorr'+postfix).jetCorrLabel = cms.string(jetCorrLabel[0]+'CombinedCorrector')
1287 
1288  getattr(process,'pfType1CorrectedMet'+postfix).applyType0Corrections = cms.bool(False)
1289  getattr(process,'pfType1CorrectedMet'+postfix).srcCHSSums = cms.VInputTag(
1290  cms.InputTag("pfchsMETcorr"+postfix,"type0")
1291  )
1292  getattr(process,'pfType1CorrectedMet'+postfix).srcType1Corrections = cms.VInputTag(
1293  cms.InputTag('pfJetMETcorr'+postfix, 'type1')
1294  )
1295 
1296  getattr(process,'pfType1p2CorrectedMet'+postfix).applyType0Corrections = cms.bool(False)
1297  getattr(process,'pfType1p2CorrectedMet'+postfix).srcCHSSums = cms.VInputTag(
1298  cms.InputTag("pfchsMETcorr"+postfix,"type0")
1299  )
1300  getattr(process,'pfType1p2CorrectedMet'+postfix).srcType1Corrections = cms.VInputTag(
1301  cms.InputTag('pfJetMETcorr'+postfix, 'type1')
1302  )
1303  getattr(process,'pfType1p2CorrectedMet'+postfix).srcUnclEnergySums = cms.VInputTag(
1304  cms.InputTag('pfJetMETcorr' +postfix, 'type2'),
1305  cms.InputTag('pfJetMETcorr' +postfix, 'offset'),
1306  cms.InputTag('pfCandMETcorr'+postfix)
1307  )
1308 
1309  ## add MET corrections to sequence
1310  getattr(process, 'patMETs'+ postfix).metSource = cms.InputTag('pfType1CorrectedMet'+postfix)
1311  getattr(process, 'patMETs'+ postfix).addMuonCorrections = False
1312 
1313  else:
1314  ## remove the jetCorrFactors from the std sequence
1315  process.patJetMETCorrections.remove(process.patJetCorrFactors)
1316  ## switch embedding of jetCorrFactors off
1317  ## for pat jet production
1318  applyPostfix(process, "patJets", postfix).addJetCorrFactors = False
1319  applyPostfix(process, "patJets", postfix).jetCorrFactorsSource=[]
1320 
1321  ## adjust output when switching to PFJets
1322  if ( 'PFJets' in jetCollection.getModuleLabel() or jetCollection.getModuleLabel().startswith("pfNo") or jetCollection.getModuleLabel() == 'particleFlow' ):
1323  ## in this case we can omit caloTowers and should keep pfCandidates
1324  if len(outputModules) > 0:
1325  for outMod in outputModules:
1326  if hasattr(process,outMod):
1327  getattr(process, outMod).outputCommands.append("keep *_selectedPatJets_pfCandidates_*")
1328  getattr(process, outMod).outputCommands.append("drop *_selectedPatJets_caloTowers_*")
1329  else:
1330  raise KeyError, "process has no OutModule named", outMod
1331 
1332 switchJetCollection=SwitchJetCollection()
1333 
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
def applyPostfix
Helpers to perform some technically boring tasks like looking for all modules with a given parameter ...
Definition: helpers.py:6
def unsupportedJetAlgorithm
Definition: jetTools.py:1523
def removeIfInSequence
Definition: helpers.py:20

Member Data Documentation

jetTools.SwitchJetCollection._comment
private

Definition at line 969 of file jetTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties.__init__().

tuple jetTools.SwitchJetCollection._defaultParameters = dicttypes.SortedKeysDict()
staticprivate

Definition at line 949 of file jetTools.py.

Referenced by photonTools.AddPhotonUserIsolation.__call__(), metTools.AddTcMET.__call__(), muonTools.AddMuonUserIsolation.__call__(), HiCoreTools.RestrictInputToAOD.__call__(), trackTools.MakeAODTrackCandidates.__call__(), metTools.AddPfMET.__call__(), HiCoreTools.RemoveMCMatching.__call__(), trackTools.MakePATTrackCandidates.__call__(), trigTools.SwitchOnTrigger.__call__(), HiCoreTools.RemoveAllPATObjectsBut.__call__(), HiCoreTools.RemoveSpecificPATObjects.__call__(), trigTools.SwitchOnTriggerStandAlone.__call__(), trackTools.MakeTrackCandidates.__call__(), HiCoreTools.RemoveCleaning.__call__(), trigTools.SwitchOnTriggerMatching.__call__(), HiCoreTools.AddCleaning.__call__(), tauTools.AddTauCollection.__call__(), trigTools.SwitchOnTriggerMatchingStandAlone.__call__(), trigTools.SwitchOnTriggerMatchEmbedding.__call__(), trigTools.RemoveCleaningFromTriggerMatching.__call__(), jetTools.SwitchJetCollection.__call__(), jetTools.AddJetID.__call__(), metUncertaintyTools.RunMEtUncertainties.__call__(), jetTools.SetTagInfos.__call__(), jetTools.SwitchJetCorrLevels.__call__(), photonTools.AddPhotonUserIsolation.__init__(), trackTools.MakeAODTrackCandidates.__init__(), metTools.AddTcMET.__init__(), muonTools.AddMuonUserIsolation.__init__(), HiCoreTools.RestrictInputToAOD.__init__(), metUncertaintyTools.RunMEtUncertainties.__init__(), HiCoreTools.RemoveMCMatching.__init__(), metTools.AddPfMET.__init__(), trackTools.MakePATTrackCandidates.__init__(), trigTools.SwitchOnTrigger.__init__(), HiCoreTools.RemoveAllPATObjectsBut.__init__(), HiCoreTools.RemoveSpecificPATObjects.__init__(), trigTools.SwitchOnTriggerStandAlone.__init__(), trackTools.MakeTrackCandidates.__init__(), HiCoreTools.RemoveCleaning.__init__(), trigTools.SwitchOnTriggerMatching.__init__(), HiCoreTools.AddCleaning.__init__(), tauTools.AddTauCollection.__init__(), trigTools.SwitchOnTriggerMatchingStandAlone.__init__(), trigTools.SwitchOnTriggerMatchEmbedding.__init__(), trigTools.RemoveCleaningFromTriggerMatching.__init__(), jetTools.SwitchJetCollection.__init__(), jetTools.AddJetID.__init__(), jetTools.SetTagInfos.__init__(), jetTools.SwitchJetCorrLevels.__init__(), metUncertaintyTools.RunMEtUncertainties._initializeInputTag(), ConfigToolBase.ConfigToolBase.dumpPython(), ConfigToolBase.ConfigToolBase.getAllowedValues(), photonTools.AddPhotonUserIsolation.getDefaultParameters(), metTools.AddTcMET.getDefaultParameters(), muonTools.AddMuonUserIsolation.getDefaultParameters(), HiCoreTools.RestrictInputToAOD.getDefaultParameters(), trackTools.MakeAODTrackCandidates.getDefaultParameters(), metTools.AddPfMET.getDefaultParameters(), HiCoreTools.RemoveMCMatching.getDefaultParameters(), metUncertaintyTools.RunMEtUncertainties.getDefaultParameters(), trackTools.MakePATTrackCandidates.getDefaultParameters(), trigTools.SwitchOnTrigger.getDefaultParameters(), HiCoreTools.RemoveAllPATObjectsBut.getDefaultParameters(), HiCoreTools.RemoveSpecificPATObjects.getDefaultParameters(), trigTools.SwitchOnTriggerStandAlone.getDefaultParameters(), trackTools.MakeTrackCandidates.getDefaultParameters(), HiCoreTools.RemoveCleaning.getDefaultParameters(), trigTools.SwitchOnTriggerMatching.getDefaultParameters(), HiCoreTools.AddCleaning.getDefaultParameters(), tauTools.AddTauCollection.getDefaultParameters(), trigTools.SwitchOnTriggerMatchingStandAlone.getDefaultParameters(), trigTools.SwitchOnTriggerMatchEmbedding.getDefaultParameters(), trigTools.RemoveCleaningFromTriggerMatching.getDefaultParameters(), jetTools.SwitchJetCollection.getDefaultParameters(), jetTools.AddJetID.getDefaultParameters(), jetTools.SetTagInfos.getDefaultParameters(), jetTools.SwitchJetCorrLevels.getDefaultParameters(), ConfigToolBase.ConfigToolBase.reset(), and ConfigToolBase.ConfigToolBase.setParameter().

string jetTools.SwitchJetCollection._label = 'switchJetCollection'
staticprivate

Definition at line 948 of file jetTools.py.

Referenced by trigTools.SwitchOnTrigger.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), and trigTools.RemoveCleaningFromTriggerMatching.toolCode().

jetTools.SwitchJetCollection._parameters
private

Definition at line 968 of file jetTools.py.

Referenced by metUncertaintyTools.RunMEtUncertainties.__init__(), photonTools.AddPhotonUserIsolation.toolCode(), metTools.AddTcMET.toolCode(), muonTools.AddMuonUserIsolation.toolCode(), HiCoreTools.RestrictInputToAOD.toolCode(), trackTools.MakeAODTrackCandidates.toolCode(), metTools.AddPfMET.toolCode(), HiCoreTools.RemoveMCMatching.toolCode(), trackTools.MakePATTrackCandidates.toolCode(), trigTools.SwitchOnTrigger.toolCode(), HiCoreTools.RemoveAllPATObjectsBut.toolCode(), HiCoreTools.RemoveSpecificPATObjects.toolCode(), trigTools.SwitchOnTriggerStandAlone.toolCode(), trackTools.MakeTrackCandidates.toolCode(), HiCoreTools.RemoveCleaning.toolCode(), trigTools.SwitchOnTriggerMatching.toolCode(), HiCoreTools.AddCleaning.toolCode(), tauTools.AddTauCollection.toolCode(), trigTools.SwitchOnTriggerMatchingStandAlone.toolCode(), trigTools.SwitchOnTriggerMatchEmbedding.toolCode(), trigTools.RemoveCleaningFromTriggerMatching.toolCode(), jetTools.SwitchJetCollection.toolCode(), jetTools.AddJetID.toolCode(), jetTools.SetTagInfos.toolCode(), jetTools.SwitchJetCorrLevels.toolCode(), and metUncertaintyTools.RunMEtUncertainties.toolCode().