CMS 3D CMS Logo

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

Functions

def backupJetsFirstStep
 
def backupJetsSecondStep
 
def makeRecoJetCollection
 
def reduceFinalJetCollection
 
def reduceInputJetCollection
 

Function Documentation

def extraJets_MuEGFixMoriond2017.backupJetsFirstStep (   process)
Take snapshots of the sequences before we change the PFCandidates

Definition at line 56 of file extraJets_MuEGFixMoriond2017.py.

References helpers.cloneProcessingSnippet(), and helpers.listDependencyChain().

Referenced by customizeMiniAOD_MuEGFixMoriond2017.customizeAll().

56 
57 def backupJetsFirstStep(process):
58  """Take snapshots of the sequences before we change the PFCandidates"""
59  process.originalAK4JetSequence = listDependencyChain(process, process.slimmedJets, ('particleFlow', 'muons'))
60  backupAK4JetSequence = cloneProcessingSnippet(process, process.originalAK4JetSequence, "Backup")
61  process.originalAK4PuppiJetSequence = listDependencyChain(process, process.slimmedJetsPuppi, ('particleFlow', 'muons'))
62  backupAK4PuppiJetSequence = cloneProcessingSnippet(process, process.originalAK4PuppiJetSequence, "Backup")
63  process.originalAK8JetSequence = listDependencyChain(process, process.slimmedJetsAK8, ('particleFlow', 'muons'))
64  backupAK8JetSequence = cloneProcessingSnippet(process, process.originalAK8JetSequence, "Backup")
65  return { 'AK4':backupAK4JetSequence, 'AK4Puppi':backupAK4PuppiJetSequence, 'AK8':backupAK8JetSequence }
66 
def listDependencyChain
Definition: helpers.py:330
def cloneProcessingSnippet
Definition: helpers.py:315
def extraJets_MuEGFixMoriond2017.backupJetsSecondStep (   process,
  sequences,
  badMuons,
  verbose = False 
)
Deploy the snapshots after the change of PFCandidates

Definition at line 67 of file extraJets_MuEGFixMoriond2017.py.

References helpers.addKeepStatement(), helpers.massSearchReplaceAnyInputTag(), reduceFinalJetCollection(), and reduceInputJetCollection().

Referenced by customizeMiniAOD_MuEGFixMoriond2017.customizeAll().

67 
68 def backupJetsSecondStep(process, sequences, badMuons, verbose=False):
69  """Deploy the snapshots after the change of PFCandidates"""
70  # put back the old input tags
71  for sequence in sequences.itervalues():
72  massSearchReplaceAnyInputTag(sequence, "pfCandidatesBadMuonsCleaned", "particleFlow")
73  massSearchReplaceAnyInputTag(sequence, "muonsCleaned", "muons")
74  # gate the input collections to avoid re-running most of PAT on good events
75  reduceInputJetCollection(process, process.ak4PFJetsCHSBackup, badMuons)
76  reduceInputJetCollection(process, process.ak4PFJetsPuppiBackup, badMuons)
77  # fix names in the valuemaps
78  process.patJetsBackup.userData.userInts.labelPostfixesToStrip = cms.vstring("Backup",)
79  process.patJetsBackup.userData.userFloats.labelPostfixesToStrip = cms.vstring("Backup",)
80  process.patJetsAK8Backup.userData.userFloats.labelPostfixesToStrip = cms.vstring("Backup",)
81  process.patJetsAK8PuppiBackup.userData.userFloats.labelPostfixesToStrip = cms.vstring("Backup",)
82  #
83  # now deal with daughter links
84  # for these we can keep the daughters
85  process.slimmedJetsBackup.mixedDaughters = True
86  process.slimmedJetsBackup.packedPFCandidates = cms.InputTag("oldPFCandToPackedOrDiscarded")
87  process.slimmedJetsAK8PFCHSSoftDropSubjetsBackup.mixedDaughters = True
88  process.slimmedJetsAK8PFCHSSoftDropSubjetsBackup.packedPFCandidates = cms.InputTag("oldPFCandToPackedOrDiscarded")
89  # for these we can't
90  process.slimmedJetsPuppiBackup.dropDaughters = '1'
91  process.slimmedJetsAK8PFPuppiSoftDropSubjetsBackup.dropDaughters = '1'
92  # for these we do even if we wouldn't have done in the standard case, since we couldn't for the subjets
93  process.packedPatJetsAK8Backup.fixDaughters = False
94  process.slimmedJetsAK8Backup.rekeyDaughters = '1'
95  process.slimmedJetsAK8Backup.mixedDaughters = True
96  process.slimmedJetsAK8Backup.packedPFCandidates = cms.InputTag("oldPFCandToPackedOrDiscarded")
97  #
98  reduceFinalJetCollection(process, process.slimmedJetsBackup, badMuons)
99  reduceFinalJetCollection(process, process.slimmedJetsPuppiBackup, badMuons)
100  reduceFinalJetCollection(process, process.slimmedJetsAK8Backup, badMuons)
101  #
102  addKeepStatement(process,
103  "keep *_slimmedJets_*_*",
104  ["keep *_slimmedJetsBackup_*_*"],
105  verbose=verbose)
106  addKeepStatement(process, "keep *_slimmedJetsPuppi_*_*",
107  ["keep *_slimmedJetsPuppiBackup_*_*"],
108  verbose=verbose)
109  addKeepStatement(process,
110  "keep *_slimmedJetsAK8_*_*",
111  ["keep *_slimmedJetsAK8Backup_*_*"],
112  verbose=verbose)
113  addKeepStatement(process,"keep *_slimmedJetsAK8PFCHSSoftDropPacked_SubJets_*",
114  ["keep *_slimmedJetsAK8PFCHSSoftDropPackedBackup_SubJets_*"],
115  verbose=verbose)
116  addKeepStatement(process,"keep *_slimmedJetsAK8PFPuppiSoftDropPacked_SubJets_*",
117  ["keep *_slimmedJetsAK8PFPuppiSoftDropPackedBackup_SubJets_*"],
118  verbose=verbose)
119 
120 
def massSearchReplaceAnyInputTag
Definition: helpers.py:271
def addKeepStatement
Definition: helpers.py:427
def extraJets_MuEGFixMoriond2017.makeRecoJetCollection (   process,
  pfCandCollection,
  coneSize,
  useCHSAlgo,
  postfix 
)

