CMS 3D CMS Logo

Functions

pfTools Namespace Reference

Functions

def adaptPFElectrons
def adaptPFMuons
def adaptPFPhotons
def adaptPFTaus
def adaptPVs
def addPFCandidates
def reconfigurePF2PATTaus
def removeMCMatchingPF2PAT
def switchToPFJets
def switchToPFMET
def tauTypeInPF2PAT
def usePF2PAT
def warningIsolation

Function Documentation

def pfTools::adaptPFElectrons (   process,
  module,
  postfix 
)

Definition at line 64 of file pfTools.py.

00065                                              :
00066     # module.useParticleFlow = True
00067     print "Adapting PF Electrons "
00068     print "********************* "
00069     warningIsolation()
00070     print
00071     module.useParticleFlow = True
00072     module.userIsolation   = cms.PSet()
00073     module.isoDeposits = cms.PSet(
00074         pfChargedHadrons = cms.InputTag("elPFIsoDepositCharged" + postfix),
00075         pfChargedAll = cms.InputTag("elPFIsoDepositChargedAll" + postfix),
00076         pfPUChargedHadrons = cms.InputTag("elPFIsoDepositPU" + postfix),
00077         pfNeutralHadrons = cms.InputTag("elPFIsoDepositNeutral" + postfix),
00078         pfPhotons = cms.InputTag("elPFIsoDepositGamma" + postfix)
00079         )
00080     module.isolationValues = cms.PSet(
00081         pfChargedHadrons = cms.InputTag("elPFIsoValueCharged04"+ postfix),
00082         pfChargedAll = cms.InputTag("elPFIsoValueChargedAll04"+ postfix),
00083         pfPUChargedHadrons = cms.InputTag("elPFIsoValuePU04" + postfix),
00084         pfNeutralHadrons = cms.InputTag("elPFIsoValueNeutral04" + postfix),
00085         pfPhotons = cms.InputTag("elPFIsoValueGamma04" + postfix)
00086         )
00087 
00088     # COLIN: since we take the egamma momentum for pat Electrons, we must
00089     # match the egamma electron to the gen electrons, and not the PFElectron.
00090     # -> do not uncomment the line below.
00091     # process.electronMatch.src = module.pfElectronSource
00092     # COLIN: how do we depend on this matching choice?
00093 
00094     print " PF electron source:", module.pfElectronSource
00095     print " isolation  :"
00096     print module.isolationValues
00097     print " isodeposits: "
00098     print module.isoDeposits
00099     print
00100 
00101     print "removing traditional isolation"
00102 
00103     removeIfInSequence(process,  "patElectronIsolation",  "patDefaultSequence", postfix)

def pfTools::adaptPFMuons (   process,
  module,
  postfix = "" 
)

Definition at line 32 of file pfTools.py.

00033                                             :
00034     print "Adapting PF Muons "
00035     print "***************** "
00036     warningIsolation()
00037     print
00038     module.useParticleFlow = True
00039     module.userIsolation   = cms.PSet()
00040     module.isoDeposits = cms.PSet(
00041         pfChargedHadrons = cms.InputTag("muPFIsoDepositCharged" + postfix),
00042         pfChargedAll = cms.InputTag("muPFIsoDepositChargedAll" + postfix),
00043         pfPUChargedHadrons = cms.InputTag("muPFIsoDepositPU" + postfix),
00044         pfNeutralHadrons = cms.InputTag("muPFIsoDepositNeutral" + postfix),
00045         pfPhotons = cms.InputTag("muPFIsoDepositGamma" + postfix)
00046         )
00047     module.isolationValues = cms.PSet(
00048         pfChargedHadrons = cms.InputTag("muPFIsoValueCharged04"+ postfix),
00049         pfChargedAll = cms.InputTag("muPFIsoValueChargedAll04"+ postfix),
00050         pfPUChargedHadrons = cms.InputTag("muPFIsoValuePU04" + postfix),
00051         pfNeutralHadrons = cms.InputTag("muPFIsoValueNeutral04" + postfix),
00052         pfPhotons = cms.InputTag("muPFIsoValueGamma04" + postfix)
00053         )
00054     # matching the pfMuons, not the standard muons.
00055     applyPostfix(process,"muonMatch",postfix).src = module.pfMuonSource
00056 
00057     print " muon source:", module.pfMuonSource
00058     print " isolation  :",
00059     print module.isolationValues
00060     print " isodeposits: "
00061     print module.isoDeposits
00062     print
00063 

