CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
customiseTrackingNtuple Namespace Reference

Functions

def _label
 
def customiseTrackingNtuple
 
def customiseTrackingNtupleHLT
 
def customiseTrackingNtupleMergeIters
 
def customiseTrackingNtupleTool
 
def extendedContent
 

Function Documentation

def customiseTrackingNtuple._label (   tag)
private

Definition at line 3 of file customiseTrackingNtuple.py.

Referenced by customiseTrackingNtupleTool().

3 
4 def _label(tag):
5  if hasattr(tag, "getModuleLabel"):
6  t = tag
7  else:
8  t = cms.InputTag(tag)
9  return t.getModuleLabel()+t.getProductInstanceLabel()
def customiseTrackingNtuple.customiseTrackingNtuple (   process)

Definition at line 91 of file customiseTrackingNtuple.py.

References customiseTrackingNtupleTool().

91 
92 def customiseTrackingNtuple(process):
93  customiseTrackingNtupleTool(process, isRECO = True)
94  return process
def customiseTrackingNtuple.customiseTrackingNtupleHLT (   process)

Definition at line 99 of file customiseTrackingNtuple.py.

References clone(), and customiseTrackingNtupleTool().

99 
100 def customiseTrackingNtupleHLT(process):
101  import Validation.RecoTrack.TrackValidation_cff as _TrackValidation_cff
102  _seedProducers = [
103  "hltIter0PFLowPixelSeedsFromPixelTracks",
104  "hltIter1PFLowPixelSeedsFromPixelTracks",
105  "hltIter2PFlowPixelSeeds",
106  "hltDoubletRecoveryPFlowPixelSeeds"
107  ]
108  _candidatesProducers = [
109  "hltIter0PFlowCkfTrackCandidates",
110  "hltIter1PFlowCkfTrackCandidates",
111  "hltIter2PFlowCkfTrackCandidates",
112  "hltDoubletRecoveryPFlowCkfTrackCandidates"
113  ]
114  (_seedSelectors, _tmpTask) = _TrackValidation_cff._addSeedToTrackProducers(_seedProducers, globals())
115  _seedSelectorsTask = cms.Task()
116  for modName in _seedSelectors:
117  if not hasattr(process, modName):
118  setattr(process,modName, globals()[modName].clone(beamSpot = "hltOnlineBeamSpot"))
119  _seedSelectorsTask.add(getattr(process, modName))
120 
121  customiseTrackingNtupleTool(process, isRECO = False)
122 
123  process.trackingNtupleSequence.insert(0,cms.Sequence(_seedSelectorsTask))
124  if process.hltSiStripRawToClustersFacility.onDemand.value():
125  #make sure that all iter tracking is done before running the ntuple-related modules
126  process.trackingNtupleSequence.insert(0,process.hltMergedTracks)
127 
128  process.trackingNtuple.tracks = "hltMergedTracks"
129  process.trackingNtuple.seedTracks = _seedSelectors
130  process.trackingNtuple.trackCandidates = _candidatesProducers
131  process.trackingNtuple.clusterTPMap = "hltTPClusterProducer"
132  process.trackingNtuple.trackAssociator = "hltTrackAssociatorByHits"
133  process.trackingNtuple.beamSpot = "hltOnlineBeamSpot"
134  process.trackingNtuple.pixelRecHits = "hltSiPixelRecHits"
135  process.trackingNtuple.stripRphiRecHits = "hltSiStripRecHits:rphiRecHit"
136  process.trackingNtuple.stripStereoRecHits = "hltSiStripRecHits:stereoRecHit"
137  process.trackingNtuple.stripMatchedRecHits = "hltSiStripRecHits:matchedRecHit"
138  process.trackingNtuple.vertices = "hltPixelVertices"
139  process.trackingNtuple.TTRHBuilder = "hltESPTTRHBWithTrackAngle"
140  process.trackingNtuple.parametersDefiner = "hltLhcParametersDefinerForTP"
141  process.trackingNtuple.includeMVA = False
142 
143  return process
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def customiseTrackingNtuple.customiseTrackingNtupleMergeIters (   process)

Definition at line 95 of file customiseTrackingNtuple.py.

References customiseTrackingNtupleTool().

95 
97  customiseTrackingNtupleTool(process, isRECO = True, mergeIters = True)
98  return process
def customiseTrackingNtuple.customiseTrackingNtupleTool (   process,
  isRECO = True,
  mergeIters = False 
)

Definition at line 10 of file customiseTrackingNtuple.py.

References _label(), python.rootplot.root2matplotlib.replace(), and makeHLTPrescaleTable.values.

Referenced by customiseTrackingNtuple(), customiseTrackingNtupleHLT(), and customiseTrackingNtupleMergeIters().

