![]() |
![]() |
Inherits FWCore::GuiBrowsers::ConfigToolBase::ConfigToolBase.
Public Member Functions | |
def | __call__ |
def | __init__ |
def | getDefaultParameters |
def | toolCode |
Private Attributes | |
_comment | |
_parameters | |
Static Private Attributes | |
tuple | _defaultParameters = dicttypes.SortedKeysDict() |
string | _label = 'removeSpecificPATObjects' |
Remove a specific PAT object from the default sequence
Definition at line 244 of file coreTools.py.
def coreTools::RemoveSpecificPATObjects::__init__ | ( | self | ) |
Definition at line 250 of file coreTools.py.
00251 : 00252 ConfigToolBase.__init__(self) 00253 self.addParameter(self._defaultParameters,'names',self._defaultValue, "list of collection names; supported are 'Photons', 'Electrons', 'Muons', 'Taus', 'Jets', 'METs'", Type=list, allowedValues=['Photons', 'Electrons', 'Muons', 'Taus', 'Jets', 'METs']) 00254 self.addParameter(self._defaultParameters,'outputInProcess',True,"indicate whether there is an output module specified for the process (default is True)" ) 00255 self.addParameter(self._defaultParameters,'postfix',"", "postfix of default sequence") 00256 self._parameters=copy.deepcopy(self._defaultParameters) 00257 self._comment = ""
def coreTools::RemoveSpecificPATObjects::__call__ | ( | self, | |
process, | |||
names = None , |
|||
outputInProcess = None , |
|||
postfix = None |
|||
) |
Definition at line 261 of file coreTools.py.
00265 : 00266 if names is None: 00267 names=self._defaultParameters['names'].value 00268 if outputInProcess is None: 00269 outputInProcess=self._defaultParameters['outputInProcess'].value 00270 if postfix is None: 00271 postfix=self._defaultParameters['postfix'].value 00272 self.setParameter('names',names) 00273 self.setParameter('outputInProcess',outputInProcess) 00274 self.setParameter('postfix',postfix) 00275 self.apply(process)
def coreTools::RemoveSpecificPATObjects::getDefaultParameters | ( | self | ) |
Definition at line 258 of file coreTools.py.
def coreTools::RemoveSpecificPATObjects::toolCode | ( | self, | |
process | |||
) |
Definition at line 276 of file coreTools.py.
00277 : 00278 names=self._parameters['names'].value 00279 outputInProcess=self._parameters['outputInProcess'].value 00280 postfix=self._parameters['postfix'].value 00281 00282 ## remove pre object production steps from the default sequence 00283 for obj in range(len(names)): 00284 if( names[obj] == 'Photons' ): 00285 removeIfInSequence(process, 'patPhotonIsolation', "patDefaultSequence", postfix) 00286 removeIfInSequence(process, 'photonMatch', "patDefaultSequence", postfix) 00287 removeIfInSequence(process, 'patPhotons', "patDefaultSequence", postfix) 00288 if( names[obj] == 'Electrons' ): 00289 removeIfInSequence(process, 'patElectronId', "patDefaultSequence", postfix) 00290 removeIfInSequence(process, 'patElectronIsolation', "patDefaultSequence", postfix) 00291 removeIfInSequence(process, 'electronMatch', "patDefaultSequence", postfix) 00292 removeIfInSequence(process, 'patElectrons', "patDefaultSequence", postfix) 00293 if( names[obj] == 'Muons' ): 00294 removeIfInSequence(process, 'muonMatch', "patDefaultSequence", postfix) 00295 removeIfInSequence(process, 'patMuons', "patDefaultSequence", postfix) 00296 if( names[obj] == 'Taus' ): 00297 removeIfInSequence(process, 'patPFCandidateIsoDepositSelection', "patDefaultSequence", postfix) 00298 removeIfInSequence(process, 'patPFTauIsolation', "patDefaultSequence", postfix) 00299 removeIfInSequence(process, 'tauMatch', "patDefaultSequence", postfix) 00300 removeIfInSequence(process, 'tauGenJets', "patDefaultSequence", postfix) 00301 removeIfInSequence(process, 'tauGenJetsSelectorAllHadrons', "patDefaultSequence", postfix) 00302 removeIfInSequence(process, 'tauGenJetMatch', "patDefaultSequence", postfix) 00303 removeIfInSequence(process, 'patTaus', "patDefaultSequence", postfix) 00304 if( names[obj] == 'Jets' ): 00305 removeIfInSequence(process, 'patJetCharge', "patDefaultSequence", postfix) 00306 removeIfInSequence(process, 'patJetCorrections', "patDefaultSequence", postfix) 00307 removeIfInSequence(process, 'patJetPartonMatch', "patDefaultSequence", postfix) 00308 removeIfInSequence(process, 'patJetGenJetMatch', "patDefaultSequence", postfix) 00309 removeIfInSequence(process, 'patJetFlavourId', "patDefaultSequence", postfix) 00310 if( names[obj] == 'METs' ): 00311 removeIfInSequence(process, 'patMETCorrections', "patDefaultSequence", postfix) 00312 00313 ## remove object production steps from the default sequence 00314 if( names[obj] == 'METs' ): 00315 process.patDefaultSequence.remove( getattr(process, 'pat'+names[obj]) ) 00316 else: 00317 if( names[obj] == 'Jets' ): 00318 applyPostfix(process,"patDefaultSequence",postfix).remove( 00319 getattr(process, jetCollectionString()+postfix) ) 00320 applyPostfix(process,"patDefaultSequence",postfix).remove( 00321 getattr(process, jetCollectionString('selected')+postfix) ) 00322 applyPostfix(process,"patDefaultSequence",postfix).remove( 00323 getattr(process, jetCollectionString('count')+postfix) ) 00324 else: 00325 applyPostfix(process,"patDefaultSequence",postfix).remove( 00326 getattr(process, 'pat'+names[obj]+postfix) ) 00327 applyPostfix(process,"patDefaultSequence",postfix).remove( 00328 getattr(process, 'selectedPat'+names[obj]+postfix) ) 00329 applyPostfix(process,"patDefaultSequence",postfix).remove( 00330 getattr(process, 'countPat'+names[obj]+postfix) ) 00331 ## in the case of leptons, the lepton counter must be modified as well 00332 if( names[obj] == 'Electrons' ): 00333 print 'removed from lepton counter: electrons' 00334 applyPostfix(process,"countPatLeptons",postfix).countElectrons = False 00335 elif( names[obj] == 'Muons' ): 00336 print 'removed from lepton counter: muons' 00337 applyPostfix(process,"countPatLeptons",postfix).countMuons = False 00338 elif( names[obj] == 'Taus' ): 00339 print 'removed from lepton counter: taus' 00340 applyPostfix(process,"countPatLeptons",postfix).countTaus = False 00341 ## remove from summary 00342 if( names[obj] == 'METs' ): 00343 applyPostfix(process,"patCandidateSummary",postfix).candidates.remove( 00344 cms.InputTag('pat'+names[obj]+postfix) ) 00345 else: 00346 if( names[obj] == 'Jets' ): 00347 applyPostfix(process,"patCandidateSummary",postfix).candidates.remove( 00348 cms.InputTag(jetCollectionString()+postfix) ) 00349 applyPostfix(process,"selectedPatCandidateSummary",postfix).candidates.remove( 00350 cms.InputTag(jetCollectionString('selected')+postfix) ) 00351 applyPostfix(process,"cleanPatCandidateSummary",postfix).candidates.remove( 00352 cms.InputTag(jetCollectionString('clean')+postfix) ) 00353 else: 00354 ## check whether module is in sequence or not 00355 result = [ m.label()[:-len(postfix)] for m in listModules( getattr(process,"patDefaultSequence"+postfix))] 00356 result.extend([ m.label()[:-len(postfix)] for m in listSequences( getattr(process,"patDefaultSequence"+postfix))] ) 00357 if applyPostfix(process,"patCandidateSummary",postfix) in result : 00358 applyPostfix(process,"patCandidateSummary",postfix).candidates.remove( 00359 cms.InputTag('pat'+names[obj]+postfix) ) 00360 if applyPostfix(process,"selectedPatCandidateSummary",postfix) in result : 00361 applyPostfix(process,"selectedPatCandidateSummary",postfix).candidates.remove( 00362 cms.InputTag('selectedPat'+names[obj]+postfix) ) 00363 if applyPostfix(process,"cleanPatCandidateSummary",postfix) in result : 00364 applyPostfix(process,"cleanPatCandidateSummary",postfix).candidates.remove( 00365 cms.InputTag('cleanPat'+names[obj]+postfix) ) 00366 ## remove cleaning for the moment; in principle only the removed object 00367 ## could be taken out of the checkOverlaps PSet 00368 if ( outputInProcess ): 00369 print "---------------------------------------------------------------------" 00370 print "INFO : some objects have been removed from the sequence. Switching " 00371 print " off PAT cross collection cleaning, as it might be of limited" 00372 print " sense now. If you still want to keep object collection cross" 00373 print " cleaning within PAT you need to run and configure it by hand" 00374 removeCleaning(process) 00375 00376 00377 removeSpecificPATObjects=RemoveSpecificPATObjects() 00378
Definition at line 250 of file coreTools.py.
tuple coreTools::RemoveSpecificPATObjects::_defaultParameters = dicttypes.SortedKeysDict() [static, private] |
Definition at line 249 of file coreTools.py.
string coreTools::RemoveSpecificPATObjects::_label = 'removeSpecificPATObjects' [static, private] |
Definition at line 248 of file coreTools.py.
Definition at line 250 of file coreTools.py.