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():
18 if not hasattr(process,
"reconstruction_step"):
19 raise Exception(
"TrackingNtuple includeSeeds=True needs reconstruction which is missing")
21 if not hasattr(process,
"HLTIterativeTrackingIter02"):
22 raise Exception(
"TrackingNtuple includeSeeds=True needs HLTIterativeTrackingIter02 which is missing")
25 if not hasattr(process,
"validation_step"):
26 raise Exception(
"TrackingNtuple customise assumes process.validation_step exists")
30 usePileupSimHits = hasattr(process,
"mix")
and hasattr(process.mix,
"input")
and len(process.mix.input.fileNames) > 0
34 if not hasattr(process,
"hltMultiTrackValidation"):
35 process.load(
"Validation.RecoTrack.HLTmultiTrackValidator_cff")
36 process.trackingNtupleSequence = process.hltMultiTrackValidation.copy()
38 process.hltSiStripRecHits = SiStripRecHitConverter_cfi.siStripMatchedRecHits.clone(
39 ClusterProducer =
"hltSiStripRawToClustersFacility",
40 StripCPE =
"hltESPStripCPEfromTrackAngle:hltESPStripCPEfromTrackAngle" 42 process.trackingNtupleSequence.insert(0,process.trackingParticlesIntime+process.simHitTPAssocProducer)
43 process.trackingNtupleSequence.remove(process.hltTrackValidator)
44 process.trackingNtupleSequence += process.hltSiStripRecHits + process.trackingNtuple
47 if mergeIters
and isRECO:
49 process.mergedStepTracks = _mod.TrackCollectionMerger.clone(
50 trackProducers = cms.VInputTag(m.replace(
"Seeds",
"Tracks").
replace(
"seedTracks",
"")
for m
in process.trackingNtuple.seedTracks),
51 inputClassifiers = cms.vstring(m.replace(
"StepSeeds",
"Step").
replace(
"seedTracks",
"").
replace(
"dSeeds",
"dTracks")
52 .
replace(
"InOut",
"InOutClassifier").
replace(
"tIn",
"tInClassifier")
53 for m
in process.trackingNtuple.seedTracks),
57 process.trackingNtupleSequence.insert(0,process.mergedStepTracks)
58 process.trackingNtuple.tracks =
"mergedStepTracks" 59 process.trackingNtuple.includeMVA =
True 60 process.trackingNtuple.trackMVAs = [
"mergedStepTracks"]
62 ntuplePath = cms.Path(process.trackingNtupleSequence)
64 if process.trackingNtuple.includeAllHits
and process.trackingNtuple.includeTrackingParticles
and usePileupSimHits:
65 ntuplePath.insert(0, cms.SequencePlaceholder(
"mix"))
67 process.load(
"Validation.RecoTrack.crossingFramePSimHitToPSimHits_cfi")
68 instanceLabels = [
_label(tag)
for tag
in process.simHitTPAssocProducer.simHitSrc]
69 process.crossingFramePSimHitToPSimHits.src = [
"mix:"+l
for l
in instanceLabels]
70 process.simHitTPAssocProducer.simHitSrc = [
"crossingFramePSimHitToPSimHits:"+l
for l
in instanceLabels]
71 process.trackingNtupleSequence.insert(0, process.crossingFramePSimHitToPSimHits)
74 modifier = cms.Modifier()
76 modifier.toReplaceWith(process.prevalidation_step, ntuplePath)
77 modifier.toReplaceWith(process.validation_step, cms.EndPath())
80 for p
in [process.paths_(), process.endpaths_()]:
81 for pathName, path
in p.items():
82 if "prevalidation_step" in pathName:
83 if len(pathName.replace(
"prevalidation_step",
"")) > 0:
84 modifier.toReplaceWith(path, cms.Path())
85 elif "validation_step" in pathName:
86 if len(pathName.replace(
"validation_step",
"")) > 0:
87 modifier.toReplaceWith(path, cms.EndPath())
90 for outputModule
in process.outputModules_().
values():
91 for path
in process.paths_().
values():
92 path.remove(outputModule)
93 for path
in process.endpaths_().
values():
94 path.remove(outputModule)
def replace(string, replacements)
def customiseTrackingNtupleTool(process, isRECO=True, mergeIters=False)