From 0bfb3b988b657cd0217a91cffb6f2077bededa47 Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Tue, 12 Dec 2023 13:39:14 +0100 Subject: [PATCH 1/8] Added displacedMuon sequences + small code change (testing) --- .../PostProcessor_RecoMuonValidator_cff.py | 12 +++++++ .../RecoMuon/python/RecoMuonValidator_cff.py | 35 +++++++++++++++++++ .../RecoMuon/python/RecoMuonValidator_cfi.py | 15 +++++++- .../RecoMuon/python/muonValidation_cff.py | 5 +-- Validation/RecoMuon/src/RecoMuonValidator.cc | 31 ++++++++-------- 5 files changed, 78 insertions(+), 20 deletions(-) diff --git a/Validation/RecoMuon/python/PostProcessor_RecoMuonValidator_cff.py b/Validation/RecoMuon/python/PostProcessor_RecoMuonValidator_cff.py index 138278afcdcf7..d67cd3c8d75bd 100644 --- a/Validation/RecoMuon/python/PostProcessor_RecoMuonValidator_cff.py +++ b/Validation/RecoMuon/python/PostProcessor_RecoMuonValidator_cff.py @@ -55,6 +55,15 @@ postProcessorRecoMuonStaPF = postProcessorRecoMuon.clone( subDirs = ["Muons/RecoMuonV/RecoMuon_MuonAssoc_StaPF"] ) +postProcessorRecoDisplacedMuonGlb = postProcessorRecoMuon.clone( + subDirs = ["Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Glb"] +) +postProcessorRecoDisplacedMuonTrk = postProcessorRecoMuon.clone( + subDirs = ["Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Trk"] +) +postProcessorRecoDisplacedMuonSta = postProcessorRecoMuon.clone( + subDirs = ["Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Sta"] +) #not sure about this one, which types are monitored postProcessorRecoMuonComp = DQMEDHarvester( "DQMGenericClient", @@ -93,5 +102,8 @@ * postProcessorRecoMuonGlbPF * postProcessorRecoMuonTrkPF * postProcessorRecoMuonStaPF + * postProcessorRecoDisplacedMuonGlb + * postProcessorRecoDisplacedMuonTrk + * postProcessorRecoDisplacedMuonSta * postProcessorRecoMuonComp * postProcessorRecoMuonCompPF ) diff --git a/Validation/RecoMuon/python/RecoMuonValidator_cff.py b/Validation/RecoMuon/python/RecoMuonValidator_cff.py index 3e7418d905f5a..f93867e86a224 100644 --- a/Validation/RecoMuon/python/RecoMuonValidator_cff.py +++ b/Validation/RecoMuon/python/RecoMuonValidator_cff.py @@ -24,6 +24,16 @@ tpRefVector = True ) recoMuonVMuAssoc_trk.tpSelector.src = ("TPmu") +#displaced tracker +recoDisplacedMuonVMuAssoc_trk = recoDisplacedMuonValidator.clone( + subDir = 'Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Trk', + muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperTrk', + trackType = 'inner', + selection = "isTrackerMuon", + simLabel = ("TPmu"), + tpRefVector = True +) +recoMuonVMuAssoc_trk.tpSelector.src = ("TPmu") #standalone muonAssociatorByHitsNoSimHitsHelperStandalone = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = False, @@ -39,6 +49,16 @@ ) recoMuonVMuAssoc_sta.tpSelector.src = ("TPmu") +#displaced standalone +recoDisplacedMuonVMuAssoc_sta = recoDisplacedMuonValidator.clone( + subDir = 'Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Sta', + muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperStandalone', + trackType = 'outer', + selection = "isStandAloneMuon", + simLabel = ("TPmu"), + tpRefVector = True +) +recoMuonVMuAssoc_sta.tpSelector.src = ("TPmu") #global muonAssociatorByHitsNoSimHitsHelperGlobal = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = True, @@ -53,6 +73,16 @@ tpRefVector = True, ) recoMuonVMuAssoc_glb.tpSelector.src = ("TPmu") +#displaced global +recoDisplacedMuonVMuAssoc_glb = recoDisplacedMuonValidator.clone( + subDir = 'Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Glb', + muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperGlobal', + trackType = 'global', + selection = "isGlobalMuon", + simLabel = ("TPmu"), + tpRefVector = True +) +recoMuonVMuAssoc_sta.tpSelector.src = ("TPmu") #tight muonAssociatorByHitsNoSimHitsHelperTight = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = True, @@ -80,6 +110,11 @@ +muonAssociatorByHitsNoSimHitsHelperGlobal +recoMuonVMuAssoc_glb +muonAssociatorByHitsNoSimHitsHelperTight +recoMuonVMuAssoc_tgt ) +muonValidationRDMV_seq = cms.Sequence( + muonAssociatorByHitsNoSimHitsHelperStandalone +recoDisplacedMuonVMuAssoc_trk + +muonAssociatorByHitsNoSimHitsHelperStandalone +recoDisplacedMuonVMuAssoc_sta + +muonAssociatorByHitsNoSimHitsHelperGlobal +recoDisplacedMuonVMuAssoc_glb + ) # not used # diff --git a/Validation/RecoMuon/python/RecoMuonValidator_cfi.py b/Validation/RecoMuon/python/RecoMuonValidator_cfi.py index 392caeede8d82..7d4a05951cb39 100644 --- a/Validation/RecoMuon/python/RecoMuonValidator_cfi.py +++ b/Validation/RecoMuon/python/RecoMuonValidator_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy -from Validation.RecoMuon.selectors_cff import muonTPSet +from Validation.RecoMuon.selectors_cff import muonTPSet, displacedMuonTPSet from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer recoMuonValidator = DQMEDAnalyzer('RecoMuonValidator', @@ -95,5 +95,18 @@ nTrks = cms.untracked.uint32(50) ) +recoDisplacedMuonValidator = recoMuonValidator.clone( + tpSelector = displacedMuonTPSet, + muonLabel = cms.InputTag("displacedMuons"), + doAssoc = cms.untracked.bool(True), + selection = cms.string(""), + nBinDxy = cms.untracked.uint32(350), + minDxy = cms.untracked.double(-700), + maxDxy = cms.untracked.double(700), + nBinDz = cms.untracked.uint32(350), + minDz = cms.untracked.double(-700), + maxDz = cms.untracked.double(700) +) + from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 premix_stage2.toModify(recoMuonValidator, simLabel = "mixData:MergedTrackTruth") diff --git a/Validation/RecoMuon/python/muonValidation_cff.py b/Validation/RecoMuon/python/muonValidation_cff.py index 70af2fe047f6b..8f9209cc8fb23 100644 --- a/Validation/RecoMuon/python/muonValidation_cff.py +++ b/Validation/RecoMuon/python/muonValidation_cff.py @@ -9,6 +9,7 @@ from Validation.RecoMuon.histoParameters_cff import * from Validation.RecoMuon.RecoMuonValidator_cff import * +#from Validation.RecoMuon.RecoDisplacedMuonValidator_cff import * import Validation.RecoMuon.MuonTrackValidator_cfi MTV = Validation.RecoMuon.MuonTrackValidator_cfi.muonTrackValidator.clone( @@ -314,12 +315,12 @@ # The full offline muon validation sequence # recoMuonValidation = cms.Sequence( TPtrack_seq + TPmu_seq + TPpfmu_seq + - muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq + muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq + muonValidationRDMV_seq ) # optionally omit TABH recoMuonValidation_noTABH = cms.Sequence( TPtrack_seq + TPmu_seq + TPpfmu_seq + - muonValidation_noTABH_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq + muonValidation_noTABH_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq + muonValidationRDMV_seq ) # ... and also displaced muons diff --git a/Validation/RecoMuon/src/RecoMuonValidator.cc b/Validation/RecoMuon/src/RecoMuonValidator.cc index ed473528e2491..5cbc79dc19a7b 100644 --- a/Validation/RecoMuon/src/RecoMuonValidator.cc +++ b/Validation/RecoMuon/src/RecoMuonValidator.cc @@ -962,28 +962,25 @@ void RecoMuonValidator::analyze(const Event& event, const EventSetup& eventSetup TrackRef Track = iMuon->track(); - if (Track.isNonnull()) { - commonME_->hMuonTrackP_->Fill(Track->p()); - commonME_->hMuonTrackPt_->Fill(Track->pt()); - commonME_->hMuonTrackEta_->Fill(Track->eta()); - commonME_->hMuonTrackPhi_->Fill(Track->phi()); - - //ip histograms - commonME_->hMuonTrackDxy_->Fill(Track->dxy()); - commonME_->hMuonTrackDz_->Fill(Track->dz()); - } - - if (iMuon->isGlobalMuon()) { - Track = iMuon->combinedMuon(); - glbNTrackerHits = countTrackerHits(*Track); - glbNMuonHits = countMuonHits(*Track); - } else if (iMuon->isTrackerMuon()) { + if (trackType_ == reco::InnerTk) { Track = iMuon->track(); trkNTrackerHits = countTrackerHits(*Track); - } else { + } else if (trackType_ == reco::OuterTk) { Track = iMuon->standAloneMuon(); + } else if (trackType_ == reco::GlobalTk) { + Track = iMuon->combinedMuon(); + glbNTrackerHits = countTrackerHits(*Track); + glbNMuonHits = countMuonHits(*Track); } + commonME_->hMuonTrackP_->Fill(Track->p()); + commonME_->hMuonTrackPt_->Fill(Track->pt()); + commonME_->hMuonTrackEta_->Fill(Track->eta()); + commonME_->hMuonTrackPhi_->Fill(Track->phi()); + //ip histograms + commonME_->hMuonTrackDxy_->Fill(Track->dxy()); + commonME_->hMuonTrackDz_->Fill(Track->dz()); + NTrackerHits = countTrackerHits(*Track); muonME_->hNTrackerHits_->Fill(NTrackerHits); muonME_->hNTrackerHits_vs_Pt_->Fill(Track->pt(), NTrackerHits); From bbc6958058c1cb1ac08099209f2135ffd1bd70e4 Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Mon, 8 Jan 2024 13:07:13 +0100 Subject: [PATCH 2/8] Add separate script (error) --- .../PostProcessor_RecoMuonValidator_cff.py | 12 - .../python/RecoDisplacedMuonValidator_cff.py | 82 ++ .../python/RecoDisplacedMuonValidator_cfi.py | 99 ++ .../RecoMuon/python/RecoMuonValidator_cff.py | 35 - .../RecoMuon/python/RecoMuonValidator_cfi.py | 15 +- Validation/RecoMuon/python/RelValCustoms.py | 1 + .../RecoMuon/python/muonValidation_cff.py | 8 +- .../src/RecoDisplacedMuonValidator.cc | 1114 +++++++++++++++++ .../RecoMuon/src/RecoDisplacedMuonValidator.h | 133 ++ Validation/RecoMuon/src/RecoMuonValidator.cc | 31 +- Validation/RecoMuon/src/SealModule.cc | 2 + 11 files changed, 1453 insertions(+), 79 deletions(-) create mode 100644 Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py create mode 100644 Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py create mode 100644 Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc create mode 100644 Validation/RecoMuon/src/RecoDisplacedMuonValidator.h diff --git a/Validation/RecoMuon/python/PostProcessor_RecoMuonValidator_cff.py b/Validation/RecoMuon/python/PostProcessor_RecoMuonValidator_cff.py index d67cd3c8d75bd..138278afcdcf7 100644 --- a/Validation/RecoMuon/python/PostProcessor_RecoMuonValidator_cff.py +++ b/Validation/RecoMuon/python/PostProcessor_RecoMuonValidator_cff.py @@ -55,15 +55,6 @@ postProcessorRecoMuonStaPF = postProcessorRecoMuon.clone( subDirs = ["Muons/RecoMuonV/RecoMuon_MuonAssoc_StaPF"] ) -postProcessorRecoDisplacedMuonGlb = postProcessorRecoMuon.clone( - subDirs = ["Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Glb"] -) -postProcessorRecoDisplacedMuonTrk = postProcessorRecoMuon.clone( - subDirs = ["Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Trk"] -) -postProcessorRecoDisplacedMuonSta = postProcessorRecoMuon.clone( - subDirs = ["Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Sta"] -) #not sure about this one, which types are monitored postProcessorRecoMuonComp = DQMEDHarvester( "DQMGenericClient", @@ -102,8 +93,5 @@ * postProcessorRecoMuonGlbPF * postProcessorRecoMuonTrkPF * postProcessorRecoMuonStaPF - * postProcessorRecoDisplacedMuonGlb - * postProcessorRecoDisplacedMuonTrk - * postProcessorRecoDisplacedMuonSta * postProcessorRecoMuonComp * postProcessorRecoMuonCompPF ) diff --git a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py new file mode 100644 index 0000000000000..7007a7fc3319e --- /dev/null +++ b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py @@ -0,0 +1,82 @@ +import FWCore.ParameterSet.Config as cms + +##################################################################################### +# Configurations for RecoDisplacedMuonValidator +# + +from RecoMuon.TrackingTools.MuonServiceProxy_cff import * +from Validation.RecoMuon.RecoDisplacedMuonValidator_cfi import * +# +from SimMuon.MCTruth.muonAssociatorByHitsNoSimHitsHelper_cfi import * +from SimMuon.MCTruth.MuonAssociatorByHits_cfi import muonAssociatorByHitsCommonParameters + +#tracker +muonAssociatorByHitsNoSimHitsHelperTrk = muonAssociatorByHitsNoSimHitsHelper.clone( + UseTracker = True, + UseMuon = False +) +recoDisplacedMuonVMuAssoc_trk = recoDisplacedMuonValidator.clone( + subDir = 'Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Trk', + muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperTrk', + trackType = 'inner', + selection = "isTrackerMuon", + simLabel = ("TPmu"), + tpRefVector = True +) +recoDisplacedMuonVMuAssoc_trk.tpSelector.src = ("TPmu") +#standalone +muonAssociatorByHitsNoSimHitsHelperStandalone = muonAssociatorByHitsNoSimHitsHelper.clone( + UseTracker = False, + UseMuon = True +) +recoDisplacedMuonVMuAssoc_sta = recoDisplacedMuonValidator.clone( + subDir = 'Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Sta', + muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperStandalone', + trackType = 'outer', + selection = "isStandAloneMuon", + simLabel = ("TPmu"), + tpRefVector = True + +) +recoDisplacedMuonVMuAssoc_sta.tpSelector.src = ("TPmu") +#global +muonAssociatorByHitsNoSimHitsHelperGlobal = muonAssociatorByHitsNoSimHitsHelper.clone( + UseTracker = True, + UseMuon = True +) +recoDisplacedMuonVMuAssoc_glb = recoDisplacedMuonValidator.clone( + subDir = 'Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Glb', + muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperGlobal', + trackType = 'global', + selection = "isGlobalMuon", + simLabel = ("TPmu"), + tpRefVector = True, +) +recoDisplacedMuonVMuAssoc_glb.tpSelector.src = ("TPmu") +#tight +muonAssociatorByHitsNoSimHitsHelperTight = muonAssociatorByHitsNoSimHitsHelper.clone( + UseTracker = True, + UseMuon = True +) +recoDisplacedMuonVMuAssoc_tgt = recoDisplacedMuonValidator.clone( + subDir = 'Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Tgt', + muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperTight', + trackType = 'global', + selection = 'isGlobalMuon', + wantTightMuon = True, + beamSpot = 'offlineBeamSpot', + primaryVertex = 'offlinePrimaryVertices', + simLabel = ("TPmu"), + tpRefVector = True, +) +recoDisplacedMuonVMuAssoc_tgt.tpSelector.src = ("TPmu") +########################################################################## +# Muon validation sequence using RecoDisplacedMuonValidator +# + +muonValidationRDMV_seq = cms.Sequence( + muonAssociatorByHitsNoSimHitsHelperTrk+recoDisplacedMuonVMuAssoc_trk + +muonAssociatorByHitsNoSimHitsHelperStandalone+recoDisplacedMuonVMuAssoc_sta + +muonAssociatorByHitsNoSimHitsHelperGlobal+recoDisplacedMuonVMuAssoc_glb + +muonAssociatorByHitsNoSimHitsHelperTight+recoDisplacedMuonVMuAssoc_tgt + ) diff --git a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py new file mode 100644 index 0000000000000..85bb6b369f318 --- /dev/null +++ b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py @@ -0,0 +1,99 @@ +import FWCore.ParameterSet.Config as cms +from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy +from Validation.RecoMuon.selectors_cff import muonTPSet, displacedMuonTPSet + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +recoDisplacedMuonValidator = DQMEDAnalyzer('RecoDisplacedMuonValidator', + MuonServiceProxy, + tpSelector = displacedMuonTPSet, + + usePFMuon = cms.untracked.bool(False), + + simLabel = cms.InputTag("mix","MergedTrackTruth"), + tpRefVector = cms.bool(False), + muonLabel = cms.InputTag("displacedMuons"), + + muAssocLabel = cms.InputTag("muonAssociatorByHitsHelper"), + + doAssoc = cms.untracked.bool(True), + + outputFileName = cms.untracked.string(''), + subDir = cms.untracked.string('Muons/RecoDisplacedMuonV/'), + trackType = cms.string("global"), + #string cut selection + selection = cms.string(""), + + wantTightMuon = cms.bool(False), + beamSpot = cms.InputTag("offlineBeamSpot"), + primaryVertex = cms.InputTag('offlinePrimaryVertices'), + + # + # Histogram dimensions # + # + nBinP = cms.untracked.uint32(100), + minP = cms.untracked.double(0.0), + maxP = cms.untracked.double(1500.0), + + nBinPt = cms.untracked.uint32(100), + minPt = cms.untracked.double(0.0), + maxPt = cms.untracked.double(1500.0), + + doAbsEta = cms.untracked.bool(False), + + nBinEta = cms.untracked.uint32(50), + minEta = cms.untracked.double(-2.5), + maxEta = cms.untracked.double(2.5), + + nBinDxy = cms.untracked.uint32(350), + minDxy = cms.untracked.double(0), + maxDxy = cms.untracked.double(700), + + nBinDz = cms.untracked.uint32(350), + minDz = cms.untracked.double(0), + maxDz = cms.untracked.double(700), + + nBinPhi = cms.untracked.uint32(25), + + # Pull width # + nBinPull = cms.untracked.uint32(50), + wPull = cms.untracked.double(5.0), + + nBinErr = cms.untracked.uint32(50), + + # |p| resolution # + minErrP = cms.untracked.double(-0.3), + maxErrP = cms.untracked.double(0.3), + + # pT resolution # + minErrPt = cms.untracked.double(-0.3), + maxErrPt = cms.untracked.double(0.3), + + # q/pT resolution # + minErrQPt = cms.untracked.double(-0.1), + maxErrQPt = cms.untracked.double(0.1), + + # Eta resolution # + minErrEta = cms.untracked.double(-0.01), + maxErrEta = cms.untracked.double(0.01), + + # Phi resolution # + minErrPhi = cms.untracked.double(-0.05), + maxErrPhi = cms.untracked.double(0.05), + + # Dxy resolution # + minErrDxy = cms.untracked.double(-0.1), + maxErrDxy = cms.untracked.double(0.1), + + # Dz resolution # + minErrDz = cms.untracked.double(-0.1), + maxErrDz = cms.untracked.double(0.1), + + # Number of sim-reco associations # + nAssoc = cms.untracked.uint32(10), + + # Number of sim,reco Tracks # + nTrks = cms.untracked.uint32(50) +) + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(recoDisplacedMuonValidator, simLabel = "mixData:MergedTrackTruth") diff --git a/Validation/RecoMuon/python/RecoMuonValidator_cff.py b/Validation/RecoMuon/python/RecoMuonValidator_cff.py index f93867e86a224..3e7418d905f5a 100644 --- a/Validation/RecoMuon/python/RecoMuonValidator_cff.py +++ b/Validation/RecoMuon/python/RecoMuonValidator_cff.py @@ -24,16 +24,6 @@ tpRefVector = True ) recoMuonVMuAssoc_trk.tpSelector.src = ("TPmu") -#displaced tracker -recoDisplacedMuonVMuAssoc_trk = recoDisplacedMuonValidator.clone( - subDir = 'Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Trk', - muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperTrk', - trackType = 'inner', - selection = "isTrackerMuon", - simLabel = ("TPmu"), - tpRefVector = True -) -recoMuonVMuAssoc_trk.tpSelector.src = ("TPmu") #standalone muonAssociatorByHitsNoSimHitsHelperStandalone = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = False, @@ -49,16 +39,6 @@ ) recoMuonVMuAssoc_sta.tpSelector.src = ("TPmu") -#displaced standalone -recoDisplacedMuonVMuAssoc_sta = recoDisplacedMuonValidator.clone( - subDir = 'Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Sta', - muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperStandalone', - trackType = 'outer', - selection = "isStandAloneMuon", - simLabel = ("TPmu"), - tpRefVector = True -) -recoMuonVMuAssoc_sta.tpSelector.src = ("TPmu") #global muonAssociatorByHitsNoSimHitsHelperGlobal = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = True, @@ -73,16 +53,6 @@ tpRefVector = True, ) recoMuonVMuAssoc_glb.tpSelector.src = ("TPmu") -#displaced global -recoDisplacedMuonVMuAssoc_glb = recoDisplacedMuonValidator.clone( - subDir = 'Muons/RecoMuonV/RecoDisplacedMuon_MuonAssoc_Glb', - muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperGlobal', - trackType = 'global', - selection = "isGlobalMuon", - simLabel = ("TPmu"), - tpRefVector = True -) -recoMuonVMuAssoc_sta.tpSelector.src = ("TPmu") #tight muonAssociatorByHitsNoSimHitsHelperTight = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = True, @@ -110,11 +80,6 @@ +muonAssociatorByHitsNoSimHitsHelperGlobal +recoMuonVMuAssoc_glb +muonAssociatorByHitsNoSimHitsHelperTight +recoMuonVMuAssoc_tgt ) -muonValidationRDMV_seq = cms.Sequence( - muonAssociatorByHitsNoSimHitsHelperStandalone +recoDisplacedMuonVMuAssoc_trk - +muonAssociatorByHitsNoSimHitsHelperStandalone +recoDisplacedMuonVMuAssoc_sta - +muonAssociatorByHitsNoSimHitsHelperGlobal +recoDisplacedMuonVMuAssoc_glb - ) # not used # diff --git a/Validation/RecoMuon/python/RecoMuonValidator_cfi.py b/Validation/RecoMuon/python/RecoMuonValidator_cfi.py index 7d4a05951cb39..392caeede8d82 100644 --- a/Validation/RecoMuon/python/RecoMuonValidator_cfi.py +++ b/Validation/RecoMuon/python/RecoMuonValidator_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy -from Validation.RecoMuon.selectors_cff import muonTPSet, displacedMuonTPSet +from Validation.RecoMuon.selectors_cff import muonTPSet from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer recoMuonValidator = DQMEDAnalyzer('RecoMuonValidator', @@ -95,18 +95,5 @@ nTrks = cms.untracked.uint32(50) ) -recoDisplacedMuonValidator = recoMuonValidator.clone( - tpSelector = displacedMuonTPSet, - muonLabel = cms.InputTag("displacedMuons"), - doAssoc = cms.untracked.bool(True), - selection = cms.string(""), - nBinDxy = cms.untracked.uint32(350), - minDxy = cms.untracked.double(-700), - maxDxy = cms.untracked.double(700), - nBinDz = cms.untracked.uint32(350), - minDz = cms.untracked.double(-700), - maxDz = cms.untracked.double(700) -) - from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 premix_stage2.toModify(recoMuonValidator, simLabel = "mixData:MergedTrackTruth") diff --git a/Validation/RecoMuon/python/RelValCustoms.py b/Validation/RecoMuon/python/RelValCustoms.py index 7d985d1ca100a..d80c985b76d0d 100644 --- a/Validation/RecoMuon/python/RelValCustoms.py +++ b/Validation/RecoMuon/python/RelValCustoms.py @@ -11,6 +11,7 @@ def validation_only(process): *process.trackingParticles *process.tracksValidation *process.recoMuonValidation + *process.recoDisplacedMuonValidation *process.HLTMuonVal ) process.validation_step.replace(process.validation,process.only_validation_and_TP) diff --git a/Validation/RecoMuon/python/muonValidation_cff.py b/Validation/RecoMuon/python/muonValidation_cff.py index 8f9209cc8fb23..414370dc52470 100644 --- a/Validation/RecoMuon/python/muonValidation_cff.py +++ b/Validation/RecoMuon/python/muonValidation_cff.py @@ -9,7 +9,7 @@ from Validation.RecoMuon.histoParameters_cff import * from Validation.RecoMuon.RecoMuonValidator_cff import * -#from Validation.RecoMuon.RecoDisplacedMuonValidator_cff import * +from Validation.RecoMuon.RecoDisplacedMuonValidator_cff import * import Validation.RecoMuon.MuonTrackValidator_cfi MTV = Validation.RecoMuon.MuonTrackValidator_cfi.muonTrackValidator.clone( @@ -315,12 +315,12 @@ # The full offline muon validation sequence # recoMuonValidation = cms.Sequence( TPtrack_seq + TPmu_seq + TPpfmu_seq + - muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq + muonValidationRDMV_seq + muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq #+ muonValidationRDMV_seq ) # optionally omit TABH recoMuonValidation_noTABH = cms.Sequence( TPtrack_seq + TPmu_seq + TPpfmu_seq + - muonValidation_noTABH_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq + muonValidationRDMV_seq + muonValidation_noTABH_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq #+ muonValidationRDMV_seq ) # ... and also displaced muons @@ -330,7 +330,7 @@ # no displaced muons in fastsim from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toReplaceWith(recoMuonValidation, cms.Sequence(cms.SequencePlaceholder("TPtrack") + cms.SequencePlaceholder("TPmu") + cms.SequencePlaceholder("TPpfmu") + muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationRMV_seq)) +fastSim.toReplaceWith(recoMuonValidation, cms.Sequence(cms.SequencePlaceholder("TPtrack") + cms.SequencePlaceholder("TPmu") + cms.SequencePlaceholder("TPpfmu") + muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationRMV_seq + muonValidationRDMV_seq)) # sequence for cosmic muons recoCosmicMuonValidation = cms.Sequence( diff --git a/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc new file mode 100644 index 0000000000000..364697d5e041a --- /dev/null +++ b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc @@ -0,0 +1,1114 @@ +#include "Validation/RecoMuon/src/RecoDisplacedMuonValidator.h" + +#include "DataFormats/MuonReco/interface/MuonSelectors.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +//#include "DQMServices/Core/interface/DQMStore.h" + +#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h" + +// for selection cut +#include "CommonTools/Utils/interface/StringCutObjectSelector.h" + +#include "TMath.h" + +using namespace std; +using namespace edm; +using namespace reco; + +typedef TrajectoryStateOnSurface TSOS; +typedef FreeTrajectoryState FTS; + +// +//Struct containing all histograms definitions +// +struct RecoDisplacedMuonValidator::MuonME { + typedef MonitorElement* MEP; + + //general kinematics + MEP hSimP_, hSimPt_, hSimEta_, hSimPhi_, hSimDxy_, hSimDz_; + //only for efficiencies + MEP hP_, hPt_, hEta_, hPhi_; + MEP hNSim_, hNMuon_; + + //misc vars + MEP hNTrks_, hNTrksEta_, hNTrksPt_; + MEP hMisQPt_, hMisQEta_; + + //resolutions + MEP hErrP_, hErrPt_, hErrEta_, hErrPhi_; + MEP hErrPBarrel_, hErrPOverlap_, hErrPEndcap_; + MEP hErrPtBarrel_, hErrPtOverlap_, hErrPtEndcap_; + MEP hErrDxy_, hErrDz_; + + MEP hErrP_vs_Eta_, hErrPt_vs_Eta_, hErrQPt_vs_Eta_; + MEP hErrP_vs_P_, hErrPt_vs_Pt_, hErrQPt_vs_Pt_, hErrEta_vs_Eta_; + + //PF-RECO event-by-event comparisons + MEP hErrPt_PF_; + MEP hErrQPt_PF_; + MEP hdPt_vs_Eta_; + MEP hdPt_vs_Pt_; + MEP hPFMomAssCorrectness; + MEP hPt_vs_PFMomAssCorrectness; + + //hit pattern + MEP hNSimHits_; + MEP hNSimToReco_, hNRecoToSim_; + + MEP hNHits_, hNLostHits_, hNTrackerHits_, hNMuonHits_; + MEP hNHits_vs_Pt_, hNHits_vs_Eta_; + MEP hNLostHits_vs_Pt_, hNLostHits_vs_Eta_; + MEP hNTrackerHits_vs_Pt_, hNTrackerHits_vs_Eta_; + MEP hNMuonHits_vs_Pt_, hNMuonHits_vs_Eta_; + + //pulls + MEP hPullPt_, hPullEta_, hPullPhi_, hPullQPt_, hPullDxy_, hPullDz_; + MEP hPullPt_vs_Eta_, hPullPt_vs_Pt_, hPullEta_vs_Eta_, hPullPhi_vs_Eta_, hPullEta_vs_Pt_; + + //chi2, ndof + MEP hNDof_, hChi2_, hChi2Norm_, hChi2Prob_; + MEP hNDof_vs_Eta_, hChi2_vs_Eta_, hChi2Norm_vs_Eta_, hChi2Prob_vs_Eta_; + + bool doAbsEta_; + bool usePFMuon_; + + // + //books histograms + // + void bookHistos(DQMStore::IBooker& ibooker, const string& dirName, const HistoDimensions& hDim) + + { + ibooker.cd(); + ibooker.setCurrentFolder(dirName); + + doAbsEta_ = hDim.doAbsEta; + usePFMuon_ = hDim.usePFMuon; + + //histograms for efficiency plots + hP_ = ibooker.book1D("P", "p of recoTracks", hDim.nBinP, hDim.minP, hDim.maxP); + hPt_ = ibooker.book1D("Pt", "p_{T} of recoTracks", hDim.nBinPt, hDim.minPt, hDim.maxPt); + hEta_ = ibooker.book1D("Eta", "#eta of recoTracks", hDim.nBinEta, hDim.minEta, hDim.maxEta); + hPhi_ = ibooker.book1D("Phi", "#phi of recoTracks", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + + hSimP_ = ibooker.book1D("SimP", "p of simTracks", hDim.nBinP, hDim.minP, hDim.maxP); + hSimPt_ = ibooker.book1D("SimPt", "p_{T} of simTracks", hDim.nBinPt, hDim.minPt, hDim.maxPt); + hSimEta_ = ibooker.book1D("SimEta", "#eta of simTracks", hDim.nBinEta, hDim.minEta, hDim.maxEta); + hSimPhi_ = ibooker.book1D("SimPhi", "#phi of simTracks", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + hSimDxy_ = ibooker.book1D("SimDxy", "Dxy of simTracks", hDim.nBinDxy, hDim.minDxy, hDim.maxDxy); + hSimDz_ = ibooker.book1D("Dz", "Dz of simTracks", hDim.nBinDz, hDim.minDz, hDim.maxDz); + + //track multiplicities + hNSim_ = ibooker.book1D("NSim", "Number of particles per event", hDim.nTrks, -0.5, hDim.nTrks + 0.5); + hNMuon_ = ibooker.book1D("NMuon", "Number of muons per event", hDim.nTrks, -0.5, hDim.nTrks + 0.5); + + // - Misc. variables + hNTrks_ = ibooker.book1D("NTrks", "Number of reco tracks per event", hDim.nTrks, -0.5, hDim.nTrks + 0.5); + hNTrksEta_ = ibooker.book1D("NTrksEta", "Number of reco tracks vs #eta", hDim.nBinEta, hDim.minEta, hDim.maxEta); + hNTrksPt_ = ibooker.book1D("NTrksPt", "Number of reco tracks vs p_{T}", hDim.nBinPt, hDim.minPt, hDim.maxPt); + + hMisQPt_ = ibooker.book1D("MisQPt", "Charge mis-id vs Pt", hDim.nBinPt, hDim.minPt, hDim.maxPt); + hMisQEta_ = ibooker.book1D("MisQEta", "Charge mis-id vs Eta", hDim.nBinEta, hDim.minEta, hDim.maxEta); + + // - Resolutions + hErrP_ = ibooker.book1D("ErrP", "#Delta(p)/p", hDim.nBinErr, hDim.minErrP, hDim.maxErrP); + hErrPBarrel_ = ibooker.book1D("ErrP_barrel", "#Delta(p)/p", hDim.nBinErr, hDim.minErrP, hDim.maxErrP); + hErrPOverlap_ = ibooker.book1D("ErrP_overlap", "#Delta(p)/p", hDim.nBinErr, hDim.minErrP, hDim.maxErrP); + hErrPEndcap_ = ibooker.book1D("ErrP_endcap", "#Delta(p)/p", hDim.nBinErr, hDim.minErrP, hDim.maxErrP); + hErrPt_ = ibooker.book1D("ErrPt", "#Delta(p_{T})/p_{T}", hDim.nBinErr, hDim.minErrPt, hDim.maxErrPt); + hErrPtBarrel_ = ibooker.book1D("ErrPt_barrel", "#Delta(p_{T})/p_{T}", hDim.nBinErr, hDim.minErrPt, hDim.maxErrPt); + hErrPtOverlap_ = ibooker.book1D("ErrPt_overlap", "#Delta(p_{T})/p_{T}", hDim.nBinErr, hDim.minErrPt, hDim.maxErrPt); + hErrPtEndcap_ = ibooker.book1D("ErrPt_endcap", "#Delta(p_{T})/p_{T}", hDim.nBinErr, hDim.minErrPt, hDim.maxErrPt); + hErrEta_ = ibooker.book1D("ErrEta", "#sigma(#eta))", hDim.nBinErr, hDim.minErrEta, hDim.maxErrEta); + hErrPhi_ = ibooker.book1D("ErrPhi", "#sigma(#phi)", hDim.nBinErr, hDim.minErrPhi, hDim.maxErrPhi); + hErrDxy_ = ibooker.book1D("ErrDxy", "#sigma(d_{xy})", hDim.nBinErr, hDim.minErrDxy, hDim.maxErrDxy); + hErrDz_ = ibooker.book1D("ErrDz", "#sigma(d_{z})", hDim.nBinErr, hDim.minErrDz, hDim.maxErrDz); + + //PF-RECO comparisons + if (usePFMuon_) { + hErrPt_PF_ = ibooker.book1D("ErrPt_PF", "#Delta(p_{T})|_{PF}/p_{T}", hDim.nBinErr, hDim.minErrPt, hDim.maxErrPt); + hErrQPt_PF_ = + ibooker.book1D("ErrQPt_PF", "#Delta(q/p_{T})|_{PF}/(q/p_{T})", hDim.nBinErr, hDim.minErrQPt, hDim.maxErrQPt); + + hPFMomAssCorrectness = + ibooker.book1D("hPFMomAssCorrectness", "Corrected momentum assignement PF/RECO", 2, 0.5, 2.5); + hPt_vs_PFMomAssCorrectness = ibooker.book2D("hPt_vs_PFMomAssCorrectness", + "Corrected momentum assignement PF/RECO", + hDim.nBinPt, + hDim.minPt, + hDim.maxP, + 2, + 0.5, + 2.5); + + hdPt_vs_Pt_ = ibooker.book2D("dPt_vs_Pt", + "#Delta(p_{T}) vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + hDim.nBinErr, + hDim.minErrPt, + hDim.maxErrPt); + hdPt_vs_Eta_ = ibooker.book2D("dPt_vs_Eta", + "#Delta(p_{T}) vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nBinErr, + hDim.minErrPt, + hDim.maxErrPt); + } + + // -- Resolutions vs Eta + hErrP_vs_Eta_ = ibooker.book2D("ErrP_vs_Eta", + "#Delta(p)/p vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nBinErr, + hDim.minErrP, + hDim.maxErrP); + hErrPt_vs_Eta_ = ibooker.book2D("ErrPt_vs_Eta", + "#Delta(p_{T})/p_{T} vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nBinErr, + hDim.minErrPt, + hDim.maxErrPt); + hErrQPt_vs_Eta_ = ibooker.book2D("ErrQPt_vs_Eta", + "#Delta(q/p_{T})/(q/p_{T}) vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nBinErr, + hDim.minErrQPt, + hDim.maxErrQPt); + hErrEta_vs_Eta_ = ibooker.book2D("ErrEta_vs_Eta", + "#sigma(#eta) vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nBinErr, + hDim.minErrEta, + hDim.maxErrEta); + + // -- Resolutions vs momentum + hErrP_vs_P_ = ibooker.book2D( + "ErrP_vs_P", "#Delta(p)/p vs p", hDim.nBinP, hDim.minP, hDim.maxP, hDim.nBinErr, hDim.minErrP, hDim.maxErrP); + hErrPt_vs_Pt_ = ibooker.book2D("ErrPt_vs_Pt", + "#Delta(p_{T})/p_{T} vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + hDim.nBinErr, + hDim.minErrPt, + hDim.maxErrPt); + hErrQPt_vs_Pt_ = ibooker.book2D("ErrQPt_vs_Pt", + "#Delta(q/p_{T})/(q/p_{T}) vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + hDim.nBinErr, + hDim.minErrQPt, + hDim.maxErrQPt); + + // - Pulls + hPullPt_ = ibooker.book1D("PullPt", "Pull(#p_{T})", hDim.nBinPull, -hDim.wPull, hDim.wPull); + hPullEta_ = ibooker.book1D("PullEta", "Pull(#eta)", hDim.nBinPull, -hDim.wPull, hDim.wPull); + hPullPhi_ = ibooker.book1D("PullPhi", "Pull(#phi)", hDim.nBinPull, -hDim.wPull, hDim.wPull); + hPullQPt_ = ibooker.book1D("PullQPt", "Pull(q/p_{T})", hDim.nBinPull, -hDim.wPull, hDim.wPull); + hPullDxy_ = ibooker.book1D("PullDxy", "Pull(D_{xy})", hDim.nBinPull, -hDim.wPull, hDim.wPull); + hPullDz_ = ibooker.book1D("PullDz", "Pull(D_{z})", hDim.nBinPull, -hDim.wPull, hDim.wPull); + + // -- Pulls vs Eta + hPullPt_vs_Eta_ = ibooker.book2D("PullPt_vs_Eta", + "Pull(p_{T}) vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nBinPull, + -hDim.wPull, + hDim.wPull); + hPullEta_vs_Eta_ = ibooker.book2D("PullEta_vs_Eta", + "Pull(#eta) vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nBinPull, + -hDim.wPull, + hDim.wPull); + hPullPhi_vs_Eta_ = ibooker.book2D("PullPhi_vs_Eta", + "Pull(#phi) vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nBinPull, + -hDim.wPull, + hDim.wPull); + + // -- Pulls vs Pt + hPullPt_vs_Pt_ = ibooker.book2D("PullPt_vs_Pt", + "Pull(p_{T}) vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + hDim.nBinPull, + -hDim.wPull, + hDim.wPull); + hPullEta_vs_Pt_ = ibooker.book2D("PullEta_vs_Pt", + "Pull(#eta) vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + hDim.nBinPull, + -hDim.wPull, + hDim.wPull); + + // -- Number of Hits + const int nHits = 100; + hNHits_ = ibooker.book1D("NHits", "Number of hits", nHits + 1, -0.5, nHits + 0.5); + hNHits_vs_Pt_ = ibooker.book2D("NHits_vs_Pt", + "Number of hits vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + nHits / 4 + 1, + -0.25, + nHits + 0.25); + hNHits_vs_Eta_ = ibooker.book2D("NHits_vs_Eta", + "Number of hits vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + nHits / 4 + 1, + -0.25, + nHits + 0.25); + hNSimHits_ = ibooker.book1D("NSimHits", "Number of simHits", nHits + 1, -0.5, nHits + 0.5); + + const int nLostHits = 5; + hNLostHits_ = ibooker.book1D("NLostHits", "Number of Lost hits", nLostHits + 1, -0.5, nLostHits + 0.5); + hNLostHits_vs_Pt_ = ibooker.book2D("NLostHits_vs_Pt", + "Number of lost Hits vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + nLostHits + 1, + -0.5, + nLostHits + 0.5); + hNLostHits_vs_Eta_ = ibooker.book2D("NLostHits_vs_Eta", + "Number of lost Hits vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + nLostHits + 1, + -0.5, + nLostHits + 0.5); + + const int nTrackerHits = 40; + hNTrackerHits_ = + ibooker.book1D("NTrackerHits", "Number of valid tracker hits", nTrackerHits + 1, -0.5, nTrackerHits + 0.5); + hNTrackerHits_vs_Pt_ = ibooker.book2D("NTrackerHits_vs_Pt", + "Number of valid traker hits vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + nTrackerHits / 4 + 1, + -0.25, + nTrackerHits + 0.25); + hNTrackerHits_vs_Eta_ = ibooker.book2D("NTrackerHits_vs_Eta", + "Number of valid tracker hits vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + nTrackerHits / 4 + 1, + -0.25, + nTrackerHits + 0.25); + + const int nMuonHits = 60; + hNMuonHits_ = ibooker.book1D("NMuonHits", "Number of valid muon hits", nMuonHits + 1, -0.5, nMuonHits + 0.5); + hNMuonHits_vs_Pt_ = ibooker.book2D("NMuonHits_vs_Pt", + "Number of valid muon hits vs p_{T}", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + nMuonHits / 4 + 1, + -0.25, + nMuonHits + 0.25); + hNMuonHits_vs_Eta_ = ibooker.book2D("NMuonHits_vs_Eta", + "Number of valid muon hits vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + nMuonHits / 4 + 1, + -0.25, + nMuonHits + 0.25); + + hNDof_ = ibooker.book1D("NDof", "Number of DoF", hDim.nDof + 1, -0.5, hDim.nDof + 0.5); + hChi2_ = ibooker.book1D("Chi2", "#Chi^{2}", hDim.nBinErr, 0, 200); + hChi2Norm_ = ibooker.book1D("Chi2Norm", "Normalized #Chi^{2}", hDim.nBinErr, 0, 50); + hChi2Prob_ = ibooker.book1D("Chi2Prob", "Prob(#Chi^{2})", hDim.nBinErr, 0, 1); + + hNDof_vs_Eta_ = ibooker.book2D("NDof_vs_Eta", + "Number of DoF vs #eta", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + hDim.nDof + 1, + -0.5, + hDim.nDof + 0.5); + hChi2_vs_Eta_ = ibooker.book2D( + "Chi2_vs_Eta", "#Chi^{2} vs #eta", hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, 0., 200.); + hChi2Norm_vs_Eta_ = ibooker.book2D( + "Chi2Norm_vs_Eta", "Normalized #Chi^{2} vs #eta", hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, 0., 50.); + hChi2Prob_vs_Eta_ = ibooker.book2D( + "Chi2Prob_vs_Eta", "Prob(#Chi^{2}) vs #eta", hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, 0., 1.); + + hNSimToReco_ = + ibooker.book1D("NSimToReco", "Number of associated reco tracks", hDim.nAssoc + 1, -0.5, hDim.nAssoc + 0.5); + hNRecoToSim_ = + ibooker.book1D("NRecoToSim", "Number of associated sim TP's", hDim.nAssoc + 1, -0.5, hDim.nAssoc + 0.5); + }; + + // + //Fill hists booked, simRef and muonRef are associated by hits + // + void fill(const TrackingParticle* simRef, const Muon* muonRef) { + const double simP = simRef->p(); + const double simPt = simRef->pt(); + const double simEta = doAbsEta_ ? fabs(simRef->eta()) : simRef->eta(); + const double simPhi = simRef->phi(); + const double simQ = simRef->charge(); + const double simQPt = simQ / simPt; + + GlobalPoint simVtx(simRef->vertex().x(), simRef->vertex().y(), simRef->vertex().z()); + GlobalVector simMom(simRef->momentum().x(), simRef->momentum().y(), simRef->momentum().z()); + const double simDxy = -simVtx.x() * sin(simPhi) + simVtx.y() * cos(simPhi); + const double simDz = simVtx.z() - (simVtx.x() * simMom.x() + simVtx.y() * simMom.y()) * simMom.z() / simMom.perp2(); + + const double recoQ = muonRef->charge(); + if (simQ * recoQ < 0) { + hMisQPt_->Fill(simPt); + hMisQEta_->Fill(simEta); + } + + double recoP, recoPt, recoEta, recoPhi, recoQPt; + if (usePFMuon_) { + // const double origRecoP = muonRef->p(); + const double origRecoPt = muonRef->pt(); + // const double origRecoEta = muonRef->eta(); + // const double origRecoPhi = muonRef->phi(); + const double origRecoQPt = recoQ / origRecoPt; + recoP = muonRef->pfP4().P(); + recoPt = muonRef->pfP4().Pt(); + recoEta = muonRef->pfP4().Eta(); + recoPhi = muonRef->pfP4().Phi(); + recoQPt = recoQ / recoPt; + hErrPt_PF_->Fill((recoPt - origRecoPt) / origRecoPt); + hErrQPt_PF_->Fill((recoQPt - origRecoQPt) / origRecoQPt); + + hdPt_vs_Eta_->Fill(recoEta, recoPt - origRecoPt); + hdPt_vs_Pt_->Fill(recoPt, recoPt - origRecoPt); + + int theCorrectPFAss = (fabs(recoPt - simPt) < fabs(origRecoPt - simPt)) ? 1 : 2; + hPFMomAssCorrectness->Fill(theCorrectPFAss); + hPt_vs_PFMomAssCorrectness->Fill(simPt, theCorrectPFAss); + } + + else { + recoP = muonRef->p(); + recoPt = muonRef->pt(); + recoEta = muonRef->eta(); + recoPhi = muonRef->phi(); + recoQPt = recoQ / recoPt; + } + + const double errP = (recoP - simP) / simP; + const double errPt = (recoPt - simPt) / simPt; + const double errEta = (recoEta - simEta) / simEta; + const double errPhi = (recoPhi - simPhi) / simPhi; + const double errQPt = (recoQPt - simQPt) / simQPt; + + hP_->Fill(simP); + hPt_->Fill(simPt); + hEta_->Fill(simEta); + hPhi_->Fill(simPhi); + + hErrP_->Fill(errP); + hErrPt_->Fill(errPt); + hErrEta_->Fill(errEta); + hErrPhi_->Fill(errPhi); + + if (fabs(simEta) > 0. && fabs(simEta) < 0.8) { + hErrPBarrel_->Fill(errP); + hErrPtBarrel_->Fill(errPt); + } else if (fabs(simEta) > 0.8 && fabs(simEta) < 1.2) { + hErrPOverlap_->Fill(errP); + hErrPtOverlap_->Fill(errPt); + } else if (fabs(simEta) > 1.2) { + hErrPEndcap_->Fill(errP); + hErrPtEndcap_->Fill(errPt); + } + + hErrP_vs_Eta_->Fill(simEta, errP); + hErrPt_vs_Eta_->Fill(simEta, errPt); + hErrQPt_vs_Eta_->Fill(simEta, errQPt); + + hErrP_vs_P_->Fill(simP, errP); + hErrPt_vs_Pt_->Fill(simPt, errPt); + hErrQPt_vs_Pt_->Fill(simQPt, errQPt); + + hErrEta_vs_Eta_->Fill(simEta, errEta); + + //access from track + reco::TrackRef recoRef = muonRef->track(); + if (recoRef.isNonnull()) { + // Number of reco-hits + const int nRecoHits = recoRef->numberOfValidHits(); + const int nLostHits = recoRef->numberOfLostHits(); + + hNHits_->Fill(nRecoHits); + hNHits_vs_Pt_->Fill(simPt, nRecoHits); + hNHits_vs_Eta_->Fill(simEta, nRecoHits); + + hNLostHits_->Fill(nLostHits); + hNLostHits_vs_Pt_->Fill(simPt, nLostHits); + hNLostHits_vs_Eta_->Fill(simEta, nLostHits); + + const double recoNDof = recoRef->ndof(); + const double recoChi2 = recoRef->chi2(); + const double recoChi2Norm = recoRef->normalizedChi2(); + const double recoChi2Prob = TMath::Prob(recoRef->chi2(), static_cast(recoRef->ndof())); + + hNDof_->Fill(recoNDof); + hChi2_->Fill(recoChi2); + hChi2Norm_->Fill(recoChi2Norm); + hChi2Prob_->Fill(recoChi2Prob); + + hNDof_vs_Eta_->Fill(simEta, recoNDof); + hChi2_vs_Eta_->Fill(simEta, recoChi2); + hChi2Norm_vs_Eta_->Fill(simEta, recoChi2Norm); + hChi2Prob_vs_Eta_->Fill(simEta, recoChi2Prob); + + const double recoDxy = recoRef->dxy(); + const double recoDz = recoRef->dz(); + + const double errDxy = (recoDxy - simDxy) / simDxy; + const double errDz = (recoDz - simDz) / simDz; + hErrDxy_->Fill(errDxy); + hErrDz_->Fill(errDz); + + const double pullPt = (recoPt - simPt) / recoRef->ptError(); + const double pullQPt = (recoQPt - simQPt) / recoRef->qoverpError(); + const double pullEta = (recoEta - simEta) / recoRef->etaError(); + const double pullPhi = (recoPhi - simPhi) / recoRef->phiError(); + const double pullDxy = (recoDxy - simDxy) / recoRef->dxyError(); + const double pullDz = (recoDz - simDz) / recoRef->dzError(); + + hPullPt_->Fill(pullPt); + hPullEta_->Fill(pullEta); + hPullPhi_->Fill(pullPhi); + hPullQPt_->Fill(pullQPt); + hPullDxy_->Fill(pullDxy); + hPullDz_->Fill(pullDz); + + hPullPt_vs_Eta_->Fill(simEta, pullPt); + hPullPt_vs_Pt_->Fill(simPt, pullPt); + + hPullEta_vs_Eta_->Fill(simEta, pullEta); + hPullPhi_vs_Eta_->Fill(simEta, pullPhi); + + hPullEta_vs_Pt_->Fill(simPt, pullEta); + } + }; +}; + +// +//struct defininiong histograms +// +struct RecoDisplacedMuonValidator::CommonME { + typedef MonitorElement* MEP; + + //diffs + MEP hTrkToGlbDiffNTrackerHits_, hStaToGlbDiffNMuonHits_; + MEP hTrkToGlbDiffNTrackerHitsEta_, hStaToGlbDiffNMuonHitsEta_; + MEP hTrkToGlbDiffNTrackerHitsPt_, hStaToGlbDiffNMuonHitsPt_; + + //global muon hit pattern + MEP hNInvalidHitsGTHitPattern_, hNInvalidHitsITHitPattern_, hNInvalidHitsOTHitPattern_; + MEP hNDeltaInvalidHitsHitPattern_; + + //muon based momentum assignment + MEP hMuonP_, hMuonPt_, hMuonEta_, hMuonPhi_; + //track based kinematics + MEP hMuonTrackP_, hMuonTrackPt_, hMuonTrackEta_, hMuonTrackPhi_, hMuonTrackDxy_, hMuonTrackDz_; + //histograms for fractions + MEP hMuonAllP_, hMuonAllPt_, hMuonAllEta_, hMuonAllPhi_; +}; + +// +//Constructor +// +RecoDisplacedMuonValidator::RecoDisplacedMuonValidator(const edm::ParameterSet& pset) + : selector_(pset.getParameter("selection")) { + // dump cfg parameters + edm::LogVerbatim("RecoDisplacedMuonValidator") << "constructing RecoDisplacedMuonValidator: " << pset.dump(); + verbose_ = pset.getUntrackedParameter("verbose", 0); + + outputFileName_ = pset.getUntrackedParameter("outputFileName", ""); + + wantTightMuon_ = pset.getParameter("wantTightMuon"); + beamspotLabel_ = pset.getParameter("beamSpot"); + primvertexLabel_ = pset.getParameter("primaryVertex"); + beamspotToken_ = consumes(beamspotLabel_); + primvertexToken_ = consumes(primvertexLabel_); + + // Set histogram dimensions from config + + hDim.nBinP = pset.getUntrackedParameter("nBinP"); + hDim.minP = pset.getUntrackedParameter("minP"); + hDim.maxP = pset.getUntrackedParameter("maxP"); + + hDim.nBinPt = pset.getUntrackedParameter("nBinPt"); + hDim.minPt = pset.getUntrackedParameter("minPt"); + hDim.maxPt = pset.getUntrackedParameter("maxPt"); + + doAbsEta_ = pset.getUntrackedParameter("doAbsEta"); + hDim.doAbsEta = doAbsEta_; + hDim.nBinEta = pset.getUntrackedParameter("nBinEta"); + hDim.minEta = pset.getUntrackedParameter("minEta"); + hDim.maxEta = pset.getUntrackedParameter("maxEta"); + + hDim.nBinDxy = pset.getUntrackedParameter("nBinDxy"); + hDim.minDxy = pset.getUntrackedParameter("minDxy"); + hDim.maxDxy = pset.getUntrackedParameter("maxDxy"); + + hDim.nBinDz = pset.getUntrackedParameter("nBinDz"); + hDim.minDz = pset.getUntrackedParameter("minDz"); + hDim.maxDz = pset.getUntrackedParameter("maxDz"); + + hDim.nBinPhi = pset.getUntrackedParameter("nBinPhi"); + hDim.minPhi = pset.getUntrackedParameter("minPhi", -TMath::Pi()); + hDim.maxPhi = pset.getUntrackedParameter("maxPhi", TMath::Pi()); + + hDim.nBinErr = pset.getUntrackedParameter("nBinErr"); + hDim.nBinPull = pset.getUntrackedParameter("nBinPull"); + + hDim.wPull = pset.getUntrackedParameter("wPull"); + + hDim.minErrP = pset.getUntrackedParameter("minErrP"); + hDim.maxErrP = pset.getUntrackedParameter("maxErrP"); + + hDim.minErrPt = pset.getUntrackedParameter("minErrPt"); + hDim.maxErrPt = pset.getUntrackedParameter("maxErrPt"); + + hDim.minErrQPt = pset.getUntrackedParameter("minErrQPt"); + hDim.maxErrQPt = pset.getUntrackedParameter("maxErrQPt"); + + hDim.minErrEta = pset.getUntrackedParameter("minErrEta"); + hDim.maxErrEta = pset.getUntrackedParameter("maxErrEta"); + + hDim.minErrPhi = pset.getUntrackedParameter("minErrPhi"); + hDim.maxErrPhi = pset.getUntrackedParameter("maxErrPhi"); + + hDim.minErrDxy = pset.getUntrackedParameter("minErrDxy"); + hDim.maxErrDxy = pset.getUntrackedParameter("maxErrDxy"); + + hDim.minErrDz = pset.getUntrackedParameter("minErrDz"); + hDim.maxErrDz = pset.getUntrackedParameter("maxErrDz"); + + hDim.nTrks = pset.getUntrackedParameter("nTrks"); + hDim.nAssoc = pset.getUntrackedParameter("nAssoc"); + hDim.nDof = pset.getUntrackedParameter("nDof", 55); + + // Labels for simulation and reconstruction tracks + simLabel_ = pset.getParameter("simLabel"); + tpRefVector = pset.getParameter("tpRefVector"); + if (tpRefVector) + tpRefVectorToken_ = consumes(simLabel_); + else + simToken_ = consumes(simLabel_); + + muonLabel_ = pset.getParameter("muonLabel"); + muonToken_ = consumes >(muonLabel_); + + // Labels for sim-reco association + doAssoc_ = pset.getUntrackedParameter("doAssoc", true); + muAssocLabel_ = pset.getParameter("muAssocLabel"); + if (doAssoc_) { + muAssocToken_ = consumes(muAssocLabel_); + } + + // Different momentum assignment and additional histos in case of PF muons + usePFMuon_ = pset.getUntrackedParameter("usePFMuon"); + hDim.usePFMuon = usePFMuon_; + + //type of track + std::string trackType = pset.getParameter("trackType"); + if (trackType == "inner") + trackType_ = reco::InnerTk; + else if (trackType == "outer") + trackType_ = reco::OuterTk; + else if (trackType == "global") + trackType_ = reco::GlobalTk; + else if (trackType == "segments") + trackType_ = reco::Segments; + else + throw cms::Exception("Configuration") << "Track type '" << trackType << "' not supported.\n"; + + // seedPropagatorName_ = pset.getParameter("SeedPropagator"); + + ParameterSet tpset = pset.getParameter("tpSelector"); + tpSelector_ = TrackingParticleSelector(tpset.getParameter("ptMin"), + tpset.getParameter("ptMax"), + tpset.getParameter("minRapidity"), + tpset.getParameter("maxRapidity"), + tpset.getParameter("tip"), + tpset.getParameter("lip"), + tpset.getParameter("minHit"), + tpset.getParameter("signalOnly"), + tpset.getParameter("intimeOnly"), + tpset.getParameter("chargedOnly"), + tpset.getParameter("stableOnly"), + tpset.getParameter >("pdgId")); + + // the service parameters + ParameterSet serviceParameters = pset.getParameter("ServiceParameters"); + + // retrieve the instance of DQMService + dbe_ = Service().operator->(); + subsystemname_ = pset.getUntrackedParameter("subSystemFolder", "YourSubsystem"); + + subDir_ = pset.getUntrackedParameter("subDir"); + if (subDir_.empty()) + subDir_ = "RecoDisplacedMuonV"; + if (subDir_[subDir_.size() - 1] == '/') + subDir_.erase(subDir_.size() - 1); +} + +void RecoDisplacedMuonValidator::bookHistograms(DQMStore::IBooker& ibooker, + edm::Run const& iRun, + edm::EventSetup const& /* iSetup */) { + // book histograms + ibooker.cd(); + + ibooker.setCurrentFolder(subDir_); + + commonME_ = new CommonME; + muonME_ = new MuonME; + + //commonME + const int nHits = 100; + + // - diffs + commonME_->hTrkToGlbDiffNTrackerHits_ = ibooker.book1D("TrkGlbDiffNTrackerHits", + "Difference of number of tracker hits (tkMuon - globalMuon)", + 2 * nHits + 1, + -nHits - 0.5, + nHits + 0.5); + commonME_->hStaToGlbDiffNMuonHits_ = ibooker.book1D("StaGlbDiffNMuonHits", + "Difference of number of muon hits (staMuon - globalMuon)", + 2 * nHits + 1, + -nHits - 0.5, + nHits + 0.5); + + commonME_->hTrkToGlbDiffNTrackerHitsEta_ = + ibooker.book2D("TrkGlbDiffNTrackerHitsEta", + "Difference of number of tracker hits (tkMuon - globalMuon)", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + 2 * nHits + 1, + -nHits - 0.5, + nHits + 0.5); + commonME_->hStaToGlbDiffNMuonHitsEta_ = ibooker.book2D("StaGlbDiffNMuonHitsEta", + "Difference of number of muon hits (staMuon - globalMuon)", + hDim.nBinEta, + hDim.minEta, + hDim.maxEta, + 2 * nHits + 1, + -nHits - 0.5, + nHits + 0.5); + + commonME_->hTrkToGlbDiffNTrackerHitsPt_ = ibooker.book2D("TrkGlbDiffNTrackerHitsPt", + "Difference of number of tracker hits (tkMuon - globalMuon)", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + 2 * nHits + 1, + -nHits - 0.5, + nHits + 0.5); + commonME_->hStaToGlbDiffNMuonHitsPt_ = ibooker.book2D("StaGlbDiffNMuonHitsPt", + "Difference of number of muon hits (staMuon - globalMuon)", + hDim.nBinPt, + hDim.minPt, + hDim.maxPt, + 2 * nHits + 1, + -nHits - 0.5, + nHits + 0.5); + + // -global muon hit pattern + commonME_->hNInvalidHitsGTHitPattern_ = ibooker.book1D( + "NInvalidHitsGTHitPattern", "Number of invalid hits on a global track", nHits + 1, -0.5, nHits + 0.5); + commonME_->hNInvalidHitsITHitPattern_ = ibooker.book1D( + "NInvalidHitsITHitPattern", "Number of invalid hits on an inner track", nHits + 1, -0.5, nHits + 0.5); + commonME_->hNInvalidHitsOTHitPattern_ = ibooker.book1D( + "NInvalidHitsOTHitPattern", "Number of invalid hits on an outer track", nHits + 1, -0.5, nHits + 0.5); + commonME_->hNDeltaInvalidHitsHitPattern_ = + ibooker.book1D("hNDeltaInvalidHitsHitPattern", + "The discrepancy for Number of invalid hits on an global track and inner and outer tracks", + 2 * nHits + 1, + -nHits - 0.5, + nHits + 0.5); + + //muon based kinematics + commonME_->hMuonP_ = ibooker.book1D("PMuon", "p of muon", hDim.nBinP, hDim.minP, hDim.maxP); + commonME_->hMuonPt_ = ibooker.book1D("PtMuon", "p_{T} of muon", hDim.nBinPt, hDim.minPt, hDim.maxPt); + commonME_->hMuonEta_ = ibooker.book1D("EtaMuon", "#eta of muon", hDim.nBinEta, hDim.minEta, hDim.maxEta); + commonME_->hMuonPhi_ = ibooker.book1D("PhiMuon", "#phi of muon", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + //track based kinematics + commonME_->hMuonTrackP_ = ibooker.book1D("PMuonTrack", "p of reco muon track", hDim.nBinP, hDim.minP, hDim.maxP); + commonME_->hMuonTrackPt_ = + ibooker.book1D("PtMuonTrack", "p_{T} of reco muon track", hDim.nBinPt, hDim.minPt, hDim.maxPt); + commonME_->hMuonTrackEta_ = + ibooker.book1D("EtaMuonTrack", "#eta of reco muon track", hDim.nBinEta, hDim.minEta, hDim.maxEta); + commonME_->hMuonTrackPhi_ = + ibooker.book1D("PhiMuonTrack", "#phi of reco muon track", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + commonME_->hMuonTrackDxy_ = + ibooker.book1D("DxyMuonTrack", "Dxy of reco muon track", hDim.nBinDxy, hDim.minDxy, hDim.maxDxy); + commonME_->hMuonTrackDz_ = + ibooker.book1D("DzMuonTrack", "Dz of reco muon track", hDim.nBinDz, hDim.minDz, hDim.maxDz); + + //histograms for fractions + commonME_->hMuonAllP_ = ibooker.book1D("PMuonAll", "p of muons of all types", hDim.nBinP, hDim.minP, hDim.maxP); + commonME_->hMuonAllPt_ = + ibooker.book1D("PtMuonAll", "p_{T} of muon of all types", hDim.nBinPt, hDim.minPt, hDim.maxPt); + commonME_->hMuonAllEta_ = + ibooker.book1D("EtaMuonAll", "#eta of muon of all types", hDim.nBinEta, hDim.minEta, hDim.maxEta); + commonME_->hMuonAllPhi_ = + ibooker.book1D("PhiMuonAll", "#phi of muon of all types", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + + muonME_->bookHistos(ibooker, subDir_, hDim); +} + +// +//Destructor +// +RecoDisplacedMuonValidator::~RecoDisplacedMuonValidator() {} + +// +//Begin run +// + +void RecoDisplacedMuonValidator::dqmBeginRun(const edm::Run&, const EventSetup& eventSetup) {} + +// +//End run +// +void RecoDisplacedMuonValidator::dqmEndRun(edm::Run const&, edm::EventSetup const&) { + if (dbe_ && !outputFileName_.empty()) + dbe_->save(outputFileName_); +} + +// +//Analyze +// +void RecoDisplacedMuonValidator::analyze(const Event& event, const EventSetup& eventSetup) { + // Look for the Primary Vertex (and use the BeamSpot instead, if you can't find it): + reco::Vertex::Point posVtx; + reco::Vertex::Error errVtx; + edm::Handle recVtxs; + event.getByToken(primvertexToken_, recVtxs); + unsigned int theIndexOfThePrimaryVertex = 999.; + for (unsigned int ind = 0; ind < recVtxs->size(); ++ind) { + if ((*recVtxs)[ind].isValid() && !((*recVtxs)[ind].isFake())) { + theIndexOfThePrimaryVertex = ind; + break; + } + } + if (theIndexOfThePrimaryVertex < 100) { + posVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).position(); + errVtx = ((*recVtxs)[theIndexOfThePrimaryVertex]).error(); + } else { + LogInfo("RecoDisplacedMuonValidator") << "reco::PrimaryVertex not found, use BeamSpot position instead\n"; + edm::Handle recoBeamSpotHandle; + event.getByToken(beamspotToken_, recoBeamSpotHandle); + reco::BeamSpot bs = *recoBeamSpotHandle; + posVtx = bs.position(); + errVtx(0, 0) = bs.BeamWidthX(); + errVtx(1, 1) = bs.BeamWidthY(); + errVtx(2, 2) = bs.sigmaZ(); + } + const reco::Vertex thePrimaryVertex(posVtx, errVtx); + + // Get TrackingParticles + TrackingParticleRefVector TPrefV; + const TrackingParticleRefVector* ptr_TPrefV = nullptr; + Handle simHandle; + Handle TPCollectionRefVector_H; + + if (tpRefVector) { + event.getByToken(tpRefVectorToken_, TPCollectionRefVector_H); + ptr_TPrefV = TPCollectionRefVector_H.product(); + TPrefV = *ptr_TPrefV; + } else { + event.getByToken(simToken_, simHandle); + size_t nTP = simHandle->size(); + for (size_t i = 0; i < nTP; ++i) { + TPrefV.push_back(TrackingParticleRef(simHandle, i)); + } + ptr_TPrefV = &TPrefV; + } + + // Get Muons + Handle > muonHandle; + event.getByToken(muonToken_, muonHandle); + View muonColl = *(muonHandle.product()); + + reco::MuonToTrackingParticleAssociator const* assoByHits = nullptr; + if (doAssoc_) { + edm::Handle associatorBase; + event.getByToken(muAssocToken_, associatorBase); + assoByHits = associatorBase.product(); + } + + const size_t nSim = ptr_TPrefV->size(); + + edm::RefToBaseVector Muons; + for (size_t i = 0; i < muonHandle->size(); ++i) { + Muons.push_back(muonHandle->refAt(i)); + } + + muonME_->hNSim_->Fill(nSim); + muonME_->hNMuon_->Fill(muonColl.size()); + + reco::MuonToSimCollection muonToSimColl; + reco::SimToMuonCollection simToMuonColl; + + if (doAssoc_) { + edm::LogVerbatim("RecoDisplacedMuonValidator") + << "\n >>> MuonToSim association : " << muAssocLabel_ << " <<< \n" + << " muon collection : " << muonLabel_ << " (size = " << muonHandle->size() << ") \n" + << " TrackingParticle collection : " << simLabel_ << " (size = " << nSim << ")"; + + assoByHits->associateMuons(muonToSimColl, simToMuonColl, Muons, trackType_, TPrefV); + } else { + /* + // SimToMuon associations + Handle simToTrkMuHandle; + event.getByLabel(trkMuAssocLabel_, simToTrkMuHandle); + trkSimRecColl = *(simToTrkMuHandle.product()); + + Handle simToStaMuHandle; + event.getByLabel(staMuAssocLabel_, simToStaMuHandle); + staSimRecColl = *(simToStaMuHandle.product()); + + Handle simToGlbMuHandle; + event.getByLabel(glbMuAssocLabel_, simToGlbMuHandle); + glbSimRecColl = *(simToGlbMuHandle.product()); + + // MuonToSim associations + Handle trkMuToSimHandle; + event.getByLabel(trkMuAssocLabel_, trkMuToSimHandle); + trkRecSimColl = *(trkMuToSimHandle.product()); + + Handle staMuToSimHandle; + event.getByLabel(staMuAssocLabel_, staMuToSimHandle); + staRecSimColl = *(staMuToSimHandle.product()); + + Handle glbMuToSimHandle; + event.getByLabel(glbMuAssocLabel_, glbMuToSimHandle); + glbRecSimColl = *(glbMuToSimHandle.product()); +*/ + } + + int glbNTrackerHits = 0; + int trkNTrackerHits = 0; + int glbNMuonHits = 0; + int staNMuonHits = 0; + int NTrackerHits = 0; + int NMuonHits = 0; + + // Analyzer reco::Muon + for (View::const_iterator iMuon = muonColl.begin(); iMuon != muonColl.end(); ++iMuon) { + double muonP, muonPt, muonEta, muonPhi; + if (usePFMuon_) { + muonP = iMuon->pfP4().P(); + muonPt = iMuon->pfP4().Pt(); + muonEta = iMuon->pfP4().Eta(); + muonPhi = iMuon->pfP4().Phi(); + } else { + muonP = iMuon->p(); + muonPt = iMuon->pt(); + muonEta = iMuon->eta(); + muonPhi = iMuon->phi(); + } + + //histograms for fractions + commonME_->hMuonAllP_->Fill(muonP); + commonME_->hMuonAllPt_->Fill(muonPt); + commonME_->hMuonAllEta_->Fill(muonEta); + commonME_->hMuonAllPhi_->Fill(muonPhi); + + if (!selector_(*iMuon)) + continue; + if (wantTightMuon_) { + if (!muon::isTightMuon(*iMuon, thePrimaryVertex)) + continue; + } + + TrackRef Track = iMuon->track(); + + if (trackType_ == reco::InnerTk) { + Track = iMuon->track(); + trkNTrackerHits = countTrackerHits(*Track); + } else if (trackType_ == reco::OuterTk) { + Track = iMuon->standAloneMuon(); + } else if (trackType_ == reco::GlobalTk) { + Track = iMuon->combinedMuon(); + glbNTrackerHits = countTrackerHits(*Track); + glbNMuonHits = countMuonHits(*Track); + } + + commonME_->hMuonTrackP_->Fill(Track->p()); + commonME_->hMuonTrackPt_->Fill(Track->pt()); + commonME_->hMuonTrackEta_->Fill(Track->eta()); + commonME_->hMuonTrackPhi_->Fill(Track->phi()); + //ip histograms + commonME_->hMuonTrackDxy_->Fill(Track->dxy()); + commonME_->hMuonTrackDz_->Fill(Track->dz()); + + NTrackerHits = countTrackerHits(*Track); + muonME_->hNTrackerHits_->Fill(NTrackerHits); + muonME_->hNTrackerHits_vs_Pt_->Fill(Track->pt(), NTrackerHits); + muonME_->hNTrackerHits_vs_Eta_->Fill(Track->eta(), NTrackerHits); + + NMuonHits = countMuonHits(*Track); + muonME_->hNMuonHits_->Fill(NMuonHits); + muonME_->hNMuonHits_vs_Pt_->Fill(Track->pt(), NMuonHits); + muonME_->hNMuonHits_vs_Eta_->Fill(Track->eta(), NMuonHits); + + //list of histos for each type + + // muonME_->hNTrks_->Fill(); + muonME_->hNTrksEta_->Fill(Track->eta()); + muonME_->hNTrksPt_->Fill(Track->pt()); + + commonME_->hMuonP_->Fill(muonP); + commonME_->hMuonPt_->Fill(muonPt); + commonME_->hMuonEta_->Fill(muonEta); + commonME_->hMuonPhi_->Fill(muonPhi); + + if (iMuon->isGlobalMuon()) { + double gtHitPat = iMuon->globalTrack()->hitPattern().numberOfAllHits(HitPattern::TRACK_HITS) - + iMuon->globalTrack()->hitPattern().numberOfValidHits(); + + double itHitPat = iMuon->innerTrack()->hitPattern().numberOfAllHits(HitPattern::TRACK_HITS) - + iMuon->innerTrack()->hitPattern().numberOfValidHits(); + + double otHitPat = iMuon->outerTrack()->hitPattern().numberOfAllHits(HitPattern::TRACK_HITS) - + iMuon->outerTrack()->hitPattern().numberOfValidHits(); + + commonME_->hNInvalidHitsGTHitPattern_->Fill(gtHitPat); + commonME_->hNInvalidHitsITHitPattern_->Fill(itHitPat); + commonME_->hNInvalidHitsOTHitPattern_->Fill(otHitPat); + commonME_->hNDeltaInvalidHitsHitPattern_->Fill(gtHitPat - itHitPat - otHitPat); + + //must be global and standalone + if (iMuon->isStandAloneMuon()) { + commonME_->hStaToGlbDiffNMuonHitsEta_->Fill(Track->eta(), staNMuonHits - glbNMuonHits); + commonME_->hStaToGlbDiffNMuonHitsPt_->Fill(Track->pt(), staNMuonHits - glbNMuonHits); + commonME_->hStaToGlbDiffNMuonHits_->Fill(staNMuonHits - glbNMuonHits); + } + + //must be global and tracker + if (iMuon->isTrackerMuon()) { + commonME_->hTrkToGlbDiffNTrackerHitsEta_->Fill(Track->eta(), trkNTrackerHits - glbNTrackerHits); + commonME_->hTrkToGlbDiffNTrackerHitsPt_->Fill(Track->pt(), trkNTrackerHits - glbNTrackerHits); + commonME_->hTrkToGlbDiffNTrackerHits_->Fill(trkNTrackerHits - glbNTrackerHits); + } + } + + } //end of reco muon loop + + // Associate by hits + for (size_t i = 0; i < nSim; i++) { + TrackingParticleRef simRef = TPrefV[i]; + const TrackingParticle* simTP = simRef.get(); + if (!tpSelector_(*simTP)) + continue; + + //denominators for efficiency plots + const double simP = simRef->p(); + const double simPt = simRef->pt(); + const double simEta = doAbsEta_ ? fabs(simRef->eta()) : simRef->eta(); + const double simPhi = simRef->phi(); + + GlobalPoint simVtx(simRef->vertex().x(), simRef->vertex().y(), simRef->vertex().z()); + GlobalVector simMom(simRef->momentum().x(), simRef->momentum().y(), simRef->momentum().z()); + const double simDxy = -simVtx.x() * sin(simPhi) + simVtx.y() * cos(simPhi); + const double simDz = simVtx.z() - (simVtx.x() * simMom.x() + simVtx.y() * simMom.y()) * simMom.z() / simMom.perp2(); + + const unsigned int nSimHits = simRef->numberOfHits(); + + muonME_->hSimP_->Fill(simP); + muonME_->hSimPt_->Fill(simPt); + muonME_->hSimEta_->Fill(simEta); + muonME_->hSimPhi_->Fill(simPhi); + muonME_->hSimDxy_->Fill(simDxy); + muonME_->hSimDz_->Fill(simDz); + muonME_->hNSimHits_->Fill(nSimHits); + + // Get sim-reco association for a simRef + vector, double> > MuRefV; + if (simToMuonColl.find(simRef) != simToMuonColl.end()) { + MuRefV = simToMuonColl[simRef]; + + if (!MuRefV.empty()) { + muonME_->hNSimToReco_->Fill(MuRefV.size()); + const Muon* Mu = MuRefV.begin()->first.get(); + if (!selector_(*Mu)) + continue; + if (wantTightMuon_) { + if (!muon::isTightMuon(*Mu, thePrimaryVertex)) + continue; + } + + muonME_->fill(&*simTP, Mu); + } + } + } +} + +int RecoDisplacedMuonValidator::countMuonHits(const reco::Track& track) const { + TransientTrackingRecHit::ConstRecHitContainer result; + + int count = 0; + + for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) { + if ((*hit)->isValid()) { + DetId recoid = (*hit)->geographicalId(); + if (recoid.det() == DetId::Muon) + count++; + } + } + return count; +} + +int RecoDisplacedMuonValidator::countTrackerHits(const reco::Track& track) const { + TransientTrackingRecHit::ConstRecHitContainer result; + + int count = 0; + + for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) { + if ((*hit)->isValid()) { + DetId recoid = (*hit)->geographicalId(); + if (recoid.det() == DetId::Tracker) + count++; + } + } + return count; +} diff --git a/Validation/RecoMuon/src/RecoDisplacedMuonValidator.h b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.h new file mode 100644 index 0000000000000..9c0bb165056e3 --- /dev/null +++ b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.h @@ -0,0 +1,133 @@ +#ifndef Validation_RecoMuon_RecoDisplacedMuonValidator_H +#define Validation_RecoMuon_RecoDisplacedMuonValidator_H + +#include "DQMServices/Core/interface/DQMOneEDAnalyzer.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "SimTracker/Common/interface/TrackingParticleSelector.h" + +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" + +#include "SimDataFormats/Associations/interface/MuonToTrackingParticleAssociator.h" + +// for selection cut +#include "CommonTools/Utils/interface/StringCutObjectSelector.h" + +class TrackAssociatorBase; + +class RecoDisplacedMuonValidator : public DQMOneEDAnalyzer<> { +public: + RecoDisplacedMuonValidator(const edm::ParameterSet& pset); + ~RecoDisplacedMuonValidator() override; + + void dqmBeginRun(const edm::Run&, const edm::EventSetup& eventSetup) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void dqmEndRun(edm::Run const&, edm::EventSetup const&) override; + void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override; + virtual int countMuonHits(const reco::Track& track) const; + virtual int countTrackerHits(const reco::Track& track) const; + +protected: + unsigned int verbose_; + + edm::InputTag simLabel_; + edm::InputTag muonLabel_; + std::string muonSelection_; + edm::EDGetTokenT simToken_; + edm::EDGetTokenT tpRefVectorToken_; + bool tpRefVector; + + edm::EDGetTokenT > muonToken_; + + edm::InputTag muAssocLabel_; + edm::EDGetTokenT muAssocToken_; + + edm::InputTag beamspotLabel_; + edm::InputTag primvertexLabel_; + edm::EDGetTokenT beamspotToken_; + edm::EDGetTokenT primvertexToken_; + + std::string outputFileName_; + std::string subDir_; + std::string subsystemname_; + edm::ParameterSet pset; + + DQMStore* dbe_; + + bool doAbsEta_; + bool doAssoc_; + bool usePFMuon_; + + TrackingParticleSelector tpSelector_; + + // Track to use + reco::MuonTrackType trackType_; + + struct MuonME; + MuonME* muonME_; + + struct CommonME; + CommonME* commonME_; + + // + //struct for histogram dimensions + // + struct HistoDimensions { + //p + unsigned int nBinP; + double minP, maxP; + //pt + unsigned int nBinPt; + double minPt, maxPt; + //if abs eta + bool doAbsEta; + //eta + unsigned int nBinEta; + double minEta, maxEta; + //phi + unsigned int nBinPhi; + double minPhi, maxPhi; + //dxy + unsigned int nBinDxy; + double minDxy, maxDxy; + //dz + unsigned int nBinDz; + double minDz, maxDz; + //pulls + unsigned int nBinPull; + double wPull; + //resolustions + unsigned int nBinErr; + double minErrP, maxErrP; + double minErrPt, maxErrPt; + double minErrQPt, maxErrQPt; + double minErrEta, maxErrEta; + double minErrPhi, maxErrPhi; + double minErrDxy, maxErrDxy; + double minErrDz, maxErrDz; + //track multiplicities + unsigned int nTrks, nAssoc; + unsigned int nDof; + // for PF muons + bool usePFMuon; + }; + + HistoDimensions hDim; + +private: + StringCutObjectSelector selector_; + bool wantTightMuon_; +}; + +#endif diff --git a/Validation/RecoMuon/src/RecoMuonValidator.cc b/Validation/RecoMuon/src/RecoMuonValidator.cc index 5cbc79dc19a7b..ed473528e2491 100644 --- a/Validation/RecoMuon/src/RecoMuonValidator.cc +++ b/Validation/RecoMuon/src/RecoMuonValidator.cc @@ -962,25 +962,28 @@ void RecoMuonValidator::analyze(const Event& event, const EventSetup& eventSetup TrackRef Track = iMuon->track(); - if (trackType_ == reco::InnerTk) { - Track = iMuon->track(); - trkNTrackerHits = countTrackerHits(*Track); - } else if (trackType_ == reco::OuterTk) { - Track = iMuon->standAloneMuon(); - } else if (trackType_ == reco::GlobalTk) { + if (Track.isNonnull()) { + commonME_->hMuonTrackP_->Fill(Track->p()); + commonME_->hMuonTrackPt_->Fill(Track->pt()); + commonME_->hMuonTrackEta_->Fill(Track->eta()); + commonME_->hMuonTrackPhi_->Fill(Track->phi()); + + //ip histograms + commonME_->hMuonTrackDxy_->Fill(Track->dxy()); + commonME_->hMuonTrackDz_->Fill(Track->dz()); + } + + if (iMuon->isGlobalMuon()) { Track = iMuon->combinedMuon(); glbNTrackerHits = countTrackerHits(*Track); glbNMuonHits = countMuonHits(*Track); + } else if (iMuon->isTrackerMuon()) { + Track = iMuon->track(); + trkNTrackerHits = countTrackerHits(*Track); + } else { + Track = iMuon->standAloneMuon(); } - commonME_->hMuonTrackP_->Fill(Track->p()); - commonME_->hMuonTrackPt_->Fill(Track->pt()); - commonME_->hMuonTrackEta_->Fill(Track->eta()); - commonME_->hMuonTrackPhi_->Fill(Track->phi()); - //ip histograms - commonME_->hMuonTrackDxy_->Fill(Track->dxy()); - commonME_->hMuonTrackDz_->Fill(Track->dz()); - NTrackerHits = countTrackerHits(*Track); muonME_->hNTrackerHits_->Fill(NTrackerHits); muonME_->hNTrackerHits_vs_Pt_->Fill(Track->pt(), NTrackerHits); diff --git a/Validation/RecoMuon/src/SealModule.cc b/Validation/RecoMuon/src/SealModule.cc index 2c3415fb4545e..c4bfc6f55c306 100644 --- a/Validation/RecoMuon/src/SealModule.cc +++ b/Validation/RecoMuon/src/SealModule.cc @@ -3,11 +3,13 @@ #include "Validation/RecoMuon/src/MuonTrackAnalyzer.h" #include "Validation/RecoMuon/src/MuonTrackResidualAnalyzer.h" #include "Validation/RecoMuon/src/RecoMuonValidator.h" +#include "Validation/RecoMuon/src/RecoDisplacedMuonValidator.h" #include "Validation/RecoMuon/src/MuonSeedTrack.h" #include "Validation/RecoMuon/src/GlobalMuonMatchAnalyzer.h" DEFINE_FWK_MODULE(MuonTrackAnalyzer); DEFINE_FWK_MODULE(MuonTrackResidualAnalyzer); DEFINE_FWK_MODULE(RecoMuonValidator); +DEFINE_FWK_MODULE(RecoDisplacedMuonValidator); DEFINE_FWK_MODULE(MuonSeedTrack); DEFINE_FWK_MODULE(GlobalMuonMatchAnalyzer); From 3cc7923b1c6915329dc072bef8c3b85cbe88915e Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Mon, 8 Jan 2024 15:50:00 +0100 Subject: [PATCH 3/8] Fixed displacedMuon sequences --- .../python/RecoDisplacedMuonValidator_cff.py | 24 +++++++++---------- .../RecoMuon/python/muonValidation_cff.py | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py index 7007a7fc3319e..7f9133173bec5 100644 --- a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py +++ b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py @@ -11,13 +11,13 @@ from SimMuon.MCTruth.MuonAssociatorByHits_cfi import muonAssociatorByHitsCommonParameters #tracker -muonAssociatorByHitsNoSimHitsHelperTrk = muonAssociatorByHitsNoSimHitsHelper.clone( +muondispAssociatorByHitsNoSimHitsHelperTrk = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = True, UseMuon = False ) recoDisplacedMuonVMuAssoc_trk = recoDisplacedMuonValidator.clone( subDir = 'Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Trk', - muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperTrk', + muAssocLabel = 'muondispAssociatorByHitsNoSimHitsHelperTrk', trackType = 'inner', selection = "isTrackerMuon", simLabel = ("TPmu"), @@ -25,13 +25,13 @@ ) recoDisplacedMuonVMuAssoc_trk.tpSelector.src = ("TPmu") #standalone -muonAssociatorByHitsNoSimHitsHelperStandalone = muonAssociatorByHitsNoSimHitsHelper.clone( +muondispAssociatorByHitsNoSimHitsHelperStandalone = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = False, UseMuon = True ) recoDisplacedMuonVMuAssoc_sta = recoDisplacedMuonValidator.clone( subDir = 'Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Sta', - muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperStandalone', + muAssocLabel = 'muondispAssociatorByHitsNoSimHitsHelperStandalone', trackType = 'outer', selection = "isStandAloneMuon", simLabel = ("TPmu"), @@ -40,13 +40,13 @@ ) recoDisplacedMuonVMuAssoc_sta.tpSelector.src = ("TPmu") #global -muonAssociatorByHitsNoSimHitsHelperGlobal = muonAssociatorByHitsNoSimHitsHelper.clone( +muondispAssociatorByHitsNoSimHitsHelperGlobal = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = True, UseMuon = True ) recoDisplacedMuonVMuAssoc_glb = recoDisplacedMuonValidator.clone( subDir = 'Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Glb', - muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperGlobal', + muAssocLabel = 'muondispAssociatorByHitsNoSimHitsHelperGlobal', trackType = 'global', selection = "isGlobalMuon", simLabel = ("TPmu"), @@ -54,13 +54,13 @@ ) recoDisplacedMuonVMuAssoc_glb.tpSelector.src = ("TPmu") #tight -muonAssociatorByHitsNoSimHitsHelperTight = muonAssociatorByHitsNoSimHitsHelper.clone( +muondispAssociatorByHitsNoSimHitsHelperTight = muonAssociatorByHitsNoSimHitsHelper.clone( UseTracker = True, UseMuon = True ) recoDisplacedMuonVMuAssoc_tgt = recoDisplacedMuonValidator.clone( subDir = 'Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Tgt', - muAssocLabel = 'muonAssociatorByHitsNoSimHitsHelperTight', + muAssocLabel = 'muondispAssociatorByHitsNoSimHitsHelperTight', trackType = 'global', selection = 'isGlobalMuon', wantTightMuon = True, @@ -75,8 +75,8 @@ # muonValidationRDMV_seq = cms.Sequence( - muonAssociatorByHitsNoSimHitsHelperTrk+recoDisplacedMuonVMuAssoc_trk - +muonAssociatorByHitsNoSimHitsHelperStandalone+recoDisplacedMuonVMuAssoc_sta - +muonAssociatorByHitsNoSimHitsHelperGlobal+recoDisplacedMuonVMuAssoc_glb - +muonAssociatorByHitsNoSimHitsHelperTight+recoDisplacedMuonVMuAssoc_tgt + muondispAssociatorByHitsNoSimHitsHelperTrk+recoDisplacedMuonVMuAssoc_trk + +muondispAssociatorByHitsNoSimHitsHelperStandalone+recoDisplacedMuonVMuAssoc_sta + +muondispAssociatorByHitsNoSimHitsHelperGlobal+recoDisplacedMuonVMuAssoc_glb + +muondispAssociatorByHitsNoSimHitsHelperTight+recoDisplacedMuonVMuAssoc_tgt ) diff --git a/Validation/RecoMuon/python/muonValidation_cff.py b/Validation/RecoMuon/python/muonValidation_cff.py index 414370dc52470..65f9ccf6cdc1c 100644 --- a/Validation/RecoMuon/python/muonValidation_cff.py +++ b/Validation/RecoMuon/python/muonValidation_cff.py @@ -315,12 +315,12 @@ # The full offline muon validation sequence # recoMuonValidation = cms.Sequence( TPtrack_seq + TPmu_seq + TPpfmu_seq + - muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq #+ muonValidationRDMV_seq + muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq + muonValidationRDMV_seq ) # optionally omit TABH recoMuonValidation_noTABH = cms.Sequence( TPtrack_seq + TPmu_seq + TPpfmu_seq + - muonValidation_noTABH_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq #+ muonValidationRDMV_seq + muonValidation_noTABH_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationDisplaced_seq + muonValidationRMV_seq + muonValidationRDMV_seq ) # ... and also displaced muons From 62a7ca9b6ad5c5860c735335be7d456a763f0e0c Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Tue, 9 Jan 2024 11:55:38 +0100 Subject: [PATCH 4/8] Tune hists + Add postproc --- ...rocessor_RecoDisplacedMuonValidator_cff.py | 97 +++++++++++++++++++ .../RecoMuon/python/PostProcessor_cff.py | 4 +- .../python/RecoDisplacedMuonValidator_cfi.py | 4 +- .../src/RecoDisplacedMuonValidator.cc | 26 ++--- 4 files changed, 115 insertions(+), 16 deletions(-) create mode 100644 Validation/RecoMuon/python/PostProcessor_RecoDisplacedMuonValidator_cff.py diff --git a/Validation/RecoMuon/python/PostProcessor_RecoDisplacedMuonValidator_cff.py b/Validation/RecoMuon/python/PostProcessor_RecoDisplacedMuonValidator_cff.py new file mode 100644 index 0000000000000..386a8f90c89fe --- /dev/null +++ b/Validation/RecoMuon/python/PostProcessor_RecoDisplacedMuonValidator_cff.py @@ -0,0 +1,97 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester + +postProcessorRecoDisplacedMuon = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring("Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc"), + #efficiencies and fractions + efficiency = cms.vstring("EffP 'Efficiency vs p' P SimP ", + "EffPt 'Efficiency vs p_{T}' Pt SimPt ", + "EffEta 'Efficiency vs #eta' Eta SimEta", + "EffPhi 'Efficiency vs #phi' Phi SimPhi", + "MisQProbPt 'Charge Mis-identification probability vs p_{T}' MisQPt SimPt ", + "MisQProbEta 'Charge Mis-identification probability vs #eta' MisQEta SimEta", + #fractions + "FractP 'Muontype fraction vs p' PMuon PMuonAll", + "FractPt 'Muontype fraction vs p_{T}' PtMuon PtMuonAll", + "FractEta 'Muontype fraction vs #eta' EtaMuon EtaMuonAll", + "FractPhi 'Muontype fraction vs #phi' PhiMuon PhiMuonAll", + ), + + resolution = cms.vstring("ErrP_vs_P '#sigma(p) vs p' ErrP_vs_P ", + "ErrP_vs_Eta '#sigma(p) vs #eta' ErrP_vs_Eta ", + "ErrPt_vs_Pt '#sigma(p_{T}) vs p_{T}' ErrPt_vs_Pt ", + "ErrPt_vs_Eta '#sigma(p_{T}) vs #eta' ErrPt_vs_Eta ", + "ErrEta_vs_Eta '#sigma(#eta) vs #eta ' ErrEta_vs_Eta ", + "ErrQPt_vs_Pt '#sigma(q/p_{T}) vs p_{T}' ErrQPt_vs_Pt ", + "ErrQPt_vs_Eta '#sigma(q/p_{T}) vs #eta' ErrQPt_vs_Eta ", + "PullEta_vs_Pt 'Pull of #eta vs p_{T}' PullEta_vs_Pt ", + "PullEta_vs_Eta 'Pull of #eta vs #eta' PullEta_vs_Eta", + "PullPhi_vs_Eta 'Pull of #phi vs #eta' PullPhi_vs_Eta", + "PullPt_vs_Pt 'Pull of p_{T} vs p_{T}' PullPt_vs_Pt ", + "PullPt_vs_Eta 'Pull of p_{T} vs #eta' PullPt_vs_Eta ", + ), + outputFileName = cms.untracked.string("") +) + +# for each type monitored +postProcessorRecoDisplacedMuonGlb = postProcessorRecoDisplacedMuon.clone( + subDirs = ["Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Glb"] +) +postProcessorRecoDisplacedMuonTrk = postProcessorRecoDisplacedMuon.clone( + subDirs = ["Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Trk"] +) +postProcessorRecoDisplacedMuonSta = postProcessorRecoDisplacedMuon.clone( + subDirs = ["Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Sta"] +) +postProcessorRecoDisplacedMuonTgt = postProcessorRecoDisplacedMuon.clone( + subDirs = ["Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_Tgt"] +) +postProcessorRecoDisplacedMuonGlbPF = postProcessorRecoDisplacedMuon.clone( + subDirs = ["Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_GlbPF"] +) +postProcessorRecoDisplacedMuonTrkPF = postProcessorRecoDisplacedMuon.clone( + subDirs = ["Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_TrkPF"] +) +postProcessorRecoDisplacedMuonStaPF = postProcessorRecoDisplacedMuon.clone( + subDirs = ["Muons/RecoDisplacedMuonV/RecoDisplacedMuon_MuonAssoc_StaPF"] +) +#not sure about this one, which types are monitored +postProcessorRecoDisplacedMuonComp = DQMEDHarvester( + "DQMGenericClient", + subDirs = cms.untracked.vstring("Muons/RecoDisplacedMuonV/"), + efficiency = cms.vstring( + "Eff_GlbSta_Eta 'Eff_{GLB,STA} vs #eta' RecoDisplacedMuon_MuonAssoc_Glb/EffEta RecoDisplacedMuon_MuonAssoc_Sta/EffEta", + "Eff_GlbSta_P 'Eff_{GLB,STA} vs p' RecoDisplacedMuon_MuonAssoc_Glb/EffP RecoDisplacedMuon_MuonAssoc_Sta/EffP", + "Eff_GlbSta_Phi 'Eff_{GLB,STA} vs #phi' RecoDisplacedMuon_MuonAssoc_Glb/EffPhi RecoDisplacedMuon_MuonAssoc_Sta/EffPhi", + "Eff_GlbSta_Pt 'Eff_{GLB,STA} vs p_{T}' RecoDisplacedMuon_MuonAssoc_Glb/EffPt RecoDisplacedMuon_MuonAssoc_Sta/EffPt", + "Eff_TgtGlb_Eta 'Eff_{TGT,GLB} vs #eta' RecoDisplacedMuon_MuonAssoc_Tgt/EffEta RecoDisplacedMuon_MuonAssoc_Glb/EffEta", + "Eff_TgtGlb_P 'Eff_{TGT,GLB} vs p' RecoDisplacedMuon_MuonAssoc_Tgt/EffP RecoDisplacedMuon_MuonAssoc_Glb/EffP", + "Eff_TgtGlb_Phi 'Eff_{TGT,GLB} vs #phi' RecoDisplacedMuon_MuonAssoc_Tgt/EffPhi RecoDisplacedMuon_MuonAssoc_Glb/EffPhi", + "Eff_TgtGlb_Pt 'Eff_{TGT,GLB} vs p_{T}' RecoDisplacedMuon_MuonAssoc_Tgt/EffPt RecoDisplacedMuon_MuonAssoc_Glb/EffPt", + ), + resolution = cms.vstring(""), + outputFileName = cms.untracked.string("") +) + +postProcessorRecoDisplacedMuonCompPF = DQMEDHarvester( + "DQMGenericClient", + subDirs = cms.untracked.vstring("Muons/RecoDisplacedMuonV/"), + efficiency = cms.vstring( + "Eff_GlbPFStaPF_Eta 'Eff_{GLBPF,STAPF} vs #eta' RecoDisplacedMuon_MuonAssoc_GlbPF/EffEta RecoDisplacedMuon_MuonAssoc_StaPF/EffEta", + "Eff_GlbPFStaPF_P 'Eff_{GLBPF,STAPF} vs p' RecoDisplacedMuon_MuonAssoc_GlbPF/EffP RecoDisplacedMuon_MuonAssoc_StaPF/EffP", + "Eff_GlbPFStaPF_Phi 'Eff_{GLBPF,STAPF} vs #phi' RecoDisplacedMuon_MuonAssoc_GlbPF/EffPhi RecoDisplacedMuon_MuonAssoc_StaPF/EffPhi", + "Eff_GlbPFStaPF_Pt 'Eff_{GLBPF,STAPF} vs p_{T}' RecoDisplacedMuon_MuonAssoc_GlbPF/EffPt RecoDisplacedMuon_MuonAssoc_StaPF/EffPt", + ), + resolution = cms.vstring(""), + outputFileName = cms.untracked.string("") +) + +postProcessorsRecoDisplacedMuonValidator_seq = cms.Sequence( postProcessorRecoDisplacedMuonGlb + * postProcessorRecoDisplacedMuonTrk + * postProcessorRecoDisplacedMuonSta + * postProcessorRecoDisplacedMuonTgt + * postProcessorRecoDisplacedMuonGlbPF + * postProcessorRecoDisplacedMuonTrkPF + * postProcessorRecoDisplacedMuonStaPF + * postProcessorRecoDisplacedMuonComp + * postProcessorRecoDisplacedMuonCompPF ) diff --git a/Validation/RecoMuon/python/PostProcessor_cff.py b/Validation/RecoMuon/python/PostProcessor_cff.py index dc232bd1176f6..9d3ae5479f5df 100644 --- a/Validation/RecoMuon/python/PostProcessor_cff.py +++ b/Validation/RecoMuon/python/PostProcessor_cff.py @@ -4,6 +4,7 @@ from DQMServices.Core.DQMEDHarvester import DQMEDHarvester from Validation.RecoMuon.PostProcessor_RecoMuonValidator_cff import * +from Validation.RecoMuon.PostProcessor_RecoDisplacedMuonValidator_cff import * postProcessorMuonTrack = DQMEDHarvester("DQMGenericClient", subDirs = cms.untracked.vstring("Muons/RecoMuonV/MuonTrack/*"), @@ -95,4 +96,5 @@ recoMuonPostProcessors = cms.Sequence( postProcessorMuonTrack * postProcessorMuonTrackComp - * postProcessorsRecoMuonValidator_seq ) + * postProcessorsRecoMuonValidator_seq + * postProcessorsRecoDisplacedMuonValidator_seq ) diff --git a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py index 85bb6b369f318..04661f6b433a9 100644 --- a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py +++ b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py @@ -45,11 +45,11 @@ maxEta = cms.untracked.double(2.5), nBinDxy = cms.untracked.uint32(350), - minDxy = cms.untracked.double(0), + minDxy = cms.untracked.double(-700), maxDxy = cms.untracked.double(700), nBinDz = cms.untracked.uint32(350), - minDz = cms.untracked.double(0), + minDz = cms.untracked.double(-700), maxDz = cms.untracked.double(700), nBinPhi = cms.untracked.uint32(25), diff --git a/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc index 364697d5e041a..c55cbaa6ac3df 100644 --- a/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc +++ b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc @@ -99,7 +99,7 @@ struct RecoDisplacedMuonValidator::MuonME { hSimEta_ = ibooker.book1D("SimEta", "#eta of simTracks", hDim.nBinEta, hDim.minEta, hDim.maxEta); hSimPhi_ = ibooker.book1D("SimPhi", "#phi of simTracks", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); hSimDxy_ = ibooker.book1D("SimDxy", "Dxy of simTracks", hDim.nBinDxy, hDim.minDxy, hDim.maxDxy); - hSimDz_ = ibooker.book1D("Dz", "Dz of simTracks", hDim.nBinDz, hDim.minDz, hDim.maxDz); + hSimDz_ = ibooker.book1D("SimDz", "Dz of simTracks", hDim.nBinDz, hDim.minDz, hDim.maxDz); //track multiplicities hNSim_ = ibooker.book1D("NSim", "Number of particles per event", hDim.nTrks, -0.5, hDim.nTrks + 0.5); @@ -765,31 +765,31 @@ void RecoDisplacedMuonValidator::bookHistograms(DQMStore::IBooker& ibooker, nHits + 0.5); //muon based kinematics - commonME_->hMuonP_ = ibooker.book1D("PMuon", "p of muon", hDim.nBinP, hDim.minP, hDim.maxP); - commonME_->hMuonPt_ = ibooker.book1D("PtMuon", "p_{T} of muon", hDim.nBinPt, hDim.minPt, hDim.maxPt); - commonME_->hMuonEta_ = ibooker.book1D("EtaMuon", "#eta of muon", hDim.nBinEta, hDim.minEta, hDim.maxEta); - commonME_->hMuonPhi_ = ibooker.book1D("PhiMuon", "#phi of muon", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + commonME_->hMuonP_ = ibooker.book1D("MuonP", "p of muon", hDim.nBinP, hDim.minP, hDim.maxP); + commonME_->hMuonPt_ = ibooker.book1D("MuonPt", "p_{T} of muon", hDim.nBinPt, hDim.minPt, hDim.maxPt); + commonME_->hMuonEta_ = ibooker.book1D("MuonEta", "#eta of muon", hDim.nBinEta, hDim.minEta, hDim.maxEta); + commonME_->hMuonPhi_ = ibooker.book1D("MuonPhi", "#phi of muon", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); //track based kinematics commonME_->hMuonTrackP_ = ibooker.book1D("PMuonTrack", "p of reco muon track", hDim.nBinP, hDim.minP, hDim.maxP); commonME_->hMuonTrackPt_ = - ibooker.book1D("PtMuonTrack", "p_{T} of reco muon track", hDim.nBinPt, hDim.minPt, hDim.maxPt); + ibooker.book1D("MuonTrackPt", "p_{T} of reco muon track", hDim.nBinPt, hDim.minPt, hDim.maxPt); commonME_->hMuonTrackEta_ = - ibooker.book1D("EtaMuonTrack", "#eta of reco muon track", hDim.nBinEta, hDim.minEta, hDim.maxEta); + ibooker.book1D("MuonTrackEta", "#eta of reco muon track", hDim.nBinEta, hDim.minEta, hDim.maxEta); commonME_->hMuonTrackPhi_ = - ibooker.book1D("PhiMuonTrack", "#phi of reco muon track", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + ibooker.book1D("MuonTrackPhi", "#phi of reco muon track", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); commonME_->hMuonTrackDxy_ = - ibooker.book1D("DxyMuonTrack", "Dxy of reco muon track", hDim.nBinDxy, hDim.minDxy, hDim.maxDxy); + ibooker.book1D("MuonTrackDxy", "Dxy of reco muon track", hDim.nBinDxy, hDim.minDxy, hDim.maxDxy); commonME_->hMuonTrackDz_ = - ibooker.book1D("DzMuonTrack", "Dz of reco muon track", hDim.nBinDz, hDim.minDz, hDim.maxDz); + ibooker.book1D("MuonTrackDz", "Dz of reco muon track", hDim.nBinDz, hDim.minDz, hDim.maxDz); //histograms for fractions commonME_->hMuonAllP_ = ibooker.book1D("PMuonAll", "p of muons of all types", hDim.nBinP, hDim.minP, hDim.maxP); commonME_->hMuonAllPt_ = - ibooker.book1D("PtMuonAll", "p_{T} of muon of all types", hDim.nBinPt, hDim.minPt, hDim.maxPt); + ibooker.book1D("MuonAllPt", "p_{T} of muon of all types", hDim.nBinPt, hDim.minPt, hDim.maxPt); commonME_->hMuonAllEta_ = - ibooker.book1D("EtaMuonAll", "#eta of muon of all types", hDim.nBinEta, hDim.minEta, hDim.maxEta); + ibooker.book1D("MuonAllEta", "#eta of muon of all types", hDim.nBinEta, hDim.minEta, hDim.maxEta); commonME_->hMuonAllPhi_ = - ibooker.book1D("PhiMuonAll", "#phi of muon of all types", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + ibooker.book1D("MuonAllPhi", "#phi of muon of all types", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); muonME_->bookHistos(ibooker, subDir_, hDim); } From 7e9b3ec048a6b4cbc00125bb91b8510d2f3db28f Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Tue, 27 Feb 2024 12:56:32 +0100 Subject: [PATCH 5/8] Set Dxy and Dz hist limits --- .../python/RecoDisplacedMuonValidator_cff.py | 9 +++++++-- .../python/RecoDisplacedMuonValidator_cfi.py | 12 ++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py index 7f9133173bec5..93d2255b0aa0a 100644 --- a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py +++ b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py @@ -35,8 +35,13 @@ trackType = 'outer', selection = "isStandAloneMuon", simLabel = ("TPmu"), - tpRefVector = True - + tpRefVector = True, + nBinDxy = cms.untracked.uint32(350), + minDxy = cms.untracked.double(-350), + maxDxy = cms.untracked.double(350), + nBinDz = cms.untracked.uint32(350), + minDz = cms.untracked.double(-350), + maxDz = cms.untracked.double(350) ) recoDisplacedMuonVMuAssoc_sta.tpSelector.src = ("TPmu") #global diff --git a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py index 04661f6b433a9..22b3c82f5280a 100644 --- a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py +++ b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py @@ -44,13 +44,13 @@ minEta = cms.untracked.double(-2.5), maxEta = cms.untracked.double(2.5), - nBinDxy = cms.untracked.uint32(350), - minDxy = cms.untracked.double(-700), - maxDxy = cms.untracked.double(700), + nBinDxy = cms.untracked.uint32(300), + minDxy = cms.untracked.double(-60), # 350 for DSA, 60 for DGL/DTK + maxDxy = cms.untracked.double(60), - nBinDz = cms.untracked.uint32(350), - minDz = cms.untracked.double(-700), - maxDz = cms.untracked.double(700), + nBinDz = cms.untracked.uint32(300), + minDz = cms.untracked.double(-60), + maxDz = cms.untracked.double(60), nBinPhi = cms.untracked.uint32(25), From 42bfc146b2122e9b0b88f454894be3674c8dd310 Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Fri, 8 Mar 2024 09:24:41 +0100 Subject: [PATCH 6/8] Wider binning in Dxy Dz and rename hists to original --- .../python/RecoDisplacedMuonValidator_cff.py | 4 ++-- .../python/RecoDisplacedMuonValidator_cfi.py | 4 ++-- .../src/RecoDisplacedMuonValidator.cc | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py index 93d2255b0aa0a..81ca3ca4e57e4 100644 --- a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py +++ b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cff.py @@ -36,10 +36,10 @@ selection = "isStandAloneMuon", simLabel = ("TPmu"), tpRefVector = True, - nBinDxy = cms.untracked.uint32(350), + nBinDxy = cms.untracked.uint32(100), minDxy = cms.untracked.double(-350), maxDxy = cms.untracked.double(350), - nBinDz = cms.untracked.uint32(350), + nBinDz = cms.untracked.uint32(100), minDz = cms.untracked.double(-350), maxDz = cms.untracked.double(350) ) diff --git a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py index 22b3c82f5280a..22686744ececc 100644 --- a/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py +++ b/Validation/RecoMuon/python/RecoDisplacedMuonValidator_cfi.py @@ -44,11 +44,11 @@ minEta = cms.untracked.double(-2.5), maxEta = cms.untracked.double(2.5), - nBinDxy = cms.untracked.uint32(300), + nBinDxy = cms.untracked.uint32(100), minDxy = cms.untracked.double(-60), # 350 for DSA, 60 for DGL/DTK maxDxy = cms.untracked.double(60), - nBinDz = cms.untracked.uint32(300), + nBinDz = cms.untracked.uint32(100), minDz = cms.untracked.double(-60), maxDz = cms.untracked.double(60), diff --git a/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc index c55cbaa6ac3df..6a03ceba0a6cd 100644 --- a/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc +++ b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc @@ -765,31 +765,31 @@ void RecoDisplacedMuonValidator::bookHistograms(DQMStore::IBooker& ibooker, nHits + 0.5); //muon based kinematics - commonME_->hMuonP_ = ibooker.book1D("MuonP", "p of muon", hDim.nBinP, hDim.minP, hDim.maxP); - commonME_->hMuonPt_ = ibooker.book1D("MuonPt", "p_{T} of muon", hDim.nBinPt, hDim.minPt, hDim.maxPt); - commonME_->hMuonEta_ = ibooker.book1D("MuonEta", "#eta of muon", hDim.nBinEta, hDim.minEta, hDim.maxEta); - commonME_->hMuonPhi_ = ibooker.book1D("MuonPhi", "#phi of muon", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + commonME_->hMuonP_ = ibooker.book1D("PMuon", "p of muon", hDim.nBinP, hDim.minP, hDim.maxP); + commonME_->hMuonPt_ = ibooker.book1D("PtMuon", "p_{T} of muon", hDim.nBinPt, hDim.minPt, hDim.maxPt); + commonME_->hMuonEta_ = ibooker.book1D("EtaMuon", "#eta of muon", hDim.nBinEta, hDim.minEta, hDim.maxEta); + commonME_->hMuonPhi_ = ibooker.book1D("PhiMuon", "#phi of muon", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); //track based kinematics commonME_->hMuonTrackP_ = ibooker.book1D("PMuonTrack", "p of reco muon track", hDim.nBinP, hDim.minP, hDim.maxP); commonME_->hMuonTrackPt_ = - ibooker.book1D("MuonTrackPt", "p_{T} of reco muon track", hDim.nBinPt, hDim.minPt, hDim.maxPt); + ibooker.book1D("PtMuonTrack", "p_{T} of reco muon track", hDim.nBinPt, hDim.minPt, hDim.maxPt); commonME_->hMuonTrackEta_ = - ibooker.book1D("MuonTrackEta", "#eta of reco muon track", hDim.nBinEta, hDim.minEta, hDim.maxEta); + ibooker.book1D("EtaMuonTrack", "#eta of reco muon track", hDim.nBinEta, hDim.minEta, hDim.maxEta); commonME_->hMuonTrackPhi_ = - ibooker.book1D("MuonTrackPhi", "#phi of reco muon track", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + ibooker.book1D("PhiMuonTrack", "#phi of reco muon track", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); commonME_->hMuonTrackDxy_ = - ibooker.book1D("MuonTrackDxy", "Dxy of reco muon track", hDim.nBinDxy, hDim.minDxy, hDim.maxDxy); + ibooker.book1D("DxyMuonTrack", "Dxy of reco muon track", hDim.nBinDxy, hDim.minDxy, hDim.maxDxy); commonME_->hMuonTrackDz_ = - ibooker.book1D("MuonTrackDz", "Dz of reco muon track", hDim.nBinDz, hDim.minDz, hDim.maxDz); + ibooker.book1D("DzMuonTrack", "Dz of reco muon track", hDim.nBinDz, hDim.minDz, hDim.maxDz); //histograms for fractions commonME_->hMuonAllP_ = ibooker.book1D("PMuonAll", "p of muons of all types", hDim.nBinP, hDim.minP, hDim.maxP); commonME_->hMuonAllPt_ = - ibooker.book1D("MuonAllPt", "p_{T} of muon of all types", hDim.nBinPt, hDim.minPt, hDim.maxPt); + ibooker.book1D("PtMuonAll", "p_{T} of muon of all types", hDim.nBinPt, hDim.minPt, hDim.maxPt); commonME_->hMuonAllEta_ = - ibooker.book1D("MuonAllEta", "#eta of muon of all types", hDim.nBinEta, hDim.minEta, hDim.maxEta); + ibooker.book1D("EtaMuonAll", "#eta of muon of all types", hDim.nBinEta, hDim.minEta, hDim.maxEta); commonME_->hMuonAllPhi_ = - ibooker.book1D("MuonAllPhi", "#phi of muon of all types", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); + ibooker.book1D("PhiMuonAll", "#phi of muon of all types", hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); muonME_->bookHistos(ibooker, subDir_, hDim); } From 84e8503cba4455117fb93c6283da128407eff29d Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Fri, 8 Mar 2024 09:53:12 +0100 Subject: [PATCH 7/8] Code-format --- Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc index 6a03ceba0a6cd..7e1248da46446 100644 --- a/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc +++ b/Validation/RecoMuon/src/RecoDisplacedMuonValidator.cc @@ -690,8 +690,8 @@ RecoDisplacedMuonValidator::RecoDisplacedMuonValidator(const edm::ParameterSet& } void RecoDisplacedMuonValidator::bookHistograms(DQMStore::IBooker& ibooker, - edm::Run const& iRun, - edm::EventSetup const& /* iSetup */) { + edm::Run const& iRun, + edm::EventSetup const& /* iSetup */) { // book histograms ibooker.cd(); From 59fba37d3ca167e6adf76ca61a51a638fbc81a5f Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Mon, 11 Mar 2024 15:31:25 +0100 Subject: [PATCH 8/8] Remove displaced validation from fastsim sequence --- Validation/RecoMuon/python/muonValidation_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/RecoMuon/python/muonValidation_cff.py b/Validation/RecoMuon/python/muonValidation_cff.py index 65f9ccf6cdc1c..d4c0aec3aa6ab 100644 --- a/Validation/RecoMuon/python/muonValidation_cff.py +++ b/Validation/RecoMuon/python/muonValidation_cff.py @@ -330,7 +330,7 @@ # no displaced muons in fastsim from Configuration.Eras.Modifier_fastSim_cff import fastSim -fastSim.toReplaceWith(recoMuonValidation, cms.Sequence(cms.SequencePlaceholder("TPtrack") + cms.SequencePlaceholder("TPmu") + cms.SequencePlaceholder("TPpfmu") + muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationRMV_seq + muonValidationRDMV_seq)) +fastSim.toReplaceWith(recoMuonValidation, cms.Sequence(cms.SequencePlaceholder("TPtrack") + cms.SequencePlaceholder("TPmu") + cms.SequencePlaceholder("TPpfmu") + muonValidation_seq + muonValidationTEV_seq + muonValidationRefit_seq + muonValidationRMV_seq)) # sequence for cosmic muons recoCosmicMuonValidation = cms.Sequence(