CMS 3D CMS Logo

trackingNtuple_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
11 
15 import Validation.RecoTrack.TrackValidation_cff as _TrackValidation_cff
16 
17 _includeHits = True
18 #_includeHits = False
19 
20 _includeSeeds = True
21 #_includeSeeds = False
22 
23 _includeMVA = True
24 #_includeMVA = False
25 
26 _includeTrackingParticles = True
27 #_includeTrackingParticles = False
28 
29 from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector
30 trackingParticlesIntime = _trackingParticleRefSelector.clone(
31  signalOnly = False,
32  intimeOnly = True,
33  chargedOnly = False,
34  tip = 1e5,
35  lip = 1e5,
36  minRapidity = -10,
37  maxRapidity = 10,
38  ptMin = 0,
39 )
40 trackingNtuple.trackingParticles = "trackingParticlesIntime"
41 trackingNtuple.trackingParticlesRef = True
42 trackingNtuple.includeAllHits = _includeHits
43 trackingNtuple.includeSeeds = _includeSeeds
44 trackingNtuple.includeMVA = _includeMVA
45 trackingNtuple.includeTrackingParticles = _includeTrackingParticles
46 
48  ret = []
49  for item in lst:
50  if "PreSplitting" in item:
51  continue
52  if "SeedsA" in item and item.replace("SeedsA", "SeedsB") in lst:
53  ret.append(item.replace("SeedsA", "Seeds"))
54  continue
55  if "SeedsB" in item:
56  continue
57  if "SeedsPair" in item and item.replace("SeedsPair", "SeedsTripl") in lst:
58  ret.append(item.replace("SeedsPair", "Seeds"))
59  continue
60  if "SeedsTripl" in item:
61  continue
62  ret.append(item)
63  return ret
64 _seedProducers = _filterForNtuple(_TrackValidation_cff._seedProducers)
65 _seedProducers_trackingPhase1 = _filterForNtuple(_TrackValidation_cff._seedProducers_trackingPhase1)
66 _seedProducers_trackingPhase1QuadProp = _filterForNtuple(_TrackValidation_cff._seedProducers_trackingPhase1QuadProp)
67 _seedProducers_trackingPhase2PU140 = _filterForNtuple(_TrackValidation_cff._seedProducers_trackingPhase2PU140)
68 
69 (_seedSelectors, trackingNtupleSeedSelectors) = _TrackValidation_cff._addSeedToTrackProducers(_seedProducers, globals())
70 (_seedSelectors_trackingPhase1, _trackingNtupleSeedSelectors_trackingPhase1) = _TrackValidation_cff._addSeedToTrackProducers(_seedProducers_trackingPhase1, globals())
71 (_seedSelectors_trackingPhase1QuadProp, _trackingNtupleSeedSelectors_trackingPhase1QuadProp) = _TrackValidation_cff._addSeedToTrackProducers(_seedProducers_trackingPhase1QuadProp, globals())
72 (_seedSelectors_trackingPhase2PU140, _trackingNtupleSeedSelectors_trackingPhase2PU140) = _TrackValidation_cff._addSeedToTrackProducers(_seedProducers_trackingPhase2PU140, globals())
73 from Configuration.Eras.Modifier_trackingPhase1_cff import trackingPhase1
74 from Configuration.Eras.Modifier_trackingPhase1QuadProp_cff import trackingPhase1QuadProp
75 from Configuration.Eras.Modifier_trackingPhase2PU140_cff import trackingPhase2PU140
76 trackingPhase1.toReplaceWith(trackingNtupleSeedSelectors, _trackingNtupleSeedSelectors_trackingPhase1)
77 trackingPhase1QuadProp.toReplaceWith(trackingNtupleSeedSelectors, _trackingNtupleSeedSelectors_trackingPhase1QuadProp)
78 trackingPhase2PU140.toReplaceWith(trackingNtupleSeedSelectors, _trackingNtupleSeedSelectors_trackingPhase2PU140)
79 
80 trackingNtuple.seedTracks = _seedSelectors
81 trackingPhase1.toModify(trackingNtuple, seedTracks = _seedSelectors_trackingPhase1)
82 trackingPhase1QuadProp.toModify(trackingNtuple, seedTracks = _seedSelectors_trackingPhase1)
83 trackingPhase2PU140.toModify(trackingNtuple, seedTracks = _seedSelectors_trackingPhase2PU140)
84 
86  return name.replace("seedTracks", "").replace("Seeds", "TrackCandidates")
87 trackingNtuple.trackCandidates = map(_seedProdToTrackCands, _seedProducers)
88 trackingPhase1.toModify(trackingNtuple, trackCandidates=map(_seedProdToTrackCands, _seedProducers_trackingPhase1))
89 trackingPhase1QuadProp.toModify(trackingNtuple, trackCandidates=map(_seedProdToTrackCands, _seedProducers_trackingPhase1QuadProp))
90 trackingPhase2PU140.toModify(trackingNtuple, trackCandidates=map(_seedProdToTrackCands, _seedProducers_trackingPhase2PU140))
91 
92 trackingNtupleSequence = cms.Sequence()
93 # reproduce hits because they're not stored in RECO
94 if _includeHits:
95  trackingNtupleSequence += (
96  siPixelRecHits +
97  siStripMatchedRecHits
98  )
99  _phase2_trackingNtupleSequence = trackingNtupleSequence.copy()
100  _phase2_trackingNtupleSequence.remove(siStripMatchedRecHits)
101  _phase2_trackingNtupleSequence += (siPhase2RecHits)
102  trackingPhase2PU140.toReplaceWith(trackingNtupleSequence, _phase2_trackingNtupleSequence)
103 
104 if _includeSeeds:
105  trackingNtupleSequence += trackingNtupleSeedSelectors
106 
107 trackingNtupleSequence += (
108  # sim information
109  trackingParticlesIntime +
110  simHitTPAssocProducer +
111  tpClusterProducer +
112  quickTrackAssociatorByHits +
113  trackingParticleNumberOfLayersProducer +
114  # ntuplizer
115  trackingNtuple
116 )
117 
118 trackingPhase2PU140.toModify(trackingNtuple, # FIXME
119  pixelDigiSimLink = cms.untracked.InputTag('simSiPixelDigis', "Pixel"),
120  stripDigiSimLink = cms.untracked.InputTag(''),
121  phase2OTSimLink = cms.untracked.InputTag('simSiPixelDigis', "Tracker")
122 )
def _seedProdToTrackCands(name)
def replace(string, replacements)
Expects test.root in current directory.