test
CMS 3D CMS Logo

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

Classes

class  seqVisitorGetModuleNames
 

Functions

def loadIfNecessary
 
def rerunParticleFlow
 
def updateInputTags
 

Function Documentation

def rerunParticleFlow.loadIfNecessary (   process,
  configFile,
  module_or_sequenceName 
)

Definition at line 10 of file rerunParticleFlow.py.

Referenced by rerunParticleFlow().

10 
11 def loadIfNecessary(process, configFile, module_or_sequenceName):
12  if not hasattr(process, module_or_sequenceName):
13  process.load(configFile)
def rerunParticleFlow.rerunParticleFlow (   process,
  inputProcess 
)

Definition at line 68 of file rerunParticleFlow.py.

References loadIfNecessary().

68 
69 def rerunParticleFlow(process, inputProcess):
70 
71  # load event-setup definitions necessary to rerun particle-flow sequence
72  loadIfNecessary(process, "TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAny_cfi", "SteppingHelixPropagatorAny")
73  loadIfNecessary(process, "CalibTracker.SiPixelESProducers.SiPixelTemplateDBObjectESProducer_cfi", "siPixelTemplateDBObjectESProducer")
74  loadIfNecessary(process, "RecoTracker.MeasurementDet.MeasurementTrackerESProducer_cfi", "MeasurementTracker")
75  loadIfNecessary(process, "RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi", "ecalSeverityLevel")
76  loadIfNecessary(process, "RecoEcal.EgammaCoreTools.EcalNextToDeadChannelESProducer_cff", "ecalNextToDeadChannelESProducer")
77  loadIfNecessary(process, "RecoLocalCalo.HcalRecAlgos.hcalRecAlgoESProd_cfi", "hcalRecAlgos")
78 
79  if not hasattr(process, "UpdaterService"):
80  process.UpdaterService = cms.Service("UpdaterService")
81 
82  # load module definitions necessary to rerun particle-flow sequence
83  loadIfNecessary(process, "RecoParticleFlow.PFClusterProducer.particleFlowCluster_cff", "particleFlowCluster")
84  loadIfNecessary(process, "RecoEgamma.EgammaElectronProducers.gsfElectronSequence_cff", "gsfEcalDrivenElectronSequence")
85  loadIfNecessary(process, "RecoParticleFlow.Configuration.RecoParticleFlow_cff", "particleFlowReco")
86  loadIfNecessary(process, "RecoMuon.MuonIsolation.muonPFIsolationValues_cff", "muonPFIsolationSequence")
87 
88  # define complete sequence of all modules necessary to rerun particle-flow algorithm
89  process.rerunParticleFlowSequence = cms.Sequence(
90  process.particleFlowCluster
91  + process.particleFlowTrackWithDisplacedVertex
92  + process.gsfEcalDrivenElectronSequence
93  + process.particleFlowReco
94  + process.particleFlowLinks
95  )
96 
97  # CV: clone sequence and give it a different name so that particle-flow algorithm
98  # can be run using "official" module labels on embedded event later
99  configtools.cloneProcessingSnippet(process, process.rerunParticleFlowSequence, "ForPFMuonCleaning")
100 
101  # CV: run particle-flow algorithm on final RECO muon collection
102  # (rather than running muon reconstruction sequence in steps)
103  process.pfTrackForPFMuonCleaning.MuColl = cms.InputTag('muons')
104  process.particleFlowBlockForPFMuonCleaning.RecMuons = cms.InputTag('muons')
105  process.particleFlowTmpForPFMuonCleaning.muons = cms.InputTag('muons')
106  process.particleFlowForPFMuonCleaning.FillMuonRefs = False
107 
108  # CV: make sure that all particle-flow based isolation is computed wrt. 'particleFlowTmp' collection
109  # (PAT may overwrite configuration parameters to refer to 'particleFlow' instead)
110  configtools.massSearchReplaceAnyInputTag(process.rerunParticleFlowSequenceForPFMuonCleaning, cms.InputTag('particleFlow'), cms.InputTag('particleFlowTmp'))
111 
112  return process.rerunParticleFlowSequenceForPFMuonCleaning
def rerunParticleFlow.updateInputTags (   process,
  object,
  inputProcess 
)

Definition at line 34 of file rerunParticleFlow.py.

References dir, and cmsPerfHarvest.visit().

Referenced by embeddingCustomizeRH.customise().

34 
35 def updateInputTags(process, object, inputProcess):
36  if isinstance(object, cms.InputTag):
37  #print "InputTag: %s" % object
38  keepStatement_regex = r"keep [a-zA-Z0-9*]+_(?P<label>[a-zA-Z0-9*]+)_[a-zA-Z0-9*]+_[a-zA-Z0-9*]+"
39  keepStatement_matcher = re.compile(keepStatement_regex)
40  isStoredInRECO = False
41  for keepStatement in RECOEventContent.outputCommands:
42  keepStatement_match = keepStatement_matcher.match(keepStatement)
43  if keepStatement_match:
44  label = keepStatement_match.group('label')
45  if label == object.getModuleLabel():
46  isStoredInRECO = True
47  isInRerunParticleFlowSequence = False
48  if hasattr(process, "rerunParticleFlowSequenceForPFMuonCleaning"):
49  sequenceVisitor = seqVisitorGetModuleNames()
50  getattr(process, "rerunParticleFlowSequenceForPFMuonCleaning").visit(sequenceVisitor)
51  moduleNames = sequenceVisitor.getModuleNames()
52  for moduleName in moduleNames:
53  if moduleName == object.getModuleLabel():
54  isInRerunParticleFlowSequence = True
55  if isStoredInRECO and not isInRerunParticleFlowSequence:
56  if object.getProcessName() != inputProcess:
57  #print "InputTag: %s --> updating processName = %s" % (object, inputProcess)
58  object.setProcessName(inputProcess)
59  elif isinstance(object, cms.PSet):
60  for attrName in dir(object):
61  attr = getattr(object, attrName)
62  updateInputTags(process, attr, inputProcess)
63  elif isinstance(object, cms.VPSet):
64  for pset in object:
65  for attrName in dir(pset):
66  attr = getattr(pset, attrName)
67  updateInputTags(process, attr, inputProcess)
def visit
Retrieve data from a perf suite output (sub) directory, only examines TimeSize at the moment...
dbl *** dir
Definition: mlp_gen.cc:35