diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc index 5bf47573cffe8..b6c66531da306 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc @@ -208,6 +208,7 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve nLooseAndAboveTracksCPU_matchedGPU++; hchi2_->Fill(tsoaCPU.chi2(it), tsoaGPU.chi2(closestTkidx)); + hCharge_->Fill(tsoaCPU.charge(it), tsoaGPU.charge(closestTkidx)); hnHits_->Fill(tsoaCPU.nHits(it), tsoaGPU.nHits(closestTkidx)); hnLayers_->Fill(tsoaCPU.nLayers(it), tsoaGPU.nLayers(closestTkidx)); hpt_->Fill(tsoaCPU.pt(it), tsoaGPU.pt(closestTkidx)); @@ -217,7 +218,8 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve hz_->Fill(tsoaCPU.zip(it), tsoaGPU.zip(closestTkidx)); htip_->Fill(tsoaCPU.tip(it), tsoaGPU.tip(closestTkidx)); hptdiffMatched_->Fill(tsoaCPU.pt(it) - tsoaGPU.pt(closestTkidx)); - hCurvdiffMatched_->Fill((tsoaCPU.charge(it) / tsoaCPU.pt(it)) - (tsoaGPU.charge(closestTkidx) / tsoaGPU.pt(closestTkidx))); + hCurvdiffMatched_->Fill((tsoaCPU.charge(it) / tsoaCPU.pt(it)) - + (tsoaGPU.charge(closestTkidx) / tsoaGPU.pt(closestTkidx))); hetadiffMatched_->Fill(etacpu - tsoaGPU.eta(closestTkidx)); hphidiffMatched_->Fill(reco::deltaPhi(phicpu, tsoaGPU.phi(closestTkidx))); hzdiffMatched_->Fill(tsoaCPU.zip(it) - tsoaGPU.zip(closestTkidx)); @@ -242,7 +244,7 @@ void SiPixelCompareTrackSoA::bookHistograms(DQMStore::IBooker& iBook, // clang-format off std::string toRep = "Number of tracks"; - // FIXME: all the 2D correlation plots are quite heavy in terms of memory consumption, so a as soon as DQM supports either TH2I or THnSparse + // FIXME: all the 2D correlation plots are quite heavy in terms of memory consumption, so a as soon as DQM supports THnSparse // these should be moved to a less resource consuming format hnTracks_ = iBook.book2I("nTracks", fmt::sprintf("%s per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); hnLooseAndAboveTracks_ = iBook.book2I("nLooseAndAboveTracks", fmt::sprintf("%s (quality #geq loose) per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc index 8d6d10111986a..02cdc72830e44 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc @@ -7,12 +7,16 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Framework/interface/MakerMacros.h" + +// for string manipulations +#include + class SiPixelTrackComparisonHarvester : public DQMEDHarvester { public: explicit SiPixelTrackComparisonHarvester(const edm::ParameterSet&); ~SiPixelTrackComparisonHarvester() override = default; void dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) override; - + void project2DalongDiagonal(MonitorElement* input2D, DQMStore::IBooker& ibooker); static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: @@ -45,6 +49,56 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS hpt_eta_matchRatio->divide(hpt_eta_tkAllCPUmatched, hpt_eta_tkAllCPU, 1., 1., "B"); hphi_z_matchRatio->divide(hphi_z_tkAllCPUmatched, hphi_z_tkAllCPU, 1., 1., "B"); + + // now create the 1D projection from the 2D histograms + std::vector listOfMEsToProject = {"nTracks", + "nLooseAndAboveTracks", + "nLooseAndAboveTracks_matched", + "nRecHits", + "nLayers", + "nChi2ndof", + "charge", + "pt", + "eta", + "phi", + "z", + "tip"}; + for (const auto& me : listOfMEsToProject) { + MonitorElement* input2D = igetter.get(topFolder_ + "/" + me); + this->project2DalongDiagonal(input2D, ibooker); + } +} + +void SiPixelTrackComparisonHarvester::project2DalongDiagonal(MonitorElement* input2D, + DQMStore::IBooker& ibooker) { + if (input2D == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MEs needed for diagonal projection are not found in the input file. Skipping."; + return; + } + + ibooker.cd(); + ibooker.setCurrentFolder(topFolder_ + "/projectedDifferences"); + const auto& h_name = fmt::sprintf("%s_proj", input2D->getName()); + const auto& h_title = fmt::sprintf(";%s CPU -GPU difference", input2D->getTitle()); + const auto& span = (input2D->getAxisMax() - input2D->getAxisMin()); + const auto& b_w = span / input2D->getNbinsX(); + const auto& nbins = ((input2D->getNbinsX() % 2) == 0) ? input2D->getNbinsX() + 1 : input2D->getNbinsX(); + + MonitorElement* diagonalized = ibooker.book1D(h_name, h_title, nbins, -span / 2., span / 2.); + + // collect all the entry on each diagonal of the 2D histogram + for (int i = 1; i <= input2D->getNbinsX(); i++) { + for (int j = 1; j <= input2D->getNbinsY(); j++) { + diagonalized->Fill((i - j) * b_w, input2D->getBinContent(i, j)); + } + } + + // zero the error on the bin as it's sort of meaningless for the way we fill it + // by collecting the entry on each diagonal + for (int bin = 1; bin <= diagonalized->getNbinsX(); bin++) { + diagonalized->setBinError(bin, 0.f); + } } #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"