def pfTools::adaptPFPhotons (   process,
  module 
)

Definition at line 104 of file pfTools.py.

00105                                   :
00106     raise RuntimeError, "Photons are not supported yet"

def pfTools::adaptPFTaus (   process,
  tauType = 'shrinkingConePFTau',
  postfix = "" 
)

Definition at line 236 of file pfTools.py.

00237                                                                      :
00238     # Set up the collection used as a preselection to use this tau type
00239     if tauType != 'hpsPFTau' :
00240         reconfigurePF2PATTaus(process, tauType, postfix=postfix)
00241     else:
00242         reconfigurePF2PATTaus(process, tauType,
00243                               ["DiscriminationByLooseChargedIsolation","DiscriminationByLooseIsolation"],
00244                               ["DiscriminationByDecayModeFinding"],
00245                               postfix=postfix)
00246     applyPostfix(process,"patTaus", postfix).tauSource = cms.InputTag("pfTaus"+postfix)
00247 
00248     redoPFTauDiscriminators(process,
00249                             cms.InputTag(tauType+'Producer'),
00250                             applyPostfix(process,"patTaus", postfix).tauSource,
00251                             tauType, postfix=postfix)
00252 
00253     switchToPFTauByType(process, pfTauType=tauType,
00254                         pfTauLabelNew=applyPostfix(process,"patTaus", postfix).tauSource,
00255                         pfTauLabelOld=cms.InputTag(tauType+'Producer'),
00256                         postfix=postfix)
00257 
00258     applyPostfix(process,"makePatTaus", postfix).remove(
00259         applyPostfix(process,"patPFCandidateIsoDepositSelection", postfix)
00260         )
00261 
#helper function for PAT on PF2PAT sample
def pfTools::adaptPVs (   process,
  pvCollection = cms.InputTag('offlinePrimaryVertices'),
  postfix = '' 
)

Definition at line 384 of file pfTools.py.

00385                                                                                       :
00386 
00387     print "Switching PV collection for PF2PAT:", pvCollection
00388     print "***********************************"
00389 
00390     # PV sources to be exchanged:
00391     pvExchange = ['Vertices','vertices','pvSrc','primaryVertices','srcPVs']
00392     # PV sources NOT to be exchanged:
00393     #noPvExchange = ['src','PVProducer','primaryVertexSrc','vertexSrc','primaryVertex']
00394 
00395     # find out all added jet collections (they don't belong to PF2PAT)
00396     interPostfixes = []
00397     for m in getattr(process,'patPF2PATSequence'+postfix).moduleNames():
00398         if m.startswith('patJets') and m.endswith(postfix) and not len(m)==len('patJets')+len(postfix):
00399             interPostfix = m.replace('patJets','')
00400             interPostfix = interPostfix.replace(postfix,'')
00401             interPostfixes.append(interPostfix)
00402 
00403     # exchange the primary vertex source of all relevant modules
00404     for m in getattr(process,'patPF2PATSequence'+postfix).moduleNames():
00405         modName = m.replace(postfix,'')
00406         # only if the module has a source with a relevant name
00407         for namePvSrc in pvExchange:
00408             if hasattr(getattr(process,m),namePvSrc):
00409                 # only if the module is not coming from an added jet collection
00410                 interPostFixFlag = False
00411                 for pfix in interPostfixes:
00412                     if modName.endswith(pfix):
00413                         interPostFixFlag = True
00414                         break
00415                 if not interPostFixFlag:
00416                     setattr(getattr(process,m),namePvSrc,deepcopy(pvCollection))
00417 

def pfTools::addPFCandidates (   process,
  src,
  patLabel = 'PFParticles',
  cut = "",
  postfix = "" 
)

Definition at line 267 of file pfTools.py.

