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.

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  }

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

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 }

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

Referenced by PrimaryVertexResolution::analyze().

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

mps_fire.i
i
Definition: mps_fire.py:428
PrimaryVertexResolution::BinningY::maxPull_
const double maxPull_
Definition: PrimaryVertexResolution.cc:81
PrimaryVertexResolution::Plots::hDiff_Ntracks_
DiffPlots hDiff_Ntracks_
Definition: PrimaryVertexResolution.cc:308
TransientVertex::isValid
bool isValid() const
Definition: TransientVertex.h:195
PrimaryVertexResolution::Plots::hDiffZ_
MonitorElement * hDiffZ_
Definition: PrimaryVertexResolution.cc:303
PrimaryVertexResolution::Plots::hDiff_X_
DiffPlots hDiff_X_
Definition: PrimaryVertexResolution.cc:311
PrimaryVertexResolution::Plots::hDiff_Y_
DiffPlots hDiff_Y_
Definition: PrimaryVertexResolution.cc:312
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:314
PrimaryVertexResolution::BinningX::maxNvertices_
const int maxNvertices_
Definition: PrimaryVertexResolution.cc:106
PrimaryVertexResolution::BinningX::maxLumi_
const double maxLumi_
Definition: PrimaryVertexResolution.cc:115
PrimaryVertexResolution::BinningY::binsPull_
const int binsPull_
Definition: PrimaryVertexResolution.cc:82
PrimaryVertexResolution::Plots::hPullZ_
MonitorElement * hPullZ_
Definition: PrimaryVertexResolution.cc:306
PrimaryVertexResolution::BinningY::binsResol_
const int binsResol_
Definition: PrimaryVertexResolution.cc:80
PrimaryVertexResolution::BinningX::maxNtracks_
const int maxNtracks_
Definition: PrimaryVertexResolution.cc:103
PrimaryVertexResolution::BinningX::minNvertices_
const int minNvertices_
Definition: PrimaryVertexResolution.cc:105
PrimaryVertexResolution::BinningX::binsNvertices_
const int binsNvertices_
Definition: PrimaryVertexResolution.cc:107
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:171
PrimaryVertexResolution::Plots::binningX_
const BinningX & binningX_
Definition: PrimaryVertexResolution.cc:298
PrimaryVertexResolution::BinningX::binsZ_
const int binsZ_
Definition: PrimaryVertexResolution.cc:111
PrimaryVertexResolution::Plots::hDiffY_
MonitorElement * hDiffY_
Definition: PrimaryVertexResolution.cc:302
PrimaryVertexResolution::BinningX::minLumi_
const double minLumi_
Definition: PrimaryVertexResolution.cc:114
Resolution
Definition: trackSplitPlot.h:33
PrimaryVertexResolution::Plots::hDiff_Nvertices_
DiffPlots hDiff_Nvertices_
Definition: PrimaryVertexResolution.cc:310
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:176
PrimaryVertexResolution::DiffPlots::fill
void fill(const Resolution &res, const T ref)
Definition: PrimaryVertexResolution.cc:232
PrimaryVertexResolution::BinningX::minPt_
const double minPt_
Definition: PrimaryVertexResolution.cc:112
PrimaryVertexResolution::BinningX::binsNtracks_
const int binsNtracks_
Definition: PrimaryVertexResolution.cc:104
TransientVertex
Definition: TransientVertex.h:18
PrimaryVertexResolution::BinningX::binsXY_
const int binsXY_
Definition: PrimaryVertexResolution.cc:109
PrimaryVertexResolution::Plots::hDiff_Z_
DiffPlots hDiff_Z_
Definition: PrimaryVertexResolution.cc:313
res
Definition: Electron.h:6
PrimaryVertexResolution::Plots::hDiffX_
MonitorElement * hDiffX_
Definition: PrimaryVertexResolution.cc:301
PrimaryVertexResolution::DiffPlots::book
void book(DQMStore::IBooker &iBooker, Args &&... args)
Definition: PrimaryVertexResolution.cc:177
PrimaryVertexResolution::Plots::hPullX_
MonitorElement * hPullX_
Definition: PrimaryVertexResolution.cc:304
PrimaryVertexResolution::Plots::hPullY_
MonitorElement * hPullY_
Definition: PrimaryVertexResolution.cc:305
PrimaryVertexResolution::BinningX::maxXY_
const double maxXY_
Definition: PrimaryVertexResolution.cc:108
PrimaryVertexResolution::Plots::hDiff_sumPt_
DiffPlots hDiff_sumPt_
Definition: PrimaryVertexResolution.cc:309
PrimaryVertexResolution::Plots::binningY_
const BinningY & binningY_
Definition: PrimaryVertexResolution.cc:299
PrimaryVertexResolution::BinningX::maxPt_
const double maxPt_
Definition: PrimaryVertexResolution.cc:113
lumi
Definition: LumiSectionData.h:20
PrimaryVertexResolution::BinningX::minNtracks_
const int minNtracks_
Definition: PrimaryVertexResolution.cc:102
PrimaryVertexResolution::BinningY::maxResol_
const double maxResol_
Definition: PrimaryVertexResolution.cc:79
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:110