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 if not hasattr(process,
"validation_step"):
22 raise Exception(
"TrackingNtuple customise assumes process.validation_step exists")
26 usePileupSimHits = hasattr(process,
"mix")
and hasattr(process.mix,
"input")
and len(process.mix.input.fileNames) > 0
29 ntuplePath = cms.EndPath(process.trackingNtupleSequence)
30 if process.trackingNtuple.includeAllHits
and usePileupSimHits:
31 ntuplePath.insert(0, cms.SequencePlaceholder(
"mix"))
33 process.load(
"Validation.RecoTrack.crossingFramePSimHitToPSimHits_cfi")
34 instanceLabels = [
_label(tag)
for tag
in process.simHitTPAssocProducer.simHitSrc]
35 process.crossingFramePSimHitToPSimHits.src = [
"mix:"+l
for l
in instanceLabels]
36 process.simHitTPAssocProducer.simHitSrc = [
"crossingFramePSimHitToPSimHits:"+l
for l
in instanceLabels]
37 process.trackingNtupleSequence.insert(0, process.crossingFramePSimHitToPSimHits)
40 modifier = cms.Modifier()
42 modifier.toReplaceWith(process.validation_step, ntuplePath)
44 if hasattr(process,
"prevalidation_step"):
45 modifier.toReplaceWith(process.prevalidation_step, cms.Path())
48 for p
in [process.paths_(), process.endpaths_()]:
49 for pathName, path
in p.iteritems():
50 if "prevalidation_step" in pathName:
51 if len(pathName.replace(
"prevalidation_step",
"")) > 0:
52 modifier.toReplaceWith(path, cms.Path())
53 elif "validation_step" in pathName:
54 if len(pathName.replace(
"validation_step",
"")) > 0:
55 modifier.toReplaceWith(path, cms.EndPath())
58 for outputModule
in process.outputModules_().itervalues():
59 for path
in process.paths_().itervalues():
60 path.remove(outputModule)
61 for path
in process.endpaths_().itervalues():
62 path.remove(outputModule)
def customiseTrackingNtuple(process)