Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:26

0001 from __future__ import print_function
0002 # This customise file provides an example (in the form of holes in
0003 # BPix L1-L2 and L3-L3) on how to select a subset of generalTracks
0004 # (e.g. by phi and eta) and setup various MTV instances for those
0005 # (selected tracks, built tracks, and seeds in this case). The naming
0006 # of DQM folders is consistent with an example in trackingCompare.py
0007 import FWCore.ParameterSet.Config as cms
0008 
0009 def customiseMTVForBPix123Holes(process):
0010     from Validation.RecoTrack.cutsRecoTracks_cfi import cutsRecoTracks as _cutsRecoTracks
0011     import math
0012     _minPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.minPhi.value()
0013     _maxPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.maxPhi.value()
0014     _nPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.nintPhi.value()
0015     _binPhi = (_maxPhi - _minPhi) / _nPhi
0016     process.generalTracksL1L2 = _cutsRecoTracks.clone(
0017         minLayer = 0,
0018         quality = [],
0019         minRapidity = -1.0, # also eta < -1 is affected, but let's start with this
0020         minPhi=_minPhi+_binPhi*14, maxPhi=_minPhi+_binPhi*19) # ~0.7 .. ~0.2
0021     process.generalTracksL2L3 = process.generalTracksL1L2.clone(
0022         minRapidity = -0.9, maxRapidity = 2,
0023         minPhi=_minPhi+_binPhi*33, maxPhi=_minPhi+_binPhi + 2*math.pi) # ~2.6 .. ~3.3
0024     
0025     print("L1L2 %f %f" % (process.generalTracksL1L2.minPhi.value(), process.generalTracksL1L2.maxPhi.value()))
0026     print("L2L3 %f %f" % (process.generalTracksL2L3.minPhi.value(), process.generalTracksL2L3.maxPhi.value()))
0027     
0028     from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector
0029     process.trackingParticlesL1L2 = _trackingParticleRefSelector.clone(
0030         signalOnly = False,
0031         chargedOnly = False,
0032         tip = 1e5,
0033         lip = 1e5,
0034         minRapidity = process.generalTracksL1L2.minRapidity.value(),
0035         maxRapidity = process.generalTracksL1L2.maxRapidity.value(),
0036         ptMin = 0,
0037         minPhi = process.generalTracksL1L2.minPhi.value(),
0038         maxPhi = process.generalTracksL1L2.maxPhi.value(),
0039     )
0040     process.trackingParticlesL2L3 = process.trackingParticlesL1L2.clone(
0041         minRapidity = process.generalTracksL2L3.minRapidity.value(),
0042         maxRapidity = process.generalTracksL2L3.maxRapidity.value(),
0043         minPhi = process.generalTracksL2L3.minPhi.value(),
0044         maxPhi = process.generalTracksL2L3.maxPhi.value(),
0045     )
0046     process.tracksPreValidationTrackingOnly += (
0047         process.trackingParticlesL1L2 +
0048         process.trackingParticlesL2L3 +
0049         process.generalTracksL1L2 +
0050         process.generalTracksL2L3
0051     )
0052 
0053     process.trackValidatorTrackingOnlyL1L2 = process.trackValidatorTrackingOnly.clone(
0054         dirName = process.trackValidatorTrackingOnly.dirName.value().replace("Track/", "TrackL1L2/"),
0055         label_tp_effic = "trackingParticlesL1L2",
0056         label_tp_effic_refvector = True,
0057         label = ["generalTracksL1L2"],
0058     )
0059     process.trackValidatorTrackingOnlyL2L3 = process.trackValidatorTrackingOnlyL1L2.clone(
0060         dirName = process.trackValidatorTrackingOnlyL1L2.dirName.value().replace("L1L2", "L2L3"),
0061         label_tp_effic = "trackingParticlesL2L3",
0062         label = ["generalTracksL2L3"],
0063     )
0064     process.trackValidatorsTrackingOnly += (
0065         process.trackValidatorTrackingOnlyL1L2 +
0066         process.trackValidatorTrackingOnlyL2L3
0067     )
0068     for trkColl in process.trackValidatorTrackingOnly.label:
0069         if "ByAlgoMask" in trkColl: continue
0070         if "Pt09" in trkColl and not trkColl in ["generalTracksPt09", "cutsRecoTracksPt09Hp"]: continue
0071         if trkColl != "generalTracks":
0072             selL1L2 = getattr(process, trkColl).clone(src="generalTracksL1L2")
0073             selL2L3 = getattr(process, trkColl).clone(src="generalTracksL2L3")
0074             if "Pt09" in trkColl:
0075                 selL1L2Name = trkColl.replace("Pt09", "Pt09L1L2")
0076                 selL2L3Name = trkColl.replace("Pt09", "Pt09L2L3")
0077             else:
0078                 selL1L2Name = trkColl.replace("cutsRecoTracks", "cutsRecoTracksL1L2")
0079                 selL2L3Name = trkColl.replace("cutsRecoTracks", "cutsRecoTracksL2L3")
0080             setattr(process, selL1L2Name, selL1L2)
0081             setattr(process, selL2L3Name, selL2L3)
0082             process.tracksPreValidationTrackingOnly += (selL1L2+selL2L3)
0083             process.trackValidatorTrackingOnlyL1L2.label.append(selL1L2Name)
0084             process.trackValidatorTrackingOnlyL2L3.label.append(selL2L3Name)
0085             
0086     for midfix in ["Building", "Seeding"]:
0087         label = "trackValidator%sTrackingOnly" % midfix
0088         mtv = getattr(process, label)
0089         mtvL1L2 = mtv.clone(
0090             dirName = mtv.dirName.value()[:-1] + "L1L2/",
0091             label_tp_effic = "trackingParticlesL1L2",
0092             label_tp_effic_refvector = True,
0093             label = [],
0094             mvaLabels = cms.PSet(),
0095             doMVAPlots = False,
0096         )
0097         mtvL2L3 = mtvL1L2.clone(
0098             dirName = mtvL1L2.dirName.value().replace("L1L2", "L2L3"),
0099             label_tp_effic = "trackingParticlesL2L3",
0100         )
0101         setattr(process, label+"L1L2", mtvL1L2)
0102         setattr(process, label+"L2L3", mtvL2L3)
0103         process.trackValidatorsTrackingOnly += (
0104             mtvL1L2 +
0105             mtvL2L3
0106         )
0107         for trkColl in mtv.label:
0108             selL1L2 = process.generalTracksL1L2.clone(src=trkColl)
0109             selL2L3 = process.generalTracksL2L3.clone(src=trkColl)
0110             selL1L2Name = trkColl+"L1L2"
0111             selL2L3Name = trkColl+"L2L3"
0112             setattr(process, selL1L2Name, selL1L2)
0113             setattr(process, selL2L3Name, selL2L3)
0114             process.tracksPreValidationTrackingOnly += (selL1L2+selL2L3)
0115     
0116             mtvL1L2.label.append(selL1L2Name)
0117             mtvL2L3.label.append(selL2L3Name)
0118     
0119     return process