CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PrimaryVertexResolution::Plots Class Reference

Public Member Functions

void book (DQMStore::IBooker &iBooker)
 
void calculateAndFillResolution (const std::vector< reco::TransientTrack > &tracks, size_t nvertices, float lumi, std::mt19937 &engine, AdaptiveVertexFitter &fitter)
 
 Plots (const BinningX &binX, const BinningY &binY)
 

Private Attributes

const BinningXbinningX_
 
const BinningYbinningY_
 
DiffPlots hDiff_instLumiScal_
 
DiffPlots hDiff_Ntracks_
 
DiffPlots hDiff_Nvertices_
 
DiffPlots hDiff_sumPt_
 
DiffPlots hDiff_X_
 
DiffPlots hDiff_Y_
 
DiffPlots hDiff_Z_
 
MonitorElementhDiffX_ = nullptr
 
MonitorElementhDiffY_ = nullptr
 
MonitorElementhDiffZ_ = nullptr
 
MonitorElementhPullX_ = nullptr
 
MonitorElementhPullY_ = nullptr
 
MonitorElementhPullZ_ = nullptr
 

Detailed Description

Definition at line 252 of file PrimaryVertexResolution.cc.

Constructor & Destructor Documentation

◆ Plots()

PrimaryVertexResolution::Plots::Plots ( const BinningX binX,
const BinningY binY 
)
inline

Definition at line 254 of file PrimaryVertexResolution.cc.

255  : binningX_(binX),
256  binningY_(binY),
257  hDiff_Ntracks_("ntracks", binY),
258  hDiff_sumPt_("sumpt", binY),
259  hDiff_Nvertices_("nvertices", binY),
260  hDiff_X_("X", binY),
261  hDiff_Y_("Y", binY),
262  hDiff_Z_("Z", binY),
263  hDiff_instLumiScal_("instLumiScal", binY) {}

Member Function Documentation

◆ book()

void PrimaryVertexResolution::Plots::book ( DQMStore::IBooker iBooker)
inline

Definition at line 265 of file PrimaryVertexResolution.cc.

References binningX_, binningY_, PrimaryVertexResolution::BinningX::binsNtracks_, PrimaryVertexResolution::BinningX::binsNvertices_, PrimaryVertexResolution::BinningY::binsPull_, PrimaryVertexResolution::BinningY::binsResol_, PrimaryVertexResolution::BinningX::binsXY_, PrimaryVertexResolution::BinningX::binsZ_, PrimaryVertexResolution::DiffPlots::book(), dqm::implementation::IBooker::book1D(), PrimaryVertexResolution::DiffPlots::bookLogX(), hDiff_instLumiScal_, hDiff_Ntracks_, hDiff_Nvertices_, hDiff_sumPt_, hDiff_X_, hDiff_Y_, hDiff_Z_, hDiffX_, hDiffY_, hDiffZ_, hPullX_, hPullY_, hPullZ_, PrimaryVertexResolution::BinningX::maxLumi_, PrimaryVertexResolution::BinningX::maxNtracks_, PrimaryVertexResolution::BinningX::maxNvertices_, PrimaryVertexResolution::BinningX::maxPt_, PrimaryVertexResolution::BinningY::maxPull_, PrimaryVertexResolution::BinningY::maxResol_, PrimaryVertexResolution::BinningX::maxXY_, PrimaryVertexResolution::BinningX::maxZ_, PrimaryVertexResolution::BinningX::minLumi_, PrimaryVertexResolution::BinningX::minNtracks_, PrimaryVertexResolution::BinningX::minNvertices_, and PrimaryVertexResolution::BinningX::minPt_.

Referenced by PrimaryVertexResolution::bookHistograms().

265  {
266  const auto binsResol = binningY_.binsResol_;
267  const auto maxResol = binningY_.maxResol_;
268  hDiffX_ = iBooker.book1D("res_x", "Resolution of X", binsResol, -maxResol, maxResol);
269  hDiffY_ = iBooker.book1D("res_y", "Resolution of Y", binsResol, -maxResol, maxResol);
270  hDiffZ_ = iBooker.book1D("res_z", "Resolution of Z", binsResol, -maxResol, maxResol);
271 
272  const auto binsPull = binningY_.binsPull_;
273  const auto maxPull = binningY_.maxPull_;
274  hPullX_ = iBooker.book1D(+"pull_x", "Pull of X", binsPull, -maxPull, maxPull);
275  hPullY_ = iBooker.book1D(+"pull_y", "Pull of Y", binsPull, -maxPull, maxPull);
276  hPullZ_ = iBooker.book1D(+"pull_z", "Pull of Z", binsPull, -maxPull, maxPull);
277 
283 
284  constexpr int binsPt = 30;
285  hDiff_sumPt_.bookLogX(iBooker, makeLogBins<float, binsPt>(binningX_.minPt_, binningX_.maxPt_));
286 
287  constexpr int binsLumi = 100;
288  hDiff_instLumiScal_.bookLogX(iBooker, makeLogBins<float, binsLumi>(binningX_.minLumi_, binningX_.maxLumi_));
289  }
void book(DQMStore::IBooker &iBooker, Args &&... args)
void bookLogX(DQMStore::IBooker &iBooker, const T &binArray)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ calculateAndFillResolution()

