CMS 3D CMS Logo

customiseMTVForBPix123Holes.py
Go to the documentation of this file.
1 # This customise file provides an example (in the form of holes in
2 # BPix L1-L2 and L3-L3) on how to select a subset of generalTracks
3 # (e.g. by phi and eta) and setup various MTV instances for those
4 # (selected tracks, built tracks, and seeds in this case). The naming
5 # of DQM folders is consistent with an example in trackingCompare.py
6 import FWCore.ParameterSet.Config as cms
7 
9  from Validation.RecoTrack.cutsRecoTracks_cfi import cutsRecoTracks as _cutsRecoTracks
10  import math
11  _minPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.minPhi.value()
12  _maxPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.maxPhi.value()
13  _nPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.nintPhi.value()
14  _binPhi = (_maxPhi - _minPhi) / _nPhi
15  process.generalTracksL1L2 = _cutsRecoTracks.clone(
16  minLayer = 0,
17  quality = [],
18  minRapidity = -1.0, # also eta < -1 is affected, but let's start with this
19  minPhi=_minPhi+_binPhi*14, maxPhi=_minPhi+_binPhi*19) # ~0.7 .. ~0.2
20  process.generalTracksL2L3 = process.generalTracksL1L2.clone(
21  minRapidity = -0.9, maxRapidity = 2,
22  minPhi=_minPhi+_binPhi*33, maxPhi=_minPhi+_binPhi + 2*math.pi) # ~2.6 .. ~3.3
23 
24  print "L1L2 %f %f" % (process.generalTracksL1L2.minPhi.value(), process.generalTracksL1L2.maxPhi.value())
25  print "L2L3 %f %f" % (process.generalTracksL2L3.minPhi.value(), process.generalTracksL2L3.maxPhi.value())
26 
27  from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector
28  process.trackingParticlesL1L2 = _trackingParticleRefSelector.clone(
29  signalOnly = False,
30  chargedOnly = False,
31  tip = 1e5,
32  lip = 1e5,
33  minRapidity = process.generalTracksL1L2.minRapidity.value(),
34  maxRapidity = process.generalTracksL1L2.maxRapidity.value(),
35  ptMin = 0,
36  minPhi = process.generalTracksL1L2.minPhi.value(),
37  maxPhi = process.generalTracksL1L2.maxPhi.value(),
38  )
39  process.trackingParticlesL2L3 = process.trackingParticlesL1L2.clone(
40  minRapidity = process.generalTracksL2L3.minRapidity.value(),
41  maxRapidity = process.generalTracksL2L3.maxRapidity.value(),
42  minPhi = process.generalTracksL2L3.minPhi.value(),
43  maxPhi = process.generalTracksL2L3.maxPhi.value(),
44  )
45  process.tracksPreValidationTrackingOnly += (
46  process.trackingParticlesL1L2 +
47  process.trackingParticlesL2L3 +
48  process.generalTracksL1L2 +
49  process.generalTracksL2L3
50  )
51 
52  process.trackValidatorTrackingOnlyL1L2 = process.trackValidatorTrackingOnly.clone(
53  dirName = process.trackValidatorTrackingOnly.dirName.value().replace("Track/", "TrackL1L2/"),
54  label_tp_effic = "trackingParticlesL1L2",
55  label_tp_effic_refvector = True,
56  label = ["generalTracksL1L2"],
57  )
58  process.trackValidatorTrackingOnlyL2L3 = process.trackValidatorTrackingOnlyL1L2.clone(
59  dirName = process.trackValidatorTrackingOnlyL1L2.dirName.value().replace("L1L2", "L2L3"),
60  label_tp_effic = "trackingParticlesL2L3",
61  label = ["generalTracksL2L3"],
62  )
63  process.trackValidatorsTrackingOnly += (
64  process.trackValidatorTrackingOnlyL1L2 +
65  process.trackValidatorTrackingOnlyL2L3
66  )
67  for trkColl in process.trackValidatorTrackingOnly.label:
68  if "ByAlgoMask" in trkColl: continue
69  if "Pt09" in trkColl and not trkColl in ["generalTracksPt09", "cutsRecoTracksPt09Hp"]: continue
70  if trkColl != "generalTracks":
71  selL1L2 = getattr(process, trkColl).clone(src="generalTracksL1L2")
72  selL2L3 = getattr(process, trkColl).clone(src="generalTracksL2L3")
73  if "Pt09" in trkColl:
74  selL1L2Name = trkColl.replace("Pt09", "Pt09L1L2")
75  selL2L3Name = trkColl.replace("Pt09", "Pt09L2L3")
76  else:
77  selL1L2Name = trkColl.replace("cutsRecoTracks", "cutsRecoTracksL1L2")
78  selL2L3Name = trkColl.replace("cutsRecoTracks", "cutsRecoTracksL2L3")
79  setattr(process, selL1L2Name, selL1L2)
80  setattr(process, selL2L3Name, selL2L3)
81  process.tracksPreValidationTrackingOnly += (selL1L2+selL2L3)
82  process.trackValidatorTrackingOnlyL1L2.label.append(selL1L2Name)
83  process.trackValidatorTrackingOnlyL2L3.label.append(selL2L3Name)
84 
85  for midfix in ["Building", "Seeding"]:
86  label = "trackValidator%sTrackingOnly" % midfix
87  mtv = getattr(process, label)
88  mtvL1L2 = mtv.clone(
89  dirName = mtv.dirName.value()[:-1] + "L1L2/",
90  label_tp_effic = "trackingParticlesL1L2",
91  label_tp_effic_refvector = True,
92  label = [],
93  mvaLabels = cms.PSet(),
94  doMVAPlots = False,
95  )
96  mtvL2L3 = mtvL1L2.clone(
97  dirName = mtvL1L2.dirName.value().replace("L1L2", "L2L3"),
98  label_tp_effic = "trackingParticlesL2L3",
99  )
100  setattr(process, label+"L1L2", mtvL1L2)
101  setattr(process, label+"L2L3", mtvL2L3)
102  process.trackValidatorsTrackingOnly += (
103  mtvL1L2 +
104  mtvL2L3
105  )
106  for trkColl in mtv.label:
107  selL1L2 = process.generalTracksL1L2.clone(src=trkColl)
108  selL2L3 = process.generalTracksL2L3.clone(src=trkColl)
109  selL1L2Name = trkColl+"L1L2"
110  selL2L3Name = trkColl+"L2L3"
111  setattr(process, selL1L2Name, selL1L2)
112  setattr(process, selL2L3Name, selL2L3)
113  process.tracksPreValidationTrackingOnly += (selL1L2+selL2L3)
114 
115  mtvL1L2.label.append(selL1L2Name)
116  mtvL2L3.label.append(selL2L3Name)
117 
118  return process
def replace(string, replacements)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135