CMS 3D CMS Logo

PrimaryVertexMonitor.cc
Go to the documentation of this file.
5 
7 
9 
10 #include "TMath.h"
11 
12 using namespace reco;
13 using namespace edm;
14 
16  : conf_(pSet),
17  TopFolderName_(pSet.getParameter<std::string>("TopFolderName")),
18  AlignmentLabel_(pSet.getParameter<std::string>("AlignmentLabel")),
19  ndof_(pSet.getParameter<int>("ndof")),
20  errorPrinted_(false),
21  nbvtx(nullptr),
22  bsX(nullptr),
23  bsY(nullptr),
24  bsZ(nullptr),
25  bsSigmaZ(nullptr),
26  bsDxdz(nullptr),
27  bsDydz(nullptr),
28  bsBeamWidthX(nullptr),
29  bsBeamWidthY(nullptr),
30  bsType(nullptr),
31  sumpt(nullptr),
32  ntracks(nullptr),
33  weight(nullptr),
34  chi2ndf(nullptr),
35  chi2prob(nullptr),
36  dxy(nullptr),
37  dxy2(nullptr),
38  dz(nullptr),
39  dxyErr(nullptr),
40  dzErr(nullptr),
41  dxyVsPhi_pt1(nullptr),
42  dzVsPhi_pt1(nullptr),
43  dxyVsEta_pt1(nullptr),
44  dzVsEta_pt1(nullptr),
45  dxyVsPhi_pt10(nullptr),
46  dzVsPhi_pt10(nullptr),
47  dxyVsEta_pt10(nullptr),
48  dzVsEta_pt10(nullptr) {
49  // dqmStore_ = edm::Service<DQMStore>().operator->();
50 
51  vertexInputTag_ = pSet.getParameter<InputTag>("vertexLabel");
52  beamSpotInputTag_ = pSet.getParameter<InputTag>("beamSpotLabel");
53  vertexToken_ = consumes<reco::VertexCollection>(vertexInputTag_);
54  scoreToken_ = consumes<VertexScore>(vertexInputTag_);
55  beamspotToken_ = consumes<reco::BeamSpot>(beamSpotInputTag_);
56 }
57 
58 // -- BeginRun
59 //---------------------------------------------------------------------------------//
61  std::string dqmLabel = "";
62 
63  //
64  // Book all histograms.
65  //
66 
67  // get the store
69  iBooker.setCurrentFolder(dqmLabel);
70 
71  // xPos = iBooker.book1D ("xPos","x Coordinate" ,100, -0.1, 0.1);
72 
73  nbvtx = iBooker.book1D("vtxNbr", "Reconstructed Vertices in Event", 80, -0.5, 79.5);
74  nbgvtx = iBooker.book1D("goodvtxNbr", "Reconstructed Good Vertices in Event", 80, -0.5, 79.5);
75 
76  // to be configured each year...
77  auto vposx = conf_.getParameter<double>("Xpos");
78  auto vposy = conf_.getParameter<double>("Ypos");
79 
80  nbtksinvtx[0] = iBooker.book1D("otherVtxTrksNbr", "Reconstructed Tracks in Vertex (other Vtx)", 40, -0.5, 99.5);
81  ntracksVsZ[0] = iBooker.bookProfile(
82  "otherVtxTrksVsZ", "Reconstructed Tracks in Vertex (other Vtx) vs Z", 80, -20., 20., 50, 0, 100, "");
83  ntracksVsZ[0]->setAxisTitle("z-bs", 1);
84  ntracksVsZ[0]->setAxisTitle("#tracks", 2);
85 
86  score[0] = iBooker.book1D("otherVtxScore", "sqrt(score) (other Vtx)", 100, 0., 400.);
87  trksWeight[0] = iBooker.book1D("otherVtxTrksWeight", "Total weight of Tracks in Vertex (other Vtx)", 40, 0, 100.);
88  vtxchi2[0] = iBooker.book1D("otherVtxChi2", "#chi^{2} (other Vtx)", 100, 0., 200.);
89  vtxndf[0] = iBooker.book1D("otherVtxNdf", "ndof (other Vtx)", 100, 0., 200.);
90  vtxprob[0] = iBooker.book1D("otherVtxProb", "#chi^{2} probability (other Vtx)", 100, 0., 1.);
91  nans[0] = iBooker.book1D("otherVtxNans", "Illegal values for x,y,z,xx,xy,xz,yy,yz,zz (other Vtx)", 9, 0.5, 9.5);
92 
93  nbtksinvtx[1] = iBooker.book1D("tagVtxTrksNbr", "Reconstructed Tracks in Vertex (tagged Vtx)", 100, -0.5, 99.5);
94  ntracksVsZ[1] = iBooker.bookProfile(
95  "tagVtxTrksVsZ", "Reconstructed Tracks in Vertex (tagged Vtx) vs Z", 80, -20., 20., 50, 0, 100, "");
96  ntracksVsZ[1]->setAxisTitle("z-bs", 1);
97  ntracksVsZ[1]->setAxisTitle("#tracks", 2);
98 
99  score[1] = iBooker.book1D("tagVtxScore", "sqrt(score) (tagged Vtx)", 100, 0., 400.);
100  trksWeight[1] = iBooker.book1D("tagVtxTrksWeight", "Total weight of Tracks in Vertex (tagged Vtx)", 100, 0, 100.);
101  vtxchi2[1] = iBooker.book1D("tagVtxChi2", "#chi^{2} (tagged Vtx)", 100, 0., 200.);
102  vtxndf[1] = iBooker.book1D("tagVtxNdf", "ndof (tagged Vtx)", 100, 0., 200.);
103  vtxprob[1] = iBooker.book1D("tagVtxProb", "#chi^{2} probability (tagged Vtx)", 100, 0., 1.);
104  nans[1] = iBooker.book1D("tagVtxNans", "Illegal values for x,y,z,xx,xy,xz,yy,yz,zz (tagged Vtx)", 9, 0.5, 9.5);
105 
106  xrec[0] = iBooker.book1D("otherPosX", "Position x Coordinate (other Vtx)", 100, vposx - 0.1, vposx + 0.1);
107  yrec[0] = iBooker.book1D("otherPosY", "Position y Coordinate (other Vtx)", 100, vposy - 0.1, vposy + 0.1);
108  zrec[0] = iBooker.book1D("otherPosZ", "Position z Coordinate (other Vtx)", 100, -20., 20.);
109  xDiff[0] = iBooker.book1D("otherDiffX", "X distance from BeamSpot (other Vtx)", 100, -500, 500);
110  yDiff[0] = iBooker.book1D("otherDiffY", "Y distance from BeamSpot (other Vtx)", 100, -500, 500);
111  xerr[0] = iBooker.book1D("otherErrX", "Uncertainty x Coordinate (other Vtx)", 100, 0., 100);
112  yerr[0] = iBooker.book1D("otherErrY", "Uncertainty y Coordinate (other Vtx)", 100, 0., 100);
113  zerr[0] = iBooker.book1D("otherErrZ", "Uncertainty z Coordinate (other Vtx)", 100, 0., 100);
114  xerrVsTrks[0] = iBooker.book2D(
115  "otherErrVsWeightX", "Uncertainty x Coordinate vs. track weight (other Vtx)", 100, 0, 100., 100, 0., 100);
116  yerrVsTrks[0] = iBooker.book2D(
117  "otherErrVsWeightY", "Uncertainty y Coordinate vs. track weight (other Vtx)", 100, 0, 100., 100, 0., 100);
118  zerrVsTrks[0] = iBooker.book2D(
119  "otherErrVsWeightZ", "Uncertainty z Coordinate vs. track weight (other Vtx)", 100, 0, 100., 100, 0., 100);
120 
121  xrec[1] = iBooker.book1D("tagPosX", "Position x Coordinate (tagged Vtx)", 100, vposx - 0.1, vposx + 0.1);
122  yrec[1] = iBooker.book1D("tagPosY", "Position y Coordinate (tagged Vtx)", 100, vposy - 0.1, vposy + 0.1);
123  zrec[1] = iBooker.book1D("tagPosZ", "Position z Coordinate (tagged Vtx)", 100, -20., 20.);
124  xDiff[1] = iBooker.book1D("tagDiffX", "X distance from BeamSpot (tagged Vtx)", 100, -500, 500);
125  yDiff[1] = iBooker.book1D("tagDiffY", "Y distance from BeamSpot (tagged Vtx)", 100, -500, 500);
126  xerr[1] = iBooker.book1D("tagErrX", "Uncertainty x Coordinate (tagged Vtx)", 100, 0., 100);
127  yerr[1] = iBooker.book1D("tagErrY", "Uncertainty y Coordinate (tagged Vtx)", 100, 0., 100);
128  zerr[1] = iBooker.book1D("tagErrZ", "Uncertainty z Coordinate (tagged Vtx)", 100, 0., 100);
129  xerrVsTrks[1] = iBooker.book2D(
130  "tagErrVsWeightX", "Uncertainty x Coordinate vs. track weight (tagged Vtx)", 100, 0, 100., 100, 0., 100);
131  yerrVsTrks[1] = iBooker.book2D(
132  "tagErrVsWeightY", "Uncertainty y Coordinate vs. track weight (tagged Vtx)", 100, 0, 100., 100, 0., 100);
133  zerrVsTrks[1] = iBooker.book2D(
134  "tagErrVsWeightZ", "Uncertainty z Coordinate vs. track weight (tagged Vtx)", 100, 0, 100., 100, 0., 100);
135 
136  type[0] = iBooker.book1D("otherType", "Vertex type (other Vtx)", 3, -0.5, 2.5);
137  type[1] = iBooker.book1D("tagType", "Vertex type (tagged Vtx)", 3, -0.5, 2.5);
138  for (int i = 0; i < 2; ++i) {
139  type[i]->setBinLabel(1, "Valid, real");
140  type[i]->setBinLabel(2, "Valid, fake");
141  type[i]->setBinLabel(3, "Invalid");
142  }
143 
144  // get the store
146  iBooker.setCurrentFolder(dqmLabel);
147 
148  bsX = iBooker.book1D("bsX", "BeamSpot x0", 100, -0.1, 0.1);
149  bsY = iBooker.book1D("bsY", "BeamSpot y0", 100, -0.1, 0.1);
150  bsZ = iBooker.book1D("bsZ", "BeamSpot z0", 100, -2., 2.);
151  bsSigmaZ = iBooker.book1D("bsSigmaZ", "BeamSpot sigmaZ", 100, 0., 10.);
152  bsDxdz = iBooker.book1D("bsDxdz", "BeamSpot dxdz", 100, -0.0003, 0.0003);
153  bsDydz = iBooker.book1D("bsDydz", "BeamSpot dydz", 100, -0.0003, 0.0003);
154  bsBeamWidthX = iBooker.book1D("bsBeamWidthX", "BeamSpot BeamWidthX", 100, 0., 100.);
155  bsBeamWidthY = iBooker.book1D("bsBeamWidthY", "BeamSpot BeamWidthY", 100, 0., 100.);
156  bsType = iBooker.book1D("bsType", "BeamSpot type", 4, -1.5, 2.5);
157  bsType->setBinLabel(1, "Unknown");
158  bsType->setBinLabel(2, "Fake");
159  bsType->setBinLabel(3, "LHC");
160  bsType->setBinLabel(4, "Tracker");
161 
162  // get the store
164  iBooker.setCurrentFolder(dqmLabel);
165 
166  int TKNoBin = conf_.getParameter<int>("TkSizeBin");
167  double TKNoMin = conf_.getParameter<double>("TkSizeMin");
168  double TKNoMax = conf_.getParameter<double>("TkSizeMax");
169 
170  int DxyBin = conf_.getParameter<int>("DxyBin");
171  double DxyMin = conf_.getParameter<double>("DxyMin");
172  double DxyMax = conf_.getParameter<double>("DxyMax");
173 
174  int DzBin = conf_.getParameter<int>("DzBin");
175  double DzMin = conf_.getParameter<double>("DzMin");
176  double DzMax = conf_.getParameter<double>("DzMax");
177 
178  int PhiBin = conf_.getParameter<int>("PhiBin");
179  double PhiMin = conf_.getParameter<double>("PhiMin");
180  double PhiMax = conf_.getParameter<double>("PhiMax");
181 
182  int EtaBin = conf_.getParameter<int>("EtaBin");
183  double EtaMin = conf_.getParameter<double>("EtaMin");
184  double EtaMax = conf_.getParameter<double>("EtaMax");
185 
186  ntracks = iBooker.book1D("ntracks", "number of PV tracks (p_{T} > 1 GeV)", TKNoBin, TKNoMin, TKNoMax);
187  ntracks->setAxisTitle("Number of PV Tracks (p_{T} > 1 GeV) per Event", 1);
188  ntracks->setAxisTitle("Number of Event", 2);
189 
190  weight = iBooker.book1D("weight", "weight of PV tracks (p_{T} > 1 GeV)", 100, 0., 1.);
191  weight->setAxisTitle("weight of PV Tracks (p_{T} > 1 GeV) per Event", 1);
192  weight->setAxisTitle("Number of Event", 2);
193 
194  sumpt = iBooker.book1D("sumpt", "#Sum p_{T} of PV tracks (p_{T} > 1 GeV)", 100, -0.5, 249.5);
195  chi2ndf = iBooker.book1D("chi2ndf", "PV tracks (p_{T} > 1 GeV) #chi^{2}/ndof", 100, 0., 20.);
196  chi2prob = iBooker.book1D("chi2prob", "PV tracks (p_{T} > 1 GeV) #chi^{2} probability", 100, 0., 1.);
197 
198  dxy = iBooker.book1D("dxy", "PV tracks (p_{T} > 1 GeV) d_{xy} (#mum)", DxyBin, DxyMin, DxyMax);
199  dxy2 = iBooker.book1D("dxyzoom", "PV tracks (p_{T} > 1 GeV) d_{xy} (#mum)", DxyBin, DxyMin / 5., DxyMax / 5.);
200  dxyErr = iBooker.book1D("dxyErr", "PV tracks (p_{T} > 1 GeV) d_{xy} error (#mum)", 100, 0., 2000.);
201  dz = iBooker.book1D("dz", "PV tracks (p_{T} > 1 GeV) d_{z} (#mum)", DzBin, DzMin, DzMax);
202  dzErr = iBooker.book1D("dzErr", "PV tracks (p_{T} > 1 GeV) d_{z} error(#mum)", 100, 0., 10000.);
203 
204  dxyVsPhi_pt1 = iBooker.bookProfile("dxyVsPhi_pt1",
205  "PV tracks (p_{T} > 1 GeV) d_{xy} (#mum) VS track #phi",
206  PhiBin,
207  PhiMin,
208  PhiMax,
209  DxyBin,
210  DxyMin,
211  DxyMax,
212  "");
213  dxyVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #phi", 1);
214  dxyVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{xy} (#mum)", 2);
215 
216  dzVsPhi_pt1 = iBooker.bookProfile("dzVsPhi_pt1",
217  "PV tracks (p_{T} > 1 GeV) d_{z} (#mum) VS track #phi",
218  PhiBin,
219  PhiMin,
220  PhiMax,
221  DzBin,
222  DzMin,
223  DzMax,
224  "");
225  dzVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #phi", 1);
226  dzVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)", 2);
227 
228  dxyVsEta_pt1 = iBooker.bookProfile("dxyVsEta_pt1",
229  "PV tracks (p_{T} > 1 GeV) d_{xy} (#mum) VS track #eta",
230  EtaBin,
231  EtaMin,
232  EtaMax,
233  DxyBin,
234  DxyMin,
235  DxyMax,
236  "");
237  dxyVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1);
238  dxyVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{xy} (#mum)", 2);
239 
240  dzVsEta_pt1 = iBooker.bookProfile("dzVsEta_pt1",
241  "PV tracks (p_{T} > 1 GeV) d_{z} (#mum) VS track #eta",
242  EtaBin,
243  EtaMin,
244  EtaMax,
245  DzBin,
246  DzMin,
247  DzMax,
248  "");
249  dzVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1);
250  dzVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)", 2);
251 
252  dxyVsPhi_pt10 = iBooker.bookProfile("dxyVsPhi_pt10",
253  "PV tracks (p_{T} > 10 GeV) d_{xy} (#mum) VS track #phi",
254  PhiBin,
255  PhiMin,
256  PhiMax,
257  DxyBin,
258  DxyMin,
259  DxyMax,
260  "");
261  dxyVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #phi", 1);
262  dxyVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{xy} (#mum)", 2);
263 
264  dzVsPhi_pt10 = iBooker.bookProfile("dzVsPhi_pt10",
265  "PV tracks (p_{T} > 10 GeV) d_{z} (#mum) VS track #phi",
266  PhiBin,
267  PhiMin,
268  PhiMax,
269  DzBin,
270  DzMin,
271  DzMax,
272  "");
273  dzVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #phi", 1);
274  dzVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)", 2);
275 
276  dxyVsEta_pt10 = iBooker.bookProfile("dxyVsEta_pt10",
277  "PV tracks (p_{T} > 10 GeV) d_{xy} (#mum) VS track #eta",
278  EtaBin,
279  EtaMin,
280  EtaMax,
281  DxyBin,
282  DxyMin,
283  DxyMax,
284  "");
285  dxyVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1);
286  dxyVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{xy} (#mum)", 2);
287 
288  dzVsEta_pt10 = iBooker.bookProfile("dzVsEta_pt10",
289  "PV tracks (p_{T} > 10 GeV) d_{z} (#mum) VS track #eta",
290  EtaBin,
291  EtaMin,
292  EtaMax,
293  DzBin,
294  DzMin,
295  DzMax,
296  "");
297  dzVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1);
298  dzVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)", 2);
299 }
300 
302 
305  iEvent.getByToken(vertexToken_, recVtxs);
306 
307  Handle<VertexScore> scores;
308  iEvent.getByToken(scoreToken_, scores);
309 
310  edm::Handle<reco::BeamSpot> beamSpotHandle;
311  iEvent.getByToken(beamspotToken_, beamSpotHandle);
312 
313  //
314  // check for absent products and simply "return" in that case
315  //
316  if (recVtxs.isValid() == false || beamSpotHandle.isValid() == false) {
317  edm::LogWarning("PrimaryVertexMonitor")
318  << " Some products not available in the event: VertexCollection " << vertexInputTag_ << " " << recVtxs.isValid()
319  << " BeamSpot " << beamSpotInputTag_ << " " << beamSpotHandle.isValid() << ". Skipping plots for this event";
320  return;
321  }
322 
323  // check upfront that refs to track are (likely) to be valid
324  {
325  bool ok = true;
326  for (const auto& v : *recVtxs) {
327  if (v.tracksSize() > 0) {
328  const auto& ref = v.trackRefAt(0);
329  if (ref.isNull() || !ref.isAvailable()) {
330  if (!errorPrinted_)
331  edm::LogWarning("PrimaryVertexMonitor")
332  << "Skipping vertex collection: " << vertexInputTag_
333  << " since likely the track collection the vertex has refs pointing to is missing (at least the first "
334  "TrackBaseRef is null or not available)";
335  else
336  errorPrinted_ = true;
337  ok = false;
338  }
339  }
340  }
341  if (!ok)
342  return;
343  }
344 
345  BeamSpot beamSpot = *beamSpotHandle;
346 
347  nbvtx->Fill(recVtxs->size() * 1.);
348  int ng = 0;
349  for (auto const& vx : (*recVtxs))
350  if (vx.isValid() && !vx.isFake() && vx.ndof() >= ndof_)
351  ++ng;
352  nbgvtx->Fill(ng * 1.);
353 
354  if (scores.isValid() && !(*scores).empty()) {
355  auto pvScore = (*scores).get(0);
356  score[1]->Fill(std::sqrt(pvScore));
357  for (unsigned int i = 1; i < (*scores).size(); ++i)
358  score[0]->Fill(std::sqrt((*scores).get(i)));
359  }
360 
361  // fill PV tracks MEs (as now, for alignment)
362  if (!recVtxs->empty()) {
363  vertexPlots(recVtxs->front(), beamSpot, 1);
364  pvTracksPlots(recVtxs->front());
365 
366  for (reco::VertexCollection::const_iterator v = recVtxs->begin() + 1; v != recVtxs->end(); ++v)
367  vertexPlots(*v, beamSpot, 0);
368  }
369 
370  // Beamline plots:
371  bsX->Fill(beamSpot.x0());
372  bsY->Fill(beamSpot.y0());
373  bsZ->Fill(beamSpot.z0());
374  bsSigmaZ->Fill(beamSpot.sigmaZ());
375  bsDxdz->Fill(beamSpot.dxdz());
376  bsDydz->Fill(beamSpot.dydz());
377  bsBeamWidthX->Fill(beamSpot.BeamWidthX() * 10000);
378  bsBeamWidthY->Fill(beamSpot.BeamWidthY() * 10000);
379  // bsType->Fill(beamSpot.type());
380 }
381 
383  if (!v.isValid())
384  return;
385  if (v.isFake())
386  return;
387 
388  if (v.tracksSize() == 0) {
389  ntracks->Fill(0);
390  return;
391  }
392 
393  const math::XYZPoint myVertex(v.position().x(), v.position().y(), v.position().z());
394 
395  size_t nTracks = 0;
396  float sumPT = 0.;
397  const int cmToUm = 10000;
398 
399  for (reco::Vertex::trackRef_iterator t = v.tracks_begin(); t != v.tracks_end(); t++) {
400  bool isHighPurity = (**t).quality(reco::TrackBase::highPurity);
401  if (!isHighPurity)
402  continue;
403 
404  float pt = (**t).pt();
405  if (pt < 1.)
406  continue;
407 
408  nTracks++;
409 
410  float eta = (**t).eta();
411  float phi = (**t).phi();
412 
413  float w = v.trackWeight(*t);
414  float chi2NDF = (**t).normalizedChi2();
415  float chi2Prob = TMath::Prob((**t).chi2(), (int)(**t).ndof());
416  float Dxy = (**t).dxy(myVertex) * cmToUm; // is it needed ?
417  float Dz = (**t).dz(myVertex) * cmToUm; // is it needed ?
418  float DxyErr = (**t).dxyError() * cmToUm;
419  float DzErr = (**t).dzError() * cmToUm;
420 
421  sumPT += pt * pt;
422 
423  // fill MEs
424  weight->Fill(w);
425  chi2ndf->Fill(chi2NDF);
426  chi2prob->Fill(chi2Prob);
427  dxy->Fill(Dxy);
428  dxy2->Fill(Dxy);
429  dz->Fill(Dz);
430  dxyErr->Fill(DxyErr);
431  dzErr->Fill(DzErr);
432 
433  dxyVsPhi_pt1->Fill(phi, Dxy);
434  dzVsPhi_pt1->Fill(phi, Dz);
435  dxyVsEta_pt1->Fill(eta, Dxy);
436  dzVsEta_pt1->Fill(eta, Dz);
437 
438  if (pt < 10.)
439  continue;
440  dxyVsPhi_pt10->Fill(phi, Dxy);
441  dzVsPhi_pt10->Fill(phi, Dz);
442  dxyVsEta_pt10->Fill(eta, Dxy);
443  dzVsEta_pt10->Fill(eta, Dz);
444  }
445  ntracks->Fill(float(nTracks));
446  sumpt->Fill(sumPT);
447 }
448 
450  if (i < 0 || i > 1)
451  return;
452  if (!v.isValid())
453  type[i]->Fill(2.);
454  else if (v.isFake())
455  type[i]->Fill(1.);
456  else
457  type[i]->Fill(0.);
458 
459  if (v.isValid() && !v.isFake()) {
460  float weight = 0;
461  for (reco::Vertex::trackRef_iterator t = v.tracks_begin(); t != v.tracks_end(); t++)
462  weight += v.trackWeight(*t);
463  trksWeight[i]->Fill(weight);
464  nbtksinvtx[i]->Fill(v.tracksSize());
465  ntracksVsZ[i]->Fill(v.position().z() - beamSpot.z0(), v.tracksSize());
466 
467  vtxchi2[i]->Fill(v.chi2());
468  vtxndf[i]->Fill(v.ndof());
469  vtxprob[i]->Fill(ChiSquaredProbability(v.chi2(), v.ndof()));
470 
471  xrec[i]->Fill(v.position().x());
472  yrec[i]->Fill(v.position().y());
473  zrec[i]->Fill(v.position().z());
474 
475  float xb = beamSpot.x0() + beamSpot.dxdz() * (v.position().z() - beamSpot.z0());
476  float yb = beamSpot.y0() + beamSpot.dydz() * (v.position().z() - beamSpot.z0());
477  xDiff[i]->Fill((v.position().x() - xb) * 10000);
478  yDiff[i]->Fill((v.position().y() - yb) * 10000);
479 
480  xerr[i]->Fill(v.xError() * 10000);
481  yerr[i]->Fill(v.yError() * 10000);
482  zerr[i]->Fill(v.zError() * 10000);
483  xerrVsTrks[i]->Fill(weight, v.xError() * 10000);
484  yerrVsTrks[i]->Fill(weight, v.yError() * 10000);
485  zerrVsTrks[i]->Fill(weight, v.zError() * 10000);
486 
487  nans[i]->Fill(1., edm::isNotFinite(v.position().x()) * 1.);
488  nans[i]->Fill(2., edm::isNotFinite(v.position().y()) * 1.);
489  nans[i]->Fill(3., edm::isNotFinite(v.position().z()) * 1.);
490 
491  int index = 3;
492  for (int k = 0; k != 3; k++) {
493  for (int j = k; j != 3; j++) {
494  index++;
495  nans[i]->Fill(index * 1., edm::isNotFinite(v.covariance(k, j)) * 1.);
496  // in addition, diagonal element must be positive
497  if (j == k && v.covariance(k, j) < 0) {
498  nans[i]->Fill(index * 1., 1.);
499  }
500  }
501  }
502  }
503 }
504 
505 //define this as a plug-in
beam_dqm_sourceclient-live_cfg.DxyMin
DxyMin
Definition: beam_dqm_sourceclient-live_cfg.py:188
PrimaryVertexMonitor::zrec
MonitorElement * zrec[2]
Definition: PrimaryVertexMonitor.h:58
electrons_cff.dzErr
dzErr
Definition: electrons_cff.py:381
reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38
PrimaryVertexMonitor::sumpt
MonitorElement * sumpt
Definition: PrimaryVertexMonitor.h:65
mps_fire.i
i
Definition: mps_fire.py:428
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
PrimaryVertexMonitor
Definition: PrimaryVertexMonitor.h:26
PrimaryVertexMonitor::dxyVsPhi_pt1
MonitorElement * dxyVsPhi_pt1
Definition: PrimaryVertexMonitor.h:67
PrimaryVertexMonitor.h
PrimaryVertexMonitor::conf_
edm::ParameterSet conf_
Definition: PrimaryVertexMonitor.h:46
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
edm::Run
Definition: Run.h:45
PrimaryVertexMonitor::vertexInputTag_
edm::InputTag vertexInputTag_
Definition: PrimaryVertexMonitor.h:44
ChiSquaredProbability
float ChiSquaredProbability(double chiSquared, double nrDOF)
Definition: ChiSquaredProbability.cc:13
PrimaryVertexMonitor::ndof_
int ndof_
Definition: PrimaryVertexMonitor.h:52
edm
HLT enums.
Definition: AlignableModifier.h:19
PrimaryVertexMonitor::dxyVsEta_pt10
MonitorElement * dxyVsEta_pt10
Definition: PrimaryVertexMonitor.h:70
PrimaryVertexMonitor::score
MonitorElement * score[2]
Definition: PrimaryVertexMonitor.h:56
PrimaryVertexMonitor::bsY
MonitorElement * bsY
Definition: PrimaryVertexMonitor.h:63
PrimaryVertexMonitor::dqmLabel
std::string dqmLabel
Definition: PrimaryVertexMonitor.h:48
PrimaryVertexMonitor::xDiff
MonitorElement * xDiff[2]
Definition: PrimaryVertexMonitor.h:58
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
PrimaryVertexMonitor::dxy2
MonitorElement * dxy2
Definition: PrimaryVertexMonitor.h:66
PrimaryVertexMonitor::bsX
MonitorElement * bsX
Definition: PrimaryVertexMonitor.h:63
PrimaryVertexMonitor::zerr
MonitorElement * zerr[2]
Definition: PrimaryVertexMonitor.h:58
ChiSquaredProbability.h
PrimaryVertexMonitor::trksWeight
MonitorElement * trksWeight[2]
Definition: PrimaryVertexMonitor.h:56
PrimaryVertexMonitor::ntracksVsZ
MonitorElement * ntracksVsZ[2]
Definition: PrimaryVertexMonitor.h:60
PrimaryVertexMonitor::nbtksinvtx
MonitorElement * nbtksinvtx[2]
Definition: PrimaryVertexMonitor.h:56
PrimaryVertexMonitor::nans
MonitorElement * nans[2]
Definition: PrimaryVertexMonitor.h:61
PrimaryVertexMonitor::vtxprob
MonitorElement * vtxprob[2]
Definition: PrimaryVertexMonitor.h:61
MonitorTrackInnerTrackMuons_cff.EtaBin
EtaBin
Definition: MonitorTrackInnerTrackMuons_cff.py:64
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
vertices_cff.ntracks
ntracks
Definition: vertices_cff.py:34
findQualityFiles.v
v
Definition: findQualityFiles.py:179
PrimaryVertexMonitor::vertexPlots
void vertexPlots(const reco::Vertex &v, const reco::BeamSpot &beamSpot, int i)
Definition: PrimaryVertexMonitor.cc:449
PrimaryVertexMonitor::bsDydz
MonitorElement * bsDydz
Definition: PrimaryVertexMonitor.h:63
PrimaryVertexMonitor::PrimaryVertexMonitor
PrimaryVertexMonitor(const edm::ParameterSet &pSet)
Definition: PrimaryVertexMonitor.cc:15
BeamSpotPI::nTracks
Definition: BeamSpotPayloadInspectorHelper.h:41
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
edm::Handle< reco::VertexCollection >
electrons_cff.dxyErr
dxyErr
Definition: electrons_cff.py:383
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
PrimaryVertexMonitor::bsSigmaZ
MonitorElement * bsSigmaZ
Definition: PrimaryVertexMonitor.h:63
PrimaryVertexMonitor::bsDxdz
MonitorElement * bsDxdz
Definition: PrimaryVertexMonitor.h:63
PrimaryVertexMonitor::yerr
MonitorElement * yerr[2]
Definition: PrimaryVertexMonitor.h:58
PrimaryVertexMonitor::yerrVsTrks
MonitorElement * yerrVsTrks[2]
Definition: PrimaryVertexMonitor.h:59
PrimaryVertexMonitor::errorPrinted_
bool errorPrinted_
Definition: PrimaryVertexMonitor.h:53
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
MakerMacros.h
MonitorTrackSTAMuons_cfi.PhiMax
PhiMax
Definition: MonitorTrackSTAMuons_cfi.py:230
PrimaryVertexMonitor::pvTracksPlots
void pvTracksPlots(const reco::Vertex &v)
Definition: PrimaryVertexMonitor.cc:382
PrimaryVertexMonitor::TopFolderName_
std::string TopFolderName_
Definition: PrimaryVertexMonitor.h:50
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
PrimaryVertexMonitor::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: PrimaryVertexMonitor.cc:303
PrimaryVertexMonitor::nbvtx
MonitorElement * nbvtx
Definition: PrimaryVertexMonitor.h:56
Service.h
PVValHelper::eta
Definition: PVValidationHelpers.h:69
w
const double w
Definition: UKUtility.cc:23
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
reco::BeamSpot
Definition: BeamSpot.h:21
dqm::implementation::IBooker::bookProfile
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
PrimaryVertexMonitor::AlignmentLabel_
std::string AlignmentLabel_
Definition: PrimaryVertexMonitor.h:51
beam_dqm_sourceclient-live_cfg.DxyMax
DxyMax
Definition: beam_dqm_sourceclient-live_cfg.py:189
PrimaryVertexMonitor::dxyVsEta_pt1
MonitorElement * dxyVsEta_pt1
Definition: PrimaryVertexMonitor.h:68
PrimaryVertexMonitor::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: PrimaryVertexMonitor.cc:60
dqmdumpme.k
k
Definition: dqmdumpme.py:60
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PrimaryVertexMonitor::xerr
MonitorElement * xerr[2]
Definition: PrimaryVertexMonitor.h:58
PrimaryVertexMonitor::yrec
MonitorElement * yrec[2]
Definition: PrimaryVertexMonitor.h:58
PrimaryVertexMonitor::dxyVsPhi_pt10
MonitorElement * dxyVsPhi_pt10
Definition: PrimaryVertexMonitor.h:69
PrimaryVertexMonitor::dzVsPhi_pt1
MonitorElement * dzVsPhi_pt1
Definition: PrimaryVertexMonitor.h:67
cmToUm
constexpr float cmToUm
Definition: DMRChecker.cc:128
edm::ParameterSet
Definition: ParameterSet.h:47
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
PrimaryVertexMonitor::nbgvtx
MonitorElement * nbgvtx
Definition: PrimaryVertexMonitor.h:56
PrimaryVertexMonitor::yDiff
MonitorElement * yDiff[2]
Definition: PrimaryVertexMonitor.h:58
PrimaryVertexMonitor::beamSpotInputTag_
edm::InputTag beamSpotInputTag_
Definition: PrimaryVertexMonitor.h:44
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
PrimaryVertexMonitor_cff.DzBin
DzBin
Definition: PrimaryVertexMonitor_cff.py:19
PrimaryVertexMonitor::vtxndf
MonitorElement * vtxndf[2]
Definition: PrimaryVertexMonitor.h:61
PrimaryVertexMonitor::bsBeamWidthY
MonitorElement * bsBeamWidthY
Definition: PrimaryVertexMonitor.h:63
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
PrimaryVertexMonitor::dzErr
MonitorElement * dzErr
Definition: PrimaryVertexMonitor.h:66
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:771
PrimaryVertexMonitor::bsType
MonitorElement * bsType
Definition: PrimaryVertexMonitor.h:63
MonitorTrackSTAMuons_cfi.PhiMin
PhiMin
Definition: MonitorTrackSTAMuons_cfi.py:231
beam_dqm_sourceclient-live_cfg.DxyBin
DxyBin
Definition: beam_dqm_sourceclient-live_cfg.py:190
edm::EventSetup
Definition: EventSetup.h:57
PrimaryVertexMonitor::dxy
MonitorElement * dxy
Definition: PrimaryVertexMonitor.h:66
PrimaryVertexMonitor::vertexToken_
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
Definition: PrimaryVertexMonitor.h:39
PrimaryVertexMonitor_cff.DzMin
DzMin
Definition: PrimaryVertexMonitor_cff.py:21
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
PrimaryVertexMonitor_cff.DzMax
DzMax
Definition: PrimaryVertexMonitor_cff.py:20
DDAxes::phi
PrimaryVertexMonitor::zerrVsTrks
MonitorElement * zerrVsTrks[2]
Definition: PrimaryVertexMonitor.h:59
std
Definition: JetResolutionObject.h:76
PrimaryVertexMonitor::dzVsEta_pt1
MonitorElement * dzVsEta_pt1
Definition: PrimaryVertexMonitor.h:68
PrimaryVertexMonitor::scoreToken_
edm::EDGetTokenT< VertexScore > scoreToken_
Definition: PrimaryVertexMonitor.h:42
PrimaryVertexMonitor::dzVsEta_pt10
MonitorElement * dzVsEta_pt10
Definition: PrimaryVertexMonitor.h:70
PVValHelper::dxy
Definition: PVValidationHelpers.h:47
isFinite.h
MonitorTrackInnerTrackMuons_cff.EtaMin
EtaMin
Definition: MonitorTrackInnerTrackMuons_cff.py:64
MonitorTrackInnerTrackMuons_cff.EtaMax
EtaMax
Definition: MonitorTrackInnerTrackMuons_cff.py:64
PVValHelper::dz
Definition: PVValidationHelpers.h:50
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
PrimaryVertexMonitor::vtxchi2
MonitorElement * vtxchi2[2]
Definition: PrimaryVertexMonitor.h:61
PrimaryVertexMonitor::~PrimaryVertexMonitor
~PrimaryVertexMonitor() override
Definition: PrimaryVertexMonitor.cc:301
PrimaryVertexMonitor::beamspotToken_
edm::EDGetTokenT< reco::BeamSpot > beamspotToken_
Definition: PrimaryVertexMonitor.h:40
PrimaryVertexMonitor::xrec
MonitorElement * xrec[2]
Definition: PrimaryVertexMonitor.h:58
PrimaryVertexMonitor::bsZ
MonitorElement * bsZ
Definition: PrimaryVertexMonitor.h:63
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorTrackSTAMuons_cfi.PhiBin
PhiBin
Definition: MonitorTrackSTAMuons_cfi.py:229
dqm::implementation::IBooker
Definition: DQMStore.h:43
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
PrimaryVertexMonitor::bsBeamWidthX
MonitorElement * bsBeamWidthX
Definition: PrimaryVertexMonitor.h:63
PrimaryVertexMonitor::dz
MonitorElement * dz
Definition: PrimaryVertexMonitor.h:66
PrimaryVertexMonitor::ntracks
MonitorElement * ntracks
Definition: PrimaryVertexMonitor.h:65
PrimaryVertexMonitor::xerrVsTrks
MonitorElement * xerrVsTrks[2]
Definition: PrimaryVertexMonitor.h:59
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
PrimaryVertexMonitor::dxyErr
MonitorElement * dxyErr
Definition: PrimaryVertexMonitor.h:66
edm::Event
Definition: Event.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
PrimaryVertexMonitor::dzVsPhi_pt10
MonitorElement * dzVsPhi_pt10
Definition: PrimaryVertexMonitor.h:69
PrimaryVertexMonitor::chi2prob
MonitorElement * chi2prob
Definition: PrimaryVertexMonitor.h:65
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
edm::InputTag
Definition: InputTag.h:15
PrimaryVertexMonitor::chi2ndf
MonitorElement * chi2ndf
Definition: PrimaryVertexMonitor.h:65
weight
Definition: weight.py:1
reco::Vertex
Definition: Vertex.h:35
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
reco::TrackBase::highPurity
Definition: TrackBase.h:154