) from JetMETCorrections.Configuration.JetCorrectors_cff import * import CommonTools.RecoAlgos.jetTracksAssociationToTrackRefs_cfi as jetTracksAssociationToTrackRefs_cfi cutsRecoTracksAK4PFJets = jetTracksAssociationToTrackRefs_cfi.jetTracksAssociationToTrackRefs.clone( association = "ak4JetTracksAssociatorExplicitAll", jets = "ak4PFJets", correctedPtMin = 10, ) ## Select signal TrackingParticles, and do the corresponding associations trackingParticlesSignal = _trackingParticleRefSelector.clone( signalOnly = True, chargedOnly = False, tip = 1e5, lip = 1e5, minRapidity = -10, maxRapidity = 10, ptMin = 0, ) # select tracks with pT > 0.9 GeV (for upgrade fake rates) generalTracksPt09 = cutsRecoTracks_cfi.cutsRecoTracks.clone(ptMin=0.9) # and then the selectors _sequenceForEachEra(_addSelectorsBySrc, modDict=globals(), args=[["_generalTracksHp"]], plainArgs=["Pt09", "generalTracksPt09"], names="_selectorsPt09", sequence="_tracksValidationSelectorsPt09", modifySequence=lambda seq:seq.insert(0, generalTracksPt09)) # select tracks from the PV
import FWCore.ParameterSet.Config as cms from Validation.RecoEgamma.tpSelection_cfi import * from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import * import SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi trackAssociatorByHitsForConversionValidation = SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi.quickTrackAssociatorByHits.clone() trackAssociatorByHitsForConversionValidation.SimToRecoDenominator = 'reco' trackAssociatorByHitsForConversionValidation.Quality_SimToReco = 0.5 trackAssociatorByHitsForConversionValidation.Purity_SimToReco = 0.5 trackAssociatorByHitsForConversionValidation.Cut_RecoToSim = 0.5 from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector tpSelecForEfficiency = _trackingParticleRefSelector.clone() tpSelecForEfficiency.chargedOnly = True # trackingParticleSelector.pdgId = cms.vint32() tpSelecForEfficiency.tip = 120 tpSelecForEfficiency.lip = 280 tpSelecForEfficiency.signalOnly = False tpSelecForEfficiency.minRapidity = -2.5 tpSelecForEfficiency.ptMin = 0.3 tpSelecForEfficiency.maxRapidity = 2.5 tpSelecForEfficiency.minHit = 0 tpSelecForFakeRate = _trackingParticleRefSelector.clone() tpSelecForFakeRate.chargedOnly = True # trackingParticleSelector.pdgId = cms.vint32() tpSelecForFakeRate.tip = 120 tpSelecForFakeRate.lip = 280 tpSelecForFakeRate.signalOnly = False tpSelecForFakeRate.minRapidity = -2.5
#'file:/opt/sbg/data/safe1/cms/jandrea/ForDouja/8A1B91E4-479A-E711-87F4-0CC47AC08BC8.root' 'file:/opt/sbg/data/safe1/cms/jandrea/TrackingSeedDefinition/10024.0_TTbar_13+TTbar_13TeV_TuneCUETP8M1_2017_GenSimFull+DigiFull_2017+RecoFull_2017+ALCAFull_2017+HARVESTFull_2017/step3.root' )) process.TFileService = cms.Service("TFileService", fileName=cms.string("trackingNTuple1.root")) process.load( "SimTracker.TrackAssociation.trackingParticleRecoTrackAsssociation_cfi") from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector process.trackingParticlesIntime = _trackingParticleRefSelector.clone( signalOnly=False, intimeOnly=False, chargedOnly=True, tip=1e5, lip=1e5, minRapidity=-2.4, maxRapidity=2.4, ptMin=1, ) process.load("SimGeneral.MixingModule.mixNoPU_cfi") process.load("SimGeneral.MixingModule.trackingTruthProducerSelection_cfi") process.trackingParticles.simHitCollections = cms.PSet() ############## CHANGED THIS BECAUSE ERROR MESSAGE ABOUT MIXING process.mix.playback = cms.untracked.bool(False) process.mix.digitizers = cms.PSet( mergedtruth=cms.PSet(process.trackingParticles)) for a in process.aliases: delattr(process, a)
import FWCore.ParameterSet.Config as cms from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector cutsTPFake = _trackingParticleRefSelector.clone( ptMin = 0.1, minRapidity = -3.0, maxRapidity = 3.0, tip = 120, lip = 250, signalOnly = False )
jets="ak4PFJets") from JetMETCorrections.Configuration.JetCorrectors_cff import * import CommonTools.RecoAlgos.jetTracksAssociationToTrackRefs_cfi as jetTracksAssociationToTrackRefs_cfi cutsRecoTracksAK4PFJets = jetTracksAssociationToTrackRefs_cfi.jetTracksAssociationToTrackRefs.clone( association="ak4JetTracksAssociatorExplicitAll", jets="ak4PFJets", correctedPtMin=10, ) ## Select signal TrackingParticles, and do the corresponding associations trackingParticlesSignal = _trackingParticleRefSelector.clone( signalOnly=True, chargedOnly=False, tip=1e5, lip=1e5, minRapidity=-10, maxRapidity=10, ptMin=0, ) # select tracks with pT > 0.9 GeV (for upgrade fake rates) generalTracksPt09 = cutsRecoTracks_cfi.cutsRecoTracks.clone(ptMin=0.9) # and then the selectors _taskForEachEra(_addSelectorsBySrc, modDict=globals(), args=[["_generalTracksHp"]], plainArgs=["Pt09", "generalTracksPt09"], names="_selectorsPt09", task="_tracksValidationSelectorsPt09", modifyTask=lambda task: task.add(generalTracksPt09))
def customiseMTVForBPix123Holes(process): from Validation.RecoTrack.cutsRecoTracks_cfi import cutsRecoTracks as _cutsRecoTracks import math _minPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.minPhi.value() _maxPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.maxPhi.value() _nPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.nintPhi.value() _binPhi = (_maxPhi - _minPhi) / _nPhi process.generalTracksL1L2 = _cutsRecoTracks.clone( minLayer = 0, quality = [], minRapidity = -1.0, # also eta < -1 is affected, but let's start with this minPhi=_minPhi+_binPhi*14, maxPhi=_minPhi+_binPhi*19) # ~0.7 .. ~0.2 process.generalTracksL2L3 = process.generalTracksL1L2.clone( minRapidity = -0.9, maxRapidity = 2, minPhi=_minPhi+_binPhi*33, maxPhi=_minPhi+_binPhi + 2*math.pi) # ~2.6 .. ~3.3 print("L1L2 %f %f" % (process.generalTracksL1L2.minPhi.value(), process.generalTracksL1L2.maxPhi.value())) print("L2L3 %f %f" % (process.generalTracksL2L3.minPhi.value(), process.generalTracksL2L3.maxPhi.value())) from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector process.trackingParticlesL1L2 = _trackingParticleRefSelector.clone( signalOnly = False, chargedOnly = False, tip = 1e5, lip = 1e5, minRapidity = process.generalTracksL1L2.minRapidity.value(), maxRapidity = process.generalTracksL1L2.maxRapidity.value(), ptMin = 0, minPhi = process.generalTracksL1L2.minPhi.value(), maxPhi = process.generalTracksL1L2.maxPhi.value(), ) process.trackingParticlesL2L3 = process.trackingParticlesL1L2.clone( minRapidity = process.generalTracksL2L3.minRapidity.value(), maxRapidity = process.generalTracksL2L3.maxRapidity.value(), minPhi = process.generalTracksL2L3.minPhi.value(), maxPhi = process.generalTracksL2L3.maxPhi.value(), ) process.tracksPreValidationTrackingOnly += ( process.trackingParticlesL1L2 + process.trackingParticlesL2L3 + process.generalTracksL1L2 + process.generalTracksL2L3 ) process.trackValidatorTrackingOnlyL1L2 = process.trackValidatorTrackingOnly.clone( dirName = process.trackValidatorTrackingOnly.dirName.value().replace("Track/", "TrackL1L2/"), label_tp_effic = "trackingParticlesL1L2", label_tp_effic_refvector = True, label = ["generalTracksL1L2"], ) process.trackValidatorTrackingOnlyL2L3 = process.trackValidatorTrackingOnlyL1L2.clone( dirName = process.trackValidatorTrackingOnlyL1L2.dirName.value().replace("L1L2", "L2L3"), label_tp_effic = "trackingParticlesL2L3", label = ["generalTracksL2L3"], ) process.trackValidatorsTrackingOnly += ( process.trackValidatorTrackingOnlyL1L2 + process.trackValidatorTrackingOnlyL2L3 ) for trkColl in process.trackValidatorTrackingOnly.label: if "ByAlgoMask" in trkColl: continue if "Pt09" in trkColl and not trkColl in ["generalTracksPt09", "cutsRecoTracksPt09Hp"]: continue if trkColl != "generalTracks": selL1L2 = getattr(process, trkColl).clone(src="generalTracksL1L2") selL2L3 = getattr(process, trkColl).clone(src="generalTracksL2L3") if "Pt09" in trkColl: selL1L2Name = trkColl.replace("Pt09", "Pt09L1L2") selL2L3Name = trkColl.replace("Pt09", "Pt09L2L3") else: selL1L2Name = trkColl.replace("cutsRecoTracks", "cutsRecoTracksL1L2") selL2L3Name = trkColl.replace("cutsRecoTracks", "cutsRecoTracksL2L3") setattr(process, selL1L2Name, selL1L2) setattr(process, selL2L3Name, selL2L3) process.tracksPreValidationTrackingOnly += (selL1L2+selL2L3) process.trackValidatorTrackingOnlyL1L2.label.append(selL1L2Name) process.trackValidatorTrackingOnlyL2L3.label.append(selL2L3Name) for midfix in ["Building", "Seeding"]: label = "trackValidator%sTrackingOnly" % midfix mtv = getattr(process, label) mtvL1L2 = mtv.clone( dirName = mtv.dirName.value()[:-1] + "L1L2/", label_tp_effic = "trackingParticlesL1L2", label_tp_effic_refvector = True, label = [], mvaLabels = cms.PSet(), doMVAPlots = False, ) mtvL2L3 = mtvL1L2.clone( dirName = mtvL1L2.dirName.value().replace("L1L2", "L2L3"), label_tp_effic = "trackingParticlesL2L3", ) setattr(process, label+"L1L2", mtvL1L2) setattr(process, label+"L2L3", mtvL2L3) process.trackValidatorsTrackingOnly += ( mtvL1L2 + mtvL2L3 ) for trkColl in mtv.label: selL1L2 = process.generalTracksL1L2.clone(src=trkColl) selL2L3 = process.generalTracksL2L3.clone(src=trkColl) selL1L2Name = trkColl+"L1L2" selL2L3Name = trkColl+"L2L3" setattr(process, selL1L2Name, selL1L2) setattr(process, selL2L3Name, selL2L3) process.tracksPreValidationTrackingOnly += (selL1L2+selL2L3) mtvL1L2.label.append(selL1L2Name) mtvL2L3.label.append(selL2L3Name) return process
from Validation.RecoTrack.TrackValidation_cff import * from SimGeneral.TrackingAnalysis.trackingParticleNumberOfLayersProducer_cff import * import Validation.RecoTrack.TrackValidation_cff as _TrackValidation_cff _includeHits = True #_includeHits = False _includeSeeds = True #_includeSeeds = False from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector trackingParticlesIntime = _trackingParticleRefSelector.clone( signalOnly=False, intimeOnly=True, chargedOnly=False, tip=1e5, lip=1e5, minRapidity=-10, maxRapidity=10, ptMin=0, ) trackingNtuple.trackingParticles = "trackingParticlesIntime" trackingNtuple.trackingParticlesRef = True trackingNtuple.includeAllHits = _includeHits trackingNtuple.includeSeeds = _includeSeeds def _filterForNtuple(lst): ret = [] for item in lst: if "PreSplitting" in item: continue
import FWCore.ParameterSet.Config as cms from Validation.RecoEgamma.tpSelection_cfi import * from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import * import SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi trackAssociatorByHitsForConversionValidation = SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi.quickTrackAssociatorByHits.clone( ) trackAssociatorByHitsForConversionValidation.SimToRecoDenominator = 'reco' trackAssociatorByHitsForConversionValidation.Quality_SimToReco = 0.5 trackAssociatorByHitsForConversionValidation.Purity_SimToReco = 0.5 trackAssociatorByHitsForConversionValidation.Cut_RecoToSim = 0.5 from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector tpSelecForEfficiency = _trackingParticleRefSelector.clone() tpSelecForEfficiency.chargedOnly = True # trackingParticleSelector.pdgId = cms.vint32() tpSelecForEfficiency.tip = 120 tpSelecForEfficiency.lip = 280 tpSelecForEfficiency.signalOnly = False tpSelecForEfficiency.minRapidity = -2.5 tpSelecForEfficiency.ptMin = 0.3 tpSelecForEfficiency.maxRapidity = 2.5 tpSelecForEfficiency.minHit = 0 tpSelecForFakeRate = _trackingParticleRefSelector.clone() tpSelecForFakeRate.chargedOnly = True # trackingParticleSelector.pdgId = cms.vint32() tpSelecForFakeRate.tip = 120 tpSelecForFakeRate.lip = 280 tpSelecForFakeRate.signalOnly = False tpSelecForFakeRate.minRapidity = -2.5
from Validation.RecoTrack.TrackValidation_cff import * from SimGeneral.TrackingAnalysis.trackingParticleNumberOfLayersProducer_cff import * import Validation.RecoTrack.TrackValidation_cff as _TrackValidation_cff _includeHits = True #_includeHits = False _includeSeeds = True #_includeSeeds = False from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector trackingParticlesIntime = _trackingParticleRefSelector.clone( signalOnly = False, intimeOnly = True, chargedOnly = False, tip = 1e5, lip = 1e5, minRapidity = -10, maxRapidity = 10, ptMin = 0, ) trackingNtuple.trackingParticles = "trackingParticlesIntime" trackingNtuple.trackingParticlesRef = True trackingNtuple.includeAllHits = _includeHits trackingNtuple.includeSeeds = _includeSeeds def _filterForNtuple(lst): ret = [] for item in lst: if "PreSplitting" in item: continue if "SeedsA" in item and item.replace("SeedsA", "SeedsB") in lst:
jets="ak4PFJets") from JetMETCorrections.Configuration.JetCorrectors_cff import * import JetMETCorrections.JetCorrector.jetTracksAssociationToTrackRefs_cfi as jetTracksAssociationToTrackRefs_cfi cutsRecoTracksAK4PFJets = jetTracksAssociationToTrackRefs_cfi.jetTracksAssociationToTrackRefs.clone( association="ak4JetTracksAssociatorExplicitAll", jets="ak4PFJets", correctedPtMin=10, ) ## Select signal TrackingParticles, and do the corresponding associations trackingParticlesSignal = _trackingParticleRefSelector.clone( signalOnly=True, chargedOnly=False, tip=1e5, lip=1e5, minRapidity=-10, maxRapidity=10, ptMin=0, ) # select tracks with pT > 0.9 GeV (for upgrade fake rates) generalTracksPt09 = cutsRecoTracks_cfi.cutsRecoTracks.clone(ptMin=0.9) # and then the selectors _taskForEachEra(_addSelectorsBySrc, modDict=globals(), args=[["_generalTracksHp"]], plainArgs=["Pt09", "generalTracksPt09"], names="_selectorsPt09", task="_tracksValidationSelectorsPt09", modifyTask=lambda task: task.add(generalTracksPt09))
import FWCore.ParameterSet.Config as cms from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector cutsTPFake = _trackingParticleRefSelector.clone(ptMin=0.1, minRapidity=-3.0, maxRapidity=3.0, tip=120, lip=250, signalOnly=False)
def customiseMTVForBPix123Holes(process): from Validation.RecoTrack.cutsRecoTracks_cfi import cutsRecoTracks as _cutsRecoTracks import math _minPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.minPhi.value() _maxPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.maxPhi.value() _nPhi = process.trackValidatorTrackingOnly.histoProducerAlgoBlock.nintPhi.value() _binPhi = (_maxPhi - _minPhi) / _nPhi process.generalTracksL1L2 = _cutsRecoTracks.clone( minLayer = 0, quality = [], minRapidity = -1.0, # also eta < -1 is affected, but let's start with this minPhi=_minPhi+_binPhi*14, maxPhi=_minPhi+_binPhi*19) # ~0.7 .. ~0.2 process.generalTracksL2L3 = process.generalTracksL1L2.clone( minRapidity = -0.9, maxRapidity = 2, minPhi=_minPhi+_binPhi*33, maxPhi=_minPhi+_binPhi + 2*math.pi) # ~2.6 .. ~3.3 print "L1L2 %f %f" % (process.generalTracksL1L2.minPhi.value(), process.generalTracksL1L2.maxPhi.value()) print "L2L3 %f %f" % (process.generalTracksL2L3.minPhi.value(), process.generalTracksL2L3.maxPhi.value()) from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector process.trackingParticlesL1L2 = _trackingParticleRefSelector.clone( signalOnly = False, chargedOnly = False, tip = 1e5, lip = 1e5, minRapidity = process.generalTracksL1L2.minRapidity.value(), maxRapidity = process.generalTracksL1L2.maxRapidity.value(), ptMin = 0, minPhi = process.generalTracksL1L2.minPhi.value(), maxPhi = process.generalTracksL1L2.maxPhi.value(), ) process.trackingParticlesL2L3 = process.trackingParticlesL1L2.clone( minRapidity = process.generalTracksL2L3.minRapidity.value(), maxRapidity = process.generalTracksL2L3.maxRapidity.value(), minPhi = process.generalTracksL2L3.minPhi.value(), maxPhi = process.generalTracksL2L3.maxPhi.value(), ) process.tracksPreValidationTrackingOnly += ( process.trackingParticlesL1L2 + process.trackingParticlesL2L3 + process.generalTracksL1L2 + process.generalTracksL2L3 ) process.trackValidatorTrackingOnlyL1L2 = process.trackValidatorTrackingOnly.clone( dirName = process.trackValidatorTrackingOnly.dirName.value().replace("Track/", "TrackL1L2/"), label_tp_effic = "trackingParticlesL1L2", label_tp_effic_refvector = True, label = ["generalTracksL1L2"], ) process.trackValidatorTrackingOnlyL2L3 = process.trackValidatorTrackingOnlyL1L2.clone( dirName = process.trackValidatorTrackingOnlyL1L2.dirName.value().replace("L1L2", "L2L3"), label_tp_effic = "trackingParticlesL2L3", label = ["generalTracksL2L3"], ) process.trackValidatorsTrackingOnly += ( process.trackValidatorTrackingOnlyL1L2 + process.trackValidatorTrackingOnlyL2L3 ) for trkColl in process.trackValidatorTrackingOnly.label: if "ByAlgoMask" in trkColl: continue if "Pt09" in trkColl and not trkColl in ["generalTracksPt09", "cutsRecoTracksPt09Hp"]: continue if trkColl != "generalTracks": selL1L2 = getattr(process, trkColl).clone(src="generalTracksL1L2") selL2L3 = getattr(process, trkColl).clone(src="generalTracksL2L3") if "Pt09" in trkColl: selL1L2Name = trkColl.replace("Pt09", "Pt09L1L2") selL2L3Name = trkColl.replace("Pt09", "Pt09L2L3") else: selL1L2Name = trkColl.replace("cutsRecoTracks", "cutsRecoTracksL1L2") selL2L3Name = trkColl.replace("cutsRecoTracks", "cutsRecoTracksL2L3") setattr(process, selL1L2Name, selL1L2) setattr(process, selL2L3Name, selL2L3) process.tracksPreValidationTrackingOnly += (selL1L2+selL2L3) process.trackValidatorTrackingOnlyL1L2.label.append(selL1L2Name) process.trackValidatorTrackingOnlyL2L3.label.append(selL2L3Name) for midfix in ["Building", "Seeding"]: label = "trackValidator%sTrackingOnly" % midfix mtv = getattr(process, label) mtvL1L2 = mtv.clone( dirName = mtv.dirName.value()[:-1] + "L1L2/", label_tp_effic = "trackingParticlesL1L2", label_tp_effic_refvector = True, label = [], mvaLabels = cms.PSet(), doMVAPlots = False, ) mtvL2L3 = mtvL1L2.clone( dirName = mtvL1L2.dirName.value().replace("L1L2", "L2L3"), label_tp_effic = "trackingParticlesL2L3", ) setattr(process, label+"L1L2", mtvL1L2) setattr(process, label+"L2L3", mtvL2L3) process.trackValidatorsTrackingOnly += ( mtvL1L2 + mtvL2L3 ) for trkColl in mtv.label: selL1L2 = process.generalTracksL1L2.clone(src=trkColl) selL2L3 = process.generalTracksL2L3.clone(src=trkColl) selL1L2Name = trkColl+"L1L2" selL2L3Name = trkColl+"L2L3" setattr(process, selL1L2Name, selL1L2) setattr(process, selL2L3Name, selL2L3) process.tracksPreValidationTrackingOnly += (selL1L2+selL2L3) mtvL1L2.label.append(selL1L2Name) mtvL2L3.label.append(selL2L3Name) return process
from SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi import * import SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi trackAssociatorByHitsForConversionValidation = SimTracker.TrackAssociatorProducers.quickTrackAssociatorByHits_cfi.quickTrackAssociatorByHits.clone( ) trackAssociatorByHitsForConversionValidation.SimToRecoDenominator = 'reco' trackAssociatorByHitsForConversionValidation.Quality_SimToReco = 0.5 trackAssociatorByHitsForConversionValidation.Purity_SimToReco = 0.5 trackAssociatorByHitsForConversionValidation.Cut_RecoToSim = 0.5 from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector tpSelecForEfficiency = _trackingParticleRefSelector.clone( chargedOnly=True, # trackingParticleSelector.pdgId = cms.vint32() tip=120, lip=280, signalOnly=False, minRapidity=-2.5, ptMin=0.3, maxRapidity=2.5, minHit=0) tpSelecForFakeRate = _trackingParticleRefSelector.clone( chargedOnly=True, # trackingParticleSelector.pdgId = cms.vint32() tip=120, lip=280, signalOnly=False, minRapidity=-2.5, ptMin=0.0, maxRapidity=2.5, minHit=0)
import FWCore.ParameterSet.Config as cms from CommonTools.RecoAlgos.trackingParticleRefSelector_cfi import trackingParticleRefSelector as _trackingParticleRefSelector cutsTPEffic = _trackingParticleRefSelector.clone()