00268                                                                          :
00269     from PhysicsTools.PatAlgos.producersLayer1.pfParticleProducer_cfi import patPFParticles
00270     # make modules
00271     producer = patPFParticles.clone(pfCandidateSource = src)
00272     filter   = cms.EDFilter("PATPFParticleSelector",
00273                     src = cms.InputTag("pat" + patLabel),
00274                     cut = cms.string(cut))
00275     counter  = cms.EDFilter("PATCandViewCountFilter",
00276                     minNumber = cms.uint32(0),
00277                     maxNumber = cms.uint32(999999),
00278                     src       = cms.InputTag("pat" + patLabel))
00279     # add modules to process
00280     setattr(process, "pat"         + patLabel, producer)
00281     setattr(process, "selectedPat" + patLabel, filter)
00282     setattr(process, "countPat"    + patLabel, counter)
00283     # insert into sequence
00284     getattr(process, "patDefaultSequence"+postfix).replace(
00285         applyPostfix(process, "patCandidateSummary", postfix),
00286         producer+applyPostfix(process, "patCandidateSummary", postfix)
00287     )
00288     getattr(process, "patDefaultSequence"+postfix).replace(
00289         applyPostfix(process, "selectedPatCandidateSummary", postfix),
00290         filter+applyPostfix(process, "selectedPatCandidateSummary", postfix)
00291     )
00292     index = len( applyPostfix( process, "patDefaultSequence", postfix ).moduleNames() )
00293     applyPostfix( process, "patDefaultSequence", postfix ).insert( index, counter )
00294     # summary tables
00295     applyPostfix(process, "patCandidateSummary", postfix).candidates.append(cms.InputTag('pat' + patLabel))
00296     applyPostfix(process, "selectedPatCandidateSummary", postfix).candidates.append(cms.InputTag('selectedPat' + patLabel))
00297 

