CMS 3D CMS Logo

Functions
extraJets_MuEGFixMoriond2017 Namespace Reference

Functions

def backupJetsFirstStep (process)
 
def backupJetsSecondStep (process, sequences, badMuons, verbose=False)
 
def makeRecoJetCollection (process, pfCandCollection, coneSize, useCHSAlgo, postfix)
 
def reduceFinalJetCollection (process, jetCollection, badMuons)
 
def reduceInputJetCollection (process, jetCollection, badMuons)
 

Function Documentation

def extraJets_MuEGFixMoriond2017.backupJetsFirstStep (   process)

Definition at line 70 of file extraJets_MuEGFixMoriond2017.py.

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

Referenced by customizeMiniAOD_MuEGFixMoriond2017.customizeAll().

70 def backupJetsFirstStep(process):
71 
72  task = getPatAlgosToolsTask(process)
73 
74  """Take snapshots of the sequences before we change the PFCandidates"""
75  process.originalAK4JetTask, process.originalAK4JetSequence = listDependencyChain(process, getattr(process,"slimmedJets"), ('particleFlow', 'muons'))
76  backupAK4JetSequence = cloneProcessingSnippet(process, getattr(process,"originalAK4JetSequence"), "Backup", addToTask = True )
77  process.originalAK4PuppiJetTask, process.originalAK4PuppiJetSequence = listDependencyChain(process,getattr(process,"slimmedJetsPuppi"), ('particleFlow', 'muons'))
78  backupAK4PuppiJetSequence = cloneProcessingSnippet(process, getattr(process,"originalAK4PuppiJetSequence"), "Backup", addToTask = True )
79  process.originalAK8JetTask,process.originalAK8JetSequence = listDependencyChain(process, getattr(process,"slimmedJetsAK8"), ('particleFlow', 'muons'))
80  backupAK8JetSequence = cloneProcessingSnippet(process, getattr(process,"originalAK8JetSequence"), "Backup", addToTask = True )
81 
82  task.add(process.originalAK4JetTask)
83  task.add(process.originalAK4PuppiJetTask)
84  task.add(process.originalAK8JetTask)
85 
86  return { 'AK4':backupAK4JetSequence, 'AK4Puppi':backupAK4PuppiJetSequence, 'AK8':backupAK8JetSequence }
87 
88 
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False)
Definition: helpers.py:251
def listDependencyChain(process, module, sources, verbose=False)
Definition: helpers.py:266
def getPatAlgosToolsTask(process)
Definition: helpers.py:12
def extraJets_MuEGFixMoriond2017.backupJetsSecondStep (   process,
  sequences,
  badMuons,
  verbose = False 
)
Deploy the snapshots after the change of PFCandidates

Definition at line 89 of file extraJets_MuEGFixMoriond2017.py.

References helpers.addKeepStatement(), helpers.getPatAlgosToolsTask(), helpers.listModules(), MassReplace.massSearchReplaceAnyInputTag(), reduceFinalJetCollection(), and reduceInputJetCollection().

Referenced by customizeMiniAOD_MuEGFixMoriond2017.customizeAll().

