diff --git a/DQMOffline/Alignment/interface/DiMuonVertexMonitor.h b/DQMOffline/Alignment/interface/DiMuonVertexMonitor.h index 567f538a80db9..b6c1737c7c493 100644 --- a/DQMOffline/Alignment/interface/DiMuonVertexMonitor.h +++ b/DQMOffline/Alignment/interface/DiMuonVertexMonitor.h @@ -15,6 +15,7 @@ #include // user includes +#include "DQMOffline/Alignment/interface/DiLeptonPlotHelpers.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/Framework/interface/Event.h" @@ -76,9 +77,31 @@ class DiMuonVertexMonitor : public DQMEDAnalyzer { MonitorElement *hCosPhi3D_; MonitorElement *hCosPhiInv_; MonitorElement *hCosPhiInv3D_; + MonitorElement *hCosPhiUnbalance_; + MonitorElement *hCosPhi3DUnbalance_; MonitorElement *hInvMass_; MonitorElement *hCutFlow_; + // 2D histograms of pointing angle vs variable + edm::ParameterSet CosPhi3DConfiguration_; + DiLepPlotHelp::PlotsVsKinematics CosPhi3DPlots_ = DiLepPlotHelp::PlotsVsKinematics(DiLepPlotHelp::MM); + + // 2D histograms of 3D PV-SV distance vs variable + edm::ParameterSet SVDistConfiguration_; + DiLepPlotHelp::PlotsVsKinematics SVDistPlots_ = DiLepPlotHelp::PlotsVsKinematics(DiLepPlotHelp::MM); + + // 2D histograms of 3D PV-SV distance significance vs variable + edm::ParameterSet SVDistSigConfiguration_; + DiLepPlotHelp::PlotsVsKinematics SVDistSigPlots_ = DiLepPlotHelp::PlotsVsKinematics(DiLepPlotHelp::MM); + + // 2D histograms of PV-SV transverse distance vs variable + edm::ParameterSet SVDist3DConfiguration_; + DiLepPlotHelp::PlotsVsKinematics SVDist3DPlots_ = DiLepPlotHelp::PlotsVsKinematics(DiLepPlotHelp::MM); + + // 2D histograms of PV-SV transverse distance significance vs variable + edm::ParameterSet SVDist3DSigConfiguration_; + DiLepPlotHelp::PlotsVsKinematics SVDist3DSigPlots_ = DiLepPlotHelp::PlotsVsKinematics(DiLepPlotHelp::MM); + // impact parameters information MonitorElement *hdxy_; MonitorElement *hdz_; diff --git a/DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py b/DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py index 17b5359da7f0d..1f61d6dfadb88 100644 --- a/DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py +++ b/DQMOffline/Alignment/python/ALCARECOTkAlDQM_cff.py @@ -164,7 +164,12 @@ decayMotherName = "J/#psi", vertices = 'offlinePrimaryVertices', FolderName = "AlCaReco/"+__selectionName, - maxSVdist = 50 + maxSVdist = 50, + CosPhi3DConfig = dict(maxDeltaEta = 1.3), + SVDistConfig = dict(maxDeltaEta = 1.3), + SVDistSigConfig = dict(maxDeltaEta = 1.3), + SVDist3DConfig = dict(maxDeltaEta = 1.3), + SVDist3DSigConfig = dict(maxDeltaEta = 1.3) ) ALCARECOTkAlJpsiMassBiasDQM = DQMOffline.Alignment.DiMuonMassBiasMonitor_cfi.DiMuonMassBiasMonitor.clone( @@ -234,7 +239,12 @@ decayMotherName = "#Upsilon", vertices = 'offlinePrimaryVertices', FolderName = "AlCaReco/"+__selectionName, - maxSVdist = 50 + maxSVdist = 50, + CosPhi3DConfig = dict(maxDeltaEta = 1.6), + SVDistConfig = dict(maxDeltaEta = 1.6), + SVDistSigConfig = dict(maxDeltaEta = 1.6), + SVDist3DConfig = dict(maxDeltaEta = 1.6), + SVDist3DSigConfig = dict(maxDeltaEta = 1.6) ) ALCARECOTkAlUpsilonMassBiasDQM = DQMOffline.Alignment.DiMuonMassBiasMonitor_cfi.DiMuonMassBiasMonitor.clone( diff --git a/DQMOffline/Alignment/python/DiMuonVertexMonitor_cfi.py b/DQMOffline/Alignment/python/DiMuonVertexMonitor_cfi.py index 7c30903ae51cb..97619766cb643 100644 --- a/DQMOffline/Alignment/python/DiMuonVertexMonitor_cfi.py +++ b/DQMOffline/Alignment/python/DiMuonVertexMonitor_cfi.py @@ -6,4 +6,54 @@ decayMotherName = cms.string('Z'), vertices = cms.InputTag('offlinePrimaryVertices'), FolderName = cms.string('DiMuonVertexMonitor'), - maxSVdist = cms.double(50)) + maxSVdist = cms.double(50), + CosPhi3DConfig = cms.PSet( + name = cms.string('CosPhi3D'), + title = cms.string('cos(#phi_{3D})'), + yUnits = cms.string(''), + NxBins = cms.int32(24), + NyBins = cms.int32(50), + ymin = cms.double(-1), + ymax = cms.double(1), + maxDeltaEta = cms.double(3.7) + ), + SVDistConfig = cms.PSet( + name = cms.string('SVDist'), + title = cms.string('PV-SV distance'), + yUnits = cms.string('[#mum]'), + NxBins = cms.int32(24), + NyBins = cms.int32(100), + ymin = cms.double(0), + ymax = cms.double(300), + maxDeltaEta = cms.double(3.7) + ), + SVDistSigConfig = cms.PSet( + name = cms.string('SVDistSig'), + title = cms.string('PV-SV distance significance'), + yUnits = cms.string('[#mum]'), + NxBins = cms.int32(24), + NyBins = cms.int32(100), + ymin = cms.double(0), + ymax = cms.double(5), + maxDeltaEta = cms.double(3.7) + ), + SVDist3DConfig = cms.PSet( + name = cms.string('SVDist3D'), + title = cms.string('PV-SV 3D distance'), + yUnits = cms.string('[#mum]'), + NxBins = cms.int32(24), + NyBins = cms.int32(100), + ymin = cms.double(0), + ymax = cms.double(300), + maxDeltaEta = cms.double(3.7) + ), + SVDist3DSigConfig = cms.PSet( + name = cms.string('SVDist3DSig'), + title = cms.string('PV-SV 3D distance significance'), + yUnits = cms.string('[#mum]'), + NxBins = cms.int32(24), + NyBins = cms.int32(100), + ymin = cms.double(0), + ymax = cms.double(5), + maxDeltaEta = cms.double(3.7) + )) diff --git a/DQMOffline/Alignment/src/DiMuonVertexMonitor.cc b/DQMOffline/Alignment/src/DiMuonVertexMonitor.cc index b55a78a39eadb..8fc14b3c3af70 100644 --- a/DQMOffline/Alignment/src/DiMuonVertexMonitor.cc +++ b/DQMOffline/Alignment/src/DiMuonVertexMonitor.cc @@ -33,7 +33,12 @@ DiMuonVertexMonitor::DiMuonVertexMonitor(const edm::ParameterSet& iConfig) motherName_(iConfig.getParameter("decayMotherName")), MEFolderName_(iConfig.getParameter("FolderName")), useClosestVertex_(iConfig.getParameter("useClosestVertex")), - maxSVdist_(iConfig.getParameter("maxSVdist")) { + maxSVdist_(iConfig.getParameter("maxSVdist")), + CosPhi3DConfiguration_(iConfig.getParameter("CosPhi3DConfig")), + SVDistConfiguration_(iConfig.getParameter("SVDistConfig")), + SVDistSigConfiguration_(iConfig.getParameter("SVDistSigConfig")), + SVDist3DConfiguration_(iConfig.getParameter("SVDist3DConfig")), + SVDist3DSigConfiguration_(iConfig.getParameter("SVDist3DSigConfig")) { if (motherName_.find('Z') != std::string::npos) { massLimits_ = std::make_pair(50., 120); } else if (motherName_.find("J/#psi") != std::string::npos) { @@ -91,6 +96,8 @@ void DiMuonVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run co hCosPhi3D_ = iBooker.book1D("CosPhi3D", fmt::sprintf("%s;cos(#phi_{3D});%s", histTit, ps), 50, -1., 1.); hCosPhiInv_ = iBooker.book1D("CosPhiInv", fmt::sprintf("%s;inverted cos(#phi_{xy});%s", histTit, ps), 50, -1., 1.); hCosPhiInv3D_ = iBooker.book1D("CosPhiInv3D", fmt::sprintf("%s;inverted cos(#phi_{3D});%s", histTit, ps), 50, -1., 1.); + hCosPhiUnbalance_ = iBooker.book1D("CosPhiUnbalance", fmt::sprintf("%s;cos(#phi_{xy}) unbalance;#Delta%s", histTit, ps), 50, -1.,1.); + hCosPhi3DUnbalance_ = iBooker.book1D("CosPhi3DUnbalance", fmt::sprintf("%s;cos(#phi_{3D}) unbalance;#Delta%s", histTit, ps), 50, -1., 1.); hdxy_ = iBooker.book1D("dxy", fmt::sprintf("%s;muon track d_{xy}(PV) [#mum];muon tracks", histTit), 150, -300, 300); hdz_ = iBooker.book1D("dz", fmt::sprintf("%s;muon track d_{z}(PV) [#mum];muon tracks", histTit), 150, -300, 300); @@ -101,6 +108,26 @@ void DiMuonVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run co hIP2dsig_ = iBooker.book1D("IP2Dsig", fmt::sprintf("%s;muon track IP_{2D} significance;muon tracks", histTit), 100, 0., 5.); hIP3dsig_ = iBooker.book1D("IP3Dsig", fmt::sprintf("%s;muon track IP_{3D} significance;muon tracks", histTit), 100, 0., 5.); // clang-format on + + // now book the cosphi3D plots vs kinematics + iBooker.setCurrentFolder(MEFolderName_ + "/DiMuonVertexMonitor/CosPhi3DPlots"); + CosPhi3DPlots_.bookFromPSet(iBooker, CosPhi3DConfiguration_); + + // now book the PV-SV distance plots vs kinematics + iBooker.setCurrentFolder(MEFolderName_ + "/DiMuonVertexMonitor/SVDistPlots"); + SVDistPlots_.bookFromPSet(iBooker, SVDistConfiguration_); + + // now book the PV-SV distance significance plots vs kinematics + iBooker.setCurrentFolder(MEFolderName_ + "/DiMuonVertexMonitor/SVDistSigPlots"); + SVDistSigPlots_.bookFromPSet(iBooker, SVDistSigConfiguration_); + + // now book the PV-SV 3D distance plots vs kinematics + iBooker.setCurrentFolder(MEFolderName_ + "/DiMuonVertexMonitor/SVDist3DPlots"); + SVDist3DPlots_.bookFromPSet(iBooker, SVDist3DConfiguration_); + + // now book the PV-SV 3D distance significance plots vs kinematics + iBooker.setCurrentFolder(MEFolderName_ + "/DiMuonVertexMonitor/SVDist3DSigPlots"); + SVDist3DSigPlots_.bookFromPSet(iBooker, SVDist3DSigConfiguration_); } void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -173,9 +200,10 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu reco::Vertex theMainVtx; if (!useClosestVertex_ || theClosestVertex == nullptr) { - theMainVtx = *theClosestVertex; - } else { + // if the closest vertex is not available, or explicitly not chosen theMainVtx = vertexHandle.product()->front(); + } else { + theMainVtx = *theClosestVertex; } const math::XYZPoint theMainVtxPos(theMainVtx.position().x(), theMainVtx.position().y(), theMainVtx.position().z()); @@ -237,6 +265,14 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu hSVDist3DErr_->Fill(dist3D_err * cmToum); hSVDist3DSig_->Fill(distance3D / dist3D_err); + // creat the pair of TLorentVectors used to make the plos + std::pair tktk_p4 = std::make_pair(p4_tplus, p4_tminus); + + SVDistPlots_.fillPlots(distance * cmToum, tktk_p4); + SVDistSigPlots_.fillPlots(distance / dist_err, tktk_p4); + SVDist3DPlots_.fillPlots(distance3D * cmToum, tktk_p4); + SVDist3DSigPlots_.fillPlots(distance3D / dist3D_err, tktk_p4); + // cut on the PV - SV distance if (distance * cmToum < maxSVdist_) { double cosphi = (ZpT.x() * deltaVtx.x() + ZpT.y() * deltaVtx.y()) / @@ -252,6 +288,15 @@ void DiMuonVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSetu // inverted hCosPhiInv_->Fill(-cosphi); hCosPhiInv3D_->Fill(-cosphi3D); + + // unbalance + hCosPhiUnbalance_->Fill(cosphi, 1.); + hCosPhiUnbalance_->Fill(-cosphi, -1.); + hCosPhi3DUnbalance_->Fill(cosphi3D, 1.); + hCosPhi3DUnbalance_->Fill(-cosphi3D, -1.); + + // fill the cos(phi3D) plots + CosPhi3DPlots_.fillPlots(cosphi3D, tktk_p4); } } else { edm::LogWarning("DiMuonVertexMonitor") << "hardest primary vertex in the event is not valid!"; @@ -295,6 +340,72 @@ void DiMuonVertexMonitor::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("decayMotherName", "Z"); desc.add("useClosestVertex", true); desc.add("maxSVdist", 50.); + + { + edm::ParameterSetDescription psCosPhi3D; + psCosPhi3D.add("name", "CosPhi3D"); + psCosPhi3D.add("title", "cos(#phi_{3D})"); + psCosPhi3D.add("yUnits", ""); + psCosPhi3D.add("NxBins", 24); + psCosPhi3D.add("NyBins", 50); + psCosPhi3D.add("ymin", -1.); + psCosPhi3D.add("ymax", 1.); + psCosPhi3D.add("maxDeltaEta", 3.7); + desc.add("CosPhi3DConfig", psCosPhi3D); + } + + { + edm::ParameterSetDescription psSVDist; + psSVDist.add("name", "SVDist"); + psSVDist.add("title", "PV-SV distance"); + psSVDist.add("yUnits", "[#mum]"); + psSVDist.add("NxBins", 24); + psSVDist.add("NyBins", 100); + psSVDist.add("ymin", 0.); + psSVDist.add("ymax", 300.); + psSVDist.add("maxDeltaEta", 3.7); + desc.add("SVDistConfig", psSVDist); + } + + { + edm::ParameterSetDescription psSVDistSig; + psSVDistSig.add("name", "SVDistSig"); + psSVDistSig.add("title", "PV-SV distance significance"); + psSVDistSig.add("yUnits", "[#mum]"); + psSVDistSig.add("NxBins", 24); + psSVDistSig.add("NyBins", 100); + psSVDistSig.add("ymin", 0.); + psSVDistSig.add("ymax", 5.); + psSVDistSig.add("maxDeltaEta", 3.7); + desc.add("SVDistSigConfig", psSVDistSig); + } + + { + edm::ParameterSetDescription psSVDist3D; + psSVDist3D.add("name", "SVDist3D"); + psSVDist3D.add("title", "PV-SV 3D distance"); + psSVDist3D.add("yUnits", "[#mum]"); + psSVDist3D.add("NxBins", 24); + psSVDist3D.add("NyBins", 100); + psSVDist3D.add("ymin", 0.); + psSVDist3D.add("ymax", 300.); + psSVDist3D.add("maxDeltaEta", 3.7); + desc.add("SVDist3DConfig", psSVDist3D); + } + + { + edm::ParameterSetDescription psSVDist3DSig; + psSVDist3DSig.add("name", "SVDist3DSig"); + psSVDist3DSig.add("title", "PV-SV 3D distance significance"); + psSVDist3DSig.add("yUnits", "[#mum]"); + psSVDist3DSig.add("NxBins", 24); + psSVDist3DSig.add("NyBins", 100); + psSVDist3DSig.add("ymin", 0.); + psSVDist3DSig.add("ymax", 5.); + psSVDist3DSig.add("maxDeltaEta", 3.7); + desc.add("SVDist3DSigConfig", psSVDist3DSig); + } + descriptions.addWithDefaultLabel(desc); }