25 #include <fmt/printf.h> 32 void setBinLog(TAxis* axis) {
33 int bins = axis->GetNbins();
34 float from = axis->GetXmin();
35 float to = axis->GetXmax();
37 std::vector<float> new_bins(
bins + 1, 0);
38 for (
int i = 0;
i <=
bins;
i++) {
39 new_bins[
i] = TMath::Power(10, from +
i *
width);
41 axis->Set(
bins, new_bins.data());
44 void setBinLogX(TH1*
h) {
45 TAxis* axis =
h->GetXaxis();
48 void setBinLogY(TH1*
h) {
49 TAxis* axis =
h->GetYaxis();
53 template <
typename...
Args>
55 auto h = std::make_unique<TH2F>(std::forward<Args>(
args)...);
60 const auto&
name =
h->GetName();
61 return ibook.book2D(
name,
h.release());
118 topFolderName_(iConfig.getParameter<
std::
string>(
"topFolderName")),
119 useQualityCut_(iConfig.getParameter<
bool>(
"useQualityCut")),
121 dr2cut_(iConfig.getParameter<double>(
"deltaR2cut")) {}
129 if (not tsoaHandleCPU
or not tsoaHandleGPU) {
131 if (not tsoaHandleCPU) {
132 out <<
"reference (cpu) tracks not found; ";
134 if (not tsoaHandleGPU) {
135 out <<
"target (gpu) tracks not found; ";
137 out <<
"the comparison will not run.";
141 auto const& tsoaCPU = *tsoaHandleCPU->get();
142 auto const& tsoaGPU = *tsoaHandleGPU->get();
143 auto maxTracksCPU = tsoaCPU.stride();
144 auto maxTracksGPU = tsoaGPU.stride();
145 auto const* qualityCPU = tsoaCPU.qualityData();
146 auto const* qualityGPU = tsoaGPU.qualityData();
147 int32_t nTracksCPU = 0;
148 int32_t nTracksGPU = 0;
149 int32_t nLooseAndAboveTracksCPU = 0;
150 int32_t nLooseAndAboveTracksCPU_matchedGPU = 0;
151 int32_t nLooseAndAboveTracksGPU = 0;
154 std::vector<int32_t> looseTrkidxGPU;
155 for (int32_t jt = 0; jt < maxTracksGPU; ++jt) {
156 if (tsoaGPU.nHits(jt) == 0)
158 if (!(tsoaGPU.pt(jt) > 0.))
163 nLooseAndAboveTracksGPU++;
164 looseTrkidxGPU.emplace_back(jt);
168 for (int32_t it = 0; it < maxTracksCPU; ++it) {
169 if (tsoaCPU.nHits(it) == 0)
171 if (!(tsoaCPU.pt(it) > 0.))
176 nLooseAndAboveTracksCPU++;
181 float etacpu = tsoaCPU.eta(it);
182 float phicpu = tsoaCPU.phi(it);
183 for (
auto gid : looseTrkidxGPU) {
184 float etagpu = tsoaGPU.eta(gid);
185 float phigpu = tsoaGPU.phi(gid);
199 nLooseAndAboveTracksCPU_matchedGPU++;
201 hchi2_->
Fill(tsoaCPU.chi2(it), tsoaGPU.chi2(closestTkidx));
202 hnHits_->
Fill(tsoaCPU.nHits(it), tsoaGPU.nHits(closestTkidx));
203 hnLayers_->
Fill(tsoaCPU.nLayers(it), tsoaGPU.nLayers(closestTkidx));
204 hpt_->
Fill(tsoaCPU.pt(it), tsoaGPU.pt(closestTkidx));
206 heta_->
Fill(etacpu, tsoaGPU.eta(closestTkidx));
207 hphi_->
Fill(phicpu, tsoaGPU.phi(closestTkidx));
208 hz_->
Fill(tsoaCPU.zip(it), tsoaGPU.zip(closestTkidx));
209 htip_->
Fill(tsoaCPU.tip(it), tsoaGPU.tip(closestTkidx));
235 hnTracks_ = iBook.
book2D(
"nTracks", fmt::sprintf(
"%s per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5);
236 hnLooseAndAboveTracks_ = iBook.
book2D(
"nLooseAndAboveTracks", fmt::sprintf(
"%s (quality #geq loose) per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5);
237 hnLooseAndAboveTracks_matched_ = iBook.
book2D(
"nLooseAndAboveTracks_matched", fmt::sprintf(
"%s (quality #geq loose) per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5);
239 toRep =
"Number of all RecHits per track (quality #geq loose)";
240 hnHits_ = iBook.
book2D(
"nRecHits", fmt::sprintf(
"%s;CPU;GPU",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5);
242 toRep =
"Number of all layers per track (quality #geq loose)";
243 hnLayers_ = iBook.
book2D(
"nLayers", fmt::sprintf(
"%s;CPU;GPU",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5);
245 toRep =
"Track (quality #geq loose) #chi^{2}/ndof";
246 hchi2_ = iBook.
book2D(
"nChi2ndof", fmt::sprintf(
"%s;CPU;GPU",toRep), 40, 0., 20., 40, 0., 20.);
248 hpt_ = iBook.
book2D(
"pt",
"Track (quality #geq loose) p_{T} [GeV];CPU;GPU", 200, 0., 200., 200, 0., 200.);
249 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.));
250 heta_ = iBook.
book2D(
"eta",
"Track (quality #geq loose) #eta;CPU;GPU", 30, -3., 3., 30, -3., 3.);
252 hz_ = iBook.
book2D(
"z",
"Track (quality #geq loose) z [cm];CPU;GPU", 30, -30., 30., 30, -30., 30.);
253 htip_ = iBook.
book2D(
"tip",
"Track (quality #geq loose) TIP [cm];CPU;GPU", 100, -0.5, 0.5, 100, -0.5, 0.5);
255 hptdiffMatched_ = iBook.
book1D(
"ptdiffmatched",
" p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 60, -30., 30.);
256 hetadiffMatched_ = iBook.
book1D(
"etadiffmatched",
" #eta diff between matched tracks; #Delta #eta", 160, -0.04 ,0.04);
257 hphidiffMatched_ = iBook.
book1D(
"phidiffmatched",
" #phi diff between matched tracks; #Delta #phi", 160, -0.04 ,0.04);
258 hzdiffMatched_ = iBook.
book1D(
"zdiffmatched",
" z diff between matched tracks; #Delta z [cm]", 300, -1.5, 1.5);
273 desc.add<
std::string>(
"topFolderName",
"SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU");
274 desc.add<
bool>(
"useQualityCut",
true);
276 desc.add<
double>(
"deltaR2cut", 0.04);
constexpr double deltaPhi(double phi1, double phi2)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
MonitorElement * hnHitsVsEta_
MonitorElement * hzdiffMatched_
MonitorElement * hnLayersVsPhi_
const std::string topFolderName_
virtual void setCurrentFolder(std::string const &fullpath)
Quality qualityByName(std::string const &name)
#define DEFINE_FWK_MODULE(type)
MonitorElement * hpt_eta_tkAllCPUMatched_
MonitorElement * hetadiffMatched_
const edm::EDGetTokenT< PixelTrackHeterogeneous > tokenSoATrackGPU_
MonitorElement * hnLooseAndAboveTracks_
const edm::EDGetTokenT< PixelTrackHeterogeneous > tokenSoATrackCPU_
dqm::reco::DQMStore DQMStore
MonitorElement * hpt_eta_tkAllCPU_
MonitorElement * hnLooseAndAboveTracks_matched_
const bool useQualityCut_
MonitorElement * hnLayers_
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
MonitorElement * hChi2VsEta_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
MonitorElement * hChi2VsPhi_
void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
MonitorElement * hphidiffMatched_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
MonitorElement * hptdiffMatched_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * hnLayersVsEta_
MonitorElement * hquality_
static const GlobalPoint notFound(0, 0, 0)
MonitorElement * hptLogLog_
~SiPixelPhase1CompareTrackSoA() override=default
MonitorElement * hphi_z_tkAllCPUMatched_
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
MonitorElement * hnHitsVsPhi_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
SiPixelPhase1CompareTrackSoA(const edm::ParameterSet &)
MonitorElement * hphi_z_tkAllCPU_
const pixelTrack::Quality minQuality_
MonitorElement * hnTracks_