Skip to content

Commit

Permalink
Merge pull request #16026 from VinInn/VtxDQM81
Browse files Browse the repository at this point in the history
Add Score histos for Primary Vertices
  • Loading branch information
cmsbuild committed Oct 4, 2016
2 parents d554507 + ffe3b7e commit 563d7f9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
16 changes: 15 additions & 1 deletion DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc
Expand Up @@ -52,6 +52,7 @@ PrimaryVertexMonitor::PrimaryVertexMonitor(const edm::ParameterSet& pSet)
vertexInputTag_ = pSet.getParameter<InputTag>("vertexLabel");
beamSpotInputTag_ = pSet.getParameter<InputTag>("beamSpotLabel");
vertexToken_ = consumes<reco::VertexCollection>(vertexInputTag_);
scoreToken_ = consumes<VertexScore>(vertexInputTag_);
beamspotToken_ = consumes<reco::BeamSpot> (beamSpotInputTag_);

}
Expand Down Expand Up @@ -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("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.);
Expand All @@ -97,6 +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.,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.);
Expand Down Expand Up @@ -237,6 +240,10 @@ void PrimaryVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSet
Handle<reco::VertexCollection> recVtxs;
iEvent.getByToken(vertexToken_, recVtxs);

Handle<VertexScore> scores;
iEvent.getByToken(scoreToken_, scores);


edm::Handle<reco::BeamSpot> beamSpotHandle;
iEvent.getByToken(beamspotToken_,beamSpotHandle);

Expand All @@ -263,13 +270,20 @@ void PrimaryVertexMonitor::analyze(const edm::Event& iEvent, const edm::EventSet

vertexPlots(recVtxs->front(), beamSpot, 1);

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());

for(reco::VertexCollection::const_iterator v=recVtxs->begin()+1;
v!=recVtxs->end(); ++v){
vertexPlots(*v, beamSpot, 0);
}

// Beamline plots:
bsX->Fill(beamSpot.x0());
bsY->Fill(beamSpot.y0());
Expand Down
6 changes: 5 additions & 1 deletion DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h
Expand Up @@ -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"
Expand Down Expand Up @@ -38,6 +40,8 @@ class PrimaryVertexMonitor : public DQMEDAnalyzer {

edm::EDGetTokenT<reco::VertexCollection> vertexToken_;
edm::EDGetTokenT<reco::BeamSpot> beamspotToken_;
using VertexScore = edm::ValueMap<float>;
edm::EDGetTokenT<VertexScore> scoreToken_;

edm::InputTag vertexInputTag_, beamSpotInputTag_;

Expand All @@ -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] ;
Expand Down

0 comments on commit 563d7f9

Please sign in to comment.