10 
11 def customiseTrackingNtupleTool(process, isRECO = True, mergeIters = False):
12  process.load("Validation.RecoTrack.trackingNtuple_cff")
13  process.TFileService = cms.Service("TFileService",
14  fileName = cms.string('trackingNtuple.root')
15  )
16 
17  if process.trackingNtuple.includeSeeds.value():
18  if isRECO:
19  if not hasattr(process, "reconstruction_step"):
20  raise Exception("TrackingNtuple includeSeeds=True needs reconstruction which is missing")
21  else: #assumes HLT with PF iter
22  if not hasattr(process, "HLTIterativeTrackingIter02"):
23  raise Exception("TrackingNtuple includeSeeds=True needs HLTIterativeTrackingIter02 which is missing")
24 
25  # Replace validation_step with ntuplePath
26  if not hasattr(process, "validation_step"):
27  raise Exception("TrackingNtuple customise assumes process.validation_step exists")
28 
29 
30  # Should replay mixing for pileup simhits?
31  usePileupSimHits = hasattr(process, "mix") and hasattr(process.mix, "input") and len(process.mix.input.fileNames) > 0
32 # process.eda = cms.EDAnalyzer("EventContentAnalyzer")
33 
34  if not isRECO:
35  if not hasattr(process,"hltMultiTrackValidation"):
36  process.load("Validation.RecoTrack.HLTmultiTrackValidator_cff")
37  process.trackingNtupleSequence = process.hltMultiTrackValidation.copy()
39  process.hltSiStripRecHits = SiStripRecHitConverter_cfi.siStripMatchedRecHits.clone(
40  ClusterProducer = "hltSiStripRawToClustersFacility",
41  StripCPE = "hltESPStripCPEfromTrackAngle:hltESPStripCPEfromTrackAngle"
42  )
43  process.trackingNtupleSequence.insert(0,process.trackingParticlesIntime+process.simHitTPAssocProducer)
44  process.trackingNtupleSequence.remove(process.hltTrackValidator)
45  process.trackingNtupleSequence += process.hltSiStripRecHits + process.trackingNtuple
46 
47  #combine all *StepTracks (TODO: write one for HLT)
48  if mergeIters and isRECO:
49  process.mergedStepTracks = cms.EDProducer("TrackSimpleMerger",
50  src = cms.VInputTag(m.replace("Seeds", "Tracks").replace("seedTracks", "") for m in process.trackingNtuple.seedTracks)
51  )
52  process.trackingNtupleSequence.insert(0,process.mergedStepTracks)
53  process.trackingNtuple.tracks = "mergedStepTracks"
54 
55  ntuplePath = cms.Path(process.trackingNtupleSequence)
56 
57  if process.trackingNtuple.includeAllHits and process.trackingNtuple.includeTrackingParticles and usePileupSimHits:
58  ntuplePath.insert(0, cms.SequencePlaceholder("mix"))
59 
60  process.load("Validation.RecoTrack.crossingFramePSimHitToPSimHits_cfi")
61  instanceLabels = [_label(tag) for tag in process.simHitTPAssocProducer.simHitSrc]
62  process.crossingFramePSimHitToPSimHits.src = ["mix:"+l for l in instanceLabels]
63  process.simHitTPAssocProducer.simHitSrc = ["crossingFramePSimHitToPSimHits:"+l for l in instanceLabels]
64  process.trackingNtupleSequence.insert(0, process.crossingFramePSimHitToPSimHits)
65 
66  # Bit of a hack but works
67  modifier = cms.Modifier()
68  modifier._setChosen()
69  modifier.toReplaceWith(process.prevalidation_step, ntuplePath)
70  modifier.toReplaceWith(process.validation_step, cms.EndPath())
71 
72  # remove the validation_stepN and prevalidatin_stepN of phase2 validation...
73  for p in [process.paths_(), process.endpaths_()]:
74  for pathName, path in p.items():
75  if "prevalidation_step" in pathName:
76  if len(pathName.replace("prevalidation_step", "")) > 0:
77  modifier.toReplaceWith(path, cms.Path())
78  elif "validation_step" in pathName:
79  if len(pathName.replace("validation_step", "")) > 0:
80  modifier.toReplaceWith(path, cms.EndPath())
81 
82  # Remove all output modules
83  for outputModule in process.outputModules_().values():
84  for path in process.paths_().values():
85  path.remove(outputModule)
86  for path in process.endpaths_().values():
87  path.remove(outputModule)
88 
89 
90  return process
def customiseTrackingNtuple.extendedContent (   process)

Definition at line 144 of file customiseTrackingNtuple.py.

145 def extendedContent(process):
146  process.trackingParticlesIntime.intimeOnly = False
147  process.trackingNtuple.includeOOT = True
148  process.trackingNtuple.keepEleSimHits = True
149 
150  process.trackingNtuple.saveSimHitsP3 = True
151  process.trackingNtuple.addSeedCurvCov = True
152 
153  return process