Definition at line 8 of file extraJets_MuEGFixMoriond2017.py.

References clone(), and helpers.cloneProcessingSnippet().

8 
9  postfix):
10 
11  jetColName="ak"+str(int(coneSize*10))+"PFJets"
12  internalPfCandColl=pfCandCollection
13  if useCHSAlgo:
14  setattr( process, "tmpPFCandCollPtr"+postfix,
15  cms.EDProducer("PFCandidateFwdPtrProducer",
16  src = cms.InputTag(pfCandCollection) )
17  )
18  process.load("CommonTools.ParticleFlow.pfNoPileUpJME_cff")
19  cloneProcessingSnippet(process, getattr(process,"pfNoPileUpJMESequence"), postfix )
20  getattr(process, "pfPileUpJME"+postfix).PFCandidates = cms.InputTag("tmpPFCandCollPtr"+postfix)
21  getattr(process, "pfNoPileUpJME"+postfix).bottomCollection = cms.InputTag("tmpPFCandCollPtr"+postfix)
22 
23  internalPfCandColl = "pfNoPileUpJME"+postfix
24  jetColName+="CHS"
25 
26  setattr(process, jetColName+postfix, getattr(process,"ak4PFJets").clone(
27  src = cms.InputTag(internalPfCandColl),
28  rParam=cms.double(coneSize),
29  doAreaFastjet = True)
30  )
31 
32 
def cloneProcessingSnippet
Definition: helpers.py:315
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def extraJets_MuEGFixMoriond2017.reduceFinalJetCollection (   process,
  jetCollection,
  badMuons 
)

Definition at line 44 of file extraJets_MuEGFixMoriond2017.py.

Referenced by backupJetsSecondStep().

44 
45 def reduceFinalJetCollection(process, jetCollection, badMuons):
46  label = jetCollection.label()
47  setattr(process, label+"AllEvents", jetCollection.clone())
48  process.globalReplace(label,
49  cms.EDProducer("PATJetCollectionReducer",
50  writeEmptyCollection = cms.bool(False),
51  jetCollection = cms.InputTag(label+"AllEvents"),
52  triggeringCollections=badMuons,
53  )
54  )
55 
def extraJets_MuEGFixMoriond2017.reduceInputJetCollection (   process,
  jetCollection,
  badMuons 
)

Definition at line 33 of file extraJets_MuEGFixMoriond2017.py.

Referenced by backupJetsSecondStep().

33 
34 def reduceInputJetCollection(process, jetCollection, badMuons):
35  label = jetCollection.label()
36  setattr(process, label+"AllEvents", jetCollection.clone())
37  process.globalReplace(label,
38  cms.EDProducer("PFJetCollectionReducer",
39  writeEmptyCollection = cms.bool(True),
40  jetCollection = cms.InputTag(label+"AllEvents"),
41  triggeringCollections=badMuons,
42  )
43  )