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 253 of file PrimaryVertexResolution.cc.

Constructor & Destructor Documentation

◆ Plots()

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

Definition at line 255 of file PrimaryVertexResolution.cc.

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

Member Function Documentation

◆ book()

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

Definition at line 266 of file PrimaryVertexResolution.cc.

266  {
267  const auto binsResol = binningY_.binsResol_;
268  const auto maxResol = binningY_.maxResol_;
269  hDiffX_ = iBooker.book1D("res_x", "Resolution of X", binsResol, -maxResol, maxResol);
270  hDiffY_ = iBooker.book1D("res_y", "Resolution of Y", binsResol, -maxResol, maxResol);
271  hDiffZ_ = iBooker.book1D("res_z", "Resolution of Z", binsResol, -maxResol, maxResol);
272 
273  const auto binsPull = binningY_.binsPull_;
274  const auto maxPull = binningY_.maxPull_;
275  hPullX_ = iBooker.book1D(+"pull_x", "Pull of X", binsPull, -maxPull, maxPull);
276  hPullY_ = iBooker.book1D(+"pull_y", "Pull of Y", binsPull, -maxPull, maxPull);
277  hPullZ_ = iBooker.book1D(+"pull_z", "Pull of Z", binsPull, -maxPull, maxPull);
278 
284 
285  constexpr int binsPt = 30;
286  hDiff_sumPt_.bookLogX(iBooker, makeLogBins<float, binsPt>(binningX_.minPt_, binningX_.maxPt_));
287 
288  constexpr int binsLumi = 100;
289  hDiff_instLumiScal_.bookLogX(iBooker, makeLogBins<float, binsLumi>(binningX_.minLumi_, binningX_.maxLumi_));
290  }

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

◆ calculateAndFillResolution()

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

Definition at line 470 of file PrimaryVertexResolution.cc.

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

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(), PDWG_EXOHSCP_cff::tracks, and AdaptiveVertexFitter::vertex().

Referenced by PrimaryVertexResolution::analyze().

Member Data Documentation

◆ binningX_

const BinningX& PrimaryVertexResolution::Plots::binningX_
private

Definition at line 299 of file PrimaryVertexResolution.cc.

Referenced by book().

◆ binningY_

const BinningY& PrimaryVertexResolution::Plots::binningY_
private

Definition at line 300 of file PrimaryVertexResolution.cc.

Referenced by book().

◆ hDiff_instLumiScal_

DiffPlots PrimaryVertexResolution::Plots::hDiff_instLumiScal_
private

Definition at line 315 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_Ntracks_

DiffPlots PrimaryVertexResolution::Plots::hDiff_Ntracks_
private

Definition at line 309 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_Nvertices_

DiffPlots PrimaryVertexResolution::Plots::hDiff_Nvertices_
private

Definition at line 311 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_sumPt_

DiffPlots PrimaryVertexResolution::Plots::hDiff_sumPt_
private

Definition at line 310 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_X_

DiffPlots PrimaryVertexResolution::Plots::hDiff_X_
private

Definition at line 312 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_Y_

DiffPlots PrimaryVertexResolution::Plots::hDiff_Y_
private

Definition at line 313 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiff_Z_

DiffPlots PrimaryVertexResolution::Plots::hDiff_Z_
private

Definition at line 314 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiffX_

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

Definition at line 302 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiffY_

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

Definition at line 303 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hDiffZ_

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

Definition at line 304 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hPullX_

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

Definition at line 305 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hPullY_

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

Definition at line 306 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

◆ hPullZ_

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

Definition at line 307 of file PrimaryVertexResolution.cc.

Referenced by book(), and calculateAndFillResolution().

PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:428
PrimaryVertexResolution::BinningY::maxPull_
const double maxPull_
Definition: PrimaryVertexResolution.cc:82
PrimaryVertexResolution::Plots::hDiff_Ntracks_
DiffPlots hDiff_Ntracks_
Definition: PrimaryVertexResolution.cc:309
TransientVertex::isValid
bool isValid() const
Definition: TransientVertex.h:195
PrimaryVertexResolution::Plots::hDiffZ_
MonitorElement * hDiffZ_
Definition: PrimaryVertexResolution.cc:304
PrimaryVertexResolution::Plots::hDiff_X_
DiffPlots hDiff_X_
Definition: PrimaryVertexResolution.cc:312
PrimaryVertexResolution::Plots::hDiff_Y_
DiffPlots hDiff_Y_
Definition: PrimaryVertexResolution.cc:313
AdaptiveVertexFitter::vertex
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
Definition: AdaptiveVertexFitter.cc:158
PrimaryVertexResolution::Plots::hDiff_instLumiScal_
DiffPlots hDiff_instLumiScal_
Definition: PrimaryVertexResolution.cc:315
PrimaryVertexResolution::BinningX::maxNvertices_
const int maxNvertices_
Definition: PrimaryVertexResolution.cc:107
PrimaryVertexResolution::BinningX::maxLumi_
const double maxLumi_
Definition: PrimaryVertexResolution.cc:116
PrimaryVertexResolution::BinningY::binsPull_
const int binsPull_
Definition: PrimaryVertexResolution.cc:83
PrimaryVertexResolution::Plots::hPullZ_
MonitorElement * hPullZ_
Definition: PrimaryVertexResolution.cc:307
PrimaryVertexResolution::BinningY::binsResol_
const int binsResol_
Definition: PrimaryVertexResolution.cc:81
PrimaryVertexResolution::BinningX::maxNtracks_
const int maxNtracks_
Definition: PrimaryVertexResolution.cc:104
PrimaryVertexResolution::BinningX::minNvertices_
const int minNvertices_
Definition: PrimaryVertexResolution.cc:106
PrimaryVertexResolution::BinningX::binsNvertices_
const int binsNvertices_
Definition: PrimaryVertexResolution.cc:108
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
mps_fire.end
end
Definition: mps_fire.py:242
PrimaryVertexResolution::DiffPlots::bookLogX
void bookLogX(DQMStore::IBooker &iBooker, const T &binArray)
Definition: PrimaryVertexResolution.cc:172
PrimaryVertexResolution::Plots::binningX_
const BinningX & binningX_
Definition: PrimaryVertexResolution.cc:299
PrimaryVertexResolution::BinningX::binsZ_
const int binsZ_
Definition: PrimaryVertexResolution.cc:112
PrimaryVertexResolution::Plots::hDiffY_
MonitorElement * hDiffY_
Definition: PrimaryVertexResolution.cc:303
PrimaryVertexResolution::BinningX::minLumi_
const double minLumi_
Definition: PrimaryVertexResolution.cc:115
Resolution
Definition: trackSplitPlot.h:33
PrimaryVertexResolution::Plots::hDiff_Nvertices_
DiffPlots hDiff_Nvertices_
Definition: PrimaryVertexResolution.cc:311
PrimaryVertexResolution::DiffPlots::fill
void fill(const Resolution &res, const T ref)
Definition: PrimaryVertexResolution.cc:233
PrimaryVertexResolution::BinningX::minPt_
const double minPt_
Definition: PrimaryVertexResolution.cc:113
PrimaryVertexResolution::BinningX::binsNtracks_
const int binsNtracks_
Definition: PrimaryVertexResolution.cc:105
TransientVertex
Definition: TransientVertex.h:18
PrimaryVertexResolution::BinningX::binsXY_
const int binsXY_
Definition: PrimaryVertexResolution.cc:110
PrimaryVertexResolution::Plots::hDiff_Z_
DiffPlots hDiff_Z_
Definition: PrimaryVertexResolution.cc:314
res
Definition: Electron.h:6
PrimaryVertexResolution::Plots::hDiffX_
MonitorElement * hDiffX_
Definition: PrimaryVertexResolution.cc:302
PrimaryVertexResolution::DiffPlots::book
void book(DQMStore::IBooker &iBooker, Args &&... args)
Definition: PrimaryVertexResolution.cc:178
PrimaryVertexResolution::Plots::hPullX_
MonitorElement * hPullX_
Definition: PrimaryVertexResolution.cc:305
PrimaryVertexResolution::Plots::hPullY_
MonitorElement * hPullY_
Definition: PrimaryVertexResolution.cc:306
PrimaryVertexResolution::BinningX::maxXY_
const double maxXY_
Definition: PrimaryVertexResolution.cc:109
PrimaryVertexResolution::Plots::hDiff_sumPt_
DiffPlots hDiff_sumPt_
Definition: PrimaryVertexResolution.cc:310
PrimaryVertexResolution::Plots::binningY_
const BinningY & binningY_
Definition: PrimaryVertexResolution.cc:300
PrimaryVertexResolution::BinningX::maxPt_
const double maxPt_
Definition: PrimaryVertexResolution.cc:114
lumi
Definition: LumiSectionData.h:20
PrimaryVertexResolution::BinningX::minNtracks_
const int minNtracks_
Definition: PrimaryVertexResolution.cc:103
PrimaryVertexResolution::BinningY::maxResol_
const double maxResol_
Definition: PrimaryVertexResolution.cc:80
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
PrimaryVertexResolution::BinningX::maxZ_
const double maxZ_
Definition: PrimaryVertexResolution.cc:111