CMS 3D CMS Logo

SplitVertexResolution.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Alignment/OfflineValidation
4 // Class: SplitVertexResolution
5 //
9 //
10 // Original Author: Marco Musich
11 // Created: Mon, 13 Jun 2016 15:07:11 GMT
12 //
13 //
14 
15 // system include files
16 #include <memory>
17 #include <algorithm> // std::sort
18 #include <vector> // std::vector
19 #include <chrono>
20 #include <iostream>
21 #include <random>
22 #include <boost/range/adaptor/indexed.hpp>
23 
24 // ROOT include files
25 #include "TTree.h"
26 #include "TProfile.h"
27 #include "TF1.h"
28 #include "TMath.h"
29 
30 // user include files
34 
42 
44 
49 
53 
59 
62 
63 //
64 // useful code
65 //
66 
67 namespace statmode {
68  using fitParams = std::pair<Measurement1D, Measurement1D>;
69 }
70 
71 //
72 // class declaration
73 //
74 
75 class SplitVertexResolution : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
76 public:
78  ~SplitVertexResolution() override;
79 
80  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
81  static bool mysorter(reco::Track i, reco::Track j) { return (i.pt() > j.pt()); }
82 
83 private:
84  void beginJob() override;
85  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
86  virtual void beginEvent() final;
87  void analyze(const edm::Event&, const edm::EventSetup&) override;
88  void endJob() override;
89  void endRun(edm::Run const&, edm::EventSetup const&) override{};
90 
91  template <std::size_t SIZE>
92  bool checkBinOrdering(std::array<float, SIZE>& bins);
93  std::vector<TH1F*> bookResidualsHistogram(TFileDirectory dir,
94  unsigned int theNOfBins,
95  TString resType,
96  TString varType);
97 
98  void fillTrendPlotByIndex(TH1F* trendPlot, std::vector<TH1F*>& h, PVValHelper::estimator fitPar_);
99  statmode::fitParams fitResiduals(TH1* hist, bool singleTime = false);
101 
102  std::pair<long long, long long> getRunTime(const edm::EventSetup& iSetup) const;
103 
104  // counters
105  int ievt;
106  int itrks;
107 
108  // compression settings
110 
111  // switch to keep the ntuple
113 
114  // storing integrated luminosity
115  double intLumi_;
116  bool debug_;
117 
120 
123 
124  edm::InputTag triggerResultsTag_ = edm::InputTag("TriggerResults", "", "HLT"); //InputTag tag("TriggerResults");
126 
127  // ES Tokens
130 
131  double minVtxNdf_;
132  double minVtxWgt_;
133 
134  // checks on the run to be processed
135 
137  std::vector<unsigned int> runControlNumbers_;
138 
139  static constexpr double cmToUm = 10000.;
140 
142 
145 
146  std::map<unsigned int, std::pair<long long, long long> > runNumbersTimesLog_;
149 
150  TH1F* h_diffX;
151  TH1F* h_diffY;
152  TH1F* h_diffZ;
153 
157 
158  TH1F* h_errX;
159  TH1F* h_errY;
160  TH1F* h_errZ;
161 
162  TH1F* h_pullX;
163  TH1F* h_pullY;
164  TH1F* h_pullZ;
165 
166  TH1F* h_ntrks;
167  TH1F* h_sumPt;
168  TH1F* h_avgSumPt;
169 
170  TH1F* h_sumPt1;
171  TH1F* h_sumPt2;
172 
173  TH1F* h_wTrks1;
174  TH1F* h_wTrks2;
175 
176  TH1F* h_minWTrks1;
177  TH1F* h_minWTrks2;
178 
181 
182  TH1F* h_runNumber;
183 
185  TH1I* h_nVertices;
188 
189  // trigger results
190 
193 
194  // resolutions
195 
196  std::vector<TH1F*> h_resolX_sumPt_;
197  std::vector<TH1F*> h_resolY_sumPt_;
198  std::vector<TH1F*> h_resolZ_sumPt_;
199 
200  std::vector<TH1F*> h_resolX_Ntracks_;
201  std::vector<TH1F*> h_resolY_Ntracks_;
202  std::vector<TH1F*> h_resolZ_Ntracks_;
203 
204  std::vector<TH1F*> h_resolX_Nvtx_;
205  std::vector<TH1F*> h_resolY_Nvtx_;
206  std::vector<TH1F*> h_resolZ_Nvtx_;
207 
211 
215 
219 
220  // pulls
221  std::vector<TH1F*> h_pullX_sumPt_;
222  std::vector<TH1F*> h_pullY_sumPt_;
223  std::vector<TH1F*> h_pullZ_sumPt_;
224 
225  std::vector<TH1F*> h_pullX_Ntracks_;
226  std::vector<TH1F*> h_pullY_Ntracks_;
227  std::vector<TH1F*> h_pullZ_Ntracks_;
228 
229  std::vector<TH1F*> h_pullX_Nvtx_;
230  std::vector<TH1F*> h_pullY_Nvtx_;
231  std::vector<TH1F*> h_pullZ_Nvtx_;
232 
236 
240 
244 
245  std::mt19937 engine_;
246 
248  TTree* tree_;
249 
250  // ----------member data ---------------------------
251  static const int nPtBins_ = 30;
252  std::array<float, nPtBins_ + 1> mypT_bins_ = PVValHelper::makeLogBins<float, nPtBins_>(1., 1e3);
253 
254  static const int nTrackBins_ = 60;
255  std::array<float, nTrackBins_ + 1> myNTrack_bins_;
256 
257  static const int nVtxBins_ = 40;
258  std::array<float, nVtxBins_ + 1> myNVtx_bins_;
259 
260  std::map<std::string, std::pair<int, int> > triggerMap_;
261 };
262 
264  : compressionSettings_(iConfig.getUntrackedParameter<int>("compressionSettings", -1)),
265  storeNtuple_(iConfig.getParameter<bool>("storeNtuple")),
266  intLumi_(iConfig.getUntrackedParameter<double>("intLumi", 0.)),
267  debug_(iConfig.getUntrackedParameter<bool>("Debug", false)),
268  pvsTag_(iConfig.getParameter<edm::InputTag>("vtxCollection")),
269  pvsToken_(consumes<reco::VertexCollection>(pvsTag_)),
270  tracksTag_(iConfig.getParameter<edm::InputTag>("trackCollection")),
271  tracksToken_(consumes<reco::TrackCollection>(tracksTag_)),
272  triggerResultsToken_(consumes<edm::TriggerResults>(triggerResultsTag_)),
273  transientTrackBuilderToken_(
274  esConsumes<TransientTrackBuilder, TransientTrackRecord>(edm::ESInputTag("", "TransientTrackBuilder"))),
275  runInfoToken_(esConsumes<RunInfo, RunInfoRcd, edm::Transition::BeginRun>()),
276  minVtxNdf_(iConfig.getUntrackedParameter<double>("minVertexNdf")),
277  minVtxWgt_(iConfig.getUntrackedParameter<double>("minVertexMeanWeight")),
278  runControl_(iConfig.getUntrackedParameter<bool>("runControl", false)) {
279  usesResource(TFileService::kSharedResource);
280 
281  std::vector<unsigned int> defaultRuns;
282  defaultRuns.push_back(0);
283  runControlNumbers_ = iConfig.getUntrackedParameter<std::vector<unsigned int> >("runControlNumber", defaultRuns);
284 
285  std::vector<float> vect = PVValHelper::generateBins(nTrackBins_ + 1, -0.5, 120.);
286  std::copy(vect.begin(), vect.begin() + nTrackBins_ + 1, myNTrack_bins_.begin());
287 
288  vect.clear();
289  vect = PVValHelper::generateBins(nVtxBins_ + 1, 1., 40.);
290  std::copy(vect.begin(), vect.begin() + nVtxBins_ + 1, myNVtx_bins_.begin());
291 }
292 
294 
295 // ------------ method called for each event ------------
297  using namespace edm;
298 
299  // deterministic seed from the event number
300  // should not bias the result as the event number is already
301  // assigned randomly-enough
302  engine_.seed(iEvent.id().event() + (iEvent.id().luminosityBlock() << 10) + (iEvent.id().run() << 20));
303 
304  // first check if the event passes the run control
305  bool passesRunControl = false;
306 
307  if (runControl_) {
308  for (const auto& runControlNumber : runControlNumbers_) {
309  if (iEvent.eventAuxiliary().run() == runControlNumber) {
310  if (debug_) {
311  edm::LogInfo("SplitVertexResolution")
312  << " run number: " << iEvent.eventAuxiliary().run() << " keeping run:" << runControlNumber;
313  }
314  passesRunControl = true;
315  break;
316  }
317  }
318  if (!passesRunControl)
319  return;
320  }
321 
322  // Fill general info
323  h_runNumber->Fill(iEvent.id().run());
324 
325  ievt++;
328 
329  const edm::TriggerNames& triggerNames_ = iEvent.triggerNames(*hltresults);
330  int ntrigs = hltresults->size();
331  //const std::vector<std::string>& triggernames = triggerNames_.triggerNames();
332 
333  beginEvent();
334 
335  // Fill general info
336  event_.runNumber = iEvent.id().run();
337  event_.luminosityBlockNumber = iEvent.id().luminosityBlock();
338  event_.eventNumber = iEvent.id().event();
339 
341 
343  iEvent.getByToken(pvsToken_, vertices);
344  const reco::VertexCollection pvtx = *(vertices.product());
345 
346  event_.nVtx = pvtx.size();
347  int nOfflineVtx = pvtx.size();
348  h_nOfflineVertices->Fill(nOfflineVtx);
349 
351  iEvent.getByToken(tracksToken_, tracks);
352  itrks += tracks.product()->size();
353 
354  for (int itrig = 0; itrig != ntrigs; ++itrig) {
355  const std::string& trigName = triggerNames_.triggerName(itrig);
356  bool accept = hltresults->accept(itrig);
357  if (accept == 1) {
358  triggerMap_[trigName].first += 1;
359  triggerMap_[trigName].second += tracks.product()->size();
360  // triggerInfo.push_back(pair <string, int> (trigName, accept));
361  }
362  }
363 
364  int counter = 0;
365  int noFakecounter = 0;
366  int goodcounter = 0;
367 
368  for (auto pvIt = pvtx.cbegin(); pvIt != pvtx.cend(); ++pvIt) {
369  reco::Vertex iPV = *pvIt;
370  counter++;
371  if (iPV.isFake())
372  continue;
373  noFakecounter++;
374 
375  // vertex selection as in bs code
376  if (iPV.ndof() < minVtxNdf_ || (iPV.ndof() + 3.) / iPV.tracksSize() < 2 * minVtxWgt_)
377  continue;
378 
379  goodcounter++;
381  reco::TrackCollection groupOne, groupTwo;
382  for (auto trki = iPV.tracks_begin(); trki != iPV.tracks_end(); ++trki) {
383  if (trki->isNonnull()) {
384  reco::TrackRef trk_now(tracks, (*trki).key());
385  allTracks.push_back(*trk_now);
386  }
387  }
388 
389  if (goodcounter > 1)
390  continue;
391 
392  // order with decreasing pt
393  std::sort(allTracks.begin(), allTracks.end(), mysorter);
394 
395  int ntrks = allTracks.size();
396  h_ntrks->Fill(ntrks);
397 
398  // discard lowest pt track
399  uint even_ntrks;
400  ntrks % 2 == 0 ? even_ntrks = ntrks : even_ntrks = ntrks - 1;
401 
402  // split into two sets equally populated
403  for (uint tracksIt = 0; tracksIt < even_ntrks; tracksIt = tracksIt + 2) {
404  reco::Track firstTrk = allTracks.at(tracksIt);
405  reco::Track secondTrk = allTracks.at(tracksIt + 1);
406  auto dis = std::uniform_int_distribution<>(0, 1); // [0, 1]
407 
408  if (dis(engine_) > 0.5) {
409  groupOne.push_back(firstTrk);
410  groupTwo.push_back(secondTrk);
411  } else {
412  groupOne.push_back(secondTrk);
413  groupTwo.push_back(firstTrk);
414  }
415  }
416 
417  if (!(groupOne.size() >= 2 && groupTwo.size() >= 2))
418  continue;
419 
420  h_OrigVertexErrX->Fill(iPV.xError() * cmToUm);
421  h_OrigVertexErrY->Fill(iPV.yError() * cmToUm);
422  h_OrigVertexErrZ->Fill(iPV.zError() * cmToUm);
423 
424  float sumPt = 0, sumPt1 = 0, sumPt2 = 0, avgSumPt = 0;
425 
426  // refit the two sets of tracks
427  std::vector<reco::TransientTrack> groupOne_ttks;
428  groupOne_ttks.clear();
429  for (auto itrk = groupOne.cbegin(); itrk != groupOne.cend(); itrk++) {
430  reco::TransientTrack tmpTransientTrack = theB.build(*itrk);
431  groupOne_ttks.push_back(tmpTransientTrack);
432  sumPt1 += itrk->pt();
433  sumPt += itrk->pt();
434  }
435 
436  AdaptiveVertexFitter pvFitter;
437  TransientVertex pvOne = pvFitter.vertex(groupOne_ttks);
438  if (!pvOne.isValid())
439  continue;
440 
441  reco::Vertex onePV = pvOne;
442 
443  std::vector<reco::TransientTrack> groupTwo_ttks;
444  groupTwo_ttks.clear();
445  for (auto itrk = groupTwo.cbegin(); itrk != groupTwo.cend(); itrk++) {
446  reco::TransientTrack tmpTransientTrack = theB.build(*itrk);
447  groupTwo_ttks.push_back(tmpTransientTrack);
448  sumPt2 += itrk->pt();
449  sumPt += itrk->pt();
450  }
451 
452  // average sumPt
453  avgSumPt = (sumPt1 + sumPt2) / 2.;
454  h_avgSumPt->Fill(avgSumPt);
455 
456  TransientVertex pvTwo = pvFitter.vertex(groupTwo_ttks);
457  if (!pvTwo.isValid())
458  continue;
459 
460  reco::Vertex twoPV = pvTwo;
461 
462  float theminW1 = 1.;
463  float theminW2 = 1.;
464  for (auto otrk = pvOne.originalTracks().cbegin(); otrk != pvOne.originalTracks().cend(); ++otrk) {
465  h_wTrks1->Fill(pvOne.trackWeight(*otrk));
466  if (pvOne.trackWeight(*otrk) < theminW1) {
467  theminW1 = pvOne.trackWeight(*otrk);
468  }
469  }
470  for (auto otrk = pvTwo.originalTracks().cbegin(); otrk != pvTwo.originalTracks().end(); ++otrk) {
471  h_wTrks2->Fill(pvTwo.trackWeight(*otrk));
472  if (pvTwo.trackWeight(*otrk) < theminW2) {
473  theminW2 = pvTwo.trackWeight(*otrk);
474  }
475  }
476 
477  h_sumPt->Fill(sumPt);
478 
479  int half_trks = twoPV.nTracks();
480 
481  const double invSqrt2 = 1. / std::sqrt(2.);
482 
483  double deltaX = (twoPV.x() - onePV.x());
484  double deltaY = (twoPV.y() - onePV.y());
485  double deltaZ = (twoPV.z() - onePV.z());
486 
487  double resX = deltaX * invSqrt2;
488  double resY = deltaY * invSqrt2;
489  double resZ = deltaZ * invSqrt2;
490 
491  h_diffX->Fill(resX * cmToUm);
492  h_diffY->Fill(resY * cmToUm);
493  h_diffZ->Fill(resZ * cmToUm);
494 
495  double errX = sqrt(pow(twoPV.xError(), 2) + pow(onePV.xError(), 2));
496  double errY = sqrt(pow(twoPV.yError(), 2) + pow(onePV.yError(), 2));
497  double errZ = sqrt(pow(twoPV.zError(), 2) + pow(onePV.zError(), 2));
498 
499  h_errX->Fill(errX * cmToUm);
500  h_errY->Fill(errY * cmToUm);
501  h_errZ->Fill(errZ * cmToUm);
502 
503  h_pullX->Fill(deltaX / errX);
504  h_pullY->Fill(deltaY / errY);
505  h_pullZ->Fill(deltaZ / errZ);
506 
507  // filling the pT-binned distributions
508 
509  for (int ipTBin = 0; ipTBin < nPtBins_; ipTBin++) {
510  float pTF = mypT_bins_[ipTBin];
511  float pTL = mypT_bins_[ipTBin + 1];
512 
513  if (avgSumPt >= pTF && avgSumPt < pTL) {
514  PVValHelper::fillByIndex(h_resolX_sumPt_, ipTBin, resX * cmToUm, "1");
515  PVValHelper::fillByIndex(h_resolY_sumPt_, ipTBin, resY * cmToUm, "2");
516  PVValHelper::fillByIndex(h_resolZ_sumPt_, ipTBin, resZ * cmToUm, "3");
517 
518  PVValHelper::fillByIndex(h_pullX_sumPt_, ipTBin, deltaX / errX, "4");
519  PVValHelper::fillByIndex(h_pullY_sumPt_, ipTBin, deltaY / errY, "5");
520  PVValHelper::fillByIndex(h_pullZ_sumPt_, ipTBin, deltaZ / errZ, "6");
521  }
522  }
523 
524  // filling the track multeplicity binned distributions
525 
526  for (int inTrackBin = 0; inTrackBin < nTrackBins_; inTrackBin++) {
527  float nTrackF = myNTrack_bins_[inTrackBin];
528  float nTrackL = myNTrack_bins_[inTrackBin + 1];
529 
530  if (ntrks >= nTrackF && ntrks < nTrackL) {
531  PVValHelper::fillByIndex(h_resolX_Ntracks_, inTrackBin, resX * cmToUm, "7");
532  PVValHelper::fillByIndex(h_resolY_Ntracks_, inTrackBin, resY * cmToUm, "8");
533  PVValHelper::fillByIndex(h_resolZ_Ntracks_, inTrackBin, resZ * cmToUm, "9");
534 
535  PVValHelper::fillByIndex(h_pullX_Ntracks_, inTrackBin, deltaX / errX, "10");
536  PVValHelper::fillByIndex(h_pullY_Ntracks_, inTrackBin, deltaY / errY, "11");
537  PVValHelper::fillByIndex(h_pullZ_Ntracks_, inTrackBin, deltaZ / errZ, "12");
538  }
539  }
540 
541  // filling the vertex multeplicity binned distributions
542 
543  for (int inVtxBin = 0; inVtxBin < nVtxBins_; inVtxBin++) {
544  /*
545  float nVtxF = myNVtx_bins_[inVtxBin];
546  float nVtxL = myNVtx_bins_[inVtxBin+1];
547  if(nOfflineVtx >= nVtxF && nOfflineVtx < nVtxL){
548  */
549 
550  if (nOfflineVtx == inVtxBin) {
551  PVValHelper::fillByIndex(h_resolX_Nvtx_, inVtxBin, deltaX * cmToUm, "7");
552  PVValHelper::fillByIndex(h_resolY_Nvtx_, inVtxBin, deltaY * cmToUm, "8");
553  PVValHelper::fillByIndex(h_resolZ_Nvtx_, inVtxBin, deltaZ * cmToUm, "9");
554 
555  PVValHelper::fillByIndex(h_pullX_Nvtx_, inVtxBin, deltaX / errX, "10");
556  PVValHelper::fillByIndex(h_pullY_Nvtx_, inVtxBin, deltaY / errY, "11");
557  PVValHelper::fillByIndex(h_pullZ_Nvtx_, inVtxBin, deltaZ / errZ, "12");
558  }
559  }
560 
561  h_sumPt1->Fill(sumPt1);
562  h_sumPt2->Fill(sumPt2);
563 
564  h_minWTrks1->Fill(theminW1);
565  h_minWTrks2->Fill(theminW2);
566 
567  h_PVCL_subVtx1->Fill(TMath::Prob(pvOne.totalChiSquared(), (int)(pvOne.degreesOfFreedom())));
568  h_PVCL_subVtx2->Fill(TMath::Prob(pvTwo.totalChiSquared(), (int)(pvTwo.degreesOfFreedom())));
569 
570  // fill ntuples
571  pvCand thePV;
572  thePV.ipos = counter;
573  thePV.nTrks = ntrks;
574 
575  thePV.x_origVtx = iPV.x();
576  thePV.y_origVtx = iPV.y();
577  thePV.z_origVtx = iPV.z();
578 
579  thePV.xErr_origVtx = iPV.xError();
580  thePV.yErr_origVtx = iPV.yError();
581  thePV.zErr_origVtx = iPV.zError();
582 
583  thePV.n_subVtx1 = half_trks;
584  thePV.x_subVtx1 = onePV.x();
585  thePV.y_subVtx1 = onePV.y();
586  thePV.z_subVtx1 = onePV.z();
587 
588  thePV.xErr_subVtx1 = onePV.xError();
589  thePV.yErr_subVtx1 = onePV.yError();
590  thePV.zErr_subVtx1 = onePV.zError();
591  thePV.sumPt_subVtx1 = sumPt1;
592 
593  thePV.n_subVtx2 = half_trks;
594  thePV.x_subVtx2 = twoPV.x();
595  thePV.y_subVtx2 = twoPV.y();
596  thePV.z_subVtx2 = twoPV.z();
597 
598  thePV.xErr_subVtx2 = twoPV.xError();
599  thePV.yErr_subVtx2 = twoPV.yError();
600  thePV.zErr_subVtx2 = twoPV.zError();
601  thePV.sumPt_subVtx2 = sumPt2;
602 
603  thePV.CL_subVtx1 = TMath::Prob(pvOne.totalChiSquared(), (int)(pvOne.degreesOfFreedom()));
604  thePV.CL_subVtx2 = TMath::Prob(pvTwo.totalChiSquared(), (int)(pvTwo.degreesOfFreedom()));
605 
606  thePV.minW_subVtx1 = theminW1;
607  thePV.minW_subVtx2 = theminW2;
608 
609  event_.pvs.push_back(thePV);
610 
611  } // loop on the vertices
612 
613  // fill the histogram of vertices per event
614  h_nVertices->Fill(counter);
615  h_nNonFakeVertices->Fill(noFakecounter);
616  h_nFinalVertices->Fill(goodcounter);
617 
618  if (storeNtuple_) {
619  tree_->Fill();
620  }
621 }
622 
624  event_.pvs.clear();
625  event_.nVtx = -1;
626 }
627 
629  unsigned int RunNumber_ = run.run();
630 
631  if (!runNumbersTimesLog_.count(RunNumber_)) {
632  auto times = getRunTime(iSetup);
633 
634  if (debug_) {
635  const time_t start_time = times.first / 1.0e+6;
636  edm::LogInfo("SplitVertexResolution")
637  << RunNumber_ << " has start time: " << times.first << " - " << times.second << std::endl;
638  edm::LogInfo("SplitVertexResolution")
639  << "human readable time: " << std::asctime(std::gmtime(&start_time)) << std::endl;
640  }
641  runNumbersTimesLog_[RunNumber_] = times;
642  }
643 }
644 
645 // ------------ method called once each job just before starting event loop ------------
647  ievt = 0;
648  itrks = 0;
649 
650  if (compressionSettings_ > 0) {
651  outfile_->file().SetCompressionSettings(compressionSettings_);
652  }
653 
654  // luminosity histo
655  TFileDirectory EventFeatures = outfile_->mkdir("EventFeatures");
657  EventFeatures.make<TH1F>("h_lumiFromConfig", "luminosity from config;;luminosity of present run", 1, -0.5, 0.5);
658  h_lumiFromConfig->SetBinContent(1, intLumi_);
659 
660  h_runFromConfig = EventFeatures.make<TH1I>("h_runFromConfig",
661  "run number from config;;run number (from configuration)",
662  runControlNumbers_.size(),
663  0.,
664  runControlNumbers_.size());
665 
666  for (const auto& run : runControlNumbers_ | boost::adaptors::indexed(1)) {
667  h_runFromConfig->SetBinContent(run.index(), run.value());
668  }
669 
670  // resolutions
671 
673  edm::LogError("SplitVertexResolution") << " Warning - the vector of pT bins is not ordered " << std::endl;
674  }
675 
677  edm::LogError("SplitVertexResolution") << " Warning -the vector of n. tracks bins is not ordered " << std::endl;
678  }
679 
681  edm::LogError("SplitVertexResolution") << " Warning -the vector of n. vertices bins is not ordered " << std::endl;
682  }
683 
684  TFileDirectory xResolSumPt = outfile_->mkdir("xResolSumPt");
685  h_resolX_sumPt_ = bookResidualsHistogram(xResolSumPt, nPtBins_, "resolX", "sumPt");
686 
687  TFileDirectory yResolSumPt = outfile_->mkdir("yResolSumPt");
688  h_resolY_sumPt_ = bookResidualsHistogram(yResolSumPt, nPtBins_, "resolY", "sumPt");
689 
690  TFileDirectory zResolSumPt = outfile_->mkdir("zResolSumPt");
691  h_resolZ_sumPt_ = bookResidualsHistogram(zResolSumPt, nPtBins_, "resolZ", "sumPt");
692 
693  TFileDirectory xResolNtracks_ = outfile_->mkdir("xResolNtracks");
694  h_resolX_Ntracks_ = bookResidualsHistogram(xResolNtracks_, nTrackBins_, "resolX", "Ntracks");
695 
696  TFileDirectory yResolNtracks_ = outfile_->mkdir("yResolNtracks");
697  h_resolY_Ntracks_ = bookResidualsHistogram(yResolNtracks_, nTrackBins_, "resolY", "Ntracks");
698 
699  TFileDirectory zResolNtracks_ = outfile_->mkdir("zResolNtracks");
700  h_resolZ_Ntracks_ = bookResidualsHistogram(zResolNtracks_, nTrackBins_, "resolZ", "Ntracks");
701 
702  TFileDirectory xResolNvtx_ = outfile_->mkdir("xResolNvtx");
703  h_resolX_Nvtx_ = bookResidualsHistogram(xResolNvtx_, nVtxBins_, "resolX", "Nvtx");
704 
705  TFileDirectory yResolNvtx_ = outfile_->mkdir("yResolNvtx");
706  h_resolY_Nvtx_ = bookResidualsHistogram(yResolNvtx_, nVtxBins_, "resolY", "Nvtx");
707 
708  TFileDirectory zResolNvtx_ = outfile_->mkdir("zResolNvtx");
709  h_resolZ_Nvtx_ = bookResidualsHistogram(zResolNvtx_, nVtxBins_, "resolZ", "Nvtx");
710 
711  // pulls
712 
713  TFileDirectory xPullSumPt = outfile_->mkdir("xPullSumPt");
714  h_pullX_sumPt_ = bookResidualsHistogram(xPullSumPt, nPtBins_, "pullX", "sumPt");
715 
716  TFileDirectory yPullSumPt = outfile_->mkdir("yPullSumPt");
717  h_pullY_sumPt_ = bookResidualsHistogram(yPullSumPt, nPtBins_, "pullY", "sumPt");
718 
719  TFileDirectory zPullSumPt = outfile_->mkdir("zPullSumPt");
720  h_pullZ_sumPt_ = bookResidualsHistogram(zPullSumPt, nPtBins_, "pullZ", "sumPt");
721 
722  TFileDirectory xPullNtracks_ = outfile_->mkdir("xPullNtracks");
723  h_pullX_Ntracks_ = bookResidualsHistogram(xPullNtracks_, nTrackBins_, "pullX", "Ntracks");
724 
725  TFileDirectory yPullNtracks_ = outfile_->mkdir("yPullNtracks");
726  h_pullY_Ntracks_ = bookResidualsHistogram(yPullNtracks_, nTrackBins_, "pullY", "Ntracks");
727 
728  TFileDirectory zPullNtracks_ = outfile_->mkdir("zPullNtracks");
729  h_pullZ_Ntracks_ = bookResidualsHistogram(zPullNtracks_, nTrackBins_, "pullZ", "Ntracks");
730 
731  TFileDirectory xPullNvtx_ = outfile_->mkdir("xPullNvtx");
732  h_pullX_Nvtx_ = bookResidualsHistogram(xPullNvtx_, nVtxBins_, "pullX", "Nvtx");
733 
734  TFileDirectory yPullNvtx_ = outfile_->mkdir("yPullNvtx");
735  h_pullY_Nvtx_ = bookResidualsHistogram(yPullNvtx_, nVtxBins_, "pullY", "Nvtx");
736 
737  TFileDirectory zPullNvtx_ = outfile_->mkdir("zPullNvtx");
738  h_pullZ_Nvtx_ = bookResidualsHistogram(zPullNvtx_, nVtxBins_, "pullZ", "Nvtx");
739 
740  // control plots
741  h_runNumber = outfile_->make<TH1F>("h_runNumber", "run number;run number;n_{events}", 100000, 250000., 350000.);
742 
743  h_nOfflineVertices = outfile_->make<TH1I>("h_nOfflineVertices", "n. of vertices;n. vertices; events", 100, 0, 100);
744  h_nVertices = outfile_->make<TH1I>("h_nVertices", "n. of vertices;n. vertices; events", 100, 0, 100);
746  outfile_->make<TH1I>("h_nRealVertices", "n. of non-fake vertices;n. vertices; events", 100, 0, 100);
748  outfile_->make<TH1I>("h_nSelectedVertices", "n. of selected vertices vertices;n. vertices; events", 100, 0, 100);
749 
750  h_diffX = outfile_->make<TH1F>(
751  "h_diffX", "x-coordinate vertex resolution;vertex resolution (x) [#mum];vertices", 100, -300, 300.);
752  h_diffY = outfile_->make<TH1F>(
753  "h_diffY", "y-coordinate vertex resolution;vertex resolution (y) [#mum];vertices", 100, -300, 300.);
754  h_diffZ = outfile_->make<TH1F>(
755  "h_diffZ", "z-coordinate vertex resolution;vertex resolution (z) [#mum];vertices", 100, -500, 500.);
756 
757  h_OrigVertexErrX = outfile_->make<TH1F>(
758  "h_OrigVertexErrX", "x-coordinate vertex error;vertex error (x) [#mum];vertices", 300, 0., 300.);
759  h_OrigVertexErrY = outfile_->make<TH1F>(
760  "h_OrigVertexErrY", "y-coordinate vertex error;vertex error (y) [#mum];vertices", 300, 0., 300.);
761  h_OrigVertexErrZ = outfile_->make<TH1F>(
762  "h_OrigVertexErrZ", "z-coordinate vertex error;vertex error (z) [#mum];vertices", 500, 0., 500.);
763 
764  h_errX = outfile_->make<TH1F>(
765  "h_errX", "x-coordinate vertex resolution error;vertex resoltuion error (x) [#mum];vertices", 300, 0., 300.);
766  h_errY = outfile_->make<TH1F>(
767  "h_errY", "y-coordinate vertex resolution error;vertex resolution error (y) [#mum];vertices", 300, 0., 300.);
768  h_errZ = outfile_->make<TH1F>(
769  "h_errZ", "z-coordinate vertex resolution error;vertex resolution error (z) [#mum];vertices", 500, 0., 500.);
770 
771  h_pullX = outfile_->make<TH1F>("h_pullX", "x-coordinate vertex pull;vertex pull (x);vertices", 500, -10, 10.);
772  h_pullY = outfile_->make<TH1F>("h_pullY", "y-coordinate vertex pull;vertex pull (y);vertices", 500, -10, 10.);
773  h_pullZ = outfile_->make<TH1F>("h_pullZ", "z-coordinate vertex pull;vertex pull (z);vertices", 500, -10, 10.);
774 
775  h_ntrks = outfile_->make<TH1F>("h_ntrks",
776  "number of tracks in vertex;vertex multeplicity;vertices",
777  myNTrack_bins_.size() - 1,
778  myNTrack_bins_.data());
779 
780  h_sumPt = outfile_->make<TH1F>(
781  "h_sumPt", "#Sigma p_{T};#sum p_{T} [GeV];vertices", mypT_bins_.size() - 1, mypT_bins_.data());
782 
783  h_avgSumPt = outfile_->make<TH1F>(
784  "h_avgSumPt", "#LT #Sigma p_{T} #GT;#LT #sum p_{T} #GT [GeV];vertices", mypT_bins_.size() - 1, mypT_bins_.data());
785 
786  h_sumPt1 = outfile_->make<TH1F>("h_sumPt1",
787  "#Sigma p_{T} sub-vertex 1;#sum p_{T} sub-vertex 1 [GeV];subvertices",
788  mypT_bins_.size() - 1,
789  mypT_bins_.data());
790  h_sumPt2 = outfile_->make<TH1F>("h_sumPt2",
791  "#Sigma p_{T} sub-vertex 2;#sum p_{T} sub-vertex 2 [GeV];subvertices",
792  mypT_bins_.size() - 1,
793  mypT_bins_.data());
794 
795  h_wTrks1 = outfile_->make<TH1F>("h_wTrks1", "weight of track for sub-vertex 1;track weight;subvertices", 500, 0., 1.);
796  h_wTrks2 = outfile_->make<TH1F>("h_wTrks2", "weithg of track for sub-vertex 2;track weight;subvertices", 500, 0., 1.);
797 
798  h_minWTrks1 = outfile_->make<TH1F>(
799  "h_minWTrks1", "minimum weight of track for sub-vertex 1;minimum track weight;subvertices", 500, 0., 1.);
800  h_minWTrks2 = outfile_->make<TH1F>(
801  "h_minWTrks2", "minimum weithg of track for sub-vertex 2;minimum track weight;subvertices", 500, 0., 1.);
802 
804  outfile_->make<TH1F>("h_PVCL_subVtx1",
805  "#chi^{2} probability for sub-vertex 1;Prob(#chi^{2},ndof) for sub-vertex 1;subvertices",
806  100,
807  0.,
808  1);
810  outfile_->make<TH1F>("h_PVCL_subVtx2",
811  "#chi^{2} probability for sub-vertex 2;Prob(#chi^{2},ndof) for sub-vertex 2;subvertices",
812  100,
813  0.,
814  1);
815 
816  // resolutions
817 
818  p_resolX_vsSumPt = outfile_->make<TH1F>("p_resolX_vsSumPt",
819  "x-resolution vs #Sigma p_{T};#sum p_{T}; x vertex resolution [#mum]",
820  mypT_bins_.size() - 1,
821  mypT_bins_.data());
822  p_resolY_vsSumPt = outfile_->make<TH1F>("p_resolY_vsSumPt",
823  "y-resolution vs #Sigma p_{T};#sum p_{T}; y vertex resolution [#mum]",
824  mypT_bins_.size() - 1,
825  mypT_bins_.data());
826  p_resolZ_vsSumPt = outfile_->make<TH1F>("p_resolZ_vsSumPt",
827  "z-resolution vs #Sigma p_{T};#sum p_{T}; z vertex resolution [#mum]",
828  mypT_bins_.size() - 1,
829  mypT_bins_.data());
830 
831  p_resolX_vsNtracks = outfile_->make<TH1F>("p_resolX_vsNtracks",
832  "x-resolution vs n_{tracks};n_{tracks}; x vertex resolution [#mum]",
833  myNTrack_bins_.size() - 1,
834  myNTrack_bins_.data());
835  p_resolY_vsNtracks = outfile_->make<TH1F>("p_resolY_vsNtracks",
836  "y-resolution vs n_{tracks};n_{tracks}; y vertex resolution [#mum]",
837  myNTrack_bins_.size() - 1,
838  myNTrack_bins_.data());
839  p_resolZ_vsNtracks = outfile_->make<TH1F>("p_resolZ_vsNtracks",
840  "z-resolution vs n_{tracks};n_{tracks}; z vertex resolution [#mum]",
841  myNTrack_bins_.size() - 1,
842  myNTrack_bins_.data());
843 
844  p_resolX_vsNvtx = outfile_->make<TH1F>("p_resolX_vsNvtx",
845  "x-resolution vs n_{vertices};n_{vertices}; x vertex resolution [#mum]",
846  myNVtx_bins_.size() - 1,
847  myNVtx_bins_.data());
848  p_resolY_vsNvtx = outfile_->make<TH1F>("p_resolY_vsNvtx",
849  "y-resolution vs n_{vertices};n_{vertices}; y vertex resolution [#mum]",
850  myNVtx_bins_.size() - 1,
851  myNVtx_bins_.data());
852  p_resolZ_vsNvtx = outfile_->make<TH1F>("p_resolZ_vsNvtx",
853  "z-resolution vs n_{vertices};n_{vertices}; z vertex resolution [#mum]",
854  myNVtx_bins_.size() - 1,
855  myNVtx_bins_.data());
856 
857  // pulls
858 
859  p_pullX_vsSumPt = outfile_->make<TH1F>(
860  "p_pullX_vsSumPt", "x-pull vs #Sigma p_{T};#sum p_{T}; x vertex pull", mypT_bins_.size() - 1, mypT_bins_.data());
861  p_pullY_vsSumPt = outfile_->make<TH1F>(
862  "p_pullY_vsSumPt", "y-pull vs #Sigma p_{T};#sum p_{T}; y vertex pull", mypT_bins_.size() - 1, mypT_bins_.data());
863  p_pullZ_vsSumPt = outfile_->make<TH1F>(
864  "p_pullZ_vsSumPt", "z-pull vs #Sigma p_{T};#sum p_{T}; z vertex pull", mypT_bins_.size() - 1, mypT_bins_.data());
865 
866  p_pullX_vsNtracks = outfile_->make<TH1F>("p_pullX_vsNtracks",
867  "x-pull vs n_{tracks};n_{tracks}; x vertex pull",
868  myNTrack_bins_.size() - 1,
869  myNTrack_bins_.data());
870  p_pullY_vsNtracks = outfile_->make<TH1F>("p_pullY_vsNtracks",
871  "y-pull vs n_{tracks};n_{tracks}; y vertex pull",
872  myNTrack_bins_.size() - 1,
873  myNTrack_bins_.data());
874  p_pullZ_vsNtracks = outfile_->make<TH1F>("p_pullZ_vsNtracks",
875  "z-pull vs n_{tracks};n_{tracks}; z vertex pull",
876  myNTrack_bins_.size() - 1,
877  myNTrack_bins_.data());
878 
879  p_pullX_vsNvtx = outfile_->make<TH1F>("p_pullX_vsNvtx",
880  "x-pull vs n_{vertices};n_{vertices}; x vertex pull",
881  myNVtx_bins_.size() - 1,
882  myNVtx_bins_.data());
883  p_pullY_vsNvtx = outfile_->make<TH1F>("p_pullY_vsNvtx",
884  "y-pull vs n_{vertices};n_{vertices}; y vertex pull",
885  myNVtx_bins_.size() - 1,
886  myNVtx_bins_.data());
887  p_pullZ_vsNvtx = outfile_->make<TH1F>("p_pullZ_vsNvtx",
888  "z-pull vs n_{vertices};n_{vertices}; z vertex pull",
889  myNVtx_bins_.size() - 1,
890  myNVtx_bins_.data());
891 
892  tree_ = outfile_->make<TTree>("pvTree", "pvTree");
893  tree_->Branch("event", &event_, 64000, 2);
894 }
895 
896 //*************************************************************
897 // Generic booker function
898 //*************************************************************
900  unsigned int theNOfBins,
901  TString resType,
902  TString varType) {
903  TH1F::SetDefaultSumw2(kTRUE);
904 
905  double up = 500.;
906  double down = -500.;
907 
908  if (resType.Contains("pull")) {
909  up *= 0.01;
910  down *= 0.01;
911  }
912 
913  std::vector<TH1F*> h;
914  h.reserve(theNOfBins);
915 
916  const char* auxResType = (resType.ReplaceAll("_", "")).Data();
917 
918  for (unsigned int i = 0; i < theNOfBins; i++) {
919  TH1F* htemp = dir.make<TH1F>(Form("histo_%s_%s_plot%i", resType.Data(), varType.Data(), i),
920  Form("%s vs %s - bin %i;%s;vertices", auxResType, varType.Data(), i, auxResType),
921  250,
922  down,
923  up);
924  h.push_back(htemp);
925  }
926 
927  return h;
928 }
929 
930 // ------------ method called once each job just after ending the event loop ------------
932  edm::LogVerbatim("SplitVertexResolution") << "*******************************" << std::endl;
933  edm::LogVerbatim("SplitVertexResolution") << "Events run in total: " << ievt << std::endl;
934  edm::LogVerbatim("SplitVertexResolution") << "n. tracks: " << itrks << std::endl;
935  edm::LogVerbatim("SplitVertexResolution") << "*******************************" << std::endl;
936 
937  int nFiringTriggers = triggerMap_.size();
938  edm::LogVerbatim("SplitVertexResolution") << "firing triggers: " << nFiringTriggers << std::endl;
939  edm::LogVerbatim("SplitVertexResolution") << "*******************************" << std::endl;
940 
941  tksByTrigger_ = outfile_->make<TH1D>(
942  "tksByTrigger", "tracks by HLT path;;% of # traks", nFiringTriggers, -0.5, nFiringTriggers - 0.5);
943  evtsByTrigger_ = outfile_->make<TH1D>(
944  "evtsByTrigger", "events by HLT path;;% of # events", nFiringTriggers, -0.5, nFiringTriggers - 0.5);
945 
946  int i = 0;
947  for (std::map<std::string, std::pair<int, int> >::iterator it = triggerMap_.begin(); it != triggerMap_.end(); ++it) {
948  i++;
949 
950  double trkpercent = ((it->second).second) * 100. / double(itrks);
951  double evtpercent = ((it->second).first) * 100. / double(ievt);
952 
953  edm::LogVerbatim("SplitVertexResolution")
954  << "HLT path: " << std::setw(60) << std::left << it->first << " | events firing: " << std::right << std::setw(8)
955  << (it->second).first << " (" << std::setw(8) << std::fixed << std::setprecision(4) << evtpercent << "%)"
956  << " | tracks collected: " << std::setw(8) << (it->second).second << " (" << std::setw(8) << std::fixed
957  << std::setprecision(4) << trkpercent << "%)";
958 
959  tksByTrigger_->SetBinContent(i, trkpercent);
960  tksByTrigger_->GetXaxis()->SetBinLabel(i, (it->first).c_str());
961 
962  evtsByTrigger_->SetBinContent(i, evtpercent);
963  evtsByTrigger_->GetXaxis()->SetBinLabel(i, (it->first).c_str());
964  }
965 
966  TFileDirectory RunFeatures = outfile_->mkdir("RunFeatures");
967  h_runStartTimes = RunFeatures.make<TH1I>(
968  "runStartTimes", "run start times", runNumbersTimesLog_.size(), 0, runNumbersTimesLog_.size());
969  h_runEndTimes =
970  RunFeatures.make<TH1I>("runEndTimes", "run end times", runNumbersTimesLog_.size(), 0, runNumbersTimesLog_.size());
971 
972  unsigned int count = 1;
973  for (const auto& run : runNumbersTimesLog_) {
974  // strip down the microseconds
975  h_runStartTimes->SetBinContent(count, run.second.first / 10e6);
976  h_runStartTimes->GetXaxis()->SetBinLabel(count, (std::to_string(run.first)).c_str());
977 
978  h_runEndTimes->SetBinContent(count, run.second.second / 10e6);
979  h_runEndTimes->GetXaxis()->SetBinLabel(count, (std::to_string(run.first)).c_str());
980 
981  count++;
982  }
983 
984  // resolutions
985 
989 
993 
997 
998  // pulls
999 
1003 
1007 
1011 }
1012 
1013 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
1015  //The following says we do not know what parameters are allowed so do no validation
1016  // Please change this to state exactly what you do use, even if it is no parameters
1018  desc.setUnknown();
1019  descriptions.addDefault(desc);
1020 }
1021 
1022 //*************************************************************
1023 std::pair<long long, long long> SplitVertexResolution::getRunTime(const edm::EventSetup& iSetup) const
1024 //*************************************************************
1025 {
1026  const auto& runInfo = iSetup.getData(runInfoToken_);
1027  if (debug_) {
1028  edm::LogInfo("SplitVertexResolution") << runInfo.m_start_time_str << " " << runInfo.m_stop_time_str << std::endl;
1029  }
1030  return std::make_pair(runInfo.m_start_time_ll, runInfo.m_stop_time_ll);
1031 }
1032 
1033 //*************************************************************
1034 void SplitVertexResolution::fillTrendPlotByIndex(TH1F* trendPlot, std::vector<TH1F*>& h, PVValHelper::estimator fitPar_)
1035 //*************************************************************
1036 {
1037  for (auto iterator = h.begin(); iterator != h.end(); iterator++) {
1038  unsigned int bin = std::distance(h.begin(), iterator) + 1;
1039  statmode::fitParams myFit = fitResiduals((*iterator));
1040 
1041  switch (fitPar_) {
1042  case PVValHelper::MEAN: {
1043  float mean_ = myFit.first.value();
1044  float meanErr_ = myFit.first.error();
1045  trendPlot->SetBinContent(bin, mean_);
1046  trendPlot->SetBinError(bin, meanErr_);
1047  break;
1048  }
1049  case PVValHelper::WIDTH: {
1050  float width_ = myFit.second.value();
1051  float widthErr_ = myFit.second.error();
1052  trendPlot->SetBinContent(bin, width_);
1053  trendPlot->SetBinError(bin, widthErr_);
1054  break;
1055  }
1056  case PVValHelper::MEDIAN: {
1057  float median_ = PVValHelper::getMedian((*iterator)).value();
1058  float medianErr_ = PVValHelper::getMedian((*iterator)).error();
1059  trendPlot->SetBinContent(bin, median_);
1060  trendPlot->SetBinError(bin, medianErr_);
1061  break;
1062  }
1063  case PVValHelper::MAD: {
1064  float mad_ = PVValHelper::getMAD((*iterator)).value();
1065  float madErr_ = PVValHelper::getMAD((*iterator)).error();
1066  trendPlot->SetBinContent(bin, mad_);
1067  trendPlot->SetBinError(bin, madErr_);
1068  break;
1069  }
1070  default:
1071  edm::LogWarning("SplitVertexResolution")
1072  << "fillTrendPlotByIndex() " << fitPar_ << " unknown estimator!" << std::endl;
1073  break;
1074  }
1075  }
1076 }
1077 
1078 //*************************************************************
1080 //*************************************************************
1081 {
1082  if (hist->GetEntries() < 10) {
1083  LogDebug("SplitVertexResolution") << "hist name: " << hist->GetName() << " has less than 10 entries" << std::endl;
1084  return std::make_pair(Measurement1D(0., 0.), Measurement1D(0., 0.));
1085  }
1086 
1087  float maxHist = hist->GetXaxis()->GetXmax();
1088  float minHist = hist->GetXaxis()->GetXmin();
1089  float mean = hist->GetMean();
1090  float sigma = hist->GetRMS();
1091 
1092  if (edm::isNotFinite(mean) || edm::isNotFinite(sigma)) {
1093  mean = 0;
1094  //sigma= - hist->GetXaxis()->GetBinLowEdge(1) + hist->GetXaxis()->GetBinLowEdge(hist->GetNbinsX()+1);
1095  sigma = -minHist + maxHist;
1096  edm::LogWarning("SplitVertexResolution")
1097  << "FitPVResiduals::fitResiduals(): histogram" << hist->GetName() << " mean or sigma are NaN!!" << std::endl;
1098  }
1099 
1100  TF1 func("tmp", "gaus", mean - 2. * sigma, mean + 2. * sigma);
1101  if (0 == hist->Fit(&func, "QNR")) { // N: do not blow up file by storing fit!
1102  mean = func.GetParameter(1);
1103  sigma = func.GetParameter(2);
1104 
1105  if (!singleTime) {
1106  // second fit: three sigma of first fit around mean of first fit
1107  func.SetRange(std::max(mean - 3 * sigma, minHist), std::min(mean + 3 * sigma, maxHist));
1108  // I: integral gives more correct results if binning is too wide
1109  // L: Likelihood can treat empty bins correctly (if hist not weighted...)
1110  if (0 == hist->Fit(&func, "Q0LR")) {
1111  if (hist->GetFunction(func.GetName())) { // Take care that it is later on drawn:
1112  hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw);
1113  }
1114  }
1115  }
1116  }
1117 
1118  float res_mean = func.GetParameter(1);
1119  float res_width = func.GetParameter(2);
1120 
1121  float res_mean_err = func.GetParError(1);
1122  float res_width_err = func.GetParError(2);
1123 
1124  Measurement1D resultM(res_mean, res_mean_err);
1125  Measurement1D resultW(res_width, res_width_err);
1126 
1127  statmode::fitParams result = std::make_pair(resultM, resultW);
1128  return result;
1129 }
1130 
1131 //*************************************************************
1133 //*************************************************************
1134 {
1135  float mean = hist->GetMean();
1136  float sigma = hist->GetRMS();
1137 
1138  TF1 func("tmp", "gaus", mean - 1.5 * sigma, mean + 1.5 * sigma);
1139  if (0 == hist->Fit(&func, "QNR")) { // N: do not blow up file by storing fit!
1140  mean = func.GetParameter(1);
1141  sigma = func.GetParameter(2);
1142  // second fit: three sigma of first fit around mean of first fit
1143  func.SetRange(mean - 2 * sigma, mean + 2 * sigma);
1144  // I: integral gives more correct results if binning is too wide
1145  // L: Likelihood can treat empty bins correctly (if hist not weighted...)
1146  if (0 == hist->Fit(&func, "Q0LR")) {
1147  if (hist->GetFunction(func.GetName())) { // Take care that it is later on drawn:
1148  hist->GetFunction(func.GetName())->ResetBit(TF1::kNotDraw);
1149  }
1150  }
1151  }
1152 
1153  float res_mean = func.GetParameter(1);
1154  float res_width = func.GetParameter(2);
1155 
1156  float res_mean_err = func.GetParError(1);
1157  float res_width_err = func.GetParError(2);
1158 
1159  Measurement1D resultM(res_mean, res_mean_err);
1160  Measurement1D resultW(res_width, res_width_err);
1161 
1162  statmode::fitParams result = std::make_pair(resultM, resultW);
1163  return result;
1164 }
1165 
1166 //*************************************************************
1167 template <std::size_t SIZE>
1168 bool SplitVertexResolution::checkBinOrdering(std::array<float, SIZE>& bins)
1169 //*************************************************************
1170 {
1171  int i = 1;
1172 
1173  if (std::is_sorted(bins.begin(), bins.end())) {
1174  return true;
1175  } else {
1176  for (const auto& bin : bins) {
1177  edm::LogInfo("SplitVertexResolution") << "bin: " << i << " : " << bin << std::endl;
1178  i++;
1179  }
1180  edm::LogInfo("SplitVertexResolution") << "--------------------------------" << std::endl;
1181  return false;
1182  }
1183 }
1184 
1185 //define this as a plug-in
AdaptiveVertexFitter
Definition: AdaptiveVertexFitter.h:29
SplitVertexResolution::fitResiduals_v0
statmode::fitParams fitResiduals_v0(TH1 *hist)
Definition: SplitVertexResolution.cc:1132
SplitVertexResolution::outfile_
edm::Service< TFileService > outfile_
Definition: SplitVertexResolution.cc:141
pvCand::zErr_subVtx2
float zErr_subVtx2
Definition: pvTree.h:39
fftjetvertexadder_cfi.errZ
errZ
Definition: fftjetvertexadder_cfi.py:39
SplitVertexResolution::h_runFromConfig
TH1I * h_runFromConfig
Definition: SplitVertexResolution.cc:144
counter
Definition: counter.py:1
SplitVertexResolution::p_pullX_vsNvtx
TH1F * p_pullX_vsNvtx
Definition: SplitVertexResolution.cc:241
alignBH_cfg.fixed
fixed
Definition: alignBH_cfg.py:54
SplitVertexResolution::triggerResultsTag_
edm::InputTag triggerResultsTag_
Definition: SplitVertexResolution.cc:124
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
Measurement1D
Definition: Measurement1D.h:11
electrons_cff.bool
bool
Definition: electrons_cff.py:393
EDAnalyzer.h
mps_fire.i
i
Definition: mps_fire.py:428
SplitVertexResolution::checkBinOrdering
bool checkBinOrdering(std::array< float, SIZE > &bins)
Definition: SplitVertexResolution.cc:1168
SplitVertexResolution::h_pullX_sumPt_
std::vector< TH1F * > h_pullX_sumPt_
Definition: SplitVertexResolution.cc:221
SplitVertexResolution::h_PVCL_subVtx2
TH1F * h_PVCL_subVtx2
Definition: SplitVertexResolution.cc:180
SplitVertexResolution::h_diffX
TH1F * h_diffX
Definition: SplitVertexResolution.cc:150
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
funct::false
false
Definition: Factorize.h:29
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
TriggerResults.h
ESInputTag
HLTBitAnalyser_cfi.hltresults
hltresults
Definition: HLTBitAnalyser_cfi.py:13
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
fftjetvertexadder_cfi.errY
errY
Definition: fftjetvertexadder_cfi.py:38
TransientVertex::isValid
bool isValid() const
Definition: TransientVertex.h:195
SplitVertexResolution::p_resolY_vsNvtx
TH1F * p_resolY_vsNvtx
Definition: SplitVertexResolution.cc:217
PVValHelper::WIDTH
Definition: PVValidationHelpers.h:44
edm::Run
Definition: Run.h:45
min
T min(T a, T b)
Definition: MathUtil.h:58
reco::Vertex::z
double z() const
z coordinate
Definition: Vertex.h:120
SplitVertexResolution::p_resolY_vsNtracks
TH1F * p_resolY_vsNtracks
Definition: SplitVertexResolution.cc:213
edm::EDGetTokenT< reco::VertexCollection >
SplitVertexResolution::tracksToken_
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
Definition: SplitVertexResolution.cc:122
SplitVertexResolution::h_runNumber
TH1F * h_runNumber
Definition: SplitVertexResolution.cc:182
TFileDirectory::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileDirectory.h:53
edm
HLT enums.
Definition: AlignableModifier.h:19
Measurement1D::value
double value() const
Definition: Measurement1D.h:25
pvCand::y_subVtx2
float y_subVtx2
Definition: pvTree.h:34
SplitVertexResolution::nVtxBins_
static const int nVtxBins_
Definition: SplitVertexResolution.cc:257
pvEvent::pvs
std::vector< pvCand > pvs
Definition: pvTree.h:62
SplitVertexResolution::minVtxNdf_
double minVtxNdf_
Definition: SplitVertexResolution.cc:131
SplitVertexResolution::h_ntrks
TH1F * h_ntrks
Definition: SplitVertexResolution.cc:166
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition: L1TUtmAlgorithmRcd.h:4
TFileService::file
TFile & file() const
return opened TFile
Definition: TFileService.h:37
pvCand::CL_subVtx2
float CL_subVtx2
Definition: pvTree.h:43
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
SplitVertexResolution::bookResidualsHistogram
std::vector< TH1F * > bookResidualsHistogram(TFileDirectory dir, unsigned int theNOfBins, TString resType, TString varType)
Definition: SplitVertexResolution.cc:899
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
pvCand::x_subVtx1
float x_subVtx1
Definition: pvTree.h:23
pvCand::minW_subVtx2
float minW_subVtx2
Definition: pvTree.h:46
SplitVertexResolution::compressionSettings_
const int compressionSettings_
Definition: SplitVertexResolution.cc:109
SplitVertexResolution::triggerMap_
std::map< std::string, std::pair< int, int > > triggerMap_
Definition: SplitVertexResolution.cc:260
PVValHelper::fillByIndex
void fillByIndex(std::vector< TH1F * > &h, unsigned int index, double x, std::string tag="")
Definition: PVValidationHelpers.cc:42
pvCand::n_subVtx2
int n_subVtx2
Definition: pvTree.h:32
SplitVertexResolution::h_PVCL_subVtx1
TH1F * h_PVCL_subVtx1
Definition: SplitVertexResolution.cc:179
muonTagProbeFilters_cff.allTracks
allTracks
Definition: muonTagProbeFilters_cff.py:22
SplitVertexResolution::p_pullZ_vsNvtx
TH1F * p_pullZ_vsNvtx
Definition: SplitVertexResolution.cc:243
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
SplitVertexResolution::h_OrigVertexErrZ
TH1F * h_OrigVertexErrZ
Definition: SplitVertexResolution.cc:156
pvEvent::nVtx
int nVtx
Definition: pvTree.h:60
SplitVertexResolution::h_resolX_Nvtx_
std::vector< TH1F * > h_resolX_Nvtx_
Definition: SplitVertexResolution.cc:204
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SplitVertexResolution::h_sumPt1
TH1F * h_sumPt1
Definition: SplitVertexResolution.cc:170
SplitVertexResolution::mypT_bins_
std::array< float, nPtBins_+1 > mypT_bins_
Definition: SplitVertexResolution.cc:252
TFileDirectory
Definition: TFileDirectory.h:24
VertexDistance3D.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
tools.TF1
TF1
Definition: tools.py:23
SplitVertexResolution::p_resolX_vsNvtx
TH1F * p_resolX_vsNvtx
Definition: SplitVertexResolution.cc:216
watchdog.const
const
Definition: watchdog.py:83
AdaptiveVertexFitter::vertex
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
Definition: AdaptiveVertexFitter.cc:158
edm::Handle< edm::TriggerResults >
pvCand::z_origVtx
float z_origVtx
Definition: pvTree.h:16
parallelization.uint
uint
Definition: parallelization.py:124
SplitVertexResolution::h_resolZ_Ntracks_
std::vector< TH1F * > h_resolZ_Ntracks_
Definition: SplitVertexResolution.cc:202
SplitVertexResolution::h_errY
TH1F * h_errY
Definition: SplitVertexResolution.cc:159
pvCand::zErr_origVtx
float zErr_origVtx
Definition: pvTree.h:20
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SplitVertexResolution::h_pullZ_sumPt_
std::vector< TH1F * > h_pullZ_sumPt_
Definition: SplitVertexResolution.cc:223
SplitVertexResolution::p_pullZ_vsNtracks
TH1F * p_pullZ_vsNtracks
Definition: SplitVertexResolution.cc:239
SplitVertexResolution::p_resolZ_vsSumPt
TH1F * p_resolZ_vsSumPt
Definition: SplitVertexResolution.cc:210
pvCand::sumPt_subVtx2
float sumPt_subVtx2
Definition: pvTree.h:40
edm::Ref< TrackCollection >
TtFullHadEvtBuilder_cfi.sumPt
sumPt
Definition: TtFullHadEvtBuilder_cfi.py:38
SplitVertexResolution::h_resolZ_Nvtx_
std::vector< TH1F * > h_resolZ_Nvtx_
Definition: SplitVertexResolution.cc:206
pvEvent
Definition: pvTree.h:54
SplitVertexResolution::runNumbersTimesLog_
std::map< unsigned int, std::pair< long long, long long > > runNumbersTimesLog_
Definition: SplitVertexResolution.cc:146
SplitVertexResolution::h_pullY_Nvtx_
std::vector< TH1F * > h_pullY_Nvtx_
Definition: SplitVertexResolution.cc:230
SplitVertexResolution::ievt
int ievt
Definition: SplitVertexResolution.cc:105
SplitVertexResolution::p_pullY_vsNvtx
TH1F * p_pullY_vsNvtx
Definition: SplitVertexResolution.cc:242
SplitVertexResolution::h_errX
TH1F * h_errX
Definition: SplitVertexResolution.cc:158
SplitVertexResolution::h_runStartTimes
TH1I * h_runStartTimes
Definition: SplitVertexResolution.cc:147
SplitVertexResolution::p_pullX_vsNtracks
TH1F * p_pullX_vsNtracks
Definition: SplitVertexResolution.cc:237
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
MakerMacros.h
pvCand::n_subVtx1
int n_subVtx1
Definition: pvTree.h:22
pvCand::y_origVtx
float y_origVtx
Definition: pvTree.h:15
down
Definition: BitonicSort.h:7
RunInfo
Definition: RunInfo.h:18
SplitVertexResolution::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: SplitVertexResolution.cc:1014
h
Track.h
pvEvent::eventNumber
int eventNumber
Definition: pvTree.h:58
SplitVertexResolution::h_wTrks1
TH1F * h_wTrks1
Definition: SplitVertexResolution.cc:173
pvCand::sumPt_subVtx1
float sumPt_subVtx1
Definition: pvTree.h:30
reco::Vertex::isFake
bool isFake() const
Definition: Vertex.h:76
PVValHelper::estimator
estimator
Definition: PVValidationHelpers.h:44
TrackFwd.h
pvCand::zErr_subVtx1
float zErr_subVtx1
Definition: pvTree.h:29
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
SplitVertexResolution::itrks
int itrks
Definition: SplitVertexResolution.cc:106
reco::Vertex::xError
double xError() const
error on x
Definition: Vertex.h:124
SplitVertexResolution::h_lumiFromConfig
TH1F * h_lumiFromConfig
Definition: SplitVertexResolution.cc:143
compare.hist
hist
Definition: compare.py:376
SplitVertexResolution::h_minWTrks1
TH1F * h_minWTrks1
Definition: SplitVertexResolution.cc:176
SplitVertexResolution::h_resolZ_sumPt_
std::vector< TH1F * > h_resolZ_sumPt_
Definition: SplitVertexResolution.cc:198
SplitVertexResolution::tree_
TTree * tree_
Definition: SplitVertexResolution.cc:248
Service.h
SplitVertexResolution::p_resolX_vsNtracks
TH1F * p_resolX_vsNtracks
Definition: SplitVertexResolution.cc:212
pvEvent::luminosityBlockNumber
int luminosityBlockNumber
Definition: pvTree.h:57
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SplitVertexResolution::myNVtx_bins_
std::array< float, nVtxBins_+1 > myNVtx_bins_
Definition: SplitVertexResolution.cc:258
SplitVertexResolution::transientTrackBuilderToken_
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transientTrackBuilderToken_
Definition: SplitVertexResolution.cc:128
reco::Vertex::tracks_end
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:73
SplitVertexResolution::runControl_
bool runControl_
Definition: SplitVertexResolution.cc:136
TransientTrackRecord
Definition: TransientTrackRecord.h:11
reco::Track
Definition: Track.h:27
pvCand::minW_subVtx1
float minW_subVtx1
Definition: pvTree.h:45
Event
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
pvCand
Definition: pvTree.h:9
pvTree.h
SplitVertexResolution::fillTrendPlotByIndex
void fillTrendPlotByIndex(TH1F *trendPlot, std::vector< TH1F * > &h, PVValHelper::estimator fitPar_)
Definition: SplitVertexResolution.cc:1034
SplitVertexResolution::mysorter
static bool mysorter(reco::Track i, reco::Track j)
Definition: SplitVertexResolution.cc:81
SplitVertexResolution::h_nOfflineVertices
TH1I * h_nOfflineVertices
Definition: SplitVertexResolution.cc:184
h
SplitVertexResolution::h_pullY_Ntracks_
std::vector< TH1F * > h_pullY_Ntracks_
Definition: SplitVertexResolution.cc:226
pvCand::z_subVtx1
float z_subVtx1
Definition: pvTree.h:25
SplitVertexResolution
Definition: SplitVertexResolution.cc:75
SplitVertexResolution::debug_
bool debug_
Definition: SplitVertexResolution.cc:116
dumpRecoGeometry_cfg.varType
varType
Definition: dumpRecoGeometry_cfg.py:8
pvCand::x_origVtx
float x_origVtx
Definition: pvTree.h:14
Measurement1D::error
double error() const
Definition: Measurement1D.h:27
GlobalTrackingGeometryRecord.h
RunInfoRcd
Definition: RunSummaryRcd.h:26
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
reco::Vertex::zError
double zError() const
error on z
Definition: Vertex.h:128
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
EgHLTOffTrigSelection_cfi.trigName
trigName
Definition: EgHLTOffTrigSelection_cfi.py:8
TFileService.h
SplitVertexResolution::p_pullY_vsNtracks
TH1F * p_pullY_vsNtracks
Definition: SplitVertexResolution.cc:238
SplitVertexResolution::fitResiduals
statmode::fitParams fitResiduals(TH1 *hist, bool singleTime=false)
Definition: SplitVertexResolution.cc:1079
TFileService::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
TransientTrackBuilder.h
SplitVertexResolution::h_resolY_Ntracks_
std::vector< TH1F * > h_resolY_Ntracks_
Definition: SplitVertexResolution.cc:201
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
PVValHelper::getMedian
Measurement1D getMedian(TH1F *histo)
Definition: PVValidationHelpers.cc:178
edm::ParameterSet
Definition: ParameterSet.h:47
SplitVertexResolution::runInfoToken_
edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
Definition: SplitVertexResolution.cc:129
edm::Transition
Transition
Definition: Transition.h:12
SplitVertexResolution::runControlNumbers_
std::vector< unsigned int > runControlNumbers_
Definition: SplitVertexResolution.cc:137
SplitVertexResolution::h_diffZ
TH1F * h_diffZ
Definition: SplitVertexResolution.cc:152
SplitVertexResolution::h_pullX_Ntracks_
std::vector< TH1F * > h_pullX_Ntracks_
Definition: SplitVertexResolution.cc:225
SplitVertexResolution::h_resolY_Nvtx_
std::vector< TH1F * > h_resolY_Nvtx_
Definition: SplitVertexResolution.cc:205
SplitVertexResolution::p_resolZ_vsNtracks
TH1F * p_resolZ_vsNtracks
Definition: SplitVertexResolution.cc:214
SplitVertexResolution::h_minWTrks2
TH1F * h_minWTrks2
Definition: SplitVertexResolution.cc:177
Event.h
SplitVertexResolution::nTrackBins_
static const int nTrackBins_
Definition: SplitVertexResolution.cc:254
SplitVertexResolution::p_resolZ_vsNvtx
TH1F * p_resolZ_vsNvtx
Definition: SplitVertexResolution.cc:218
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
reco::Vertex::tracks_begin
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:71
PVValidationHelpers.h
pvCand::z_subVtx2
float z_subVtx2
Definition: pvTree.h:35
SplitVertexResolution::h_pullZ_Ntracks_
std::vector< TH1F * > h_pullZ_Ntracks_
Definition: SplitVertexResolution.cc:227
SplitVertexResolution::intLumi_
double intLumi_
Definition: SplitVertexResolution.cc:115
reco::Vertex::x
double x() const
x coordinate
Definition: Vertex.h:116
SplitVertexResolution::h_sumPt2
TH1F * h_sumPt2
Definition: SplitVertexResolution.cc:171
SplitVertexResolution::nPtBins_
static const int nPtBins_
Definition: SplitVertexResolution.cc:251
edm::Service< TFileService >
PVValHelper::MAD
Definition: PVValidationHelpers.h:44
createfilelist.int
int
Definition: createfilelist.py:10
SplitVertexResolution::h_OrigVertexErrY
TH1F * h_OrigVertexErrY
Definition: SplitVertexResolution.cc:155
TriggerNames.h
reco::Vertex::tracksSize
size_t tracksSize() const
number of tracks
Definition: Vertex.cc:69
iEvent
int iEvent
Definition: GenABIO.cc:224
SplitVertexResolution::triggerResultsToken_
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
Definition: SplitVertexResolution.cc:125
SplitVertexResolution::myNTrack_bins_
std::array< float, nTrackBins_+1 > myNTrack_bins_
Definition: SplitVertexResolution.cc:255
SplitVertexResolution::p_pullY_vsSumPt
TH1F * p_pullY_vsSumPt
Definition: SplitVertexResolution.cc:234
TransientTrackBuilder
Definition: TransientTrackBuilder.h:16
SplitVertexResolution::h_sumPt
TH1F * h_sumPt
Definition: SplitVertexResolution.cc:167
SplitVertexResolution::h_runEndTimes
TH1I * h_runEndTimes
Definition: SplitVertexResolution.cc:148
counter
static std::atomic< unsigned int > counter
Definition: SharedResourceNames.cc:17
SplitVertexResolution::h_OrigVertexErrX
TH1F * h_OrigVertexErrX
Definition: SplitVertexResolution.cc:154
TransientVertex
Definition: TransientVertex.h:18
edm::EventSetup
Definition: EventSetup.h:57
PVValHelper::generateBins
std::vector< float > generateBins(int n, float start, float range)
Definition: PVValidationHelpers.cc:161
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TransientTrackRecord.h
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
SplitVertexResolution::tracksTag_
edm::InputTag tracksTag_
Definition: SplitVertexResolution.cc:121
PVValHelper::MEAN
Definition: PVValidationHelpers.h:44
SplitVertexResolution::h_pullY_sumPt_
std::vector< TH1F * > h_pullY_sumPt_
Definition: SplitVertexResolution.cc:222
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord >
pvCand::x_subVtx2
float x_subVtx2
Definition: pvTree.h:33
SplitVertexResolution::getRunTime
std::pair< long long, long long > getRunTime(const edm::EventSetup &iSetup) const
Definition: SplitVertexResolution.cc:1023
InputTag.h
edm::TriggerNames::triggerName
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:22
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SplitVertexResolution::beginJob
void beginJob() override
Definition: SplitVertexResolution.cc:646
SplitVertexResolution::event_
pvEvent event_
Definition: SplitVertexResolution.cc:247
SiPixelPhase1Clusters_cfi.e3
e3
Definition: SiPixelPhase1Clusters_cfi.py:9
SplitVertexResolution::p_resolY_vsSumPt
TH1F * p_resolY_vsSumPt
Definition: SplitVertexResolution.cc:209
SplitVertexResolution::h_resolX_Ntracks_
std::vector< TH1F * > h_resolX_Ntracks_
Definition: SplitVertexResolution.cc:200
VertexFwd.h
pvCand::xErr_origVtx
float xErr_origVtx
Definition: pvTree.h:18
SplitVertexResolution::h_resolX_sumPt_
std::vector< TH1F * > h_resolX_sumPt_
Definition: SplitVertexResolution.cc:196
pvCand::yErr_subVtx1
float yErr_subVtx1
Definition: pvTree.h:28
RunInfo.h
statmode
Definition: SplitVertexResolution.cc:67
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
ESInputTag.h
writedatasetfile.run
run
Definition: writedatasetfile.py:27
reco::Vertex::y
double y() const
y coordinate
Definition: Vertex.h:118
SplitVertexResolution::endJob
void endJob() override
Definition: SplitVertexResolution.cc:931
reco::TransientTrack
Definition: TransientTrack.h:19
pvCand::nTrks
int nTrks
Definition: pvTree.h:11
isFinite.h
SplitVertexResolution::h_resolY_sumPt_
std::vector< TH1F * > h_resolY_sumPt_
Definition: SplitVertexResolution.cc:197
Frameworkfwd.h
TransientVertex::trackWeight
float trackWeight(const reco::TransientTrack &track) const
Definition: TransientVertex.cc:241
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
SplitVertexResolution::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: SplitVertexResolution.cc:296
SplitVertexResolution::p_pullX_vsSumPt
TH1F * p_pullX_vsSumPt
Definition: SplitVertexResolution.cc:233
pvCand::xErr_subVtx1
float xErr_subVtx1
Definition: pvTree.h:27
PVValHelper::MEDIAN
Definition: PVValidationHelpers.h:44
SplitVertexResolution::h_pullX
TH1F * h_pullX
Definition: SplitVertexResolution.cc:162
TFileService::kSharedResource
static const std::string kSharedResource
Definition: TFileService.h:76
TransientVertex::originalTracks
std::vector< reco::TransientTrack > const & originalTracks() const
Definition: TransientVertex.h:200
PVValHelper::getMAD
Measurement1D getMAD(TH1F *histo)
Definition: PVValidationHelpers.cc:194
SplitVertexResolution::h_avgSumPt
TH1F * h_avgSumPt
Definition: SplitVertexResolution.cc:168
edm::TriggerNames
Definition: TriggerNames.h:55
SplitVertexResolution::h_nFinalVertices
TH1I * h_nFinalVertices
Definition: SplitVertexResolution.cc:187
pvCand::ipos
int ipos
Definition: pvTree.h:12
EventSetup.h
SplitVertexResolution::minVtxWgt_
double minVtxWgt_
Definition: SplitVertexResolution.cc:132
submitPVValidationJobs.runInfo
dictionary runInfo
Definition: submitPVValidationJobs.py:1013
SplitVertexResolution::p_resolX_vsSumPt
TH1F * p_resolX_vsSumPt
Definition: SplitVertexResolution.cc:208
SplitVertexResolution::h_diffY
TH1F * h_diffY
Definition: SplitVertexResolution.cc:151
SplitVertexResolution::h_nNonFakeVertices
TH1I * h_nNonFakeVertices
Definition: SplitVertexResolution.cc:186
TransientTrackBuilder::build
reco::TransientTrack build(const reco::Track *p) const
Definition: TransientTrackBuilder.cc:20
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
SplitVertexResolution::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: SplitVertexResolution.cc:628
reco::Vertex::nTracks
unsigned int nTracks(float minWeight=0.5) const
Returns the number of tracks in the vertex with weight above minWeight.
Definition: Vertex.cc:146
mps_fire.result
result
Definition: mps_fire.py:311
reco::Vertex::yError
double yError() const
error on y
Definition: Vertex.h:126
SplitVertexResolution::h_pullX_Nvtx_
std::vector< TH1F * > h_pullX_Nvtx_
Definition: SplitVertexResolution.cc:229
SplitVertexResolution::SplitVertexResolution
SplitVertexResolution(const edm::ParameterSet &)
Definition: SplitVertexResolution.cc:263
genParticles_cff.map
map
Definition: genParticles_cff.py:11
trigObjTnPSource_cfi.bins
bins
Definition: trigObjTnPSource_cfi.py:20
EventSetup
pvCand::yErr_subVtx2
float yErr_subVtx2
Definition: pvTree.h:38
ParameterSet.h
SplitVertexResolution::pvsTag_
edm::InputTag pvsTag_
Definition: SplitVertexResolution.cc:118
pvCand::CL_subVtx1
float CL_subVtx1
Definition: pvTree.h:42
SplitVertexResolution::h_nVertices
TH1I * h_nVertices
Definition: SplitVertexResolution.cc:185
pvCand::xErr_subVtx2
float xErr_subVtx2
Definition: pvTree.h:37
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SplitVertexResolution::h_pullZ
TH1F * h_pullZ
Definition: SplitVertexResolution.cc:164
SplitVertexResolution::beginEvent
virtual void beginEvent() final
Definition: SplitVertexResolution.cc:623
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition: HLTObjectsMonitor_cfi.py:9
SplitVertexResolution::h_pullY
TH1F * h_pullY
Definition: SplitVertexResolution.cc:163
edm::Event
Definition: Event.h:73
AdaptiveVertexFitter.h
SplitVertexResolution::engine_
std::mt19937 engine_
Definition: SplitVertexResolution.cc:245
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7799
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
pvCand::y_subVtx1
float y_subVtx1
Definition: pvTree.h:24
reco::Vertex::ndof
double ndof() const
Definition: Vertex.h:110
SplitVertexResolution::p_pullZ_vsSumPt
TH1F * p_pullZ_vsSumPt
Definition: SplitVertexResolution.cc:235
fftjetvertexadder_cfi.errX
errX
Definition: fftjetvertexadder_cfi.py:37
edm::InputTag
Definition: InputTag.h:15
pvCand::yErr_origVtx
float yErr_origVtx
Definition: pvTree.h:19
SplitVertexResolution::h_wTrks2
TH1F * h_wTrks2
Definition: SplitVertexResolution.cc:174
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
SplitVertexResolution::h_pullZ_Nvtx_
std::vector< TH1F * > h_pullZ_Nvtx_
Definition: SplitVertexResolution.cc:231
up
Definition: BitonicSort.h:7
reco::Vertex
Definition: Vertex.h:35
statmode::fitParams
std::pair< Measurement1D, Measurement1D > fitParams
Definition: SplitVertexResolution.cc:68
pvEvent::runNumber
int runNumber
Definition: pvTree.h:56
SplitVertexResolution::h_errZ
TH1F * h_errZ
Definition: SplitVertexResolution.cc:160
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
SplitVertexResolution::storeNtuple_
bool storeNtuple_
Definition: SplitVertexResolution.cc:112
SplitVertexResolution::tksByTrigger_
TH1D * tksByTrigger_
Definition: SplitVertexResolution.cc:191
SplitVertexResolution::evtsByTrigger_
TH1D * evtsByTrigger_
Definition: SplitVertexResolution.cc:192
SplitVertexResolution::pvsToken_
edm::EDGetTokenT< reco::VertexCollection > pvsToken_
Definition: SplitVertexResolution.cc:119
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
SplitVertexResolution::endRun
void endRun(edm::Run const &, edm::EventSetup const &) override
Definition: SplitVertexResolution.cc:89
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
SplitVertexResolution::cmToUm
static constexpr double cmToUm
Definition: SplitVertexResolution.cc:139
SplitVertexResolution::~SplitVertexResolution
~SplitVertexResolution() override
Definition: SplitVertexResolution.cc:293
Run