CMS 3D CMS Logo

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