2 #include <fmt/printf.h> 25 void setBinLog(TAxis* axis) {
26 int bins = axis->GetNbins();
27 float from = axis->GetXmin();
28 float to = axis->GetXmax();
30 std::vector<float> new_bins(
bins + 1, 0);
31 for (
int i = 0;
i <=
bins;
i++) {
32 new_bins[
i] = TMath::Power(10, from +
i *
width);
34 axis->Set(
bins, new_bins.data());
37 void setBinLogX(TH1*
h) {
38 TAxis* axis =
h->GetXaxis();
41 void setBinLogY(TH1*
h) {
42 TAxis* axis =
h->GetYaxis();
46 template <
typename... Args>
48 auto h = std::make_unique<TH2I>(std::forward<Args>(
args)...);
53 const auto&
name =
h->GetName();
54 return ibook.book2I(
name,
h.release());
115 template <
typename T>
119 topFolderName_(iConfig.getParameter<
std::
string>(
"topFolderName")),
120 useQualityCut_(iConfig.getParameter<
bool>(
"useQualityCut")),
122 dr2cut_(iConfig.getParameter<double>(
"deltaR2cut")) {}
127 template <
typename T>
130 const auto& tsoaHandleHost =
iEvent.getHandle(tokenSoATrackHost_);
131 const auto& tsoaHandleDevice =
iEvent.getHandle(tokenSoATrackDevice_);
132 if (not tsoaHandleHost
or not tsoaHandleDevice) {
134 if (not tsoaHandleHost) {
135 out <<
"reference (cpu) tracks not found; ";
137 if (not tsoaHandleDevice) {
138 out <<
"target (gpu) tracks not found; ";
140 out <<
"the comparison will not run.";
144 auto const& tsoaHost = *tsoaHandleHost;
145 auto const& tsoaDevice = *tsoaHandleDevice;
146 auto maxTracksHost = tsoaHost.view().metadata().size();
147 auto maxTracksDevice = tsoaDevice.view().metadata().size();
148 auto const* qualityHost = tsoaHost.view().quality();
149 auto const* qualityDevice = tsoaDevice.view().quality();
150 int32_t nTracksHost = 0;
151 int32_t nTracksDevice = 0;
152 int32_t nLooseAndAboveTracksHost = 0;
153 int32_t nLooseAndAboveTracksHost_matchedDevice = 0;
154 int32_t nLooseAndAboveTracksDevice = 0;
157 std::vector<int32_t> looseTrkidxDevice;
158 for (int32_t jt = 0; jt < maxTracksDevice; ++jt) {
161 if (!(tsoaDevice.view()[jt].pt() > 0.))
164 if (useQualityCut_ && qualityDevice[jt] < minQuality_)
166 nLooseAndAboveTracksDevice++;
167 looseTrkidxDevice.emplace_back(jt);
171 for (int32_t
it = 0;
it < maxTracksHost; ++
it) {
177 float ptHost = tsoaHost.view()[
it].pt();
178 float etaHost = tsoaHost.view()[
it].eta();
186 if (useQualityCut_ && qualityHost[
it] < minQuality_)
188 nLooseAndAboveTracksHost++;
192 float mindr2 = dr2cut_;
194 for (
auto gid : looseTrkidxDevice) {
195 float etaDevice = tsoaDevice.view()[gid].
eta();
196 float phiDevice =
reco::phi(tsoaDevice.view(), gid);
197 float dr2 =
reco::deltaR2(etaHost, phiHost, etaDevice, phiDevice);
206 hpt_eta_tkAllHost_->Fill(etaHost, ptHost);
207 hphi_z_tkAllHost_->Fill(phiHost, zipHost);
210 nLooseAndAboveTracksHost_matchedDevice++;
212 hchi2_->Fill(tsoaHost.view()[
it].chi2(), tsoaDevice.view()[closestTkidx].chi2());
215 hnLayers_->Fill(tsoaHost.view()[
it].nLayers(), tsoaDevice.view()[closestTkidx].nLayers());
216 hpt_->Fill(tsoaHost.view()[
it].pt(), tsoaDevice.view()[closestTkidx].pt());
217 hptLogLog_->Fill(tsoaHost.view()[
it].pt(), tsoaDevice.view()[closestTkidx].pt());
218 heta_->Fill(etaHost, tsoaDevice.view()[closestTkidx].eta());
219 hphi_->Fill(phiHost,
reco::phi(tsoaDevice.view(), closestTkidx));
220 hz_->Fill(zipHost,
reco::zip(tsoaDevice.view(), closestTkidx));
221 htip_->Fill(tipHost,
reco::tip(tsoaDevice.view(), closestTkidx));
222 hptdiffMatched_->Fill(ptHost - tsoaDevice.view()[closestTkidx].pt());
223 hCurvdiffMatched_->Fill((
reco::charge(tsoaHost.view(),
it) / tsoaHost.view()[
it].pt()) -
224 (
reco::charge(tsoaDevice.view(), closestTkidx) / tsoaDevice.view()[closestTkidx].pt()));
225 hetadiffMatched_->Fill(etaHost - tsoaDevice.view()[closestTkidx].eta());
227 hzdiffMatched_->Fill(zipHost -
reco::zip(tsoaDevice.view(), closestTkidx));
228 htipdiffMatched_->Fill(tipHost -
reco::tip(tsoaDevice.view(), closestTkidx));
229 hpt_eta_tkAllHostMatched_->Fill(etaHost, tsoaHost.view()[
it].pt());
230 hphi_z_tkAllHostMatched_->Fill(etaHost, zipHost);
232 hnTracks_->Fill(nTracksHost, nTracksDevice);
233 hnLooseAndAboveTracks_->Fill(nLooseAndAboveTracksHost, nLooseAndAboveTracksDevice);
234 hnLooseAndAboveTracks_matched_->Fill(nLooseAndAboveTracksHost, nLooseAndAboveTracksHost_matchedDevice);
240 template <
typename T>
251 hnTracks_ = iBook.
book2I(
"nTracks",
fmt::format(
"{} per event; Host; Device",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5);
252 hnLooseAndAboveTracks_ = iBook.
book2I(
"nLooseAndAboveTracks",
fmt::format(
"{} (quality #geq loose) per event; Host; Device",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5);
253 hnLooseAndAboveTracks_matched_ = iBook.
book2I(
"nLooseAndAboveTracks_matched",
fmt::format(
"{} (quality #geq loose) per event; Host; Device",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5);
255 toRep =
"Number of all RecHits per track (quality #geq loose)";
256 hnHits_ = iBook.
book2I(
"nRecHits",
fmt::format(
"{};Host;Device",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5);
258 toRep =
"Number of all layers per track (quality #geq loose)";
259 hnLayers_ = iBook.
book2I(
"nLayers",
fmt::format(
"{};Host;Device",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5);
261 toRep =
"Track (quality #geq loose) #chi^{2}/ndof";
262 hchi2_ = iBook.
book2I(
"nChi2ndof",
fmt::format(
"{};Host;Device",toRep), 40, 0., 20., 40, 0., 20.);
264 toRep =
"Track (quality #geq loose) charge";
265 hCharge_ = iBook.
book2I(
"charge",
fmt::format(
"{};Host;Device",toRep),3, -1.5, 1.5, 3, -1.5, 1.5);
267 hpt_ = iBook.
book2I(
"pt",
"Track (quality #geq loose) p_{T} [GeV];Host;Device", 200, 0., 200., 200, 0., 200.);
268 hptLogLog_ = make2DIfLog(iBook,
true,
true,
"ptLogLog",
"Track (quality #geq loose) p_{T} [GeV];Host;Device", 200, log10(0.5), log10(200.), 200, log10(0.5), log10(200.));
269 heta_ = iBook.
book2I(
"eta",
"Track (quality #geq loose) #eta;Host;Device", 30, -3., 3., 30, -3., 3.);
270 hphi_ = iBook.
book2I(
"phi",
"Track (quality #geq loose) #phi;Host;Device", 30, -
M_PI,
M_PI, 30, -
M_PI,
M_PI);
271 hz_ = iBook.
book2I(
"z",
"Track (quality #geq loose) z [cm];Host;Device", 30, -30., 30., 30, -30., 30.);
272 htip_ = iBook.
book2I(
"tip",
"Track (quality #geq loose) TIP [cm];Host;Device", 100, -0.5, 0.5, 100, -0.5, 0.5);
274 hptdiffMatched_ = iBook.
book1D(
"ptdiffmatched",
" p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 60, -30., 30.);
275 hCurvdiffMatched_ = iBook.
book1D(
"curvdiffmatched",
"q/p_{T} diff [GeV] between matched tracks; #Delta q/p_{T} [GeV]", 60, -30., 30.);
276 hetadiffMatched_ = iBook.
book1D(
"etadiffmatched",
" #eta diff between matched tracks; #Delta #eta", 160, -0.04 ,0.04);
277 hphidiffMatched_ = iBook.
book1D(
"phidiffmatched",
" #phi diff between matched tracks; #Delta #phi", 160, -0.04 ,0.04);
278 hzdiffMatched_ = iBook.
book1D(
"zdiffmatched",
" z diff between matched tracks; #Delta z [cm]", 300, -1.5, 1.5);
279 htipdiffMatched_ = iBook.
book1D(
"tipdiffmatched",
" TIP diff between matched tracks; #Delta TIP [cm]", 300, -1.5, 1.5);
281 hpt_eta_tkAllHost_ = iBook.
book2I(
"ptetatrkAllHost",
"Track (quality #geq loose) on Host; #eta; p_{T} [GeV];", 30, -
M_PI,
M_PI, 200, 0., 200.);
282 hpt_eta_tkAllHostMatched_ = iBook.
book2I(
"ptetatrkAllHostmatched",
"Track (quality #geq loose) on Host matched to Device track; #eta; p_{T} [GeV];", 30, -
M_PI,
M_PI, 200, 0., 200.);
284 hphi_z_tkAllHost_ = iBook.
book2I(
"phiztrkAllHost",
"Track (quality #geq loose) on Host; #phi; z [cm];", 30, -
M_PI,
M_PI, 30, -30., 30.);
285 hphi_z_tkAllHostMatched_ = iBook.
book2I(
"phiztrkAllHostmatched",
"Track (quality #geq loose) on Host; #phi; z [cm];", 30, -
M_PI,
M_PI, 30, -30., 30.);
295 desc.add<
std::string>(
"topFolderName",
"SiPixelHeterogeneous/PixelTrackCompareDeviceVSHost");
296 desc.add<
bool>(
"useQualityCut",
true);
298 desc.add<
double>(
"deltaR2cut", 0.04);
MonitorElement * hetadiffMatched_
constexpr double deltaPhi(double phi1, double phi2)
MonitorElement * hnLooseAndAboveTracks_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const std::string topFolderName_
MonitorElement * hChi2VsPhi_
virtual void setCurrentFolder(std::string const &fullpath)
Quality qualityByName(std::string const &name)
MonitorElement * hnHitsVsEta_
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float zip(ConstView const &tracks, int32_t i)
MonitorElement * hCharge_
MonitorElement * hphi_z_tkAllHostMatched_
~SiPixelCompareTrackSoAAlpaka() override=default
MonitorElement * hnLayers_
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float charge(ConstView const &tracks, int32_t i)
MonitorElement * hnLayersVsPhi_
const pixelTrack::Quality minQuality_
MonitorElement * hpt_eta_tkAllHost_
dqm::reco::DQMStore DQMStore
MonitorElement * hnTracks_
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float tip(ConstView const &tracks, int32_t i)
MonitorElement * hptdiffMatched_
MonitorElement * hnLooseAndAboveTracks_matched_
MonitorElement * htipdiffMatched_
MonitorElement * hnLayersVsEta_
MonitorElement * hnHitsVsPhi_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float phi(ConstView const &tracks, int32_t i)
MonitorElement * hzdiffMatched_
#define DEFINE_FWK_MODULE(type)
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
MonitorElement * hphi_z_tkAllHost_
SiPixelCompareTrackSoAAlpaka(const edm::ParameterSet &)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const edm::EDGetTokenT< PixelTrackSoA > tokenSoATrackHost_
static const GlobalPoint notFound(0, 0, 0)
MonitorElement * hptLogLog_
MonitorElement * hCurvdiffMatched_
MonitorElement * hpt_eta_tkAllHostMatched_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const edm::EDGetTokenT< PixelTrackSoA > tokenSoATrackDevice_
MonitorElement * hphidiffMatched_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * book2I(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * hChi2VsEta_
MonitorElement * hquality_
const bool useQualityCut_