def pfTools::reconfigurePF2PATTaus (   process,
  tauType = 'shrinkingConePFTau',
  pf2patSelection = ["DiscriminationByIsolation",
  DiscriminationByLeadingPionPtCut,
  selectionDependsOn = ["DiscriminationByLeadingTrackFinding"],
  producerFromType = lambda producer: producer+"Producer",
  postfix = "" 
)

Definition at line 109 of file pfTools.py.

00113                                       : producer+"Producer",
00114       postfix = ""):
00115    print "patTaus will be produced from taus of type: %s that pass %s" \
00116          % (tauType, pf2patSelection)
00117 
00118    #get baseSequence
00119    baseSequence = getattr(process,"pfTausBaseSequence"+postfix)
00120    #clean baseSequence from old modules
00121    for oldBaseModuleName in baseSequence.moduleNames():
00122        oldBaseModule = getattr(process,oldBaseModuleName)
00123        baseSequence.remove(oldBaseModule)
00124 
00125    # Get the prototype of tau producer to make, i.e. fixedConePFTauProducer
00126    producerName = producerFromType(tauType)
00127    # Set as the source for the pf2pat taus (pfTaus) selector
00128    applyPostfix(process,"pfTaus", postfix).src = producerName+postfix
00129    # Start our pf2pat taus base sequence
00130    oldTau = getattr(process,'pfTausProducer'+postfix)
00131    ## copy tau and setup it properly
00132    newTau = getattr(process,producerName).clone()
00133    ## adapted to new structure in RecoTauProducers PLEASE CHECK!!!
00134    if tauType=='shrinkingConePFTau': #Only shrCone tau has modifiers???
00135        # like this, it should have it already definied??
00136        newTau.modifiers[1] = cms.PSet(
00137            pfTauTagInfoSrc = cms.InputTag("pfTauTagInfoProducer"+postfix),
00138            name = cms.string('pfTauTTIworkaround'+postfix),
00139            plugin = cms.string('RecoTauTagInfoWorkaroundModifer')
00140            )
00141        newTau.piZeroSrc = "pfJetsLegacyTaNCPiZeros"+postfix
00142    elif tauType=='fixedConePFTau':
00143        newTau.piZeroSrc = "pfJetsPiZeros"+postfix
00144    elif tauType=='hpsPFTau':
00145        newTau = process.combinatoricRecoTaus.clone()
00146        newTau.piZeroSrc="pfJetsLegacyHPSPiZeros"+postfix
00147        newTau.modifiers[2] = cms.PSet(
00148            pfTauTagInfoSrc = cms.InputTag("pfTauTagInfoProducer"+postfix),
00149            name = cms.string('pfTauTTIworkaround'+postfix),
00150            plugin = cms.string('RecoTauTagInfoWorkaroundModifer')
00151         )
00152        from PhysicsTools.PatAlgos.tools.helpers import cloneProcessingSnippet
00153        cloneProcessingSnippet(process, process.produceHPSPFTaus, postfix)
00154        massSearchReplaceParam(getattr(process,"produceHPSPFTaus"+postfix),
00155                               "PFTauProducer",
00156                               cms.InputTag("combinatoricRecoTaus"),
00157                               cms.InputTag("pfTausBase"+postfix) )
00158        getattr(process,"hpsPFTauProducer"+postfix).src = "pfTausBase"+postfix
00159 
00160    newTau.builders[0].pfCandSrc = oldTau.builders[0].pfCandSrc
00161    newTau.jetRegionSrc = oldTau.jetRegionSrc
00162    newTau.jetSrc = oldTau.jetSrc
00163 
00164    # replace old tau producer by new one put it into baseSequence
00165    setattr(process,"pfTausBase"+postfix,newTau)
00166    baseSequence += getattr(process,"pfTausBase"+postfix)
00167    if tauType=='hpsPFTau':
00168        baseSequence += getattr(process,"produceHPSPFTaus"+postfix)
00169    #make custom mapper to take postfix into account (could have gone with lambda of lambda but... )
00170    def producerIsTauTypeMapperWithPostfix(tauProducer):
00171        return lambda x: producerIsTauTypeMapper(tauProducer)+x.group(1)+postfix
00172 
00173    def recoTauTypeMapperWithGroup(tauProducer):
00174        return "%s(.*)"%recoTauTypeMapper(tauProducer)
00175 
00176    # Get our prediscriminants
00177    for predisc in selectionDependsOn:
00178       # Get the prototype
00179       originalName = tauType+predisc # i.e. fixedConePFTauProducerDiscriminationByLeadingTrackFinding
00180       clonedName = "pfTausBase"+predisc+postfix
00181       clonedDisc = getattr(process, originalName).clone()
00182       # Register in our process
00183       setattr(process, clonedName, clonedDisc)
00184       baseSequence += getattr(process, clonedName)
00185 
00186       tauCollectionToSelect = None
00187       if tauType != 'hpsPFTau' :
00188           tauCollectionToSelect = "pfTausBase"+postfix
00189           #cms.InputTag(clonedDisc.PFTauProducer.value()+postfix)
00190       else:
00191           tauCollectionToSelect = "hpsPFTauProducer"+postfix
00192       # Adapt this discriminator for the cloned prediscriminators
00193       adaptTauDiscriminator(clonedDisc, newTauProducer="pfTausBase",
00194                             oldTauTypeMapper=recoTauTypeMapperWithGroup,
00195                             newTauTypeMapper=producerIsTauTypeMapperWithPostfix,
00196                             preservePFTauProducer=True)
00197       clonedDisc.PFTauProducer = tauCollectionToSelect
00198 
00199    # Reconfigure the pf2pat PFTau selector discrimination sources
00200    applyPostfix(process,"pfTaus", postfix).discriminators = cms.VPSet()
00201    for selection in pf2patSelection:
00202       # Get our discriminator that will be used to select pfTaus
00203       originalName = tauType+selection
00204       clonedName = "pfTausBase"+selection+postfix
00205       clonedDisc = getattr(process, originalName).clone()
00206       # Register in our process
00207       setattr(process, clonedName, clonedDisc)
00208 
00209       tauCollectionToSelect = None
00210 
00211       if tauType != 'hpsPFTau' :
00212           tauCollectionToSelect = cms.InputTag("pfTausBase"+postfix)
00213           #cms.InputTag(clonedDisc.PFTauProducer.value()+postfix)
00214       else:
00215           tauCollectionToSelect = cms.InputTag("hpsPFTauProducer"+postfix)
00216       #Adapt our cloned discriminator to the new prediscriminants
00217       adaptTauDiscriminator(clonedDisc, newTauProducer="pfTausBase",
00218                             oldTauTypeMapper=recoTauTypeMapperWithGroup,
00219                             newTauTypeMapper=producerIsTauTypeMapperWithPostfix,
00220                             preservePFTauProducer=True)
00221       clonedDisc.PFTauProducer = tauCollectionToSelect
00222       baseSequence += clonedDisc
00223       # Add this selection to our pfTau selectors
00224       applyPostfix(process,"pfTaus", postfix).discriminators.append(cms.PSet(
00225          discriminator=cms.InputTag(clonedName), selectionCut=cms.double(0.5)))
00226       # Set the input of the final selector.
00227       if tauType != 'hpsPFTau':
00228           applyPostfix(process,"pfTaus", postfix).src = "pfTausBase"+postfix
00229       else:
00230           # If we are using HPS taus, we need to take the output of the clenaed
00231           # collection
00232           applyPostfix(process,"pfTaus", postfix).src = "hpsPFTauProducer"+postfix
00233 
00234 
00235 
def pfTools::removeMCMatchingPF2PAT (   process,
  postfix = "",
  outputModules = ['out'] 
)