89 def backupJetsSecondStep(process, sequences, badMuons, verbose=False):
90  """Deploy the snapshots after the change of PFCandidates"""
91 
92  task = getPatAlgosToolsTask(process)
93 
94  # put back the old input tags and copy in task
95  for sequence in sequences.itervalues():
96  massSearchReplaceAnyInputTag(sequence, "pfCandidatesBadMuonsCleaned", "particleFlow")
97  massSearchReplaceAnyInputTag(sequence, "muonsCleaned", "muons")
98  for mod in listModules(sequence):
99  task.add(mod)
100  # gate the input collections to avoid re-running most of PAT on good events
101  reduceInputJetCollection(process, process.ak4PFJetsCHSBackup, badMuons)
102  reduceInputJetCollection(process, process.ak4PFJetsPuppiBackup, badMuons)
103  # fix names in the valuemaps
104  process.patJetsBackup.userData.userInts.labelPostfixesToStrip = cms.vstring("Backup",)
105  process.patJetsBackup.userData.userFloats.labelPostfixesToStrip = cms.vstring("Backup",)
106  process.patJetsAK8Backup.userData.userFloats.labelPostfixesToStrip = cms.vstring("Backup",)
107  process.patJetsAK8PuppiBackup.userData.userFloats.labelPostfixesToStrip = cms.vstring("Backup",)
108  #
109  # now deal with daughter links
110  # for these we can keep the daughters
111  if hasattr(process,"slimmedJetsBackup"):
112  process.slimmedJetsBackup.mixedDaughters = True
113  process.slimmedJetsBackup.packedPFCandidates = cms.InputTag("oldPFCandToPackedOrDiscarded")
114  process.packedPatJetsAK8Backup.fixDaughters = False
115  #for this one the link is broken using oldPFCandToPackedOrDiscarded...
116  #not sure why, but result is the same
117  process.slimmedJetsAK8Backup.rekeyDaughters = '1'
118  process.slimmedJetsAK8Backup.mixedDaughters = False
119  process.slimmedJetsAK8Backup.packedPFCandidates = cms.InputTag("packedPFCandidatesBackup") #oldPFCandToPackedOrDiscarded
120  reduceFinalJetCollection(process, process.slimmedJetsBackup, badMuons)
121 
122  if hasattr(process,"slimmedJetsAK8PFCHSSoftDropSubjetsBackup"):
123  process.slimmedJetsAK8PFCHSSoftDropSubjetsBackup.mixedDaughters = True
124  process.slimmedJetsAK8PFCHSSoftDropSubjetsBackup.packedPFCandidates = cms.InputTag("oldPFCandToPackedOrDiscarded")
125  reduceFinalJetCollection(process, process.slimmedJetsAK8Backup, badMuons)
126  #for this one the link is broken using oldPFCandToPackedOrDiscarded...
127  #not sure why, but result is the same
128  process.slimmedJetsAK8BackupAllEvents.packedPFCandidates = cms.InpuTag("packedPFCandidatesBackup")
129 
130  # for these we can't
131  if hasattr(process,"slimmedJetsPuppiBackup"):
132  process.slimmedJetsPuppiBackup.dropDaughters = '1'
133  process.slimmedJetsAK8PFPuppiSoftDropSubjetsBackup.dropDaughters = '1'
134  reduceFinalJetCollection(process, process.slimmedJetsPuppiBackup, badMuons)
135 
136  #
137  addKeepStatement(process,
138  "keep *_slimmedJets_*_*",
139  ["keep *_slimmedJetsBackup_*_*"],
140  verbose=verbose)
141  addKeepStatement(process, "keep *_slimmedJetsPuppi_*_*",
142  ["keep *_slimmedJetsPuppiBackup_*_*"],
143  verbose=verbose)
144  addKeepStatement(process,
145  "keep *_slimmedJetsAK8_*_*",
146  ["keep *_slimmedJetsAK8Backup_*_*"],
147  verbose=verbose)
148  addKeepStatement(process,"keep *_slimmedJetsAK8PFCHSSoftDropPacked_SubJets_*",
149  ["keep *_slimmedJetsAK8PFCHSSoftDropPackedBackup_SubJets_*"],
150  verbose=verbose)
151  addKeepStatement(process,"keep *_slimmedJetsAK8PFPuppiSoftDropPacked_SubJets_*",
152  ["keep *_slimmedJetsAK8PFPuppiSoftDropPackedBackup_SubJets_*"],
153  verbose=verbose)
154 
155 
156 
def backupJetsSecondStep(process, sequences, badMuons, verbose=False)
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:72
def addKeepStatement(process, oldKeep, newKeeps, verbose=False)
Definition: helpers.py:348
def listModules(sequence)
Definition: helpers.py:201
def reduceFinalJetCollection(process, jetCollection, badMuons)
def reduceInputJetCollection(process, jetCollection, badMuons)
def getPatAlgosToolsTask(process)
Definition: helpers.py:12
def extraJets_MuEGFixMoriond2017.makeRecoJetCollection (   process,
  pfCandCollection,
  coneSize,
  useCHSAlgo,
  postfix 
)

