diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 09cba7289ff33..2c48fdcd5cddd 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1694,7 +1694,8 @@ def setup_(self, step, stepName, stepDict, k, properties): '--customise' : 'HeterogeneousCore/AlpakaServices/customiseAlpakaServiceMemoryFilling.customiseAlpakaServiceMemoryFilling', }, harvest = { - '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM', + '--procModifiers': 'alpakaValidation', }, suffix = 'Patatrack_PixelOnlyAlpaka_Validation', offset = 0.403, diff --git a/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py index abfa60c5b0d75..78e036c4008ec 100644 --- a/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py @@ -87,14 +87,20 @@ # Pixel DQM Tasks and Harvesters import #------------------------------------- process.load('DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff') +process.load('DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQMHarvesting_cff') +process.siPixelTrackComparisonHarvesterAlpaka.topFolderName = cms.string('SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU') #------------------------------------- # Some Settings before Finishing up #------------------------------------- if process.runType.getRunType() == process.runType.hi_run: - process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigisFromSoAPPOnAA' - process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigisLegacyPPOnAA' + process.siPixelPhase1MonitorRawDataASerial.src = 'hltSiPixelDigiErrorsPPOnAASerialSync' + process.siPixelPhase1MonitorRawDataADevice.src = 'hltSiPixelDigiErrorsPPOnAA' + process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigiErrorsPPOnAA' + process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigiErrorsPPOnAASerialSync' else: + process.siPixelPhase1MonitorRawDataASerial.src = 'hltSiPixelDigiErrorsSerialSync' + process.siPixelPhase1MonitorRawDataADevice.src = 'hltSiPixelDigiErrors' process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigiErrors' process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigiErrorsSerialSync' #------------------------------------- @@ -106,7 +112,11 @@ #------------------------------------- # Hcal DQM Tasks/Clients Sequences Definition #------------------------------------- -process.tasksPath = cms.Path(process.siPixelPhase1RawDataErrorComparator) +process.tasksPath = cms.Path(process.siPixelPhase1MonitorRawDataASerial * + process.siPixelPhase1MonitorRawDataADevice * + process.siPixelPhase1RawDataErrorComparator * + process.siPixelHeterogeneousDQMComparisonHarvestingAlpaka + ) #------------------------------------- # Paths/Sequences Definitions diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc index 03d023cf17a71..f3635d6df45da 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc @@ -84,6 +84,9 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* hnTracks_; MonitorElement* hnLooseAndAboveTracks_; MonitorElement* hnLooseAndAboveTracks_matched_; + MonitorElement* hDeltaNTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_matched_; MonitorElement* hnHits_; MonitorElement* hnHitsVsPhi_; MonitorElement* hnHitsVsEta_; @@ -95,6 +98,7 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi_; MonitorElement* hChi2VsEta_; MonitorElement* hpt_; + MonitorElement* hCurvature_; MonitorElement* hptLogLog_; MonitorElement* heta_; MonitorElement* hphi_; @@ -110,10 +114,10 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* htipdiffMatched_; //for matching eff vs region: derive the ratio at harvesting - MonitorElement* hpt_eta_tkAllCPU_; - MonitorElement* hpt_eta_tkAllCPUMatched_; - MonitorElement* hphi_z_tkAllCPU_; - MonitorElement* hphi_z_tkAllCPUMatched_; + MonitorElement* hpt_eta_tkAllRef_; + MonitorElement* hpt_eta_tkAllRefMatched_; + MonitorElement* hphi_z_tkAllRef_; + MonitorElement* hphi_z_tkAllRefMatched_; }; // @@ -187,6 +191,7 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve float phiCPU = helper::phi(tsoaCPU.view(), it); float zipCPU = helper::zip(tsoaCPU.view(), it); float tipCPU = helper::tip(tsoaCPU.view(), it); + auto qCPU = helper::charge(tsoaCPU.view(), it); if (!(ptCPU > 0.)) continue; @@ -211,17 +216,18 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve } } - hpt_eta_tkAllCPU_->Fill(etaCPU, ptCPU); //all CPU tk - hphi_z_tkAllCPU_->Fill(phiCPU, zipCPU); + hpt_eta_tkAllRef_->Fill(etaCPU, ptCPU); //all CPU tk + hphi_z_tkAllRef_->Fill(phiCPU, zipCPU); if (closestTkidx == notFound) continue; nLooseAndAboveTracksCPU_matchedGPU++; hchi2_->Fill(tsoaCPU.view()[it].chi2(), tsoaGPU.view()[closestTkidx].chi2()); - hCharge_->Fill(helper::charge(tsoaCPU.view(), it), helper::charge(tsoaGPU.view(), closestTkidx)); + hCharge_->Fill(qCPU, helper::charge(tsoaGPU.view(), closestTkidx)); hnHits_->Fill(helper::nHits(tsoaCPU.view(), it), helper::nHits(tsoaGPU.view(), closestTkidx)); hnLayers_->Fill(tsoaCPU.view()[it].nLayers(), tsoaGPU.view()[closestTkidx].nLayers()); hpt_->Fill(ptCPU, tsoaGPU.view()[closestTkidx].pt()); + hCurvature_->Fill(qCPU / ptCPU, helper::charge(tsoaGPU.view(), closestTkidx) / tsoaGPU.view()[closestTkidx].pt()); hptLogLog_->Fill(ptCPU, tsoaGPU.view()[closestTkidx].pt()); heta_->Fill(etaCPU, tsoaGPU.view()[closestTkidx].eta()); hphi_->Fill(phiCPU, helper::phi(tsoaGPU.view(), closestTkidx)); @@ -234,12 +240,26 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve hphidiffMatched_->Fill(reco::deltaPhi(phiCPU, helper::phi(tsoaGPU.view(), closestTkidx))); hzdiffMatched_->Fill(zipCPU - helper::zip(tsoaGPU.view(), closestTkidx)); htipdiffMatched_->Fill(tipCPU - helper::tip(tsoaGPU.view(), closestTkidx)); - hpt_eta_tkAllCPUMatched_->Fill(etaCPU, tsoaCPU.view()[it].pt()); //matched to gpu - hphi_z_tkAllCPUMatched_->Fill(etaCPU, zipCPU); + hpt_eta_tkAllRefMatched_->Fill(etaCPU, tsoaCPU.view()[it].pt()); //matched to gpu + hphi_z_tkAllRefMatched_->Fill(etaCPU, zipCPU); } - hnTracks_->Fill(nTracksCPU, nTracksGPU); - hnLooseAndAboveTracks_->Fill(nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); - hnLooseAndAboveTracks_matched_->Fill(nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); + + // Define a lambda function for filling the histograms + auto fillHistogram = [](auto& histogram, auto xValue, auto yValue) { histogram->Fill(xValue, yValue); }; + + // Define a lambda for filling delta histograms + auto fillDeltaHistogram = [](auto& histogram, int cpuValue, int gpuValue) { + histogram->Fill(std::min(cpuValue, 1000), std::clamp(gpuValue - cpuValue, -100, 100)); + }; + + // Fill the histograms + fillHistogram(hnTracks_, nTracksCPU, nTracksGPU); + fillHistogram(hnLooseAndAboveTracks_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); + fillHistogram(hnLooseAndAboveTracks_matched_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); + + fillDeltaHistogram(hDeltaNTracks_, nTracksCPU, nTracksGPU); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_matched_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); } // @@ -252,13 +272,44 @@ void SiPixelCompareTrackSoA::bookHistograms(DQMStore::IBooker& iBook, iBook.cd(); iBook.setCurrentFolder(topFolderName_); - // clang-format off + // Define a helper function for booking histograms std::string toRep = "Number of tracks"; + auto bookTracksTH2I = [&](const std::string& name, + const std::string& title, + int xBins, + double xMin, + double xMax, + int yBins, + double yMin, + double yMax) { + return iBook.book2I(name, fmt::sprintf(title, toRep), xBins, xMin, xMax, yBins, yMin, yMax); + }; + + // Define common parameters for different histogram types + constexpr int xBins = 501; + constexpr double xMin = -0.5; + constexpr double xMax = 1001.5; + + constexpr int dXBins = 1001; + constexpr double dXMin = -0.5; + constexpr double dXMax = 1000.5; + + constexpr int dYBins = 201; + constexpr double dYMin = -100.5; + constexpr double dYMax = 100.5; + // 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); - hnLooseAndAboveTracks_matched_ = iBook.book2I("nLooseAndAboveTracks_matched", fmt::sprintf("%s (quality #geq loose) per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); + + // Book histograms using the helper function + // clang-format off + hnTracks_ = bookTracksTH2I("nTracks", "%s per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_ = bookTracksTH2I("nLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_matched_ = bookTracksTH2I("nLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + + hDeltaNTracks_ = bookTracksTH2I("deltaNTracks", "%s per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_ = bookTracksTH2I("deltaNLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_matched_ = bookTracksTH2I("deltaNLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits_ = iBook.book2I("nRecHits", fmt::sprintf("%s;CPU;GPU",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5); @@ -273,24 +324,25 @@ void SiPixelCompareTrackSoA::bookHistograms(DQMStore::IBooker& iBook, hCharge_ = iBook.book2I("charge",fmt::sprintf("%s;CPU;GPU",toRep),3, -1.5, 1.5, 3, -1.5, 1.5); hpt_ = iBook.book2I("pt", "Track (quality #geq loose) p_{T} [GeV];CPU;GPU", 200, 0., 200., 200, 0., 200.); + hCurvature_ = iBook.book2I("curvature", "Track (quality #geq loose) q/p_{T} [GeV^{-1}];CPU;GPU", 60,- 3., 3., 60, -3., 3. ); hptLogLog_ = make2DIfLog(iBook, true, true, "ptLogLog", "Track (quality #geq loose) p_{T} [GeV];CPU;GPU", 200, log10(0.5), log10(200.), 200, log10(0.5), log10(200.)); heta_ = iBook.book2I("eta", "Track (quality #geq loose) #eta;CPU;GPU", 30, -3., 3., 30, -3., 3.); hphi_ = iBook.book2I("phi", "Track (quality #geq loose) #phi;CPU;GPU", 30, -M_PI, M_PI, 30, -M_PI, M_PI); hz_ = iBook.book2I("z", "Track (quality #geq loose) z [cm];CPU;GPU", 30, -30., 30., 30, -30., 30.); htip_ = iBook.book2I("tip", "Track (quality #geq loose) TIP [cm];CPU;GPU", 100, -0.5, 0.5, 100, -0.5, 0.5); //1D difference plots - hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 60, -30., 30.); - hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV] between matched tracks; #Delta q/p_{T} [GeV]", 60, -30., 30.); - hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 160, -0.04 ,0.04); - hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 160, -0.04 ,0.04); - hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 300, -1.5, 1.5); - htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 300, -1.5, 1.5); + hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 61, -30.5, 30.5); + hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV^{-1}] between matched tracks; #Delta q/p_{T} [GeV^{-1}]", 61, -3.05, 3.05); + hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 161, -0.045 ,0.045); + hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 161, -0.045 ,0.045); + hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 301, -1.55, 1.55); + htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 301, -1.55, 1.55); //2D plots for eff - hpt_eta_tkAllCPU_ = iBook.book2I("ptetatrkAllCPU", "Track (quality #geq loose) on CPU; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); - hpt_eta_tkAllCPUMatched_ = iBook.book2I("ptetatrkAllCPUmatched", "Track (quality #geq loose) on CPU matched to GPU track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); + hpt_eta_tkAllRef_ = iBook.book2I("ptetatrkAllReference", "Track (quality #geq loose) on CPU; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); + hpt_eta_tkAllRefMatched_ = iBook.book2I("ptetatrkAllReferencematched", "Track (quality #geq loose) on CPU matched to GPU track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); - hphi_z_tkAllCPU_ = iBook.book2I("phiztrkAllCPU", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); - hphi_z_tkAllCPUMatched_ = iBook.book2I("phiztrkAllCPUmatched", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); + hphi_z_tkAllRef_ = iBook.book2I("phiztrkAllReference", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); + hphi_z_tkAllRefMatched_ = iBook.book2I("phiztrkAllReferencematched", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); } @@ -303,7 +355,7 @@ void SiPixelCompareTrackSoA::fillDescriptions(edm::ConfigurationDescriptions& desc.add("topFolderName", "SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU"); desc.add("useQualityCut", true); desc.add("minQuality", "loose"); - desc.add("deltaR2cut", 0.04); + desc.add("deltaR2cut", 0.02 * 0.02)->setComment("deltaR2 cut between track on CPU and GPU"); descriptions.addWithDefaultLabel(desc); } diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc index 064831cab6d13..4394b5d59f34b 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc @@ -11,6 +11,7 @@ // // for string manipulations +#include #include #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Math/interface/deltaR.h" @@ -94,6 +95,9 @@ class SiPixelCompareTracks : public DQMEDAnalyzer { MonitorElement* hnTracks_; MonitorElement* hnLooseAndAboveTracks_; MonitorElement* hnLooseAndAboveTracks_matched_; + MonitorElement* hDeltaNTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_matched_; MonitorElement* hnHits_; MonitorElement* hnHitsVsPhi_; MonitorElement* hnHitsVsEta_; @@ -105,6 +109,7 @@ class SiPixelCompareTracks : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi_; MonitorElement* hChi2VsEta_; MonitorElement* hpt_; + MonitorElement* hCurvature_; MonitorElement* hptLogLog_; MonitorElement* heta_; MonitorElement* hphi_; @@ -200,6 +205,7 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: float phiRef = reco::phi(tsoaRef.view(), it); float zipRef = reco::zip(tsoaRef.view(), it); float tipRef = reco::tip(tsoaRef.view(), it); + auto qRef = reco::charge(tsoaRef.view(), it); if (!(ptRef > 0.)) continue; @@ -231,17 +237,18 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: nLooseAndAboveTracksRef_matchedTar++; hchi2_->Fill(tsoaRef.view()[it].chi2(), tsoaTar.view()[closestTkidx].chi2()); - hCharge_->Fill(reco::charge(tsoaRef.view(), it), reco::charge(tsoaTar.view(), closestTkidx)); + hCharge_->Fill(qRef, reco::charge(tsoaTar.view(), closestTkidx)); hnHits_->Fill(helper::nHits(tsoaRef.view(), it), helper::nHits(tsoaTar.view(), closestTkidx)); hnLayers_->Fill(tsoaRef.view()[it].nLayers(), tsoaTar.view()[closestTkidx].nLayers()); hpt_->Fill(ptRef, tsoaTar.view()[closestTkidx].pt()); + hCurvature_->Fill(qRef / ptRef, reco::charge(tsoaTar.view(), closestTkidx) / tsoaTar.view()[closestTkidx].pt()); hptLogLog_->Fill(ptRef, tsoaTar.view()[closestTkidx].pt()); heta_->Fill(etaRef, tsoaTar.view()[closestTkidx].eta()); hphi_->Fill(phiRef, reco::phi(tsoaTar.view(), closestTkidx)); hz_->Fill(zipRef, reco::zip(tsoaTar.view(), closestTkidx)); htip_->Fill(tipRef, reco::tip(tsoaTar.view(), closestTkidx)); hptdiffMatched_->Fill(ptRef - tsoaTar.view()[closestTkidx].pt()); - hCurvdiffMatched_->Fill((reco::charge(tsoaRef.view(), it) / tsoaRef.view()[it].pt()) - + hCurvdiffMatched_->Fill(qRef / ptRef - (reco::charge(tsoaTar.view(), closestTkidx) / tsoaTar.view()[closestTkidx].pt())); hetadiffMatched_->Fill(etaRef - tsoaTar.view()[closestTkidx].eta()); hphidiffMatched_->Fill(reco::deltaPhi(phiRef, reco::phi(tsoaTar.view(), closestTkidx))); @@ -250,9 +257,23 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: hpt_eta_tkAllRefMatched_->Fill(etaRef, tsoaRef.view()[it].pt()); //matched to gpu hphi_z_tkAllRefMatched_->Fill(etaRef, zipRef); } - hnTracks_->Fill(nTracksRef, nTracksTar); - hnLooseAndAboveTracks_->Fill(nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); - hnLooseAndAboveTracks_matched_->Fill(nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); + + // Define a lambda function for filling the histograms + auto fillHistogram = [](auto& histogram, auto xValue, auto yValue) { histogram->Fill(xValue, yValue); }; + + // Define a lambda for filling delta histograms + auto fillDeltaHistogram = [](auto& histogram, int cpuValue, int gpuValue) { + histogram->Fill(std::min(cpuValue, 1000), std::clamp(gpuValue - cpuValue, -100, 100)); + }; + + // Fill the histograms + fillHistogram(hnTracks_, nTracksRef, nTracksTar); + fillHistogram(hnLooseAndAboveTracks_, nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); + fillHistogram(hnLooseAndAboveTracks_matched_, nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); + + fillDeltaHistogram(hDeltaNTracks_, nTracksRef, nTracksTar); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_, nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_matched_, nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); } // @@ -275,13 +296,44 @@ void SiPixelCompareTracks::bookHistograms(DQMStore::IBooker& iBook, iBook.cd(); iBook.setCurrentFolder(topFolderName_); - // clang-format off + // Define a helper function for booking histograms std::string toRep = "Number of tracks"; + auto bookTracksTH2I = [&](const std::string& name, + const std::string& title, + int xBins, + double xMin, + double xMax, + int yBins, + double yMin, + double yMax) { + return iBook.book2I(name, fmt::sprintf(title, toRep), xBins, xMin, xMax, yBins, yMin, yMax); + }; + + // Define common parameters for different histogram types + constexpr int xBins = 501; + constexpr double xMin = -0.5; + constexpr double xMax = 1001.5; + + constexpr int dXBins = 1001; + constexpr double dXMin = -0.5; + constexpr double dXMax = 1000.5; + + constexpr int dYBins = 201; + constexpr double dYMin = -100.5; + constexpr double dYMax = 100.5; + // 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; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_ = iBook.book2I("nLooseAndAboveTracks", fmt::sprintf("%s (quality #geq loose) per event; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_matched_ = iBook.book2I("nLooseAndAboveTracks_matched", fmt::sprintf("%s (quality #geq loose) per event; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); + + // Book histograms using the helper function + // clang-format off + hnTracks_ = bookTracksTH2I("nTracks", "%s per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_ = bookTracksTH2I("nLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_matched_ = bookTracksTH2I("nLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + + hDeltaNTracks_ = bookTracksTH2I("deltaNTracks", "%s per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_ = bookTracksTH2I("deltaNLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_matched_ = bookTracksTH2I("deltaNLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits_ = iBook.book2I("nRecHits", fmt::sprintf("%s;Reference;Target",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5); @@ -296,18 +348,20 @@ void SiPixelCompareTracks::bookHistograms(DQMStore::IBooker& iBook, hCharge_ = iBook.book2I("charge",fmt::sprintf("%s;Reference;Target",toRep),3, -1.5, 1.5, 3, -1.5, 1.5); hpt_ = iBook.book2I("pt", "Track (quality #geq loose) p_{T} [GeV];Reference;Target", 200, 0., 200., 200, 0., 200.); + hCurvature_ = iBook.book2I("curvature", "Track (quality #geq loose) q/p_{T} [GeV^{-1}];Reference;Target", 60,- 3., 3., 60, -3., 3. ); hptLogLog_ = make2DIfLog(iBook, true, true, "ptLogLog", "Track (quality #geq loose) p_{T} [GeV];Reference;Target", 200, log10(0.5), log10(200.), 200, log10(0.5), log10(200.)); heta_ = iBook.book2I("eta", "Track (quality #geq loose) #eta;Reference;Target", 30, -3., 3., 30, -3., 3.); hphi_ = iBook.book2I("phi", "Track (quality #geq loose) #phi;Reference;Target", 30, -M_PI, M_PI, 30, -M_PI, M_PI); hz_ = iBook.book2I("z", "Track (quality #geq loose) z [cm];Reference;Target", 30, -30., 30., 30, -30., 30.); htip_ = iBook.book2I("tip", "Track (quality #geq loose) TIP [cm];Reference;Target", 100, -0.5, 0.5, 100, -0.5, 0.5); + //1D difference plots - hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 60, -30., 30.); - hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV] between matched tracks; #Delta q/p_{T} [GeV]", 60, -30., 30.); - hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 160, -0.04 ,0.04); - hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 160, -0.04 ,0.04); - hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 300, -1.5, 1.5); - htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 300, -1.5, 1.5); + hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 61, -30.5, 30.5); + hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV^{-1}] between matched tracks; #Delta q/p_{T} [GeV^{-1}]", 61, -3.05, 3.05); + hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 161, -0.045 ,0.045); + hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 161, -0.045 ,0.045); + hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 301, -1.55, 1.55); + htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 301, -1.55, 1.55); //2D plots for eff hpt_eta_tkAllRef_ = iBook.book2I("ptetatrkAllReference", "Track (quality #geq loose) on Reference; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); hpt_eta_tkAllRefMatched_ = iBook.book2I("ptetatrkAllReferencematched", "Track (quality #geq loose) on Reference matched to Target track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); @@ -326,7 +380,7 @@ void SiPixelCompareTracks::fillDescriptions(edm::ConfigurationDescriptions& d desc.add("topFolderName", "SiPixelHeterogeneous/PixelTrackCompareDeviceVSHost"); desc.add("useQualityCut", true); desc.add("minQuality", "loose"); - desc.add("deltaR2cut", 0.04); + desc.add("deltaR2cut", 0.02 * 0.02)->setComment("deltaR2 cut between track on device and host"); descriptions.addWithDefaultLabel(desc); } diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc index e971ff184b052..f3ccb74bc3fea 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc @@ -52,6 +52,7 @@ class SiPixelMonitorTrackSoA : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi; MonitorElement* hChi2VsEta; MonitorElement* hpt; + MonitorElement* hCurvature; MonitorElement* heta; MonitorElement* hphi; MonitorElement* hz; @@ -112,6 +113,7 @@ void SiPixelMonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve float zip = helper::zip(tsoa.const_view(), it); float eta = tsoa.view()[it].eta(); float tip = helper::tip(tsoa.const_view(), it); + auto charge = helper::charge(tsoa.const_view(), it); hchi2->Fill(chi2); hChi2VsPhi->Fill(phi, chi2); @@ -123,6 +125,7 @@ void SiPixelMonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve hnLayersVsPhi->Fill(phi, nLayers); hnLayersVsEta->Fill(eta, nLayers); hpt->Fill(pt); + hCurvature->Fill(charge / pt); heta->Fill(eta); hphi->Fill(phi); hz->Fill(zip); @@ -145,8 +148,8 @@ void SiPixelMonitorTrackSoA::bookHistograms(DQMStore::IBooker& iBook, // clang-format off std::string toRep = "Number of tracks"; - hnTracks = iBook.book1D("nTracks", fmt::sprintf(";%s per event;#events",toRep), 1001, -0.5, 1000.5); - hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::sprintf(";%s (quality #geq loose) per event;#events",toRep), 1001, -0.5, 1000.5); + hnTracks = iBook.book1D("nTracks", fmt::sprintf(";%s per event;#events",toRep), 1001, -0.5, 2001.5); + hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::sprintf(";%s (quality #geq loose) per event;#events",toRep), 1001, -0.5, 2001.5); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits = iBook.book1D("nRecHits", fmt::sprintf(";%s;#tracks",toRep), 15, -0.5, 14.5); @@ -165,6 +168,7 @@ void SiPixelMonitorTrackSoA::bookHistograms(DQMStore::IBooker& iBook, // clang-format on hpt = iBook.book1D("pt", ";Track (quality #geq loose) p_{T} [GeV];#tracks", 200, 0., 200.); + hCurvature = iBook.book1D("curvature", ";Track (quality #geq loose) q/p_{T} [GeV^{-1}];#tracks", 100, -3., 3.); heta = iBook.book1D("eta", ";Track (quality #geq loose) #eta;#tracks", 30, -3., 3.); hphi = iBook.book1D("phi", ";Track (quality #geq loose) #phi;#tracks", 30, -M_PI, M_PI); hz = iBook.book1D("z", ";Track (quality #geq loose) z [cm];#tracks", 30, -30., 30.); diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc index fd98957ee8492..8bd1cdfa2e429 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc @@ -52,6 +52,7 @@ class SiPixelMonitorTrackSoAAlpaka : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi; MonitorElement* hChi2VsEta; MonitorElement* hpt; + MonitorElement* hCurvature; MonitorElement* heta; MonitorElement* hphi; MonitorElement* hz; @@ -112,6 +113,7 @@ void SiPixelMonitorTrackSoAAlpaka::analyze(const edm::Event& iEvent, const ed float zip = tsoa.view()[it].state()(4); float eta = tsoa.view()[it].eta(); float tip = tsoa.view()[it].state()(1); + auto charge = reco::charge(tsoa.view(), it); hchi2->Fill(chi2); hChi2VsPhi->Fill(phi, chi2); @@ -123,6 +125,7 @@ void SiPixelMonitorTrackSoAAlpaka::analyze(const edm::Event& iEvent, const ed hnLayersVsPhi->Fill(phi, nLayers); hnLayersVsEta->Fill(eta, nLayers); hpt->Fill(pt); + hCurvature->Fill(charge / pt); heta->Fill(eta); hphi->Fill(phi); hz->Fill(zip); @@ -145,8 +148,8 @@ void SiPixelMonitorTrackSoAAlpaka::bookHistograms(DQMStore::IBooker& iBook, // clang-format off std::string toRep = "Number of tracks"; -hnTracks = iBook.book1D("nTracks", fmt::format(";{} per event;#events",toRep), 1001, -0.5, 1000.5); -hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::format(";{} (quality #geq loose) per event;#events",toRep), 1001, -0.5, 1000.5); +hnTracks = iBook.book1D("nTracks", fmt::format(";{} per event;#events",toRep), 1001, -0.5, 2001.5); +hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::format(";{} (quality #geq loose) per event;#events",toRep), 1001, -0.5, 2001.5); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits = iBook.book1D("nRecHits", fmt::format(";{};#tracks",toRep), 15, -0.5, 14.5); @@ -165,6 +168,7 @@ hChi2VsEta = iBook.bookProfile("nChi2ndofVsEta", fmt::format("{} vs track #eta;T // clang-format on hpt = iBook.book1D("pt", ";Track (quality #geq loose) p_{T} [GeV];#tracks", 200, 0., 200.); + hCurvature = iBook.book1D("curvature", ";Track (quality #geq loose) q/p_{T} [GeV^{-1}];#tracks", 100, -3., 3.); heta = iBook.book1D("eta", ";Track (quality #geq loose) #eta;#tracks", 30, -3., 3.); hphi = iBook.book1D("phi", ";Track (quality #geq loose) #phi;#tracks", 30, -M_PI, M_PI); hz = iBook.book1D("z", ";Track (quality #geq loose) z [cm];#tracks", 30, -30., 30.); diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc index 1d72a7bec4105..12be60250a65a 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc @@ -28,15 +28,31 @@ SiPixelTrackComparisonHarvester::SiPixelTrackComparisonHarvester(const edm::Para : topFolder_(iConfig.getParameter("topFolderName")) {} void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) { - MonitorElement* hpt_eta_tkAllCPU = igetter.get(topFolder_ + "/ptetatrkAllCPU"); - MonitorElement* hpt_eta_tkAllCPUmatched = igetter.get(topFolder_ + "/ptetatrkAllCPUmatched"); - MonitorElement* hphi_z_tkAllCPU = igetter.get(topFolder_ + "/phiztrkAllCPU"); - MonitorElement* hphi_z_tkAllCPUmatched = igetter.get(topFolder_ + "/phiztrkAllCPUmatched"); + MonitorElement* hpt_eta_tkAllReference = igetter.get(topFolder_ + "/ptetatrkAllReference"); + if (hpt_eta_tkAllReference == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/ptetatrkAllReference. Skipping."; + return; + } + + MonitorElement* hpt_eta_tkAllReferencematched = igetter.get(topFolder_ + "/ptetatrkAllReferencematched"); + if (hpt_eta_tkAllReferencematched == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/ptetatrkAllReferencematched. Skipping."; + return; + } + + MonitorElement* hphi_z_tkAllReference = igetter.get(topFolder_ + "/phiztrkAllReference"); + if (hphi_z_tkAllReference == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/phiztrkAllReference. Skipping."; + return; + } - if (hpt_eta_tkAllCPU == nullptr or hpt_eta_tkAllCPUmatched == nullptr or hphi_z_tkAllCPU == nullptr or - hphi_z_tkAllCPUmatched == nullptr) { + MonitorElement* hphi_z_tkAllReferencematched = igetter.get(topFolder_ + "/phiztrkAllReferencematched"); + if (hphi_z_tkAllReferencematched == nullptr) { edm::LogError("SiPixelTrackComparisonHarvester") - << "MEs needed for this module are not found in the input file. Skipping."; + << "MonitorElement not found: " << topFolder_ << "/phiztrkAllReferencematched. Skipping."; return; } @@ -47,8 +63,8 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS MonitorElement* hphi_z_matchRatio = ibooker.book2D( "matchingeff_phi_z", "Efficiency of track matching; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); - 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"); + hpt_eta_matchRatio->divide(hpt_eta_tkAllReferencematched, hpt_eta_tkAllReference, 1., 1., "B"); + hphi_z_matchRatio->divide(hphi_z_tkAllReferencematched, hphi_z_tkAllReference, 1., 1., "B"); // now create the 1D projection from the 2D histograms std::vector listOfMEsToProject = {"nTracks", @@ -59,12 +75,14 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS "nChi2ndof", "charge", "pt", + "curvature", "eta", "phi", "z", "tip"}; for (const auto& me : listOfMEsToProject) { MonitorElement* input2D = igetter.get(topFolder_ + "/" + me); + edm::LogPrint("SiPixelTrackComparisonHarvester") << "processing " << topFolder_ + "/" + me; this->project2DalongDiagonal(input2D, ibooker); } } @@ -72,7 +90,7 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS 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."; + << "ME needed for diagonal projection is not found in the input file at" << topFolder_ << ". Skipping."; return; } diff --git a/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py b/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py index d39b9e277bec7..32573ec5a5281 100644 --- a/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py +++ b/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py @@ -2,19 +2,30 @@ siPixelHeterogeneousDQMHarvesting = cms.Sequence() # empty sequence if not both CPU and GPU recos are run from DQM.SiPixelPhase1Common.SiPixelPhase1RawData_cfi import * -from DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff import SiPixelPhase1RawDataConfForCPU,SiPixelPhase1RawDataConfForGPU +from DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff import SiPixelPhase1RawDataConfForCPU,SiPixelPhase1RawDataConfForGPU,SiPixelPhase1RawDataConfForSerial,SiPixelPhase1RawDataConfForDevice +# CUDA code siPixelPhase1RawDataHarvesterCPU = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForCPU) siPixelPhase1RawDataHarvesterGPU = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForGPU) +# alpaka code +siPixelPhase1RawDataHarvesterSerial = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForSerial) +siPixelPhase1RawDataHarvesterDevice = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForDevice) + from DQM.SiPixelHeterogeneous.siPixelTrackComparisonHarvester_cfi import * +siPixelTrackComparisonHarvesterAlpaka = siPixelTrackComparisonHarvester.clone(topFolderName = cms.string('SiPixelHeterogeneous/PixelTrackCompareDeviceVSHost')) siPixelHeterogeneousDQMComparisonHarvesting = cms.Sequence(siPixelPhase1RawDataHarvesterCPU * siPixelPhase1RawDataHarvesterGPU * siPixelTrackComparisonHarvester ) +siPixelHeterogeneousDQMComparisonHarvestingAlpaka = cms.Sequence(siPixelPhase1RawDataHarvesterSerial * + siPixelPhase1RawDataHarvesterDevice * + siPixelTrackComparisonHarvesterAlpaka ) + # add the harvester in case of the validation modifier is active from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel gpuValidationPixel.toReplaceWith(siPixelHeterogeneousDQMHarvesting,siPixelHeterogeneousDQMComparisonHarvesting) - +from Configuration.ProcessModifiers.alpakaValidationPixel_cff import alpakaValidationPixel +(alpakaValidationPixel & ~gpuValidationPixel).toReplaceWith(siPixelHeterogeneousDQMHarvesting,siPixelHeterogeneousDQMComparisonHarvestingAlpaka)