1 import FWCore.ParameterSet.Config
as cms
4 if hasattr(tag,
"getModuleLabel"):
8 return t.getModuleLabel()+t.getProductInstanceLabel()
11 process.load(
"Validation.RecoTrack.trackingNtuple_cff")
12 process.TFileService = cms.Service(
"TFileService",
13 fileName = cms.string(
'trackingNtuple.root')
16 if process.trackingNtuple.includeSeeds.value():
17 if not hasattr(process,
"reconstruction_step"):
18 raise Exception(
"TrackingNtuple includeSeeds=True needs reconstruction which is missing")
21 for trkCand
in process.trackingNtuple.trackCandidates.value():
22 producer = getattr(process, cms.InputTag(trkCand).getModuleLabel())
23 producer.produceSeedStopReasons =
True 26 if not hasattr(process,
"validation_step"):
27 raise Exception(
"TrackingNtuple customise assumes process.validation_step exists")
31 usePileupSimHits = hasattr(process,
"mix")
and hasattr(process.mix,
"input")
and len(process.mix.input.fileNames) > 0
34 ntuplePath = cms.EndPath(process.trackingNtupleSequence)
35 if process.trackingNtuple.includeAllHits
and usePileupSimHits:
36 ntuplePath.insert(0, cms.SequencePlaceholder(
"mix"))
38 process.load(
"Validation.RecoTrack.crossingFramePSimHitToPSimHits_cfi")
39 instanceLabels = [
_label(tag)
for tag
in process.simHitTPAssocProducer.simHitSrc]
40 process.crossingFramePSimHitToPSimHits.src = [
"mix:"+l
for l
in instanceLabels]
41 process.simHitTPAssocProducer.simHitSrc = [
"crossingFramePSimHitToPSimHits:"+l
for l
in instanceLabels]
42 process.trackingNtupleSequence.insert(0, process.crossingFramePSimHitToPSimHits)
45 modifier = cms.Modifier()
47 modifier.toReplaceWith(process.validation_step, ntuplePath)
49 if hasattr(process,
"prevalidation_step"):
50 modifier.toReplaceWith(process.prevalidation_step, cms.Path())
53 for p
in [process.paths_(), process.endpaths_()]:
54 for pathName, path
in p.iteritems():
55 if "prevalidation_step" in pathName:
56 if len(pathName.replace(
"prevalidation_step",
"")) > 0:
57 modifier.toReplaceWith(path, cms.Path())
58 elif "validation_step" in pathName:
59 if len(pathName.replace(
"validation_step",
"")) > 0:
60 modifier.toReplaceWith(path, cms.EndPath())
63 for outputModule
in process.outputModules_().itervalues():
64 for path
in process.paths_().itervalues():
65 path.remove(outputModule)
66 for path
in process.endpaths_().itervalues():
67 path.remove(outputModule)
def customiseTrackingNtuple(process)