From 3ce3432dbc81846afa59a64992f86b5bf76ec6f1 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Wed, 28 Sep 2016 16:46:12 +0200 Subject: [PATCH 1/4] add score plot --- DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc | 14 +++++++++++++- DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h | 6 +++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc index e63f34a46e3e3..dbea1bc48707e 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc @@ -52,6 +52,7 @@ PrimaryVertexMonitor::PrimaryVertexMonitor(const edm::ParameterSet& pSet) vertexInputTag_ = pSet.getParameter("vertexLabel"); beamSpotInputTag_ = pSet.getParameter("beamSpotLabel"); vertexToken_ = consumes(vertexInputTag_); + scoreToken_ = consumes(vertexInputTag_); beamspotToken_ = consumes (beamSpotInputTag_); } @@ -85,7 +86,8 @@ PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker &iBooker, ntracksVsZ[0] = iBooker.bookProfile("otherVtxTrksVsZ","Reconstructed Tracks in Vertex (other Vtx) vs Z",80,-20.,20.,50,0,100,""); ntracksVsZ[0]->setAxisTitle("z-bs",1); ntracksVsZ[0]->setAxisTitle("#tracks",2); - + + score[0] = iBooker.book1D("otherVtxTrksWeight","sqrt(score) (other Vtx)",100,0.,500.); trksWeight[0] = iBooker.book1D("otherVtxTrksWeight","Total weight of Tracks in Vertex (other Vtx)",40,0,100.); vtxchi2[0] = iBooker.book1D("otherVtxChi2","#chi^{2} (other Vtx)",100,0.,200.); vtxndf[0] = iBooker.book1D("otherVtxNdf","ndof (other Vtx)",100,0.,200.); @@ -97,6 +99,7 @@ PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker &iBooker, ntracksVsZ[1]->setAxisTitle("z-bs",1); ntracksVsZ[1]->setAxisTitle("#tracks",2); + score[1] = iBooker.book1D("otherVtxTrksWeight","sqrt(score) (tagged Vtx)",100,0.,500.); trksWeight[1] = iBooker.book1D("tagVtxTrksWeight","Total weight of Tracks in Vertex (tagged Vtx)",100,0,100.); vtxchi2[1] = iBooker.book1D("tagVtxChi2","#chi^{2} (tagged Vtx)",100,0.,200.); vtxndf[1] = iBooker.book1D("tagVtxNdf","ndof (tagged Vtx)",100,0.,200.); @@ -237,6 +240,10 @@ void PrimaryVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSet Handle recVtxs; iEvent.getByToken(vertexToken_, recVtxs); + Handle scores; + iEvent.getByToken(scoreToken_, scores); + + edm::Handle beamSpotHandle; iEvent.getByToken(beamspotToken_,beamSpotHandle); @@ -263,6 +270,10 @@ void PrimaryVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSet vertexPlots(recVtxs->front(), beamSpot, 1); + auto pvScore = (*scores).get(0); + score[0]->Fill(std::sqrt(pvScore)); + for (unsigned int i=1; i<(*scores).size(); ++i) score[1]->Fill(std::sqrt((*scores).get(i))); + // fill PV tracks MEs (as now, for alignment) pvTracksPlots(recVtxs->front()); @@ -270,6 +281,7 @@ void PrimaryVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSet v!=recVtxs->end(); ++v){ vertexPlots(*v, beamSpot, 0); } + // Beamline plots: bsX->Fill(beamSpot.x0()); bsY->Fill(beamSpot.y0()); diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h index 5ab0e1d83ba7d..ff99595954b3f 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h @@ -8,6 +8,8 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/Common/interface/ValueMap.h" +#include "DataFormats/Common/interface/Association.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/MonitorElement.h" @@ -38,6 +40,8 @@ class PrimaryVertexMonitor : public DQMEDAnalyzer { edm::EDGetTokenT vertexToken_; edm::EDGetTokenT beamspotToken_; + using VertexScore = edm::ValueMap; + edm::EDGetTokenT scoreToken_; edm::InputTag vertexInputTag_, beamSpotInputTag_; @@ -49,7 +53,7 @@ class PrimaryVertexMonitor : public DQMEDAnalyzer { std::string AlignmentLabel_; // the histos - MonitorElement *nbvtx, *nbgvtx, *nbtksinvtx[2], *trksWeight[2]; + MonitorElement *nbvtx, *nbgvtx, *nbtksinvtx[2], *trksWeight[2], *score[2]; MonitorElement *tt[2]; MonitorElement *xrec[2] , *yrec[2], *zrec[2], *xDiff[2] , *yDiff[2], *xerr[2] , *yerr[2], *zerr[2] ; MonitorElement *xerrVsTrks[2] , *yerrVsTrks[2], *zerrVsTrks[2] ; From f5e78d3dcfe635c63c73d5907e3f3c648b312627 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Wed, 28 Sep 2016 19:38:25 +0200 Subject: [PATCH 2/4] fix mistype --- DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc index dbea1bc48707e..272e97b62caf7 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc @@ -87,7 +87,7 @@ PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker &iBooker, ntracksVsZ[0]->setAxisTitle("z-bs",1); ntracksVsZ[0]->setAxisTitle("#tracks",2); - score[0] = iBooker.book1D("otherVtxTrksWeight","sqrt(score) (other Vtx)",100,0.,500.); + score[0] = iBooker.book1D("otherVtxScore","sqrt(score) (other Vtx)",100,0.,500.); trksWeight[0] = iBooker.book1D("otherVtxTrksWeight","Total weight of Tracks in Vertex (other Vtx)",40,0,100.); vtxchi2[0] = iBooker.book1D("otherVtxChi2","#chi^{2} (other Vtx)",100,0.,200.); vtxndf[0] = iBooker.book1D("otherVtxNdf","ndof (other Vtx)",100,0.,200.); @@ -99,7 +99,7 @@ PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker &iBooker, ntracksVsZ[1]->setAxisTitle("z-bs",1); ntracksVsZ[1]->setAxisTitle("#tracks",2); - score[1] = iBooker.book1D("otherVtxTrksWeight","sqrt(score) (tagged Vtx)",100,0.,500.); + score[1] = iBooker.book1D("tagVtxScore","sqrt(score) (tagged Vtx)",100,0.,500.); trksWeight[1] = iBooker.book1D("tagVtxTrksWeight","Total weight of Tracks in Vertex (tagged Vtx)",100,0,100.); vtxchi2[1] = iBooker.book1D("tagVtxChi2","#chi^{2} (tagged Vtx)",100,0.,200.); vtxndf[1] = iBooker.book1D("tagVtxNdf","ndof (tagged Vtx)",100,0.,200.); @@ -271,8 +271,8 @@ void PrimaryVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSet vertexPlots(recVtxs->front(), beamSpot, 1); auto pvScore = (*scores).get(0); - score[0]->Fill(std::sqrt(pvScore)); - for (unsigned int i=1; i<(*scores).size(); ++i) score[1]->Fill(std::sqrt((*scores).get(i))); + score[1]->Fill(std::sqrt(pvScore)); + for (unsigned int i=1; i<(*scores).size(); ++i) score[0]->Fill(std::sqrt((*scores).get(i))); // fill PV tracks MEs (as now, for alignment) pvTracksPlots(recVtxs->front()); From 401803a51a0b7c28c9362e89b45824c550f73fb4 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Thu, 29 Sep 2016 08:14:48 +0200 Subject: [PATCH 3/4] reduce scale --- DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc index 272e97b62caf7..663aa02605662 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc @@ -87,7 +87,7 @@ PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker &iBooker, ntracksVsZ[0]->setAxisTitle("z-bs",1); ntracksVsZ[0]->setAxisTitle("#tracks",2); - score[0] = iBooker.book1D("otherVtxScore","sqrt(score) (other Vtx)",100,0.,500.); + score[0] = iBooker.book1D("otherVtxScore","sqrt(score) (other Vtx)",100,0.,400.); trksWeight[0] = iBooker.book1D("otherVtxTrksWeight","Total weight of Tracks in Vertex (other Vtx)",40,0,100.); vtxchi2[0] = iBooker.book1D("otherVtxChi2","#chi^{2} (other Vtx)",100,0.,200.); vtxndf[0] = iBooker.book1D("otherVtxNdf","ndof (other Vtx)",100,0.,200.); @@ -99,7 +99,7 @@ PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker &iBooker, ntracksVsZ[1]->setAxisTitle("z-bs",1); ntracksVsZ[1]->setAxisTitle("#tracks",2); - score[1] = iBooker.book1D("tagVtxScore","sqrt(score) (tagged Vtx)",100,0.,500.); + score[1] = iBooker.book1D("tagVtxScore","sqrt(score) (tagged Vtx)",100,0.,400.); trksWeight[1] = iBooker.book1D("tagVtxTrksWeight","Total weight of Tracks in Vertex (tagged Vtx)",100,0,100.); vtxchi2[1] = iBooker.book1D("tagVtxChi2","#chi^{2} (tagged Vtx)",100,0.,200.); vtxndf[1] = iBooker.book1D("tagVtxNdf","ndof (tagged Vtx)",100,0.,200.); From ffe3b7e5b4c980200b8a9ef21206baa6e8823ae9 Mon Sep 17 00:00:00 2001 From: Vincenzo Innocente Date: Thu, 29 Sep 2016 10:13:07 +0200 Subject: [PATCH 4/4] protect against missing collection --- DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc index 663aa02605662..3d399340b9773 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc @@ -270,9 +270,11 @@ void PrimaryVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSet vertexPlots(recVtxs->front(), beamSpot, 1); - auto pvScore = (*scores).get(0); - score[1]->Fill(std::sqrt(pvScore)); - for (unsigned int i=1; i<(*scores).size(); ++i) score[0]->Fill(std::sqrt((*scores).get(i))); + if (scores.isValid() && (*scores).size()>0) { + auto pvScore = (*scores).get(0); + score[1]->Fill(std::sqrt(pvScore)); + for (unsigned int i=1; i<(*scores).size(); ++i) score[0]->Fill(std::sqrt((*scores).get(i))); + } // fill PV tracks MEs (as now, for alignment) pvTracksPlots(recVtxs->front());