Inherits FWCore::GuiBrowsers::ConfigToolBase::ConfigToolBase.
Public Member Functions | |
def | __call__ |
def | __init__ |
def | getDefaultParameters |
def | toolCode |
Private Attributes | |
_comment | |
add comments | |
_parameters | |
initialization of the base class | |
Static Private Attributes | |
tuple | _defaultParameters = dicttypes.SortedKeysDict() |
string | _label = 'addJetCollection' |
Tool to add a new jet collection to your PAT Tuple or to modify an existing one.
Definition at line 7 of file jetTools.py.
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 14 of file jetTools.py.
00015 : 00016 """ 00017 Initialize elements of the class. Note that the tool needs to be derived from ConfigToolBase to be usable in the configEditor. 00018 """ 00019 ## initialization of the base class 00020 ConfigToolBase.__init__(self) 00021 ## add all parameters that should be known to the class 00022 self.addParameter(self._defaultParameters,'labelName',self._defaultValue, "Label name of the new patJet collection.", str) 00023 self.addParameter(self._defaultParameters,'jetSource',self._defaultValue, "Label of the input collection from which the new patJet collection should be created", cms.InputTag) 00024 self.addParameter(self._defaultParameters,'jetCorrections',None, "Add all relevant information about jet energy corrections that you want to be added to your new patJet \ 00025 collection. The format has to be given in a python tuple of type: (\'AK5Calo\',[\'L2Relative\', \'L3Absolute\'], patMet). Here the first argument corresponds to the payload \ 00026 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 \ 00027 new patJet collection. This should be given as a list of strings. Available values are L1Offset, L1FastJet, L1JPTOffset, L2Relative, L3Absolute, L5Falvour, L7Parton; the \ 00028 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 \ 00029 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 \ 00030 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\' \ 00031 and \'type-2\' are not case sensitive.", tuple, acceptNoneValue=True) 00032 self.addParameter(self._defaultParameters,'btagDiscriminators',['None'], "If you are interested in btagging, in most cases just the labels of the btag discriminators that \ 00033 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. \ 00034 If this list is empty no btag discriminator information will be added to your new patJet collection.", allowedValues=supportedBtagDiscr.keys(),Type=list) 00035 self.addParameter(self._defaultParameters,'btagInfos',['None'], "The btagInfos objects contain all relevant information from which all discriminators of a certain \ 00036 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 \ 00037 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 \ 00038 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 \ 00039 will be added to your new patJet collection.", allowedValues=supportedBtagInfos,Type=list) 00040 self.addParameter(self._defaultParameters,'jetTrackAssociation',False, "Add JetTrackAssociation and JetCharge from reconstructed tracks to your new patJet collection. This \ 00041 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 \ 00042 your new patJetCollection. If btag information of any form is added to the new patJet collection this information will be added automatically.") 00043 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 \ 00044 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 \ 00045 to more than one output module.") 00046 ## set defaults 00047 self._parameters=copy.deepcopy(self._defaultParameters) 00048 ## add comments 00049 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\ 00050 energy correction factors, btag infomration and generator match information to the new patJet collection depending on the parameters that you pass on to this function. Consult \ 00051 the descriptions of each parameter for more information."
def jetTools::AddJetCollection::__call__ | ( | self, | |
process, | |||
labelName = None , |
|||
jetSource = 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 58 of file jetTools.py.
00059 : 00060 """ 00061 Function call wrapper. This will check the parameters and call the actual implementation that 00062 can be found in toolCode via the base class function apply. 00063 """ 00064 if labelName is None: 00065 labelName=self._defaultParameters['labelName'].value 00066 self.setParameter('labelName', labelName) 00067 if jetSource is None: 00068 jetSource=self._defaultParameters['jetSource'].value 00069 self.setParameter('jetSource', jetSource) 00070 if jetCorrections is None: 00071 jetCorrections=self._defaultParameters['jetCorrections'].value 00072 self.setParameter('jetCorrections', jetCorrections) 00073 if btagDiscriminators is None: 00074 btagDiscriminators=self._defaultParameters['btagDiscriminators'].value 00075 self.setParameter('btagDiscriminators', btagDiscriminators) 00076 if btagInfos is None: 00077 btagInfos=self._defaultParameters['btagInfos'].value 00078 self.setParameter('btagInfos', btagInfos) 00079 if jetTrackAssociation is None: 00080 jetTrackAssociation=self._defaultParameters['jetTrackAssociation'].value 00081 self.setParameter('jetTrackAssociation', jetTrackAssociation) 00082 if outputModules is None: 00083 outputModules=self._defaultParameters['outputModules'].value 00084 self.setParameter('outputModules', outputModules) 00085 self.apply(process)
def jetTools::AddJetCollection::getDefaultParameters | ( | self | ) |
Return default parameters of the class
Definition at line 52 of file jetTools.py.
def jetTools::AddJetCollection::toolCode | ( | self, | |
process | |||
) |
Tool code implementation
Definition at line 86 of file jetTools.py.
00087 : 00088 """ 00089 Tool code implementation 00090 """ 00091 ## initialize parameters 00092 labelName='patJets'+self._parameters['labelName'].value 00093 jetSource=self._parameters['jetSource'].value 00094 jetCorrections=self._parameters['jetCorrections'].value 00095 btagDiscriminators=list(self._parameters['btagDiscriminators'].value) 00096 btagInfos=list(self._parameters['btagInfos'].value) 00097 jetTrackAssociation=self._parameters['jetTrackAssociation'].value 00098 outputModules=list(self._parameters['outputModules'].value) 00099 00100 ## a list of all producer modules, which are already known to process 00101 knownModules = process.producerNames().split() 00102 00103 ## determine whether btagging information is required or not 00104 if btagDiscriminators.count('None')>0: 00105 btagDiscriminators.remove('None') 00106 if btagInfos.count('None')>0: 00107 btagInfos.remove('None') 00108 bTagging=(len(btagDiscriminators)>0 or len(btagInfos)>0) 00109 ## construct postfix label for auxiliary modules; this postfix 00110 ## label will start with a capitalized first letter following 00111 ## the CMS nameing conventions and for improved readablility 00112 _labelName=labelName[:1].upper()+labelName[1:] 00113 ## determine jet algorithm from jetSource; supported algo types 00114 ## are ak, kt, sc, ic. This loop expects that the algo type is 00115 ## followed by a single integer corresponding to the opening 00116 ## angle parameter dR times 10 (examples ak5, kt4, kt6, ...) 00117 _algo='None' 00118 for x in ["ak", "kt", "sc", "ic"]: 00119 if jetSource.getModuleLabel().lower().find(x)>-1: 00120 _algo=jetSource.getModuleLabel()[jetSource.getModuleLabel().lower().find(x):jetSource.getModuleLabel().lower().find(x)+3] 00121 00122 ## add new patJets to process (keep instance for later further modifications) 00123 from PhysicsTools.PatAlgos.producersLayer1.jetProducer_cfi import patJets 00124 if labelName in knownModules : 00125 _newPatJets=getattr(process, labelName) 00126 _newPatJets.jetSource=jetSource 00127 else : 00128 setattr(process, labelName, patJets.clone(jetSource=jetSource)) 00129 _newPatJets=getattr(process, labelName) 00130 knownModules.append(labelName) 00131 ## add new selectedPatJets to process 00132 from PhysicsTools.PatAlgos.selectionLayer1.jetSelector_cfi import selectedPatJets 00133 if 'selected'+_labelName in knownModules : 00134 _newSelectedPatJets=getattr(process, 'selected'+_labelName) 00135 _newSelectedPatJets.src=labelName 00136 else : 00137 setattr(process, 'selected'+_labelName, selectedPatJets.clone(src=labelName)) 00138 knownModules.append('selected'+_labelName) 00139 ## set postfix label to '' if there is no labelName given. In this case all 00140 ## modules should keep there names w/o postfixes. This will cover the case 00141 ## of switchJectCollection 00142 if self._parameters['labelName'].value == '' : 00143 _labelName = '' 00144 00145 ## add new patJetPartonMatch to process 00146 from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetPartonMatch 00147 if 'patJetPartonMatch'+_labelName in knownModules : 00148 _newPatJetPartonMatch=getattr(process, 'patJetPartonMatch'+_labelName) 00149 _newPatJetPartonMatch.src=jetSource 00150 else : 00151 setattr(process, 'patJetPartonMatch'+_labelName, patJetPartonMatch.clone(src=jetSource)) 00152 knownModules.append('patJetPartonMatch'+_labelName) 00153 ## add new patJetGenJetMatch to process 00154 from PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi import patJetGenJetMatch 00155 if 'patJetGenJetMatch'+_labelName in knownModules : 00156 _newPatJetGenJetMatch=getattr(process, 'patJetGenJetMatch'+_labelName) 00157 _newPatJetGenJetMatch.src=jetSource 00158 _newPatJetGenJetMatch.matched=_algo+'GenJets' 00159 else : 00160 setattr(process, 'patJetGenJetMatch'+_labelName, patJetGenJetMatch.clone(src=jetSource, matched=_algo+'GenJets')) 00161 knownModules.append('patJetGenJetMatch'+_labelName) 00162 ## add new patJetPartonAssociation to process 00163 from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetPartonAssociation 00164 if 'patJetPartonAssociation'+_labelName in knownModules : 00165 _newPatJetPartonAssociation=getattr(process, 'patJetPartonAssociation'+_labelName, patJetPartonAssociation.clone(jets=jetSource)) 00166 _newPatJetPartonAssociation.jets=jetSource 00167 else : 00168 setattr(process, 'patJetPartonAssociation'+_labelName, patJetPartonAssociation.clone(jets=jetSource)) 00169 knownModules.append('patJetPartonAssociation'+_labelName) 00170 ## add new patJetPartonAssociation to process 00171 from PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff import patJetFlavourAssociation 00172 if 'patJetFlavourAssociation'+_labelName in knownModules : 00173 _newPatJetFlavourAssociation=getattr(process, 'patJetFlavourAssociation'+_labelName, patJetFlavourAssociation.clone(srcByReference='patJetPartonAssociation'+_labelName)) 00174 _newPatJetFlavourAssociation.srcByReference='patJetPartonAssociation'+_labelName 00175 else: 00176 setattr(process, 'patJetFlavourAssociation'+_labelName, patJetFlavourAssociation.clone(srcByReference='patJetPartonAssociation'+_labelName)) 00177 knownModules.append('patJetFlavourAssociation'+_labelName) 00178 ## modify new patJets collection accordingly 00179 _newPatJets.genJetMatch.setModuleLabel('patJetGenJetMatch'+_labelName) 00180 _newPatJets.genPartonMatch.setModuleLabel('patJetPartonMatch'+_labelName) 00181 _newPatJets.JetPartonMapSource.setModuleLabel('patJetFlavourAssociation'+_labelName) 00182 00183 ## add jetTrackAssociation for btagging (or jetTracksAssociation only) if required by user 00184 if (jetTrackAssociation or bTagging): 00185 ## add new jetTracksAssociationAtVertex to process 00186 from RecoJets.JetAssociationProducers.ak5JTA_cff import ak5JetTracksAssociatorAtVertex 00187 if 'jetTracksAssociationAtVertex'+_labelName in knownModules : 00188 _newJetTracksAssociationAtVertex=getattr(process, 'jetTracksAssociatorAtVertex'+_labelName) 00189 _newJetTracksAssociationAtVertex.jets=jetSource 00190 else: 00191 setattr(process, 'jetTracksAssociatorAtVertex'+_labelName, ak5JetTracksAssociatorAtVertex.clone(jets=jetSource)) 00192 knownModules.append('jetTracksAssociationAtVertex'+_labelName) 00193 ## add new patJetCharge to process 00194 from PhysicsTools.PatAlgos.recoLayer0.jetTracksCharge_cff import patJetCharge 00195 if 'patJetCharge'+_labelName in knownModules : 00196 _newPatJetCharge=getattr(process, 'patJetCharge'+_labelName) 00197 _newPatJetCharge.src='jetTracksAssociatorAtVertex'+_labelName 00198 else: 00199 setattr(process, 'patJetCharge'+_labelName, patJetCharge.clone(src = 'jetTracksAssociatorAtVertex'+_labelName)) 00200 knownModules.append('patJetCharge'+_labelName) 00201 ## modify new patJets collection accordingly 00202 _newPatJets.addAssociatedTracks=True 00203 _newPatJets.trackAssociationSource=cms.InputTag('jetTracksAssociatorAtVertex'+_labelName) 00204 _newPatJets.addJetCharge=True 00205 _newPatJets.jetChargeSource=cms.InputTag('patJetCharge'+_labelName) 00206 else: 00207 ## modify new patJets collection accordingly 00208 _newPatJets.addAssociatedTracks=False 00209 _newPatJets.trackAssociationSource='' 00210 _newPatJets.addJetCharge=False 00211 _newPatJets.jetChargeSource='' 00212 00213 ## run btagging if required by user 00214 if (bTagging): 00215 ## expand tagInfos to what is explicitely required by user + implicit 00216 ## requirements that come in from one or the other discriminator 00217 requiredTagInfos = list(btagInfos) 00218 for btagDiscr in btagDiscriminators : 00219 for requiredTagInfo in supportedBtagDiscr[btagDiscr] : 00220 tagInfoCovered = False 00221 for tagInfo in requiredTagInfos : 00222 if requiredTagInfo == tagInfo : 00223 tagInfoCovered = True 00224 break 00225 if not tagInfoCovered : 00226 requiredTagInfos.append(requiredTagInfo) 00227 ## load sequences and setups needed fro btagging 00228 process.load("RecoBTag.Configuration.RecoBTag_cff") 00229 import RecoBTag.Configuration.RecoBTag_cff as btag 00230 ## prepare setups for simple secondary vertex infos 00231 setattr(process, "simpleSecondaryVertex2Trk", simpleSecondaryVertex2Trk) 00232 ## prepare setups for transient tracks 00233 setattr(process, "TransientTrackBuilderESProducer", TransientTrackBuilderESProducer) 00234 ## setup all required btagInfos : we give a dedicated treatment for all five different 00235 ## types of tagINfos here. A common treatment is possible but might require a more 00236 ## general approach anyway in coordination with the btaggin POG. 00237 for btagInfo in requiredTagInfos : 00238 if 'impactParameterTagInfos' in btagInfo : 00239 setattr(process, btagInfo+_labelName, btag.impactParameterTagInfos.clone(jetTracks = cms.InputTag('jetTracksAssociatorAtVertex'+_labelName))) 00240 if 'secondaryVertexTagInfos' in btagInfo : 00241 setattr(process, btagInfo+_labelName, btag.secondaryVertexTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+_labelName))) 00242 if 'secondaryVertexNegativeTagInfos' in btagInfo : 00243 setattr(process, btagInfo+_labelName, btag.secondaryVertexNegativeTagInfos.clone(trackIPTagInfos = cms.InputTag('impactParameterTagInfos'+_labelName))) 00244 if 'softElectronTagInfos' in btagInfo : 00245 setattr(process, btagInfo+_labelName, btag.softElectronTagInfos.clone(jets = cms.InputTag(_newJetCollection))) 00246 if 'softMuonTagInfos' in btagInfo : 00247 setattr(process, btagInfo+_labelName, btag.softMuonTagInfos.clone(jets = cms.InputTag(_newJetCollection))) 00248 ## setup all required btagDiscriminators 00249 for btagDiscr in btagDiscriminators : 00250 setattr(process, btagDiscr+_labelName, getattr(btag, btagDiscr).clone(tagInfos = cms.VInputTag( *[ cms.InputTag(x+_labelName) for x in supportedBtagDiscr[btagDiscr] ] ))) 00251 ## replace corresponding tags for pat jet production 00252 _newPatJets.tagInfoSources = cms.VInputTag( *[ cms.InputTag(x+_labelName) for x in btagInfos ] ) 00253 _newPatJets.discriminatorSources = cms.VInputTag( *[ cms.InputTag(x+_labelName) for x in btagDiscriminators ] ) 00254 else: 00255 _newPatJets.addBTagInfo = False 00256 ## adjust output module; these collections will be empty anyhow, but we do it to stay clean 00257 for outputModule in outputModules: 00258 if hasattr(process,outputModule): 00259 getattr(process,outputModule).outputCommands.append("drop *_"+'selected'+_labelName+"_tagInfos_*") 00260 00261 ## add jet correction factors if required by user 00262 if (jetCorrections != None): 00263 ## check for the correct format 00264 if type(jetCorrections) != type(('PAYLOAD-LABEL',['CORRECTION-LEVEL-A','CORRECTION-LEVEL-B'], 'MET-LABEL')): 00265 raise ValueError, "In addJetCollection: 'jetCorrections' must be 'None' (as a python value w/o quotation marks), or of type ('PAYLOAD-LABEL', ['CORRECTION-LEVEL-A', \ 00266 'CORRECTION-LEVEL-B', ...], 'MET-LABEL'). Note that 'MET-LABEL' can be set to 'None' (as a string in quotation marks) in case you do not want to apply MET(Type1) \ 00267 corrections." 00268 ## determine type of jet constituents from jetSource; supported 00269 ## jet constituent types are calo, pf, jpt, for pf also particleflow 00270 ## is aloowed as part of the jetSource label, which might be used 00271 ## in CommonTools.ParticleFlow 00272 _type="NONE" 00273 if jetCorrections[0].count('PF')>0: 00274 _type='PF' 00275 elif jetCorrections[0].count('Calo')>0: 00276 _type='Calo' 00277 elif jetCorrections[0].count('JPT')>0: 00278 _type='JPT' 00279 else: 00280 raise TypeError, "In addJetCollection: Jet energy corrections are only supported for PF, JPT and Calo jets." 00281 00282 from PhysicsTools.PatAlgos.recoLayer0.jetCorrFactors_cfi import patJetCorrFactors 00283 if 'patJetCorrFactors'+_labelName in knownModules : 00284 _newPatJetCorrFactors=getattr(process, 'patJetCorrFactors'+_labelName) 00285 _newPatJetCorrFactors.src=jetSource 00286 else : 00287 setattr(process, 'patJetCorrFactors'+_labelName, patJetCorrFactors.clone(src=jetSource)) 00288 _newPatJetCorrFactors=getattr(process, "patJetCorrFactors"+_labelName) 00289 _newPatJetCorrFactors.payload=jetCorrections[0] 00290 _newPatJetCorrFactors.levels=jetCorrections[1] 00291 ## check whether L1Offset or L1FastJet is part of levels 00292 error=False 00293 for x in jetCorrections[1]: 00294 if x == 'L1Offset' : 00295 if not error : 00296 _newPatJetCorrFactors.useNPV=True 00297 _newPatJetCorrFactors.primaryVertices='offlinePrimaryVertices' 00298 ## we set this to True now as a L1 correction type should appear only once 00299 ## otherwise levels is miss configured 00300 error=True 00301 else: 00302 raise ValueError, "In addJetCollection: Correction levels for jet energy corrections are miss configured. An L1 correction type should appear not more than \ 00303 once. Check the list of correction levels you requested to be applied: ", jetCorrections[1] 00304 if x == 'L1FastJet' : 00305 if not error : 00306 if _type == "JPT" : 00307 raise TypeError, "In addJetCollection: L1FastJet corrections are only supported for PF and Calo jets." 00308 ## configure module 00309 _newPatJetCorrFactors.useRho=True 00310 _newPatJetCorrFactors.rho=cms.InputTag('kt6'+_type+'Jets', 'rho') 00311 ## we set this to True now as a L1 correction type should appear only once 00312 ## otherwise levels is miss configured 00313 error=True 00314 else: 00315 raise ValueError, "In addJetCollection: Correction levels for jet energy corrections are miss configured. An L1 correction type should appear not more than \ 00316 once. Check the list of correction levels you requested to be applied: ", jetCorrections[1] 00317 _newPatJets.jetCorrFactorsSource=cms.VInputTag(cms.InputTag('patJetCorrFactors'+_labelName)) 00318 00319 ## configure MET(Type1) corrections 00320 if jetCorrections[2].lower() != 'none' and jetCorrections[2] != '': 00321 if not jetCorrections[2].lower() == 'type-1' and not jetCorrections[2].lower() == 'type-2': 00322 raise valueError, "In addJetCollection: Wrong choice of MET corrections for new jet collection. Possible choices are None (or empty string), Type-1, Type-2 (i.e.\ 00323 Type-1 and Type-2 corrections applied). This choice is not case sensitive. Your choice was: ", jetCorrections[2] 00324 if _type == "JPT": 00325 raise ValueError, "In addJecCollection: MET(type1) corrections are not supported for JPTJets. Please set the MET-LABEL to \"None\" (as string in quatiation \ 00326 marks) and use raw tcMET together with JPTJets." 00327 ## set up jet correctors for MET corrections 00328 from JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff import ak5PFL1Fastjet 00329 from JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff import ak5PFL1Offset 00330 from JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff import ak5PFL2Relative 00331 from JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff import ak5PFL3Absolute 00332 from JetMETCorrections.Configuration.JetCorrectionServicesAllAlgos_cff import ak5PFResidual 00333 00334 setattr(process, jetCorrections[0]+'L1FastJet', ak5PFL1Fastjet.clone(algorithm=jetCorrections[0], srcRho=cms.InputTag('kt6'+_type+'Jets','rho'))) 00335 setattr(process, jetCorrections[0]+'L1Offset', ak5PFL1Offset.clone(algorithm=jetCorrections[0])) 00336 setattr(process, jetCorrections[0]+'L2Relative', ak5PFL2Relative.clone(algorithm=jetCorrections[0])) 00337 setattr(process, jetCorrections[0]+'L3Absolute', ak5PFL3Absolute.clone(algorithm=jetCorrections[0])) 00338 setattr(process, jetCorrections[0]+'L2L3Residual', ak5PFResidual.clone(algorithm=jetCorrections[0])) 00339 setattr(process, jetCorrections[0]+'CombinedCorrector', cms.ESProducer( 'JetCorrectionESChain', correctors = cms.vstring())) 00340 for x in jetCorrections[1]: 00341 if x != 'L1FastJet' and x != 'L1Offset' and x != 'L2Relative' and x != 'L3Absolute' and x != 'L2L3Residual': 00342 raise ValueError, 'In addJetCollection: Unsupported JEC for MET(Type1). Currently supported jet correction levels are L1FastJet, L1Offset, L2Relative, \ 00343 L3Asolute, L2L3Residual. Requested was:', x 00344 else: 00345 getattr(process, jetCorrections[0]+'CombinedCorrector').correctors.append(jetCorrections[0]+x) 00346 00347 ## set up MET(Type1) correction modules 00348 if _type == 'Calo': 00349 from JetMETCorrections.Type1MET.caloMETCorrections_cff import caloJetMETcorr 00350 from JetMETCorrections.Type1MET.caloMETCorrections_cff import caloType1CorrectedMet 00351 from JetMETCorrections.Type1MET.caloMETCorrections_cff import caloType1p2CorrectedMet 00352 setattr(process,jetCorrections[0]+'JetMETcorr', caloJetMETcorr.clone(src=jetSource,srcMET = "corMetGlobalMuons",jetCorrections = cms.string(jetCorrections[0]+'CombinedCorrector'))) 00353 setattr(process,jetCorrections[0]+'Type1CorMet', caloType1CorrectedMet.clone(src = "corMetGlobalMuons",srcType1Corrections = cms.VInputTag(cms.InputTag(jetCorrections[0]+'JetMETcorr', 'type1')))) 00354 setattr(process,jetCorrections[0]+'Type1p2CorMet',caloType1p2CorrectedMet.clone(src = "corMetGlobalMuons",srcType1Corrections = cms.VInputTag(cms.InputTag(jetCorrections[0]+'JetMETcorr', 'type1')),srcUnclEnergySums = cms.VInputTag(cms.InputTag(jetCorrections[0]+'JetMETcorr', 'type2'),cms.InputTag(jetCorrections[0]+'JetMETcorr', 'offset'),cms.InputTag('muonCaloMETcorr')))) 00355 00356 elif _type == 'PF': 00357 from JetMETCorrections.Type1MET.pfMETCorrections_cff import pfCandsNotInJet 00358 from JetMETCorrections.Type1MET.pfMETCorrections_cff import pfJetMETcorr 00359 from JetMETCorrections.Type1MET.pfMETCorrections_cff import pfCandMETcorr 00360 from JetMETCorrections.Type1MET.pfMETCorrections_cff import pfType1CorrectedMet 00361 from JetMETCorrections.Type1MET.pfMETCorrections_cff import pfType1p2CorrectedMet 00362 setattr(process,jetCorrections[0]+'CandsNotInJet',pfCandsNotInJet.clone(topCollection = jetSource)) 00363 setattr(process,jetCorrections[0]+'CandMETcorr', pfCandMETcorr.clone(src = cms.InputTag(jetCorrections[0]+'CandsNotInJet'))) 00364 setattr(process,jetCorrections[0]+'JetMETcorr', pfJetMETcorr.clone(src = jetSource)) 00365 setattr(process,jetCorrections[0]+'Type1CorMet', pfType1CorrectedMet.clone(srcType1Corrections = cms.VInputTag(cms.InputTag(jetCorrections[0]+'JetMETcorr', 'type1')))) 00366 setattr(process,jetCorrections[0]+'Type1p2CorMet', pfType1p2CorrectedMet.clone(srcType1Corrections = cms.VInputTag(cms.InputTag(jetCorrections[0]+'JetMETcorr', 'type1')),srcUnclEnergySums = cms.VInputTag(cms.InputTag(jetCorrections[0]+'JetMETcorr', 'type2'),cms.InputTag(jetCorrections[0]+'JetMETcorr', 'offset'),cms.InputTag(jetCorrections[0]+'CandMETcorr')))) 00367 00368 ## common configuration for Calo and PF 00369 if ('L1FastJet' in jetCorrections[1] or 'L1Fastjet' in jetCorrections[1]): 00370 getattr(process,jetCorrections[0]+'JetMETcorr').offsetCorrLabel = cms.string(jetCorrections[0]+'L1FastJet') 00371 elif ('L1Offset' in jetCorrections[1]): 00372 getattr(process,jetCorrections[0]+'JetMETcorr').offsetCorrLabel = cms.string(jetCorrections[0]+'L1Offset') 00373 else: 00374 getattr(process,jetCorrections[0]+'JetMETcorr').offsetCorrLabel = cms.string('') 00375 00376 from PhysicsTools.PatAlgos.producersLayer1.metProducer_cfi import patMETs 00377 if jetCorrections[2].lower() == 'type-1': 00378 setattr(process, 'patMETs'+_labelName, patMETs.clone(metSource = cms.InputTag(jetCorrections[0]+'Type1CorMet'), addMuonCorrections = False)) 00379 elif jetCorrections[2].lower() == 'type-1': 00380 setattr(process, 'patMETs'+_labelName, patMETs.clone(metSource = cms.InputTag(jetCorrections[0]+'Type1p2CorMet'), addMuonCorrections = False)) 00381 else: 00382 ## switch jetCorrFactors off 00383 _newPatJets.addJetCorrFactors=False 00384 00385 addJetCollection=AddJetCollection()
jetTools::AddJetCollection::_comment [private] |
add comments
Definition at line 37 of file jetTools.py.
tuple jetTools::AddJetCollection::_defaultParameters = dicttypes.SortedKeysDict() [static, private] |
Definition at line 12 of file jetTools.py.
string jetTools::AddJetCollection::_label = 'addJetCollection' [static, private] |
Definition at line 11 of file jetTools.py.
jetTools::AddJetCollection::_parameters [private] |
initialization of the base class
add all parameters that should be known to the class set defaults
Definition at line 36 of file jetTools.py.