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_
 
MonitorElementhDiffX_ = 0
 
MonitorElementhDiffY_ = 0
 
MonitorElementhDiffZ_ = 0
 
MonitorElementhPullX_ = 0
 
MonitorElementhPullY_ = 0
 
MonitorElementhPullZ_ = 0
 

Detailed Description

Definition at line 206 of file PrimaryVertexResolution.cc.

Constructor & Destructor Documentation

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

Definition at line 208 of file PrimaryVertexResolution.cc.

208  :
209  binningX_(binX),
210  binningY_(binY),
211  hDiff_Ntracks_("ntracks", binY),
212  hDiff_sumPt_("sumpt", binY),
213  hDiff_Nvertices_("nvertices", binY),
214  hDiff_instLumiScal_("instLumiScal", binY)
215  {}

Member Function Documentation

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

Definition at line 217 of file PrimaryVertexResolution.cc.

References PrimaryVertexResolution::binningX_, PrimaryVertexResolution::binningY_, PrimaryVertexResolution::BinningX::binsNtracks_, PrimaryVertexResolution::BinningX::binsNvertices_, PrimaryVertexResolution::BinningY::binsPull_, PrimaryVertexResolution::BinningY::binsResol_, DQMStore::IBooker::book1D(), constexpr, PrimaryVertexResolution::BinningX::maxLumi_, PrimaryVertexResolution::BinningX::maxNtracks_, PrimaryVertexResolution::BinningX::maxNvertices_, PrimaryVertexResolution::BinningX::maxPt_, PrimaryVertexResolution::BinningY::maxPull_, PrimaryVertexResolution::BinningY::maxResol_, PrimaryVertexResolution::BinningX::minLumi_, PrimaryVertexResolution::BinningX::minNtracks_, PrimaryVertexResolution::BinningX::minNvertices_, PrimaryVertexResolution::BinningX::minPt_, and l1t::tracks.

Referenced by PrimaryVertexResolution::bookHistograms().

217  {
218  const auto binsResol = binningY_.binsResol_;
219  const auto maxResol = binningY_.maxResol_;
220  hDiffX_ = iBooker.book1D("res_x", "Resolution of X", binsResol, -maxResol, maxResol);
221  hDiffY_ = iBooker.book1D("res_y", "Resolution of Y", binsResol, -maxResol, maxResol);
222  hDiffZ_ = iBooker.book1D("res_z", "Resolution of Z", binsResol, -maxResol, maxResol);
223 
224  const auto binsPull = binningY_.binsPull_;
225  const auto maxPull = binningY_.maxPull_;
226  hPullX_ = iBooker.book1D(+"pull_x", "Pull of X", binsPull, -maxPull, maxPull);
227  hPullY_ = iBooker.book1D(+"pull_y", "Pull of Y", binsPull, -maxPull, maxPull);
228  hPullZ_ = iBooker.book1D(+"pull_z", "Pull of Z", binsPull, -maxPull, maxPull);
229 
232 
233  constexpr int binsPt = 30;
234  hDiff_sumPt_.bookLogX(iBooker, makeLogBins<float, binsPt>(binningX_.minPt_, binningX_.maxPt_));
235 
236  constexpr int binsLumi = 100;
237  hDiff_instLumiScal_.bookLogX(iBooker, makeLogBins<float, binsLumi>(binningX_.minLumi_, binningX_.maxLumi_));
238  }
#define constexpr
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void bookLogX(DQMStore::IBooker &iBooker, const T &binArray)
void book(DQMStore::IBooker &iBooker, Args &&...args)
void PrimaryVertexResolution::Plots::calculateAndFillResolution ( const std::vector< reco::TransientTrack > &  tracks,
size_t  nvertices,
const LumiScalersCollection lumiScalers,
std::mt19937 &  engine,
AdaptiveVertexFitter fitter 
)

Definition at line 394 of file PrimaryVertexResolution.cc.

References DEFINE_FWK_MODULE, end, mps_fire::i, 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().

398  {
399  const size_t end = tracks.size()%2 == 0 ? tracks.size() : tracks.size()-1;
400 
401  std::vector<reco::TransientTrack> set1, set2;
402  set1.reserve(end/2); set2.reserve(end/2);
403 
404  auto dis = std::uniform_int_distribution<>(0, 1); // [0, 1]
405 
406  double sumpt1=0, sumpt2=0;
407  for(size_t i=0; i<end; i += 2) {
408  const size_t set1_i = dis(engine);
409  const size_t set2_i = 1-set1_i;
410 
411  set1.push_back(tracks[i+set1_i]);
412  set2.push_back(tracks[i+set2_i]);
413 
414  sumpt1 += set1.back().track().pt();
415  sumpt2 += set2.back().track().pt();
416  }
417 
418  // For resolution we only fit
419  TransientVertex vertex1 = fitter.vertex(set1);
420  TransientVertex vertex2 = fitter.vertex(set2);
421 
422  Resolution res(vertex1, vertex2);
423  hDiffX_->Fill(res.resx());
424  hDiffY_->Fill(res.resy());
425  hDiffZ_->Fill(res.resz());
426  hPullX_->Fill(res.pullx());
427  hPullY_->Fill(res.pully());
428  hPullZ_->Fill(res.pullz());
429 
430  hDiff_Ntracks_.fill(res, set1.size());
431  hDiff_sumPt_.fill(res, (sumpt1+sumpt2)/2.0); // taking average is probably the best we can do, anyway they should be close to each other
432  hDiff_Nvertices_.fill(res, nvertices);
433 
434  if(!lumiScalers.empty()) {
435  hDiff_instLumiScal_.fill(res, lumiScalers.front().instantLumi());
436  }
437 }
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

Member Data Documentation

const BinningX& PrimaryVertexResolution::Plots::binningX_
private

Definition at line 247 of file PrimaryVertexResolution.cc.

const BinningY& PrimaryVertexResolution::Plots::binningY_
private

Definition at line 248 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_instLumiScal_
private

Definition at line 260 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_Ntracks_
private

Definition at line 257 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_Nvertices_
private

Definition at line 259 of file PrimaryVertexResolution.cc.

DiffPlots PrimaryVertexResolution::Plots::hDiff_sumPt_
private

Definition at line 258 of file PrimaryVertexResolution.cc.

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

Definition at line 250 of file PrimaryVertexResolution.cc.

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

Definition at line 251 of file PrimaryVertexResolution.cc.

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

Definition at line 252 of file PrimaryVertexResolution.cc.

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

Definition at line 253 of file PrimaryVertexResolution.cc.

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

Definition at line 254 of file PrimaryVertexResolution.cc.

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

Definition at line 255 of file PrimaryVertexResolution.cc.