@@ -84,6 +84,9 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer {
8484 MonitorElement* hnTracks_;
8585 MonitorElement* hnLooseAndAboveTracks_;
8686 MonitorElement* hnLooseAndAboveTracks_matched_;
87+ MonitorElement* hDeltaNTracks_;
88+ MonitorElement* hDeltaNLooseAndAboveTracks_;
89+ MonitorElement* hDeltaNLooseAndAboveTracks_matched_;
8790 MonitorElement* hnHits_;
8891 MonitorElement* hnHitsVsPhi_;
8992 MonitorElement* hnHitsVsEta_;
@@ -95,6 +98,7 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer {
9598 MonitorElement* hChi2VsPhi_;
9699 MonitorElement* hChi2VsEta_;
97100 MonitorElement* hpt_;
101+ MonitorElement* hCurvature_;
98102 MonitorElement* hptLogLog_;
99103 MonitorElement* heta_;
100104 MonitorElement* hphi_;
@@ -110,10 +114,10 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer {
110114 MonitorElement* htipdiffMatched_;
111115
112116 // for matching eff vs region: derive the ratio at harvesting
113- MonitorElement* hpt_eta_tkAllCPU_ ;
114- MonitorElement* hpt_eta_tkAllCPUMatched_ ;
115- MonitorElement* hphi_z_tkAllCPU_ ;
116- MonitorElement* hphi_z_tkAllCPUMatched_ ;
117+ MonitorElement* hpt_eta_tkAllRef_ ;
118+ MonitorElement* hpt_eta_tkAllRefMatched_ ;
119+ MonitorElement* hphi_z_tkAllRef_ ;
120+ MonitorElement* hphi_z_tkAllRefMatched_ ;
117121};
118122
119123//
@@ -187,6 +191,7 @@ void SiPixelCompareTrackSoA<T>::analyze(const edm::Event& iEvent, const edm::Eve
187191 float phiCPU = helper::phi (tsoaCPU.view (), it);
188192 float zipCPU = helper::zip (tsoaCPU.view (), it);
189193 float tipCPU = helper::tip (tsoaCPU.view (), it);
194+ auto qCPU = helper::charge (tsoaCPU.view (), it);
190195
191196 if (!(ptCPU > 0 .))
192197 continue ;
@@ -211,17 +216,18 @@ void SiPixelCompareTrackSoA<T>::analyze(const edm::Event& iEvent, const edm::Eve
211216 }
212217 }
213218
214- hpt_eta_tkAllCPU_ ->Fill (etaCPU, ptCPU); // all CPU tk
215- hphi_z_tkAllCPU_ ->Fill (phiCPU, zipCPU);
219+ hpt_eta_tkAllRef_ ->Fill (etaCPU, ptCPU); // all CPU tk
220+ hphi_z_tkAllRef_ ->Fill (phiCPU, zipCPU);
216221 if (closestTkidx == notFound)
217222 continue ;
218223 nLooseAndAboveTracksCPU_matchedGPU++;
219224
220225 hchi2_->Fill (tsoaCPU.view ()[it].chi2 (), tsoaGPU.view ()[closestTkidx].chi2 ());
221- hCharge_->Fill (helper::charge (tsoaCPU. view (), it) , helper::charge (tsoaGPU.view (), closestTkidx));
226+ hCharge_->Fill (qCPU , helper::charge (tsoaGPU.view (), closestTkidx));
222227 hnHits_->Fill (helper::nHits (tsoaCPU.view (), it), helper::nHits (tsoaGPU.view (), closestTkidx));
223228 hnLayers_->Fill (tsoaCPU.view ()[it].nLayers (), tsoaGPU.view ()[closestTkidx].nLayers ());
224229 hpt_->Fill (ptCPU, tsoaGPU.view ()[closestTkidx].pt ());
230+ hCurvature_->Fill (qCPU / ptCPU, helper::charge (tsoaGPU.view (), closestTkidx) / tsoaGPU.view ()[closestTkidx].pt ());
225231 hptLogLog_->Fill (ptCPU, tsoaGPU.view ()[closestTkidx].pt ());
226232 heta_->Fill (etaCPU, tsoaGPU.view ()[closestTkidx].eta ());
227233 hphi_->Fill (phiCPU, helper::phi (tsoaGPU.view (), closestTkidx));
@@ -234,12 +240,26 @@ void SiPixelCompareTrackSoA<T>::analyze(const edm::Event& iEvent, const edm::Eve
234240 hphidiffMatched_->Fill (reco::deltaPhi (phiCPU, helper::phi (tsoaGPU.view (), closestTkidx)));
235241 hzdiffMatched_->Fill (zipCPU - helper::zip (tsoaGPU.view (), closestTkidx));
236242 htipdiffMatched_->Fill (tipCPU - helper::tip (tsoaGPU.view (), closestTkidx));
237- hpt_eta_tkAllCPUMatched_ ->Fill (etaCPU, tsoaCPU.view ()[it].pt ()); // matched to gpu
238- hphi_z_tkAllCPUMatched_ ->Fill (etaCPU, zipCPU);
243+ hpt_eta_tkAllRefMatched_ ->Fill (etaCPU, tsoaCPU.view ()[it].pt ()); // matched to gpu
244+ hphi_z_tkAllRefMatched_ ->Fill (etaCPU, zipCPU);
239245 }
240- hnTracks_->Fill (nTracksCPU, nTracksGPU);
241- hnLooseAndAboveTracks_->Fill (nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU);
242- hnLooseAndAboveTracks_matched_->Fill (nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU);
246+
247+ // Define a lambda function for filling the histograms
248+ auto fillHistogram = [](auto & histogram, auto xValue, auto yValue) { histogram->Fill (xValue, yValue); };
249+
250+ // Define a lambda for filling delta histograms
251+ auto fillDeltaHistogram = [](auto & histogram, int cpuValue, int gpuValue) {
252+ histogram->Fill (std::min (cpuValue, 1000 ), std::clamp (gpuValue - cpuValue, -100 , 100 ));
253+ };
254+
255+ // Fill the histograms
256+ fillHistogram (hnTracks_, nTracksCPU, nTracksGPU);
257+ fillHistogram (hnLooseAndAboveTracks_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU);
258+ fillHistogram (hnLooseAndAboveTracks_matched_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU);
259+
260+ fillDeltaHistogram (hDeltaNTracks_, nTracksCPU, nTracksGPU);
261+ fillDeltaHistogram (hDeltaNLooseAndAboveTracks_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU);
262+ fillDeltaHistogram (hDeltaNLooseAndAboveTracks_matched_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU);
243263}
244264
245265//
@@ -252,13 +272,44 @@ void SiPixelCompareTrackSoA<T>::bookHistograms(DQMStore::IBooker& iBook,
252272 iBook.cd ();
253273 iBook.setCurrentFolder (topFolderName_);
254274
255- // clang-format off
275+ // Define a helper function for booking histograms
256276 std::string toRep = " Number of tracks" ;
277+ auto bookTracksTH2I = [&](const std::string& name,
278+ const std::string& title,
279+ int xBins,
280+ double xMin,
281+ double xMax,
282+ int yBins,
283+ double yMin,
284+ double yMax) {
285+ return iBook.book2I (name, fmt::sprintf (title, toRep), xBins, xMin, xMax, yBins, yMin, yMax);
286+ };
287+
288+ // Define common parameters for different histogram types
289+ constexpr int xBins = 501 ;
290+ constexpr double xMin = -0.5 ;
291+ constexpr double xMax = 1001.5 ;
292+
293+ constexpr int dXBins = 1001 ;
294+ constexpr double dXMin = -0.5 ;
295+ constexpr double dXMax = 1000.5 ;
296+
297+ constexpr int dYBins = 201 ;
298+ constexpr double dYMin = -100.5 ;
299+ constexpr double dYMax = 100.5 ;
300+
257301 // FIXME: all the 2D correlation plots are quite heavy in terms of memory consumption, so a as soon as DQM supports THnSparse
258302 // these should be moved to a less resource consuming format
259- hnTracks_ = iBook.book2I (" nTracks" , fmt::sprintf (" %s per event; CPU; GPU" ,toRep), 501 , -0.5 , 500.5 , 501 , -0.5 , 500.5 );
260- 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 );
261- 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 );
303+
304+ // Book histograms using the helper function
305+ // clang-format off
306+ hnTracks_ = bookTracksTH2I (" nTracks" , " %s per event; Reference; Target" , xBins, xMin, xMax, xBins, xMin, xMax);
307+ hnLooseAndAboveTracks_ = bookTracksTH2I (" nLooseAndAboveTracks" , " %s (quality #geq loose) per event; Reference; Target" , xBins, xMin, xMax, xBins, xMin, xMax);
308+ hnLooseAndAboveTracks_matched_ = bookTracksTH2I (" nLooseAndAboveTracks_matched" , " %s (quality #geq loose) per event; Reference; Target" , xBins, xMin, xMax, xBins, xMin, xMax);
309+
310+ hDeltaNTracks_ = bookTracksTH2I (" deltaNTracks" , " %s per event; Reference; Target - Reference" , dXBins, dXMin, dXMax, dYBins, dYMin, dYMax);
311+ hDeltaNLooseAndAboveTracks_ = bookTracksTH2I (" deltaNLooseAndAboveTracks" , " %s (quality #geq loose) per event; Reference; Target - Reference" , dXBins, dXMin, dXMax, dYBins, dYMin, dYMax);
312+ hDeltaNLooseAndAboveTracks_matched_ = bookTracksTH2I (" deltaNLooseAndAboveTracks_matched" , " %s (quality #geq loose) per event; Reference; Target - Reference" , dXBins, dXMin, dXMax, dYBins, dYMin, dYMax);
262313
263314 toRep = " Number of all RecHits per track (quality #geq loose)" ;
264315 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<T>::bookHistograms(DQMStore::IBooker& iBook,
273324 hCharge_ = iBook.book2I (" charge" ,fmt::sprintf (" %s;CPU;GPU" ,toRep),3 , -1.5 , 1.5 , 3 , -1.5 , 1.5 );
274325
275326 hpt_ = iBook.book2I (" pt" , " Track (quality #geq loose) p_{T} [GeV];CPU;GPU" , 200 , 0 ., 200 ., 200 , 0 ., 200 .);
327+ hCurvature_ = iBook.book2I (" curvature" , " Track (quality #geq loose) q/p_{T} [GeV^{-1}];CPU;GPU" , 60 ,- 3 ., 3 ., 60 , -3 ., 3 . );
276328 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 .));
277329 heta_ = iBook.book2I (" eta" , " Track (quality #geq loose) #eta;CPU;GPU" , 30 , -3 ., 3 ., 30 , -3 ., 3 .);
278330 hphi_ = iBook.book2I (" phi" , " Track (quality #geq loose) #phi;CPU;GPU" , 30 , -M_PI, M_PI, 30 , -M_PI, M_PI);
279331 hz_ = iBook.book2I (" z" , " Track (quality #geq loose) z [cm];CPU;GPU" , 30 , -30 ., 30 ., 30 , -30 ., 30 .);
280332 htip_ = iBook.book2I (" tip" , " Track (quality #geq loose) TIP [cm];CPU;GPU" , 100 , -0.5 , 0.5 , 100 , -0.5 , 0.5 );
281333 // 1D difference plots
282- hptdiffMatched_ = iBook.book1D (" ptdiffmatched" , " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]" , 60 , -30 ., 30 .);
283- hCurvdiffMatched_ = iBook.book1D (" curvdiffmatched" , " q/p_{T} diff [GeV] between matched tracks; #Delta q/p_{T} [GeV]" , 60 , -30 ., 30 . );
284- hetadiffMatched_ = iBook.book1D (" etadiffmatched" , " #eta diff between matched tracks; #Delta #eta" , 160 , -0.04 ,0.04 );
285- hphidiffMatched_ = iBook.book1D (" phidiffmatched" , " #phi diff between matched tracks; #Delta #phi" , 160 , -0.04 ,0.04 );
286- hzdiffMatched_ = iBook.book1D (" zdiffmatched" , " z diff between matched tracks; #Delta z [cm]" , 300 , -1.5 , 1.5 );
287- htipdiffMatched_ = iBook.book1D (" tipdiffmatched" , " TIP diff between matched tracks; #Delta TIP [cm]" , 300 , -1.5 , 1.5 );
334+ hptdiffMatched_ = iBook.book1D (" ptdiffmatched" , " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]" , 61 , -30.5 , 30.5 );
335+ hCurvdiffMatched_ = iBook.book1D (" curvdiffmatched" , " q/p_{T} diff [GeV^{-1} ] between matched tracks; #Delta q/p_{T} [GeV^{-1} ]" , 61 , -3.05 , 3.05 );
336+ hetadiffMatched_ = iBook.book1D (" etadiffmatched" , " #eta diff between matched tracks; #Delta #eta" , 161 , -0.045 ,0.045 );
337+ hphidiffMatched_ = iBook.book1D (" phidiffmatched" , " #phi diff between matched tracks; #Delta #phi" , 161 , -0.045 ,0.045 );
338+ hzdiffMatched_ = iBook.book1D (" zdiffmatched" , " z diff between matched tracks; #Delta z [cm]" , 301 , -1.55 , 1.55 );
339+ htipdiffMatched_ = iBook.book1D (" tipdiffmatched" , " TIP diff between matched tracks; #Delta TIP [cm]" , 301 , -1.55 , 1.55 );
288340 // 2D plots for eff
289- hpt_eta_tkAllCPU_ = iBook.book2I (" ptetatrkAllCPU " , " Track (quality #geq loose) on CPU; #eta; p_{T} [GeV];" , 30 , -M_PI, M_PI, 200 , 0 ., 200 .);
290- 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 .);
341+ hpt_eta_tkAllRef_ = iBook.book2I (" ptetatrkAllReference " , " Track (quality #geq loose) on CPU; #eta; p_{T} [GeV];" , 30 , -M_PI, M_PI, 200 , 0 ., 200 .);
342+ 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 .);
291343
292- hphi_z_tkAllCPU_ = iBook.book2I (" phiztrkAllCPU " , " Track (quality #geq loose) on CPU; #phi; z [cm];" , 30 , -M_PI, M_PI, 30 , -30 ., 30 .);
293- hphi_z_tkAllCPUMatched_ = iBook.book2I (" phiztrkAllCPUmatched " , " Track (quality #geq loose) on CPU; #phi; z [cm];" , 30 , -M_PI, M_PI, 30 , -30 ., 30 .);
344+ hphi_z_tkAllRef_ = iBook.book2I (" phiztrkAllReference " , " Track (quality #geq loose) on CPU; #phi; z [cm];" , 30 , -M_PI, M_PI, 30 , -30 ., 30 .);
345+ hphi_z_tkAllRefMatched_ = iBook.book2I (" phiztrkAllReferencematched " , " Track (quality #geq loose) on CPU; #phi; z [cm];" , 30 , -M_PI, M_PI, 30 , -30 ., 30 .);
294346
295347}
296348
@@ -303,7 +355,7 @@ void SiPixelCompareTrackSoA<T>::fillDescriptions(edm::ConfigurationDescriptions&
303355 desc.add <std::string>(" topFolderName" , " SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU" );
304356 desc.add <bool >(" useQualityCut" , true );
305357 desc.add <std::string>(" minQuality" , " loose" );
306- desc.add <double >(" deltaR2cut" , 0.04 );
358+ desc.add <double >(" deltaR2cut" , 0.02 * 0.02 )-> setComment ( " deltaR2 cut between track on CPU and GPU " );
307359 descriptions.addWithDefaultLabel (desc);
308360}
309361
0 commit comments