Definition at line 378 of file pfTools.py.

00379                                                                         :
00380     from PhysicsTools.PatAlgos.tools.coreTools import removeMCMatching
00381     removeIfInSequence(process, "genForPF2PATSequence", "patDefaultSequence", postfix)
00382     removeMCMatching(process, names=['All'], postfix=postfix, outputModules=outputModules)
00383 

def pfTools::switchToPFJets (   process,
  input = cms.InputTag('pfNoTau'),
  algo = 'AK5',
  postfix = "",
  jetCorrections = ('AK5PFchs', ['L1FastJet',
  L2Relative,
  L3Absolute,
  type1 = False,
  outputModules = ['out'] 
)

Definition at line 315 of file pfTools.py.

00316                                                                                                                                                                                                :
00317 
00318     print "Switching to PFJets,  ", algo
00319     print "************************ "
00320     print "input collection: ", input
00321 
00322     if( algo == 'IC5' ):
00323         genJetCollection = cms.InputTag('iterativeCone5GenJetsNoNu')
00324     elif algo == 'AK5':
00325         genJetCollection = cms.InputTag('ak5GenJetsNoNu')
00326     elif algo == 'AK7':
00327         genJetCollection = cms.InputTag('ak7GenJetsNoNu')
00328     else:
00329         print 'bad jet algorithm:', algo, '! for now, only IC5, AK5 and AK7 are allowed. If you need other algorithms, please contact Colin'
00330         sys.exit(1)
00331 
00332     # changing the jet collection in PF2PAT:
00333     from CommonTools.ParticleFlow.Tools.jetTools import jetAlgo
00334     inputCollection = getattr(process,"pfJets"+postfix).src
00335     setattr(process,"pfJets"+postfix,jetAlgo(algo)) # problem for cfgBrowser
00336     getattr(process,"pfJets"+postfix).src = inputCollection
00337     inputJetCorrLabel=jetCorrections
00338     switchJetCollection(process,
00339                         input,
00340                         jetIdLabel = algo,
00341                         doJTA=True,
00342                         doBTagging=True,
00343                         jetCorrLabel=inputJetCorrLabel,
00344                         doType1MET=type1,
00345                         genJetCollection = genJetCollection,
00346                         doJetID = True,
00347                         postfix = postfix,
00348                         outputModules = outputModules
00349                         )
00350     # check whether L1FastJet is in the list of correction levels or not
00351     applyPostfix(process, "patJetCorrFactors", postfix).useRho = False
00352     for corr in inputJetCorrLabel[1]:
00353         if corr == 'L1FastJet':
00354             applyPostfix(process, "patJetCorrFactors", postfix).useRho = True
00355             applyPostfix(process, "pfJets", postfix).doAreaFastjet = True
00356             applyPostfix(process, "kt6PFJets", postfix).src = inputCollection
00357             # do correct treatment for TypeI MET corrections
00358             if type1:
00359                 for mod in getattr(process,'patPF2PATSequence'+postfix).moduleNames():
00360                     if mod.startswith("kt6"):
00361                         prefix = mod.replace(postfix,'')
00362                         prefix = prefix.replace('kt6PFJets','')
00363                         prefix = prefix.replace('kt6CaloJets','')
00364                         prefix = getattr(process,'patJetCorrFactors'+prefix+postfix).payload.pythonValue().replace("'","")
00365                         for essource in process.es_sources_().keys():
00366                             if essource == prefix+'L1FastJet':
00367                                 setattr(process,essource+postfix,getattr(process,essource).clone(srcRho=cms.InputTag(mod,'rho')))
00368                                 setattr(process,prefix+'CombinedCorrector'+postfix,getattr(process,prefix+'CombinedCorrector').clone())
00369                                 getattr(process,prefix+'CorMet'+postfix).corrector = prefix+'CombinedCorrector'+postfix
00370                                 for cor in getattr(process,prefix+'CombinedCorrector'+postfix).correctors:
00371                                     if cor == essource:
00372                                         idx = getattr(process,prefix+'CombinedCorrector'+postfix).correctors.index(essource);
00373                                         getattr(process,prefix+'CombinedCorrector'+postfix).correctors[idx] = essource+postfix
00374 
00375     applyPostfix(process, "patJets", postfix).embedCaloTowers   = False
00376     applyPostfix(process, "patJets", postfix).embedPFCandidates = True
00377 
#-- Remove MC dependence ------------------------------------------------------
def pfTools::switchToPFMET (   process,
  input = cms.InputTag('pfMET'),
  type1 = False,
  postfix = "" 
)

Definition at line 298 of file pfTools.py.

00299                                                                                :
00300     print 'MET: using ', input
00301     if( not type1 ):
00302         oldMETSource = applyPostfix(process, "patMETs",postfix).metSource
00303         applyPostfix(process, "patMETs",postfix).metSource = input
00304         applyPostfix(process, "patMETs",postfix).addMuonCorrections = False
00305         getattr(process, "patDefaultSequence"+postfix).remove(applyPostfix(process, "patMETCorrections",postfix))
00306     else:
00307         # type1 corrected MET
00308         # name of corrected MET hardcoded in PAT and meaningless
00309         print 'Apply TypeI corrections for MET'
00310         getattr(process, "patDefaultSequence"+postfix).remove(applyPostfix(process, "patMETCorrections",postfix))
00311         jecLabel = getattr(process,'patJetCorrFactors'+postfix).payload.pythonValue().replace("'","")
00312         getattr(process,jecLabel+'CorMet'+postfix).inputUncorMetLabel = input.getModuleLabel()
00313         getattr(process,'patMETs'+postfix).metSource = jecLabel+'CorMet'+postfix
00314         getattr(process,'patMETs'+postfix).addMuonCorrections = False

def pfTools::tauTypeInPF2PAT (   process,
  tauType = 'shrinkingConePFTau',
  postfix = "" 
)

Definition at line 262 of file pfTools.py.

00263                                                                        :
00264     process.load("CommonTools.ParticleFlow.pfTaus_cff")
00265     applyPostfix(process, "pfTaus",postfix).src = cms.InputTag(tauType+'Producer'+postfix)
00266 

def pfTools::usePF2PAT (   process,
  runPF2PAT = True,
  jetAlgo = 'AK5',
  runOnMC = True,
  postfix = "",
  jetCorrections = ('AK5PFchs', ['L1FastJet',
  L2Relative,
  L3Absolute,
  pvCollection = cms.InputTag('offlinePrimaryVertices'),
  typeIMetCorrections = False,
  outputModules = ['out'] 
)
Switch PAT to use PF2PAT instead of AOD sources. if 'runPF2PAT' is true, we'll also add PF2PAT in front of the PAT sequence

Definition at line 418 of file pfTools.py.

00419                                                                                                                                                                                                                                                             :
00420     # PLEASE DO NOT CLOBBER THIS FUNCTION WITH CODE SPECIFIC TO A GIVEN PHYSICS OBJECT.
00421     # CREATE ADDITIONAL FUNCTIONS IF NEEDED.
00422 
00423     """Switch PAT to use PF2PAT instead of AOD sources. if 'runPF2PAT' is true, we'll also add PF2PAT in front of the PAT sequence"""
00424 
00425     # -------- CORE ---------------
00426     if runPF2PAT:
00427         process.load("CommonTools.ParticleFlow.PF2PAT_cff")
00428         #add Pf2PAT *before* cloning so that overlapping modules are cloned too
00429         #process.patDefaultSequence.replace( process.patCandidates, process.PF2PAT+process.patCandidates)
00430         process.patPF2PATSequence = cms.Sequence( process.PF2PAT + process.patDefaultSequence)
00431     else:
00432         process.patPF2PATSequence = cms.Sequence( process.patDefaultSequence )
00433 
00434     if not postfix == "":
00435         from PhysicsTools.PatAlgos.tools.helpers import cloneProcessingSnippet
00436         cloneProcessingSnippet(process, process.patPF2PATSequence, postfix)
00437         #delete everything pat PF2PAT modules! if you want to test the postfixing for completeness
00438         #from PhysicsTools.PatAlgos.tools.helpers import listModules,listSequences
00439         #for module in listModules(process.patDefaultSequence):
00440         #    if not module.label() is None: process.__delattr__(module.label())
00441         #for sequence in listSequences(process.patDefaultSequence):
00442         #    if not sequence.label() is None: process.__delattr__(sequence.label())
00443         #del process.patDefaultSequence
00444 
00445     removeCleaning(process, postfix=postfix, outputModules=outputModules)
00446 
00447     # -------- OBJECTS ------------
00448     # Muons
00449     adaptPFMuons(process,
00450                  applyPostfix(process,"patMuons",postfix),
00451                  postfix)
00452 
00453     # Electrons
00454     adaptPFElectrons(process,
00455                      applyPostfix(process,"patElectrons",postfix),
00456                      postfix)
00457 
00458     # Photons
00459     print "Temporarily switching off photons completely"
00460 
00461     removeSpecificPATObjects(process,names=['Photons'],outputModules=outputModules,postfix=postfix)
00462     removeIfInSequence(process,"patPhotonIsolation","patDefaultSequence",postfix)
00463 
00464     # Jets
00465     if runOnMC :
00466         switchToPFJets( process, cms.InputTag('pfNoTau'+postfix), jetAlgo, postfix=postfix,
00467                         jetCorrections=jetCorrections, type1=typeIMetCorrections, outputModules=outputModules )
00468         applyPostfix(process,"patDefaultSequence",postfix).replace(
00469             applyPostfix(process,"patJetGenJetMatch",postfix),
00470             getattr(process,"genForPF2PATSequence") *
00471             applyPostfix(process,"patJetGenJetMatch",postfix)
00472             )
00473     else :
00474         if not 'L2L3Residual' in jetCorrections[1]:
00475             print '#################################################'
00476             print 'WARNING! Not using L2L3Residual but this is data.'
00477             print 'If this is okay with you, disregard this message.'
00478             print '#################################################'
00479         switchToPFJets( process, cms.InputTag('pfNoTau'+postfix), jetAlgo, postfix=postfix,
00480                         jetCorrections=jetCorrections, type1=typeIMetCorrections, outputModules=outputModules )
00481 
00482     # Taus
00483     adaptPFTaus( process, tauType='shrinkingConePFTau', postfix=postfix )
00484     #adaptPFTaus( process, tauType='fixedConePFTau', postfix=postfix )
00485     #adaptPFTaus( process, tauType='hpsPFTau', postfix=postfix )
00486 
00487     # MET
00488     switchToPFMET(process, cms.InputTag('pfMET'+postfix), type1=typeIMetCorrections, postfix=postfix)
00489 
00490     # Unmasked PFCandidates
00491     addPFCandidates(process,cms.InputTag('pfNoJet'+postfix),patLabel='PFParticles'+postfix,cut="",postfix=postfix)
00492 
00493     # adapt primary vertex collection
00494     adaptPVs(process, pvCollection=pvCollection, postfix=postfix)
00495 
00496     if runOnMC:
00497         process.load("CommonTools.ParticleFlow.genForPF2PAT_cff")
00498         getattr(process, "patDefaultSequence"+postfix).replace(
00499             applyPostfix(process,"patCandidates",postfix),
00500             process.genForPF2PATSequence+applyPostfix(process,"patCandidates",postfix)
00501             )
00502     else:
00503         removeMCMatchingPF2PAT(process,postfix=postfix,outputModules=outputModules)
00504 
00505     print "Done: PF2PAT interfaced to PAT, postfix=", postfix
def pfTools::warningIsolation ( )

Definition at line 29 of file pfTools.py.

00030                       :
00031     print "WARNING: particle based isolation must be studied"