void PrimaryVertexResolution::Plots::calculateAndFillResolution ( const std::vector< reco::TransientTrack > &  tracks,
size_t  nvertices,
float  lumi,
std::mt19937 &  engine,
AdaptiveVertexFitter fitter 
)

Definition at line 463 of file PrimaryVertexResolution.cc.

References mps_fire::end, PrimaryVertexResolution::DiffPlots::fill(), dqm::impl::MonitorElement::Fill(), hDiff_instLumiScal_, hDiff_Ntracks_, hDiff_Nvertices_, hDiff_sumPt_, hDiff_X_, hDiff_Y_, hDiff_Z_, hDiffX_, hDiffY_, hDiffZ_, hPullX_, hPullY_, hPullZ_, mps_fire::i, TransientVertex::isValid(), pwdgSkimBPark_cfi::tracks, and AdaptiveVertexFitter::vertex().

Referenced by PrimaryVertexResolution::analyze().

467  {
468  const size_t end = tracks.size() % 2 == 0 ? tracks.size() : tracks.size() - 1;
469 
470  std::vector<reco::TransientTrack> set1, set2;
471  set1.reserve(end / 2);
472  set2.reserve(end / 2);
473 
474  auto dis = std::uniform_int_distribution<>(0, 1); // [0, 1]
475 
476  double sumpt1 = 0, sumpt2 = 0;
477  for (size_t i = 0; i < end; i += 2) {
478  const size_t set1_i = dis(engine);
479  const size_t set2_i = 1 - set1_i;
480 
481  set1.push_back(tracks[i + set1_i]);
482  set2.push_back(tracks[i + set2_i]);
483 
484  sumpt1 += set1.back().track().pt();
485  sumpt2 += set2.back().track().pt();
486  }
487 
488  // For resolution we only fit
489  TransientVertex vertex1 = fitter.vertex(set1);
490  TransientVertex vertex2 = fitter.vertex(set2);
491 
492  Resolution res(vertex1, vertex2);
493  hDiffX_->Fill(res.resx());
494  hDiffY_->Fill(res.resy());
495  hDiffZ_->Fill(res.resz());
496  hPullX_->Fill(res.pullx());
497  hPullY_->Fill(res.pully());
498  hPullZ_->Fill(res.pullz());
499 
500  hDiff_Ntracks_.fill(res, set1.size());
502  res,
503  (sumpt1 + sumpt2) /
504  2.0); // taking average is probably the best we can do, anyway they should be close to each other
505  hDiff_Nvertices_.fill(res, nvertices);
506 
507  if (vertex1.isValid() && vertex2.isValid()) {
508  hDiff_X_.fill(res, res.avgx());
509  hDiff_Y_.fill(res, res.avgy());
510  hDiff_Z_.fill(res, res.avgz());
511  }
512 
514 }
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
Definition: Electron.h:6
void Fill(long long x)
bool isValid() const
void fill(const Resolution &res, const T ref)

Member Data Documentation

◆ binningX_

const BinningX& PrimaryVertexResolution::Plots::binningX_
private

Definition at line 298 of file PrimaryVertexResolution.cc.

Referenced by book().

◆ binningY_

const BinningY& PrimaryVertexResolution::Plots::binningY_
private

Definition at line 299 of file PrimaryVertexResolution.cc.

Referenced by book().

◆ hDiff_instLumiScal_

DiffPlots PrimaryVertexResolution::Plots::hDiff_instLumiScal_
private

Definition at line 314 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_Ntracks_

DiffPlots PrimaryVertexResolution::Plots::hDiff_Ntracks_
private

Definition at line 308 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_Nvertices_

DiffPlots PrimaryVertexResolution::Plots::hDiff_Nvertices_
private

Definition at line 310 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_sumPt_

DiffPlots PrimaryVertexResolution::Plots::hDiff_sumPt_
private

Definition at line 309 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_X_

DiffPlots PrimaryVertexResolution::Plots::hDiff_X_
private

Definition at line 311 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_Y_

DiffPlots PrimaryVertexResolution::Plots::hDiff_Y_
private

Definition at line 312 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_Z_

DiffPlots PrimaryVertexResolution::Plots::hDiff_Z_
private

Definition at line 313 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiffX_

MonitorElement* PrimaryVertexResolution::Plots::hDiffX_ = nullptr
private

Definition at line 301 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiffY_

MonitorElement* PrimaryVertexResolution::Plots::hDiffY_ = nullptr
private

Definition at line 302 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiffZ_

MonitorElement* PrimaryVertexResolution::Plots::hDiffZ_ = nullptr
private

Definition at line 303 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hPullX_

MonitorElement* PrimaryVertexResolution::Plots::hPullX_ = nullptr
private

Definition at line 304 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hPullY_

MonitorElement* PrimaryVertexResolution::Plots::hPullY_ = nullptr
private

Definition at line 305 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hPullZ_

MonitorElement* PrimaryVertexResolution::Plots::hPullZ_ = nullptr
private

Definition at line 306 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().