Definition at line 10 of file extraJets_MuEGFixMoriond2017.py.

References helpers.addToProcessAndTask(), clone(), helpers.cloneProcessingSnippet(), helpers.getPatAlgosToolsTask(), createfilelist.int, and harvestTrackValidationPlots.str.

10  postfix):
11 
12  task = getPatAlgosToolsTask(process)
13 
14  jetColName="ak"+str(int(coneSize*10))+"PFJets"
15  internalPfCandColl=pfCandCollection
16  if useCHSAlgo:
17  addToProcessAndTask("tmpPFCandCollPtr"+postfix,
18  cms.EDProducer("PFCandidateFwdPtrProducer",
19  src = cms.InputTag(pfCandCollection) ),
20  process, task )
21  process.load("CommonTools.ParticleFlow.pfNoPileUpJME_cff")
22  task.add(process.pfNoPileUpJMETask)
23  cloneProcessingSnippet(process, getattr(process,"pfNoPileUpJMESequence"), postfix, addToTask = True )
24  getattr(process, "pfPileUpJME"+postfix).PFCandidates = cms.InputTag("tmpPFCandCollPtr"+postfix)
25  getattr(process, "pfNoPileUpJME"+postfix).bottomCollection = cms.InputTag("tmpPFCandCollPtr"+postfix)
26 
27  internalPfCandColl = "pfNoPileUpJME"+postfix
28  jetColName+="CHS"
29 
30  addToProcessAndTask(jetColName+postfix,
31  getattr(process,jetColName).clone(
32  src = cms.InputTag(internalPfCandColl),
33  rParam=cms.double(coneSize),
34  doAreaFastjet = True),
35  process, task )
36 
def cloneProcessingSnippet(process, sequence, postfix, removePostfix="", noClones=[], addToTask=False)
Definition: helpers.py:251
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:27
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def getPatAlgosToolsTask(process)
Definition: helpers.py:12
def extraJets_MuEGFixMoriond2017.reduceFinalJetCollection (   process,
  jetCollection,
  badMuons 
)

Definition at line 53 of file extraJets_MuEGFixMoriond2017.py.

References helpers.addToProcessAndTask(), and helpers.getPatAlgosToolsTask().

Referenced by backupJetsSecondStep().

53 def reduceFinalJetCollection(process, jetCollection, badMuons):
54 
55  task = getPatAlgosToolsTask(process)
56 
57  label = jetCollection.label()
58  addToProcessAndTask(label+"AllEvents",
59  jetCollection.clone(),
60  process, task )
61  process.globalReplace(label,
62  cms.EDProducer("PATJetCollectionReducer",
63  writeEmptyCollection = cms.bool(False),
64  jetCollection = cms.InputTag(label+"AllEvents"),
65  triggeringCollections=badMuons,
66  )
67  )
68 
69 
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:27
def reduceFinalJetCollection(process, jetCollection, badMuons)
def getPatAlgosToolsTask(process)
Definition: helpers.py:12
def extraJets_MuEGFixMoriond2017.reduceInputJetCollection (   process,
  jetCollection,
  badMuons 
)

Definition at line 37 of file extraJets_MuEGFixMoriond2017.py.

References helpers.addToProcessAndTask(), and helpers.getPatAlgosToolsTask().

Referenced by backupJetsSecondStep().

37 def reduceInputJetCollection(process, jetCollection, badMuons):
38 
39  task = getPatAlgosToolsTask(process)
40 
41  label = jetCollection.label()
42  addToProcessAndTask(label+"AllEvents",
43  jetCollection.clone(),
44  process, task )
45  process.globalReplace(label,
46  cms.EDProducer("PFJetCollectionReducer",
47  writeEmptyCollection = cms.bool(True),
48  jetCollection = cms.InputTag(label+"AllEvents"),
49  triggeringCollections=badMuons,
50  )
51  )
52 
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:27
def reduceInputJetCollection(process, jetCollection, badMuons)
def getPatAlgosToolsTask(process)
Definition: helpers.py:12