CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
SUSY_pattuple_cff Namespace Reference

Functions

def addDefaultSUSYPAT
 
def addJetMET
 
def addSUSYJetCollection
 
def addTagInfos
 
def addTypeIIMet
 
def extensiveMatching
 
def getSUSY_pattuple_outputCommands
 
def loadPAT
 
def loadPATTriggers
 
def loadPF2PAT
 
def loadSusyValidation
 
def loadType1METSequence
 
def removeMCDependence
 

Function Documentation

def SUSY_pattuple_cff.addDefaultSUSYPAT (   process,
  mcInfo = True,
  HLTMenu = 'HLT',
  jetMetCorrections = ['L2Relative',
  L3Absolute,
  mcVersion = '',
  theJetNames = ['AK5PF'],
  doValidation = False,
  extMatch = False,
  doSusyTopProjection = False,
  doType1MetCorrection = True,
  doType0MetCorrection = False 
)

Definition at line 12 of file SUSY_pattuple_cff.py.

References addJetMET(), addTagInfos(), extensiveMatching(), loadPAT(), loadPF2PAT(), loadSusyValidation(), and removeMCDependence().

12 
13 def addDefaultSUSYPAT(process,mcInfo=True,HLTMenu='HLT',jetMetCorrections=['L2Relative', 'L3Absolute'],mcVersion='',theJetNames = ['AK5PF'],doValidation=False,extMatch=False,doSusyTopProjection=False,doType1MetCorrection=True,doType0MetCorrection=False):
14  loadPF2PAT(process,mcInfo,jetMetCorrections,extMatch,doSusyTopProjection,doType1MetCorrection,doType0MetCorrection,'PF')
15  addTagInfos(process,jetMetCorrections)
16  if not mcInfo:
17  removeMCDependence(process)
18  loadPAT(process,jetMetCorrections,extMatch)
19  addJetMET(process,theJetNames,jetMetCorrections,mcVersion)
20  # loadType1METSequence(process) # defines process.Type1METSequence
21  # loadPATTriggers(process,HLTMenu,theJetNames,electronMatches,muonMatches,tauMatches,jetMatches,photonMatches)
22 
23  #-- Counter for the number of processed events --------------------------------
24  process.eventCountProducer = cms.EDProducer("EventCountProducer")
25 
26  # Full path
27  #process.load('RecoTauTag.Configuration.RecoPFTauTag_cff')
28  process.susyPatDefaultSequence = cms.Sequence( process.eventCountProducer
29  # * process.PFTau
30  # * process.Type1METSequence
31  * process.patPF2PATSequence
32  * process.patPF2PATSequencePF
33  )
34 
35  if mcInfo and extMatch:
36  extensiveMatching(process)
37  process.susyPatDefaultSequence.replace(process.patDefaultSequence, process.extensiveMatching+process.patDefaultSequence)
38 
39  if doValidation:
40  loadSusyValidation(process)
41  process.susyPatDefaultSequence.replace(process.patPF2PATSequencePF, process.patPF2PATSequencePF * process.ak5CaloJetsL2L3 * process.metJESCorAK5CaloJet * process.RecoSusyValidation * process.PatSusyValidation*process.MEtoEDMConverter)
def SUSY_pattuple_cff.addJetMET (   process,
  theJetNames,
  jetMetCorrections,
  mcVersion 
)

Definition at line 479 of file SUSY_pattuple_cff.py.

References addSUSYJetCollection().

Referenced by addDefaultSUSYPAT().

480 def addJetMET(process,theJetNames,jetMetCorrections,mcVersion):
481  #-- Extra Jet/MET collections -------------------------------------------------
482  # Add a few jet collections...
483  for jetName in theJetNames:
484  addSUSYJetCollection(process,jetMetCorrections,jetName,mcVersion)
485 
486  #-- Tune contents of jet collections -----------------------------------------
487  theJetNames.append('')
488  for jetName in theJetNames:
489  module = getattr(process,'patJets'+jetName)
490  module.addTagInfos = False # Remove tag infos
491  module.embedGenJetMatch = False # Only keep reference, since we anyway keep the genJet collections
492  #module.embedCaloTowers = True # To drop calo towers
493  theJetNames.pop()
494 
495  # Add tcMET
496  from PhysicsTools.PatAlgos.tools.metTools import addTcMET #, addPfMET
497  addTcMET(process,'TC')
498  #addPfMET(process,'PF') #is in PF2PAT
499 
500  # Rename default jet collection for uniformity
501  process.cleanPatJetsAK5Calo = process.cleanPatJets
502  process.patMETsAK5Calo = process.patMETs
503 
504  # TODO: fix type2 MET in 52X
505  #addTypeIIMet(process)
506 
507  # Modify subsequent modules
508  process.patHemispheres.patJets = process.cleanPatJetsAK5Calo.label()
509  process.countPatJets.src = process.cleanPatJetsAK5Calo.label()
510 
511  # Modify counters' input
512  process.patCandidateSummary.candidates.remove(cms.InputTag('patMETs'))
513  process.patCandidateSummary.candidates.append(cms.InputTag('patMETsAK5Calo'))
514  process.patCandidateSummary.candidates.append(cms.InputTag('patMHTsAK5Calo'))
515  process.cleanPatCandidateSummary.candidates.remove(cms.InputTag('cleanPatJets'))
516  process.cleanPatCandidateSummary.candidates.append(cms.InputTag('cleanPatJetsAK5Calo'))
517  # Add new jet collections to counters (MET done automatically)
518  for jets in theJetNames:
519  process.patCandidateSummary.candidates.append(cms.InputTag('patJets'+jets))
520  process.selectedPatCandidateSummary.candidates.append(cms.InputTag('selectedPatJets'+jets))
521  process.cleanPatCandidateSummary.candidates.append(cms.InputTag('cleanPatJets'+jets))
def SUSY_pattuple_cff.addSUSYJetCollection (   process,
  jetMetCorrections,
  jets = 'IC5Calo',
  mcVersion = '',
  doJTA = True,
  doType1MET = True,
  doJetID = True,
  jetIdLabel = None 
)

Definition at line 436 of file SUSY_pattuple_cff.py.

Referenced by addJetMET().

437 def addSUSYJetCollection(process,jetMetCorrections,jets = 'IC5Calo',mcVersion='',doJTA=True,doType1MET=True,doJetID=True,jetIdLabel=None):
438  from PhysicsTools.PatAlgos.tools.jetTools import addJetCollection
439  algorithm = jets[0:3]
440  type = jets[3:len(jets)]
441  jetCorrLabel = (jets,cms.vstring(jetMetCorrections))
442  if 'IC' in algorithm: collection = algorithm.replace('IC','iterativeCone')
443  elif 'SC' in algorithm: collection = algorithm.replace('SC','sisCone')
444  elif 'AK' in algorithm: collection = algorithm.replace('AK','ak')
445  elif 'KT' in algorithm: collection = algorithm.replace('KT','kt')
446  else: raise ValueError, "Unknown jet algorithm: %s" % (jets)
447  jetIdLabel = algorithm.lower()
448  if type == 'Calo':
449  jetCollection = '%(collection)sCaloJets' % locals()
450  if not 'AK7' in algorithm:
451  doType1MET = True
452  elif type == 'PF':
453  jetCollection = '%(collection)sPFJets' % locals()
454  doJetID = False
455  elif type == 'JPT':
456  if 'IC' in algorithm: collectionJPT = algorithm.replace('IC','Icone')
457  elif 'SC' in algorithm: collectionJPT = algorithm.replace('SC','Siscone')
458  elif 'AK' in algorithm: collectionJPT = algorithm.replace('AK','AntiKt')
459  else: raise ValueError, "Unknown jet algorithm: %s" % (jets)
460  jetCollection = 'JetPlusTrackZSPCorJet%(collectionJPT)s' % locals()
461  elif type == 'Track':
462  jetCollection = '%(collection)sTrackJets' % locals()
463  jetCorrLabel = None
464  doJetID = False
465  else: raise ValueError, "Unknown jet type: %s" % (jets)
466 
467  addJetCollection(process, cms.InputTag(jetCollection),
468  algorithm, type,
469  doJTA = doJTA,
470  doBTagging = True,
471  jetCorrLabel = jetCorrLabel,
472  doType1MET = doType1MET,
473  doL1Cleaning = True,
474  doL1Counters = True,
475  doJetID = doJetID,
476  jetIdLabel = jetIdLabel,
477  genJetCollection = cms.InputTag('%(collection)sGenJets' % locals())
478  )
def SUSY_pattuple_cff.addTagInfos (   process,
  jetMetCorrections 
)

Definition at line 430 of file SUSY_pattuple_cff.py.

Referenced by addDefaultSUSYPAT().

431 def addTagInfos(process,jetMetCorrections):
432  from PhysicsTools.PatAlgos.tools.jetTools import switchJetCollection
433  switchJetCollection( process,
434  jetCollection=cms.InputTag('ak5CaloJets'),
435  jetCorrLabel=('AK5Calo', jetMetCorrections))
def SUSY_pattuple_cff.addTypeIIMet (   process)

Definition at line 402 of file SUSY_pattuple_cff.py.

403 def addTypeIIMet(process) :
404  # Add reco::MET with Type II correction
405  from PhysicsTools.PatAlgos.recoLayer0.jetMETCorrections_cff import metJESCorAK5CaloJet
406  process.metJESCorAK5CaloJetTypeII = metJESCorAK5CaloJet.clone()
407  process.metJESCorAK5CaloJetTypeII.useTypeII = True
408  process.metJESCorAK5CaloJetTypeII.hasMuonsCorr = False
409  # Add muon corrections for above II reco::MET
410  process.metJESCorAK5CaloJetMuonsTypeII = process.metJESCorAK5CaloJetMuons.clone(
411  uncorMETInputTag = cms.InputTag('metJESCorAK5CaloJetTypeII')
412  )
413  # Add to recoLayer0 sequence
414  process.patMETCorrections.replace(
415  process.metJESCorAK5CaloJet,
416  (process.metJESCorAK5CaloJetTypeII*
417  process.metJESCorAK5CaloJetMuonsTypeII)+
418  process.metJESCorAK5CaloJet
419  )
420  # Add pat::MET with Type II correction
421  process.patMETsAK5CaloTypeII = process.patMETs.clone(
422  metSource = cms.InputTag("metJESCorAK5CaloJetMuonsTypeII")
423  )
424  # Add to producersLayer1 sequence
425  process.patDefaultSequence.replace(
426  process.patMETsAK5Calo,
427  process.patMETsAK5Calo+
428  process.patMETsAK5CaloTypeII
429  )
def SUSY_pattuple_cff.extensiveMatching (   process)

Definition at line 42 of file SUSY_pattuple_cff.py.

Referenced by addDefaultSUSYPAT().

42 
43 def extensiveMatching(process):
44  process.load("SimGeneral.TrackingAnalysis.trackingParticlesNoSimHits_cfi") # On RECO
45  process.load("SimMuon.MCTruth.MuonAssociatorByHits_cfi") # On RECO
46  process.mergedTruth = cms.EDProducer("GenPlusSimParticleProducer",
47  src = cms.InputTag("g4SimHits"), # use "famosSimHits" for FAMOS
48  setStatus = cms.int32(5), # set status = 8 for GEANT GPs
49  filter = cms.vstring("pt > 0.0"), # just for testing (optional)
50  genParticles = cms.InputTag("genParticles") # original genParticle list
51  )
52  process.load("MuonAnalysis.MuonAssociators.muonClassificationByHits_cfi")
53 
54  from MuonAnalysis.MuonAssociators.muonClassificationByHits_cfi import addUserData as addClassByHits
55  addClassByHits(process.patMuons,labels=['classByHitsGlb'],extraInfo=True)
56  addClassByHits(process.patMuonsPF,labels=['classByHitsGlb'],extraInfo=True)
57 
58  process.extensiveMatching = cms.Sequence(process.mergedTruth+process.muonClassificationByHits)
def SUSY_pattuple_cff.getSUSY_pattuple_outputCommands (   process)

Definition at line 539 of file SUSY_pattuple_cff.py.

540 def getSUSY_pattuple_outputCommands( process ):
541  from PhysicsTools.PatAlgos.patEventContent_cff import patEventContent, patExtraAodEventContent, patTriggerEventContent, patTriggerStandAloneEventContent, patEventContentTriggerMatch
542  keepList = []
543  susyAddEventContent = [ # PAT Objects
544  #'keep *_triggerMatched*_*_*',
545  # Keep PF2PAT output
546  'keep *_selectedPatMuonsPF_*_*',
547  'keep *_selectedPatElectronsPF_*_*',
548  'keep *_selectedPatTausPF_*_*',
549  'keep *_selectedPatJetsPF_*_*',
550  #L1 trigger info
551  'keep L1GlobalTriggerObjectMapRecord_*_*_*',
552  'keep L1GlobalTriggerReadoutRecord_*_*_*',
553  # Generator information
554  'keep recoGenJets_*GenJets*_*_*',
555  'keep recoGenMETs_*_*_*',
556  #Number of processed events
557  'keep edmMergeableCounter_eventCountProducer_*_*',
558  'keep recoRecoChargedRefCandidates_trackRefsForJets_*_*',
559  #'keep recoTrackJets_ak5TrackJets_*_*',
560  'keep *_electronMergedSeeds_*_*',
561  'keep *_Conversions_*_*',
562  'keep recoPFCandidates_particleFlow_*_*',
563  #'keep recoSuperClusters_corrected*_*_*',
564  #'keep recoSuperClusters_pfElectronTranslator_*_*',
565  #'keep *_gsfElectronCores_*_*', #Keep electron core
566  #'keep *_photonCore_*_*', #Keep electron core
567  'keep recoConversions_conversions_*_*',
568  'keep recoTracks_*onversions_*_*',
569  'keep HcalNoiseSummary_*_*_*', #Keep the one in RECO
570  'keep *BeamHaloSummary_*_*_*',
571  # Keep Gap Vertices for comparison
572  'keep *_offlinePrimaryVerticesGap_*_*',
573  'keep *_offlinePrimaryVerticesGapWithBS_*_*',
574  #DQM
575  'keep *_MEtoEDMConverter_*_PAT',
576  'drop recoTracks_generalTracks*_*_*',
577  'drop *_towerMaker_*_*',
578  'keep *_pfType1CorrectedMet*_*_*',
579  ]
580  keepList.extend(patEventContent)
581  keepList.extend(patExtraAodEventContent)
582  keepList.extend(patTriggerEventContent)
583  keepList.extend(patEventContentTriggerMatch)
584  keepList.extend(susyAddEventContent)
585  return keepList
586 
def SUSY_pattuple_cff.loadPAT (   process,
  jetMetCorrections,
  extMatch 
)

Definition at line 59 of file SUSY_pattuple_cff.py.

References pfTools.usePFIso().

Referenced by addDefaultSUSYPAT().

59 
60 def loadPAT(process,jetMetCorrections,extMatch):
61  #-- Changes for electron and photon ID ----------------------------------------
62  from PhysicsTools.PatAlgos.tools.pfTools import usePFIso
63  usePFIso( process )
64  process.patElectrons.isolationValues = cms.PSet(
65  pfNeutralHadrons = cms.InputTag("elPFIsoValueNeutral03PFIdPFIso"),
66  pfChargedAll = cms.InputTag("elPFIsoValueChargedAll03PFIdPFIso"),
67  pfPUChargedHadrons = cms.InputTag("elPFIsoValuePU03PFIdPFIso"),
68  pfPhotons = cms.InputTag("elPFIsoValueGamma03PFIdPFIso"),
69  pfChargedHadrons = cms.InputTag("elPFIsoValueCharged03PFIdPFIso")
70  )
71  process.patElectrons.isolationValuesNoPFId = cms.PSet(
72  pfNeutralHadrons = cms.InputTag("elPFIsoValueNeutral03NoPFIdPFIso"),
73  pfChargedAll = cms.InputTag("elPFIsoValueChargedAll03NoPFIdPFIso"),
74  pfPUChargedHadrons = cms.InputTag("elPFIsoValuePU03NoPFIdPFIso"),
75  pfPhotons = cms.InputTag("elPFIsoValueGamma03NoPFIdPFIso"),
76  pfChargedHadrons = cms.InputTag("elPFIsoValueCharged03NoPFIdPFIso")
77  )
78  process.patDefaultSequence.replace(process.patElectrons,process.eleIsoSequence+process.patElectrons)
79  process.patDefaultSequence.replace(process.patMuons,process.muIsoSequence+process.patMuons)
80 
81  # Turn off photon-electron cleaning (i.e., flag only)
82  process.cleanPatPhotons.checkOverlaps.electrons.requireNoOverlaps = False
83 
84  # Embed tracks, since we drop them
85  process.patElectrons.embedTrack = True
86  process.patMuons.embedTrack = True
87 
88  #include tau decay mode in pat::Taus (elese it will just be uninitialized)
89  #decay modes are dropped and have to be redone, this is a bit dangorous since the decay modes insered are *not* the ones used in RECO
90  #process.patTaus.addDecayMode = True
91  #process.makePatTaus.replace( process.patTaus, process.shrinkingConePFTauDecayModeProducer + process.patTaus )
92 
93  #Additional electron ids as defined for VBTF
94  process.load("ElectroWeakAnalysis.WENu.simpleEleIdSequence_cff")
95  process.patElectrons.electronIDSources = cms.PSet(
96  eidTight = cms.InputTag("eidTight"),
97  eidLoose = cms.InputTag("eidLoose"),
98  eidRobustTight = cms.InputTag("eidRobustTight"),
99  eidRobustHighEnergy = cms.InputTag("eidRobustHighEnergy"),
100  eidRobustLoose = cms.InputTag("eidRobustLoose"),
101  simpleEleId95relIso= cms.InputTag("simpleEleId95relIso"),
102  simpleEleId90relIso= cms.InputTag("simpleEleId90relIso"),
103  simpleEleId85relIso= cms.InputTag("simpleEleId85relIso"),
104  simpleEleId80relIso= cms.InputTag("simpleEleId80relIso"),
105  simpleEleId70relIso= cms.InputTag("simpleEleId70relIso"),
106  simpleEleId60relIso= cms.InputTag("simpleEleId60relIso"),
107  simpleEleId95cIso= cms.InputTag("simpleEleId95cIso"),
108  simpleEleId90cIso= cms.InputTag("simpleEleId90cIso"),
109  simpleEleId85cIso= cms.InputTag("simpleEleId85cIso"),
110  simpleEleId80cIso= cms.InputTag("simpleEleId80cIso"),
111  simpleEleId70cIso= cms.InputTag("simpleEleId70cIso"),
112  simpleEleId60cIso= cms.InputTag("simpleEleId60cIso"))
113  process.patDefaultSequence.replace(process.patElectrons,process.simpleEleIdSequence+process.patElectrons)
114 
115  #-- Tuning of Monte Carlo matching --------------------------------------------
116  # Also match with leptons of opposite charge
117  process.electronMatch.checkCharge = False
118  process.electronMatch.maxDeltaR = cms.double(0.2)
119  process.electronMatch.maxDPtRel = cms.double(999999.)
120  process.muonMatch.checkCharge = False
121  process.muonMatch.maxDeltaR = cms.double(0.2)
122  process.muonMatch.maxDPtRel = cms.double(999999.)
123  #process.tauMatch.checkCharge = False
124  #process.tauMatch.maxDeltaR = cms.double(0.3)
125  process.patJetPartonMatch.maxDeltaR = cms.double(0.25)
126  process.patJetPartonMatch.maxDPtRel = cms.double(999999.)
127  process.patJetGenJetMatch.maxDeltaR = cms.double(0.25)
128  process.patJetGenJetMatch.maxDPtRel = cms.double(999999.)
129  if extMatch:
130  process.electronMatch.mcStatus = cms.vint32(1,5)
131  process.electronMatch.matched = "mergedTruth"
132  process.muonMatch.mcStatus = cms.vint32(1,5)
133  process.muonMatch.matched = "mergedTruth"
134  process.patJetPartonMatch.matched = "mergedTruth"
135  process.patJetPartons.src = "mergedTruth"
136  process.photonMatch.matched = "mergedTruth"
137  #process.tauGenJets.GenParticles = "mergedTruth"
138  #process.tauMatch.matched = "mergedTruth"
139 
140 
141  #-- Taus ----------------------------------------------------------------------
142  #some tau discriminators have been switched off during development. They can be switched on again...
143  #setattr(process.patTaus.tauIDSources, "trackIsolation", cms.InputTag("shrinkingConePFTauDiscriminationByTrackIsolation"))
144  #setattr(process.patTaus.tauIDSources, "ecalIsolation", cms.InputTag("shrinkingConePFTauDiscriminationByECALIsolation"))
145  #setattr(process.patTaus.tauIDSources, "byIsolation", cms.InputTag("shrinkingConePFTauDiscriminationByIsolation"))
146  #setattr(process.patTaus.tauIDSources, "leadingPionPtCut", cms.InputTag("shrinkingConePFTauDiscriminationByLeadingPionPtCut"))
147  #setattr(process.patTaus.tauIDSources, "trackIsolationUsingLeadingPion", cms.InputTag("shrinkingConePFTauDiscriminationByTrackIsolationUsingLeadingPion"))
148  #setattr(process.patTaus.tauIDSources, "ecalIsolationUsingLeadingPion", cms.InputTag("shrinkingConePFTauDiscriminationByECALIsolationUsingLeadingPion"))
149  #setattr(process.patTaus.tauIDSources, "byIsolationUsingLeadingPion", cms.InputTag("shrinkingConePFTauDiscriminationByIsolationUsingLeadingPion"))
150  #setattr(process.patTaus.tauIDSources, "byTaNC", cms.InputTag("shrinkingConePFTauDiscriminationByTaNC"))
151  #setattr(process.patTaus.tauIDSources, "byTaNCfrOnePercent", cms.InputTag("shrinkingConePFTauDiscriminationByTaNCfrOnePercent"))
152  #setattr(process.patTaus.tauIDSources, "byTaNCfrHalfPercent", cms.InputTag("shrinkingConePFTauDiscriminationByTaNCfrHalfPercent"))
153  #setattr(process.patTaus.tauIDSources, "byTaNCfrQuarterPercent", cms.InputTag("shrinkingConePFTauDiscriminationByTaNCfrQuarterPercent"))
154  #setattr(process.patTaus.tauIDSources, "byTaNCfrTenthPercent", cms.InputTag("shrinkingConePFTauDiscriminationByTaNCfrTenthPercent"))
155 
156 
157  #-- Jet corrections -----------------------------------------------------------
158  # L1 FastJet jet corrections
159  # kt6PFJets for FastJet corrections are already run and placed before jetCorrection calculation
160  # apply FastJet corrections only if demanded
161  # TODO: Check if still necessary to switch here
162  if ("L1FastJet" in jetMetCorrections):
163  process.pfJets.doAreaFastjet = True
164  process.pfJetsPF.doAreaFastjet = True
def usePFIso
Definition: pfTools.py:89
def SUSY_pattuple_cff.loadPATTriggers (   process,
  HLTMenu,
  theJetNames,
  electronMatches,
  muonMatches,
  tauMatches,
  jetMatches,
  photonMatches 
)

Definition at line 342 of file SUSY_pattuple_cff.py.

References clone(), trigTools.switchOnTrigger, and trigTools.switchOnTriggerMatchEmbedding.

343 def loadPATTriggers(process,HLTMenu,theJetNames,electronMatches,muonMatches,tauMatches,jetMatches,photonMatches):
344  #-- Trigger matching ----------------------------------------------------------
345  def pfSwitchOnTriggerMatchEmbedding(process, matches, src, embedder, sequence='patDefaultSequencePF'):
346  setattr(process,src.replace('PF','TriggerMatchPF'),getattr(process,embedder).clone(src=src, matches=matches))
347  theSequence = getattr(process,sequence)
348  theSequence += getattr(process,src.replace('PF','TriggerMatchPF'))
349  from PhysicsTools.PatAlgos.tools.trigTools import switchOnTrigger, switchOnTriggerMatchEmbedding
350  switchOnTrigger(process, triggerProducer='patTrigger', triggerEventProducer='patTriggerEvent', sequence='patDefaultSequence', hltProcess=HLTMenu)
351  process.patTriggerPF = process.patTrigger.clone()
352  process.patTriggerEventPF = process.patTriggerEvent.clone()
353  process.patDefaultSequencePF += process.patTriggerPF
354  process.patDefaultSequencePF += process.patTriggerEventPF
355  switchOnTrigger(process, triggerProducer='patTriggerPF', triggerEventProducer='patTriggerEventPF', sequence='patDefaultSequencePF', hltProcess=HLTMenu)
356  #Electrons
357  from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanElectronTriggerMatchHLTEle20SWL1R
358  process.patElectronMatch = cleanElectronTriggerMatchHLTEle20SWL1R.clone(matchedCuts = cms.string( electronMatches ))
359  process.patElectronMatchPF = cleanElectronTriggerMatchHLTEle20SWL1R.clone(matchedCuts = cms.string( electronMatches ), src='selectedPatElectronsPF')
360  process.patDefaultSequencePF += process.patElectronMatchPF
361  switchOnTriggerMatchEmbedding( process, ['patElectronMatch'], hltProcess=HLTMenu)
362  pfSwitchOnTriggerMatchEmbedding( process, ['patElectronMatchPF'], 'selectedPatElectronsPF', 'cleanPatElectronsTriggerMatch' )
363  #Muons
364  from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanMuonTriggerMatchHLTMu9
365  process.patMuonMatch = cleanMuonTriggerMatchHLTMu9.clone(matchedCuts = cms.string( muonMatches ))
366  process.patMuonMatchPF = cleanMuonTriggerMatchHLTMu9.clone(matchedCuts = cms.string( muonMatches ),src = 'selectedPatMuonsPF',matched='patTriggerPF')
367  process.patDefaultSequencePF += process.patMuonMatchPF
368  switchOnTriggerMatchEmbedding( process, ['patMuonMatch'], hltProcess=HLTMenu)
369  pfSwitchOnTriggerMatchEmbedding( process, ['patMuonMatchPF'], 'selectedPatMuonsPF', 'cleanPatMuonsTriggerMatch' )
370  #Photons
371  from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanPhotonTriggerMatchHLTPhoton20CleanedL1R
372  process.patPhotonMatch = cleanPhotonTriggerMatchHLTPhoton20CleanedL1R.clone(matchedCuts = cms.string( photonMatches ))
373  switchOnTriggerMatchEmbedding( process, ['patPhotonMatch'], hltProcess=HLTMenu)
374  #Jets
375  from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanJetTriggerMatchHLTJet15U
376  process.patJetMatchAK5Calo = cleanJetTriggerMatchHLTJet15U.clone(matchedCuts = cms.string( jetMatches ),src='cleanPatJetsAK5Calo')
377  switchOnTriggerMatchEmbedding( process, ['patJetMatchAK5Calo'], hltProcess=HLTMenu)
378  for jetType in theJetNames:
379  setattr(process,'patJetMatch'+jetType,cleanJetTriggerMatchHLTJet15U.clone(matchedCuts = cms.string( jetMatches ),src = 'cleanPatJets'+jetType))
380  process.patJetMatchPF = cleanJetTriggerMatchHLTJet15U.clone(src='selectedPatJetsPF', matchedCuts = cms.string( jetMatches ))
381  process.patDefaultSequencePF += process.patJetMatchPF
382  for jetType in theJetNames:
383  switchOnTriggerMatchEmbedding( process, ['patJetMatch'+jetType], hltProcess=HLTMenu)
384  pfSwitchOnTriggerMatchEmbedding( process, ['patJetMatchPF'], 'selectedPatJetsPF', 'cleanPatJetsAK5CaloTriggerMatch' )
385  #Taus
386  from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi import cleanTauTriggerMatchHLTDoubleLooseIsoTau15
387  process.patTauMatch = cleanTauTriggerMatchHLTDoubleLooseIsoTau15.clone(matchedCuts = cms.string( tauMatches ))
388  process.patTauMatchPF = cleanTauTriggerMatchHLTDoubleLooseIsoTau15.clone(src='selectedPatTausPF', matchedCuts = cms.string( tauMatches ))
389  process.patDefaultSequencePF += process.patTauMatchPF
390  switchOnTriggerMatchEmbedding( process, ['patTauMatch'], hltProcess=HLTMenu)
391  pfSwitchOnTriggerMatchEmbedding( process, ['patTauMatchPF'], 'selectedPatTausPF', 'cleanPatTausTriggerMatch' )
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple switchOnTriggerMatchEmbedding
Definition: trigTools.py:720
tuple switchOnTrigger
Definition: trigTools.py:197
def SUSY_pattuple_cff.loadPF2PAT (   process,
  mcInfo,
  jetMetCorrections,
  extMatch,
  doSusyTopProjection,
  doType1MetCorrection,
  doType0MetCorrection,
  postfix 
)

Definition at line 165 of file SUSY_pattuple_cff.py.

References pfTools.usePF2PAT().

Referenced by addDefaultSUSYPAT().

166 def loadPF2PAT(process,mcInfo,jetMetCorrections,extMatch,doSusyTopProjection,doType1MetCorrection,doType0MetCorrection,postfix):
167  #-- PAT standard config -------------------------------------------------------
168  process.load("PhysicsTools.PatAlgos.patSequences_cff")
169  #-- Jet corrections -----------------------------------------------------------
170  process.patJetCorrFactors.levels = jetMetCorrections
171  #-- PF2PAT config -------------------------------------------------------------
172  from PhysicsTools.PatAlgos.tools.pfTools import usePF2PAT
173  usePF2PAT(process,runPF2PAT=True,
174  jetAlgo = 'AK5',
175  runOnMC = (mcInfo==1),
176  postfix = postfix,
177  jetCorrections = ('AK5PFchs', jetMetCorrections),
178  typeIMetCorrections = doType1MetCorrection)
179 
180  if doType0MetCorrection:
181  getattr(process,'patType1CorrectedPFMet'+postfix).srcType1Corrections = cms.VInputTag(
182  cms.InputTag("patPFJetMETtype1p2Corr"+postfix,"type1"),
183  cms.InputTag("patPFMETtype0Corr"+postfix)
184  )
185 
186 
187  #process.patJetsPF.embedGenJetMatch = False
188  #process.patJetsPF.embedPFCandidates = False
189  #drop tracks
190  process.patElectronsPF.embedTrack = True
191  process.patMuonsPF.embedTrack = True
192  process.electronMatchPF.maxDeltaR = cms.double(0.2)
193  process.electronMatchPF.maxDPtRel = cms.double(999999.)
194  process.electronMatchPF.checkCharge = False
195  process.muonMatchPF.maxDeltaR = cms.double(0.2)
196  process.muonMatchPF.maxDPtRel = cms.double(999999.)
197  process.muonMatchPF.checkCharge = False
198  if extMatch:
199  process.electronMatchPF.mcStatus = cms.vint32(1,5)
200  process.electronMatchPF.matched = "mergedTruth"
201  process.muonMatchPF.mcStatus = cms.vint32(1,5)
202  process.muonMatchPF.matched = "mergedTruth"
203  process.genParticlesForJets.src = "mergedTruth"
204  process.genParticlesForJetsNoMuNoNu.src = "mergedTruth"
205  process.genParticlesForJetsNoNu.src = "mergedTruth"
206  process.patJetPartonMatchPF.matched = "mergedTruth"
207  process.patJetPartonsPF.src = "mergedTruth"
208  process.photonMatchPF.matched = "mergedTruth"
209  #process.tauGenJetsPF.GenParticles = "mergedTruth"
210  #process.tauMatchPF.matched = "mergedTruth"
211 
212  #Remove jet pt cut
213  #process.pfJetsPF.ptMin = 0.
214  #include tau decay mode in pat::Taus (elese it will just be uninitialized)
215  #process.patTausPF.addDecayMode = True
216  #process.patTausPF.decayModeSrc = "shrinkingConePFTauDecayModeProducerPF"
217 
218  #Set isolation cone to 0.3 for PF leptons
219  # TODO: fix this for electrons and muons
220  #process.pfElectrons.isolationValueMapsCharged = cms.VInputTag(cms.InputTag("elPFIsoValueCharged03PFId"))
221  #process.pfElectrons.deltaBetaIsolationValueMap = cms.InputTag("elPFIsoValuePU03PFId")
222  #process.pfElectrons.isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("elPFIsoValueNeutral03PFId"), cms.InputTag("elPFIsoValueGamma03PFId"))
223  #process.pfIsolatedElectrons.isolationValueMapsCharged = cms.VInputTag(cms.InputTag("elPFIsoValueCharged03PFId"))
224  #process.pfIsolatedElectrons.deltaBetaIsolationValueMap = cms.InputTag("elPFIsoValuePU03PFId")
225  #process.pfIsolatedElectrons.isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("elPFIsoValueNeutral03PFId"), cms.InputTag("elPFIsoValueGamma03PFId"))
226 
227  #process.pfElectronsPF.isolationValueMapsCharged = cms.VInputTag(cms.InputTag("elPFIsoValueCharged03PFIdPF"))
228  #process.pfElectronsPF.deltaBetaIsolationValueMap = cms.InputTag("elPFIsoValuePU03PFIdPF")
229  #process.pfElectronsPF.isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("elPFIsoValueNeutral03PFIdPF"), cms.InputTag("elPFIsoValueGamma03PFIdPF"))
230  #process.pfIsolatedElectronsPF.isolationValueMapsCharged = cms.VInputTag(cms.InputTag("elPFIsoValueCharged03PFIdPF"))
231  #process.pfIsolatedElectronsPF.deltaBetaIsolationValueMap = cms.InputTag("elPFIsoValuePU03PFIdPF")
232  #process.pfIsolatedElectronsPF.isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("elPFIsoValueNeutral03PFIdPF"), cms.InputTag("elPFIsoValueGamma03PFIdPF"))
233 
234  #process.pfMuons.isolationValueMapsCharged = cms.VInputTag(cms.InputTag("muPFIsoValueCharged03mu03"))
235  #process.pfMuons.deltaBetaIsolationValueMap = cms.InputTag("muPFIsoValuePU03")
236  #process.pfMuons.isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("muPFIsoValueNeutral03"), cms.InputTag("muPFIsoValueGamma03"))
237  #process.pfIsolatedMuons.isolationValueMapsCharged = cms.VInputTag(cms.InputTag("muPFIsoValueCharged03mu03"))
238  #process.pfIsolatedMuons.deltaBetaIsolationValueMap = cms.InputTag("muPFIsoValuePU03")
239  #process.pfIsolatedMuons.isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("muPFIsoValueNeutral03"), cms.InputTag("muPFIsoValueGamma03"))
240 
241  #process.pfMuonsPF.isolationValueMapsCharged = cms.VInputTag(cms.InputTag("muPFIsoValueCharged03mu03PF"))
242  #process.pfMuonsPF.deltaBetaIsolationValueMap = cms.InputTag("muPFIsoValuePU03PF")
243  #process.pfMuonsPF.isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("muPFIsoValueNeutral03PF"), cms.InputTag("muPFIsoValueGamma03PF"))
244  #process.pfIsolatedMuonsPF.isolationValueMapsCharged = cms.VInputTag(cms.InputTag("muPFIsoValueCharged03mu03PF"))
245  #process.pfIsolatedMuonsPF.deltaBetaIsolationValueMap = cms.InputTag("muPFIsoValuePU03PF")
246  #process.pfIsolatedMuonsPF.isolationValueMapsNeutral = cms.VInputTag(cms.InputTag("muPFIsoValueNeutral03PF"), cms.InputTag("muPFIsoValueGamma03PF"))
247 
248  #-- Enable pileup sequence -------------------------------------------------------------
249  #Vertices
250  process.goodVertices = cms.EDFilter("VertexSelector",
251  src = cms.InputTag("offlinePrimaryVertices"),
252  cut = cms.string("!isFake && ndof > 4 && abs(z) <= 24 && position.Rho <= 2"),
253  filter = cms.bool(False),
254  )
255 
256  process.pfPileUpPF.Vertices = "goodVertices"
257  process.pfPileUpPF.Enable = True
258 
259  process.pfNoPileUpSequencePF.replace(process.pfPileUpPF,
260  process.goodVertices + process.pfPileUpPF)
261 
262  if not doSusyTopProjection:
263  return
264  #-- Top projection selection -----------------------------------------------------------
265  #Electrons
266  #relax all selectors *before* pat-lepton creation
267  process.pfElectronsFromVertexPF.dzCut = 9999.0
268  process.pfElectronsFromVertexPF.d0Cut = 9999.0
269  process.pfSelectedElectronsPF.cut = ""
270  process.pfRelaxedElectronsPF = process.pfIsolatedElectronsPF.clone(isolationCut = 3.)
271  process.pfIsolatedElectronsPF.isolationCut = 0.15
272 
273  process.pfElectronsFromGoodVertex = cms.EDFilter(
274  "IPCutPFCandidateSelector",
275  src = cms.InputTag("pfIsolatedElectronsPF"), # PFCandidate source
276  vertices = cms.InputTag("goodVertices"), # vertices source
277  d0Cut = cms.double(0.04), # transverse IP
278  dzCut = cms.double(1.), # longitudinal IP
279  d0SigCut = cms.double(99.), # transverse IP significance
280  dzSigCut = cms.double(99.), # longitudinal IP significance
281  )
282 
283  electronSelection = "abs( eta ) < 2.5 & pt > 5"
284  electronSelection += " & mva_e_pi > 0.4" # same as patElectron::mva()
285  #electronSelection += " & (isEB & (sigmaIetaIeta < 0.024 & hadronicOverEm < 0.15) | isEE & (sigmaIetaIeta < 0.040 & hadronicOverEm < 0.10))" #caloIdVL
286  #electronSelection += " & (isEB & (deltaPhiSuperClusterTrackAtVtx < 0.15 & deltaEtaSuperClusterTrackAtVtx < 0.01) | isEE & (deltaPhiSuperClusterTrackAtVtx < 0.10 & deltaEtaSuperClusterTrackAtVtx < 0.01))" #trkIdVL
287  electronSelection += " & gsfTrackRef().isNonnull() & gsfTrackRef().trackerExpectedHitsInner().numberOfHits() <= 0"
288  process.pfUnclusteredElectronsPF = cms.EDFilter( "GenericPFCandidateSelector",
289  src = cms.InputTag("pfElectronsFromGoodVertex"), #pfSelectedElectronsPF
290  cut = cms.string(electronSelection)
291  )
292  process.pfElectronSequencePF.replace(process.pfIsolatedElectronsPF,
293  process.pfIsolatedElectronsPF +
294  process.goodVertices * process.pfElectronsFromGoodVertex +
295  process.pfUnclusteredElectronsPF + process.pfRelaxedElectronsPF)
296  process.patElectronsPF.pfElectronSource = "pfRelaxedElectronsPF"
297  process.pfNoElectronPF.topCollection = "pfUnclusteredElectronsPF"
298  #Muons
299  #relaxe built-in preselection
300  process.pfMuonsFromVertexPF.dzCut = 9999.0
301  process.pfMuonsFromVertexPF.d0Cut = 9999.0
302  process.pfSelectedMuonsPF.cut = ""
303  process.pfRelaxedMuonsPF = process.pfIsolatedMuonsPF.clone(isolationCut = 3)
304  process.pfIsolatedMuonsPF.isolationCut = 0.15
305 
306  process.pfMuonsFromGoodVertex = cms.EDFilter(
307  "IPCutPFCandidateSelector",
308  src = cms.InputTag("pfIsolatedMuonsPF"), # PFCandidate source
309  vertices = cms.InputTag("goodVertices"), # vertices source
310  d0Cut = cms.double(0.02), # transverse IP
311  dzCut = cms.double(1.), # longitudinal IP
312  d0SigCut = cms.double(99.), # transverse IP significance
313  dzSigCut = cms.double(99.), # longitudinal IP significance
314  )
315  muonSelection = "abs( eta ) < 2.5 & pt > 5"
316  #GlobalMuonPromptTight
317  muonSelection += " & muonRef().isNonnull & muonRef().isGlobalMuon()"
318  muonSelection += " & muonRef().isTrackerMuon() & muonRef().numberOfMatches > 1"
319  muonSelection += " & muonRef().globalTrack().normalizedChi2() < 10"
320  muonSelection += " & muonRef().track().numberOfValidHits() > 10"
321  muonSelection += " & muonRef().globalTrack().hitPattern().numberOfValidMuonHits() > 0"
322  muonSelection += " & muonRef().innerTrack().hitPattern().numberOfValidPixelHits() > 0"
323  process.pfUnclusteredMuonsPF = cms.EDFilter( "GenericPFCandidateSelector",
324  src = cms.InputTag("pfMuonsFromGoodVertex"), #pfSelectedMuonsPF
325  cut = cms.string(muonSelection)
326  )
327  process.pfMuonSequencePF.replace(process.pfIsolatedMuonsPF,
328  process.pfIsolatedMuonsPF +
329  process.goodVertices * process.pfMuonsFromGoodVertex +
330  process.pfUnclusteredMuonsPF + process.pfRelaxedMuonsPF)
331  process.patMuonsPF.pfMuonSource = "pfRelaxedMuonsPF"
332  process.pfNoMuonPF.topCollection = "pfUnclusteredMuonsPF"
333  #Taus
334  # TODO: Fix taus in 52X
335  #process.pfTausPF.discriminators = cms.VPSet()
336  #process.pfUnclusteredTausPF = process.pfTausPF.clone(
337  # cut = cms.string("pt < 0")
338  #)
339  #process.pfTauSequencePF.replace(process.pfTausPF, process.pfTausPF+ process.pfUnclusteredTausPF)
340  #process.pfNoTauPF.topCollection = "pfUnclusteredTausPF"
341 
def usePF2PAT
Definition: pfTools.py:535
def SUSY_pattuple_cff.loadSusyValidation (   process)

Definition at line 527 of file SUSY_pattuple_cff.py.

Referenced by addDefaultSUSYPAT().

528 def loadSusyValidation(process):
529  process.load("JetMETCorrections.Configuration.JetCorrectionProducers_cff")
530  process.load("DQM.Physics.susyValidation_cfi")
531  process.load("DQMServices.Components.MEtoEDMConverter_cfi")
532  process.load("DQMServices.Core.DQM_cfg")
533  process.load("DQMServices.Components.DQMEnvironment_cfi")
534  process.DQMStore = cms.Service("DQMStore")
535  process.DQMStore.collateHistograms = cms.untracked.bool(True)
536  process.options = cms.untracked.PSet(
537  fileMode = cms.untracked.string('NOMERGE')
538  )
def SUSY_pattuple_cff.loadType1METSequence (   process)

Definition at line 392 of file SUSY_pattuple_cff.py.

393 def loadType1METSequence(process):
394  process.load("JetMETCorrections.Type1MET.pfMETCorrections_cff")
395  ## Type 0?
396  # process.pfType1CorrectedMet.srcCHSSums = cms.VInputTag(cms.InputTag("pfchsMETcorr","type0"))
397  # process.pfType1CorrectedMet.applyType2Corrections = cms.bool(False)
398  # process.pfType1CorrectedMet.type0Rsoft = cms.double(0.6)
399  # process.pfType1CorrectedMet.applyType0Corrections = cms.bool(True)
400  process.Type1METSequence = cms.Sequence(process.producePFMETCorrections)
401 
def SUSY_pattuple_cff.removeMCDependence (   process)

Definition at line 522 of file SUSY_pattuple_cff.py.

Referenced by addDefaultSUSYPAT().

523 def removeMCDependence( process ):
524  #-- Remove MC dependence ------------------------------------------------------
525  from PhysicsTools.PatAlgos.tools.coreTools import removeMCMatching
526  removeMCMatching(process, ['All'])