1 import FWCore.ParameterSet.Config
as cms
5 if hasattr(tag,
"getModuleLabel"):
9 return t.getModuleLabel()+t.getProductInstanceLabel()
12 process.load(
"Validation.RecoTrack.trackingNtuple_cff")
13 process.TFileService = cms.Service(
"TFileService",
14 fileName = cms.string(
'trackingNtuple.root')
17 if process.trackingNtuple.includeSeeds.value():
18 if not hasattr(process,
"reconstruction_step"):
19 raise Exception(
"TrackingNtuple includeSeeds=True needs reconstruction which is missing")
22 if not hasattr(process,
"validation_step"):
23 raise Exception(
"TrackingNtuple customise assumes process.validation_step exists")
27 usePileupSimHits = hasattr(process,
"mix")
and hasattr(process.mix,
"input")
and len(process.mix.input.fileNames) > 0
30 ntuplePath = cms.Path(process.trackingNtupleSequence)
31 if process.trackingNtuple.includeAllHits
and process.trackingNtuple.includeTrackingParticles
and usePileupSimHits:
32 ntuplePath.insert(0, cms.SequencePlaceholder(
"mix"))
34 process.load(
"Validation.RecoTrack.crossingFramePSimHitToPSimHits_cfi")
35 instanceLabels = [
_label(tag)
for tag
in process.simHitTPAssocProducer.simHitSrc]
36 process.crossingFramePSimHitToPSimHits.src = [
"mix:"+l
for l
in instanceLabels]
37 process.simHitTPAssocProducer.simHitSrc = [
"crossingFramePSimHitToPSimHits:"+l
for l
in instanceLabels]
38 process.trackingNtupleSequence.insert(0, process.crossingFramePSimHitToPSimHits)
41 modifier = cms.Modifier()
43 modifier.toReplaceWith(process.prevalidation_step, ntuplePath)
44 modifier.toReplaceWith(process.validation_step, cms.EndPath())
47 for p
in [process.paths_(), process.endpaths_()]:
48 for pathName, path
in six.iteritems(p):
49 if "prevalidation_step" in pathName:
50 if len(pathName.replace(
"prevalidation_step",
"")) > 0:
51 modifier.toReplaceWith(path, cms.Path())
52 elif "validation_step" in pathName:
53 if len(pathName.replace(
"validation_step",
"")) > 0:
54 modifier.toReplaceWith(path, cms.EndPath())
57 for outputModule
in six.itervalues(process.outputModules_()):
58 for path
in six.itervalues(process.paths_()):
59 path.remove(outputModule)
60 for path
in six.itervalues(process.endpaths_()):
61 path.remove(outputModule)
def customiseTrackingNtuple(process)