diff --git a/DQM/TrackingMonitorSource/interface/TrackToTrackComparisonHists.h b/DQM/TrackingMonitorSource/interface/TrackToTrackComparisonHists.h index bc1544703fe76..be671fbff0397 100644 --- a/DQM/TrackingMonitorSource/interface/TrackToTrackComparisonHists.h +++ b/DQM/TrackingMonitorSource/interface/TrackToTrackComparisonHists.h @@ -12,6 +12,8 @@ #include "FWCore/Utilities/interface/EDGetToken.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" +#include "DataFormats/Scalers/interface/LumiScalers.h" +#include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h" #include "DQMServices/Core/interface/MonitorElement.h" #include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" @@ -41,6 +43,7 @@ class TrackToTrackComparisonHists : public DQMEDAnalyzer { MonitorElement *h_tracks, *h_pt, *h_eta, *h_phi, *h_dxy, *h_dz, *h_dxyWRTpv, *h_dzWRTpv, *h_charge, *h_hits; MonitorElement *h_dRmin, *h_dRmin_l; MonitorElement* h_pt_vs_eta; + MonitorElement *h_onlinelumi, *h_PU, *h_ls; }; struct matchingME { @@ -69,8 +72,14 @@ class TrackToTrackComparisonHists : public DQMEDAnalyzer { void book_generic_tracks_histos(DQMStore::IBooker& ibooker, generalME& mes, TString label, std::string& dir); void book_matching_tracks_histos(DQMStore::IBooker& ibooker, matchingME& mes, TString label, std::string& dir); - void fill_generic_tracks_histos( - generalME& mes, reco::Track* trk, reco::BeamSpot* bs, reco::Vertex* pv, bool requirePlateau = true); + void fill_generic_tracks_histos(generalME& mes, + reco::Track* trk, + reco::BeamSpot* bs, + reco::Vertex* pv, + unsigned int ls, + double onlinelumi, + double PU, + bool requirePlateau = true); void fill_matching_tracks_histos( matchingME& mes, reco::Track* mon, reco::Track* ref, reco::BeamSpot* bs, reco::Vertex* pv); @@ -86,6 +95,8 @@ class TrackToTrackComparisonHists : public DQMEDAnalyzer { edm::EDGetTokenT referenceBSToken_; edm::EDGetTokenT monitoredPVToken_; edm::EDGetTokenT referencePVToken_; + edm::EDGetTokenT lumiScalersToken_; + edm::EDGetTokenT onlineMetaDataDigisToken_; private: // edm::ParameterSet conf_; @@ -130,4 +141,10 @@ class TrackToTrackComparisonHists : public DQMEDAnalyzer { unsigned int dxyRes_nbin; double dzRes_rangeMin, dzRes_rangeMax; unsigned int dzRes_nbin; + unsigned int ls_rangeMin, ls_rangeMax; + unsigned int ls_nbin; + double PU_rangeMin, PU_rangeMax; + unsigned int PU_nbin; + double onlinelumi_rangeMin, onlinelumi_rangeMax; + unsigned int onlinelumi_nbin; }; diff --git a/DQM/TrackingMonitorSource/python/TrackToTrackComparisonHists_cfi.py b/DQM/TrackingMonitorSource/python/TrackToTrackComparisonHists_cfi.py new file mode 100644 index 0000000000000..de54238c01b93 --- /dev/null +++ b/DQM/TrackingMonitorSource/python/TrackToTrackComparisonHists_cfi.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +from DQM.TrackingMonitorSource.trackToTrackComparisonHists_cfi import trackToTrackComparisonHists +from Configuration.Eras.Modifier_run3_common_cff import run3_common +from Configuration.Eras.Modifier_phase2_common_cff import phase2_common + +TrackToTrackComparisonHists = trackToTrackComparisonHists.clone() + +run3_common.toModify(TrackToTrackComparisonHists.histoPSet, onlinelumi_nbin=375, onlinelumi_rangeMin=200., onlinelumi_rangeMax=25000.) +phase2_common.toModify(TrackToTrackComparisonHists.histoPSet, PU_nbin=200, PU_rangeMin=0., PU_rangeMax=200.) \ No newline at end of file diff --git a/DQM/TrackingMonitorSource/src/TrackToTrackComparisonHists.cc b/DQM/TrackingMonitorSource/src/TrackToTrackComparisonHists.cc index 530d8a6abd4e7..a9fbef6ec0b5a 100644 --- a/DQM/TrackingMonitorSource/src/TrackToTrackComparisonHists.cc +++ b/DQM/TrackingMonitorSource/src/TrackToTrackComparisonHists.cc @@ -6,6 +6,7 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "DataFormats/VertexReco/interface/Vertex.h" +#include "DataFormats/Luminosity/interface/LumiSummary.h" #include "DataFormats/Math/interface/deltaR.h" #include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h" @@ -35,6 +36,9 @@ TrackToTrackComparisonHists::TrackToTrackComparisonHists(const edm::ParameterSet referenceBSToken_ = consumes(iConfig.getParameter("referenceBeamSpot")); monitoredPVToken_ = consumes(iConfig.getParameter("monitoredPrimaryVertices")); referencePVToken_ = consumes(iConfig.getParameter("referencePrimaryVertices")); + lumiScalersToken_ = consumes(iConfig.getParameter("scalers")); + onlineMetaDataDigisToken_ = + consumes(iConfig.getParameter("onlineMetaDataDigis")); referenceTracksMEs_.label = referenceTrackInputTag_.label(); matchedReferenceTracksMEs_.label = referenceTrackInputTag_.label() + "_matched"; @@ -68,6 +72,31 @@ void TrackToTrackComparisonHists::analyze(const edm::Event& iEvent, const edm::E return; } + // + // Get Lumi/LS Info + // + + unsigned int ls = iEvent.id().luminosityBlock(); + + double onlinelumi = -1.f; + double PU = -1.f; + + auto const lumiScalersHandle = iEvent.getHandle(lumiScalersToken_); + auto const onlineMetaDataDigisHandle = iEvent.getHandle(onlineMetaDataDigisToken_); + + if (onlineMetaDataDigisHandle.isValid()) { + onlinelumi = onlineMetaDataDigisHandle->instLumi(); + PU = onlineMetaDataDigisHandle->avgPileUp(); + } else if (lumiScalersHandle.isValid() and not lumiScalersHandle->empty()) { + edm::LogError("TrackToTrackComparisonHists") << "onlineMetaDataDigisHandle not found, trying SCAL"; + auto const scalit = lumiScalersHandle->begin(); + onlinelumi = scalit->instantLumi(); + PU = scalit->pileup(); + } else { + edm::LogError("TrackToTrackComparisonHists") << "lumiScalersHandle not found or empty, skipping event"; + return; + } + // // Get Reference Track Info // @@ -164,7 +193,7 @@ void TrackToTrackComparisonHists::analyze(const edm::Event& iEvent, const edm::E if (fabs(dzWRTpv) > dzWRTPvCut_) continue; - fill_generic_tracks_histos(*&referenceTracksMEs_, &track, &referenceBS, &referencePV); + fill_generic_tracks_histos(*&referenceTracksMEs_, &track, &referenceBS, &referencePV, ls, onlinelumi, PU); std::map trackDRmap = pItr->second; if (trackDRmap.empty()) { @@ -183,7 +212,7 @@ void TrackToTrackComparisonHists::analyze(const edm::Event& iEvent, const edm::E if (matched) { nMatchedReferenceTracks++; - fill_generic_tracks_histos(*&matchedReferenceTracksMEs_, &track, &referenceBS, &referencePV); + fill_generic_tracks_histos(*&matchedReferenceTracksMEs_, &track, &referenceBS, &referencePV, ls, onlinelumi, PU); (matchedReferenceTracksMEs_.h_dRmin)->Fill(dRmin); (matchedReferenceTracksMEs_.h_dRmin_l)->Fill(dRmin); @@ -209,7 +238,7 @@ void TrackToTrackComparisonHists::analyze(const edm::Event& iEvent, const edm::E if (fabs(dzWRTpv) > dzWRTPvCut_) continue; - fill_generic_tracks_histos(*&monitoredTracksMEs_, &track, &monitoredBS, &monitoredPV); + fill_generic_tracks_histos(*&monitoredTracksMEs_, &track, &monitoredBS, &monitoredPV, ls, onlinelumi, PU); std::map trackDRmap = pItr->second; if (trackDRmap.empty()) { @@ -228,7 +257,8 @@ void TrackToTrackComparisonHists::analyze(const edm::Event& iEvent, const edm::E if (!matched) { nUnmatchedMonitoredTracks++; - fill_generic_tracks_histos(*&unMatchedMonitoredTracksMEs_, &track, &monitoredBS, &monitoredPV); + fill_generic_tracks_histos( + *&unMatchedMonitoredTracksMEs_, &track, &monitoredBS, &monitoredPV, ls, onlinelumi, PU); (unMatchedMonitoredTracksMEs_.h_dRmin)->Fill(dRmin); (unMatchedMonitoredTracksMEs_.h_dRmin_l)->Fill(dRmin); } @@ -282,6 +312,8 @@ void TrackToTrackComparisonHists::fillDescriptions(edm::ConfigurationDescription desc.add("referenceTrack", edm::InputTag("generalTracks")); desc.add("referenceBeamSpot", edm::InputTag("offlineBeamSpot")); desc.add("referencePrimaryVertices", edm::InputTag("offlinePrimaryVertices")); + desc.add("scalers", edm::InputTag("scalersRawToDigi")); + desc.add("onlineMetaDataDigis", edm::InputTag("onlineMetaDataDigis")); desc.add("topDirName", "HLT/Tracking/ValidationWRTOffline"); desc.add("dRmin", 0.002); @@ -380,6 +412,17 @@ void TrackToTrackComparisonHists::book_generic_tracks_histos(DQMStore::IBooker& Pt_nbin, Pt_rangeMin, Pt_rangeMax); + + // counts of tracks vs lumi + // for this moment, xmin,xmax and binning are hardcoded, maybe in future in a config file! + // have to add (declare) this in the .h file as well + (mes.h_onlinelumi) = ibooker.book1D(label + "_onlinelumi", + "number of tracks vs onlinelumi", + onlinelumi_nbin, + onlinelumi_rangeMin, + onlinelumi_rangeMax); + (mes.h_ls) = ibooker.book1D(label + "_ls", "number of tracks vs ls", ls_nbin, ls_rangeMin, ls_rangeMax); + (mes.h_PU) = ibooker.book1D(label + "_PU", "number of tracks vs PU", PU_nbin, PU_rangeMin, PU_rangeMax); } void TrackToTrackComparisonHists::book_matching_tracks_histos(DQMStore::IBooker& ibooker, @@ -437,8 +480,14 @@ void TrackToTrackComparisonHists::book_matching_tracks_histos(DQMStore::IBooker& (mes.h_dHits) = ibooker.book1D(label + "_dHits", "#Delta track number of hits", 39, -19.5, 19.5); } -void TrackToTrackComparisonHists::fill_generic_tracks_histos( - generalME& mes, reco::Track* trk, reco::BeamSpot* bs, reco::Vertex* pv, bool requirePlateau) { +void TrackToTrackComparisonHists::fill_generic_tracks_histos(generalME& mes, + reco::Track* trk, + reco::BeamSpot* bs, + reco::Vertex* pv, + unsigned int ls, + double onlinelumi, + double PU, + bool requirePlateau) { float pt = trk->pt(); float eta = trk->eta(); float phi = trk->phi(); @@ -463,6 +512,9 @@ void TrackToTrackComparisonHists::fill_generic_tracks_histos( (mes.h_dzWRTpv)->Fill(dzWRTpv); (mes.h_charge)->Fill(charge); (mes.h_hits)->Fill(nhits); + (mes.h_onlinelumi)->Fill(onlinelumi); + (mes.h_ls)->Fill(ls); + (mes.h_PU)->Fill(PU); } if (pTOnPlateau || !requirePlateau) { @@ -553,6 +605,18 @@ void TrackToTrackComparisonHists::initialize_parameter(const edm::ParameterSet& dzRes_rangeMin = pset.getParameter("dzRes_rangeMin"); dzRes_rangeMax = pset.getParameter("dzRes_rangeMax"); dzRes_nbin = pset.getParameter("dzRes_nbin"); + + ls_rangeMin = pset.getParameter("ls_rangeMin"); + ls_rangeMax = pset.getParameter("ls_rangeMax"); + ls_nbin = pset.getParameter("ls_nbin"); + + onlinelumi_rangeMin = pset.getParameter("onlinelumi_rangeMin"); + onlinelumi_rangeMax = pset.getParameter("onlinelumi_rangeMax"); + onlinelumi_nbin = pset.getParameter("onlinelumi_nbin"); + + PU_rangeMin = pset.getParameter("PU_rangeMin"); + PU_rangeMax = pset.getParameter("PU_rangeMax"); + PU_nbin = pset.getParameter("PU_nbin"); } void TrackToTrackComparisonHists::fillHistoPSetDescription(edm::ParameterSetDescription& pset) { @@ -595,4 +659,16 @@ void TrackToTrackComparisonHists::fillHistoPSetDescription(edm::ParameterSetDesc pset.add("dzRes_rangeMin", -0.05); pset.add("dzRes_rangeMax", 0.05); pset.add("dzRes_nbin", 150); + + pset.add("ls_rangeMin", 0); + pset.add("ls_rangeMax", 3000); + pset.add("ls_nbin", 300); + + pset.add("onlinelumi_rangeMin", 0.0); + pset.add("onlinelumi_rangeMax", 20000.0); + pset.add("onlinelumi_nbin", 200); + + pset.add("PU_rangeMin", 0.0); + pset.add("PU_rangeMax", 120.0); + pset.add("PU_nbin", 120); } diff --git a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py index 468e3faf2a14d..5734f718a7d7f 100644 --- a/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py +++ b/DQMOffline/Trigger/python/BTVHLTOfflineSource_cfi.py @@ -44,14 +44,14 @@ # # Relative Online-Offline Track Monitoring # -from DQM.TrackingMonitorSource.trackToTrackComparisonHists_cfi import trackToTrackComparisonHists +from DQM.TrackingMonitorSource.TrackToTrackComparisonHists_cfi import TrackToTrackComparisonHists referenceTracksForHLTBTag = cms.EDFilter('TrackSelector', src = cms.InputTag('generalTracks'), cut = cms.string("quality('highPurity')") ) -bTagHLTTrackMonitoring_muPF1 = trackToTrackComparisonHists.clone( +bTagHLTTrackMonitoring_muPF1 = TrackToTrackComparisonHists.clone( dzWRTPvCut = 0.1, monitoredTrack = "hltMergedTracks", referenceTrack = "referenceTracksForHLTBTag", diff --git a/DQMOffline/Trigger/python/TrackToTrackMonitoring_cff.py b/DQMOffline/Trigger/python/TrackToTrackMonitoring_cff.py index aa82eac2f8890..62b13daf49481 100644 --- a/DQMOffline/Trigger/python/TrackToTrackMonitoring_cff.py +++ b/DQMOffline/Trigger/python/TrackToTrackMonitoring_cff.py @@ -2,7 +2,7 @@ from DQMServices.Core.DQM_cfg import * DQMStore.collateHistograms =cms.untracked.bool(True) -from DQM.TrackingMonitorSource.trackToTrackComparisonHists_cfi import trackToTrackComparisonHists +from DQM.TrackingMonitorSource.TrackToTrackComparisonHists_cfi import TrackToTrackComparisonHists trackSelector = cms.EDFilter('TrackSelector', src = cms.InputTag('generalTracks'), @@ -12,7 +12,7 @@ cut = "quality('highPurity')" ) -hltMerged2highPurity = trackToTrackComparisonHists.clone( +hltMerged2highPurity = TrackToTrackComparisonHists.clone( monitoredTrack = "hltMergedTracks", referenceTrack = "highPurityTracks", monitoredBeamSpot = "hltOnlineBeamSpot", @@ -22,7 +22,7 @@ monitoredPrimaryVertices = "hltVerticesPFSelector" ) -hltMerged2highPurityPV = trackToTrackComparisonHists.clone( +hltMerged2highPurityPV = TrackToTrackComparisonHists.clone( dzWRTPvCut = 0.1, monitoredTrack = "hltMergedTracks", referenceTrack = "highPurityTracks", diff --git a/DQMOffline/Trigger/python/TrackingMonitoring_Client_cff.py b/DQMOffline/Trigger/python/TrackingMonitoring_Client_cff.py index 587fb0531d74b..0ff5d95b4f6e4 100644 --- a/DQMOffline/Trigger/python/TrackingMonitoring_Client_cff.py +++ b/DQMOffline/Trigger/python/TrackingMonitoring_Client_cff.py @@ -46,6 +46,9 @@ "Eff_dzWRTpv 'Relative Efficiency vs dzWRTpv;d_{z};relative efficiency' ref_matched_dzWRTpv ref_dzWRTpv eff", "Eff_charge 'Relative Efficiency vs charge;charge;relative efficiency' ref_matched_charge ref_charge eff", "Eff_hits 'Relative Efficiency vs hits;number of hits;relative efficiency' ref_matched_hits ref_hits eff", + "Eff_OnlineLumi 'Relative Efficiency vs OnlineLumi;OnlineLumi E30 [Hz cm^{-2}];relative efficiency' ref_matched_onlinelumi ref_onlinelumi eff", + "Eff_LS 'Relative Efficiency vs LS;LS;relative efficiency' ref_matched_ls ref_ls eff", + "Eff_PU 'Relative Efficiency vs PU;PU;relative efficiency' ref_matched_PU ref_PU eff", "FakeRate_pt 'Relative Fake Rate vs Pt;#P_T;relative fake rate' mon_unMatched_pt mon_pt eff", "FakeRate_eta 'Relative Fake Rate vs Eta;#eta;relative fake rate' mon_unMatched_eta mon_eta eff", @@ -56,6 +59,9 @@ "FakeRate_dzWRTpv 'Relative Fake Rate vs dzWRTpv;d_{z};relative fake rate' mon_unMatched_dzWRTpv mon_dzWRTpv eff", "FakeRate_charge 'Relative Fake Rate vs charge;charge;relative fake rate' mon_unMatched_charge mon_charge eff", "FakeRate_hits 'Relative Fake Rate vs hits;number of hits;relative fake rate' mon_unMatched_hits mon_hits eff", + "FakeRate_OnlineLumi 'Relative Fake Rate vs OnlineLumi;OnlineLumi E30 [Hz cm^{-2}];relative efficiency' mon_unMatched_onlinelumi mon_onlinelumi eff", + "FakeRate_LS 'Relative Fake Rate vs LS;LS;relative efficiency' mon_unMatched_ls mon_ls eff", + "FakeRate_PU 'Relative Fake Rate vs PU;PU;relative efficiency' mon_unMatched_PU mon_PU eff", ), )