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, const LumiScalersCollection &lumiScalers, 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_ = 0
 
MonitorElementhDiffY_ = 0
 
MonitorElementhDiffZ_ = 0
 
MonitorElementhPullX_ = 0
 
MonitorElementhPullY_ = 0
 
MonitorElementhPullZ_ = 0
 

Detailed Description

Definition at line 250 of file PrimaryVertexResolution.cc.

Constructor & Destructor Documentation

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

Definition at line 252 of file PrimaryVertexResolution.cc.

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

Member Function Documentation

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

Definition at line 263 of file PrimaryVertexResolution.cc.

References PrimaryVertexResolution::binningX_, PrimaryVertexResolution::binningY_, PrimaryVertexResolution::BinningX::binsNtracks_, PrimaryVertexResolution::BinningX::binsNvertices_, PrimaryVertexResolution::BinningY::binsPull_, PrimaryVertexResolution::BinningY::binsResol_, PrimaryVertexResolution::BinningX::binsXY_, PrimaryVertexResolution::BinningX::binsZ_, dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), constexpr, V0Monitor_cfi::lumiScalers, 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_, PrimaryVertexResolution::BinningX::minPt_, and PDWG_EXOHSCP_cff::tracks.

Referenced by PrimaryVertexResolution::bookHistograms().

263  {
264  const auto binsResol = binningY_.binsResol_;
265  const auto maxResol = binningY_.maxResol_;
266  hDiffX_ = iBooker.book1D("res_x", "Resolution of X", binsResol, -maxResol, maxResol);
267  hDiffY_ = iBooker.book1D("res_y", "Resolution of Y", binsResol, -maxResol, maxResol);
268  hDiffZ_ = iBooker.book1D("res_z", "Resolution of Z", binsResol, -maxResol, maxResol);
269 
270  const auto binsPull = binningY_.binsPull_;
271  const auto maxPull = binningY_.maxPull_;
272  hPullX_ = iBooker.book1D(+"pull_x", "Pull of X", binsPull, -maxPull, maxPull);
273  hPullY_ = iBooker.book1D(+"pull_y", "Pull of Y", binsPull, -maxPull, maxPull);
274  hPullZ_ = iBooker.book1D(+"pull_z", "Pull of Z", binsPull, -maxPull, maxPull);
275 
281 
282  constexpr int binsPt = 30;
283  hDiff_sumPt_.bookLogX(iBooker, makeLogBins<float, binsPt>(binningX_.minPt_, binningX_.maxPt_));
284 
285  constexpr int binsLumi = 100;
286  hDiff_instLumiScal_.bookLogX(iBooker, makeLogBins<float, binsLumi>(binningX_.minLumi_, binningX_.maxLumi_));
287  }
void bookLogX(DQMStore::IBooker &iBooker, const T &binArray)
void book(DQMStore::IBooker &iBooker, Args &&...args)
#define constexpr
void PrimaryVertexResolution::Plots::calculateAndFillResolution ( const std::vector< reco::TransientTrack > &  tracks,
size_t  nvertices,
const LumiScalersCollection lumiScalers,
std::mt19937 &  engine,
AdaptiveVertexFitter fitter 
)

Definition at line 452 of file PrimaryVertexResolution.cc.

References PrimaryVertexResolution::Resolution::avgx(), PrimaryVertexResolution::Resolution::avgy(), PrimaryVertexResolution::Resolution::avgz(), DEFINE_FWK_MODULE, end, mps_fire::i, TransientVertex::isValid(), PrimaryVertexResolution::Resolution::pullx(), PrimaryVertexResolution::Resolution::pully(), PrimaryVertexResolution::Resolution::pullz(), PrimaryVertexResolution::Resolution::resx(), PrimaryVertexResolution::Resolution::resy(), PrimaryVertexResolution::Resolution::resz(), and AdaptiveVertexFitter::vertex().

Referenced by PrimaryVertexResolution::analyze().

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

Member Data Documentation

const BinningX& PrimaryVertexResolution::Plots::binningX_
private

Definition at line 296 of file PrimaryVertexResolution.cc.

const BinningY& PrimaryVertexResolution::Plots::binningY_
private

Definition at line 297 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_instLumiScal_
private

Definition at line 312 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_Ntracks_
private

Definition at line 306 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_Nvertices_
private

Definition at line 308 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_sumPt_
private

Definition at line 307 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_X_
private

Definition at line 309 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_Y_
private

Definition at line 310 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_Z_
private

Definition at line 311 of file PrimaryVertexResolution.cc.

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

Definition at line 299 of file PrimaryVertexResolution.cc.

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

Definition at line 300 of file PrimaryVertexResolution.cc.

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

Definition at line 301 of file PrimaryVertexResolution.cc.

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

Definition at line 302 of file PrimaryVertexResolution.cc.

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

Definition at line 303 of file PrimaryVertexResolution.cc.

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

Definition at line 304 of file PrimaryVertexResolution.cc.