CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
SiPixelPhase1CompareVertexSoA Class Reference

#include <SiPixelPhase1CompareVertexSoA.cc>

Inheritance diagram for SiPixelPhase1CompareVertexSoA:

Public Types

using IndToEdm = std::vector< uint16_t >
 

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void bookHistograms (DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
 SiPixelPhase1CompareVertexSoA (const edm::ParameterSet &)
 
 ~SiPixelPhase1CompareVertexSoA () override=default
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const float dzCut_
 
MonitorElementhchi2_
 
MonitorElementhchi2oNdof_
 
MonitorElementhntrks_
 
MonitorElementhnVertex_
 
MonitorElementhptv2_
 
MonitorElementhx_
 
MonitorElementhxdiff_
 
MonitorElementhy_
 
MonitorElementhydiff_
 
MonitorElementhz_
 
MonitorElementhzdiff_
 
const edm::EDGetTokenT< reco::BeamSpottokenBeamSpot_
 
const edm::EDGetTokenT< ZVertexHeterogeneoustokenSoAVertexCPU_
 
const edm::EDGetTokenT< ZVertexHeterogeneoustokenSoAVertexGPU_
 
const std::string topFolderName_
 

Detailed Description

Definition at line 24 of file SiPixelPhase1CompareVertexSoA.cc.

Member Typedef Documentation

◆ IndToEdm

using SiPixelPhase1CompareVertexSoA::IndToEdm = std::vector<uint16_t>

Definition at line 26 of file SiPixelPhase1CompareVertexSoA.cc.

Constructor & Destructor Documentation

◆ SiPixelPhase1CompareVertexSoA()

SiPixelPhase1CompareVertexSoA::SiPixelPhase1CompareVertexSoA ( const edm::ParameterSet iConfig)
explicit

Definition at line 56 of file SiPixelPhase1CompareVertexSoA.cc.

57  : tokenSoAVertexCPU_(consumes<ZVertexHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelVertexSrcCPU"))),
58  tokenSoAVertexGPU_(consumes<ZVertexHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelVertexSrcGPU"))),
59  tokenBeamSpot_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotSrc"))),
60  topFolderName_(iConfig.getParameter<std::string>("topFolderName")),
61  dzCut_(iConfig.getParameter<double>("dzCut")) {}
const edm::EDGetTokenT< ZVertexHeterogeneous > tokenSoAVertexGPU_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< ZVertexHeterogeneous > tokenSoAVertexCPU_
const edm::EDGetTokenT< reco::BeamSpot > tokenBeamSpot_

◆ ~SiPixelPhase1CompareVertexSoA()

SiPixelPhase1CompareVertexSoA::~SiPixelPhase1CompareVertexSoA ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiPixelPhase1CompareVertexSoA::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 66 of file SiPixelPhase1CompareVertexSoA.cc.

References funct::abs(), cms::cuda::bs, dxdz, dydz, dzCut_, dqm::impl::MonitorElement::Fill(), hchi2_, hchi2oNdof_, hntrks_, hnVertex_, hptv2_, hx_, hxdiff_, hy_, hydiff_, hz_, hzdiff_, iEvent, notFound, or, MillePedeFileConverter_cfg::out, tokenBeamSpot_, tokenSoAVertexCPU_, tokenSoAVertexGPU_, and HLTMuonOfflineAnalyzer_cfi::z0.

66  {
67  const auto& vsoaHandleCPU = iEvent.getHandle(tokenSoAVertexCPU_);
68  const auto& vsoaHandleGPU = iEvent.getHandle(tokenSoAVertexGPU_);
69  if (not vsoaHandleCPU or not vsoaHandleGPU) {
70  edm::LogWarning out("SiPixelPhase1CompareTrackSoA");
71  if (not vsoaHandleCPU) {
72  out << "reference (cpu) tracks not found; ";
73  }
74  if (not vsoaHandleGPU) {
75  out << "target (gpu) tracks not found; ";
76  }
77  out << "the comparison will not run.";
78  return;
79  }
80 
81  auto const& vsoaCPU = *vsoaHandleCPU->get();
82  int nVerticesCPU = vsoaCPU.nvFinal;
83  auto const& vsoaGPU = *vsoaHandleGPU->get();
84  int nVerticesGPU = vsoaGPU.nvFinal;
85 
86  auto bsHandle = iEvent.getHandle(tokenBeamSpot_);
87  float x0 = 0., y0 = 0., z0 = 0., dxdz = 0., dydz = 0.;
88  if (!bsHandle.isValid()) {
89  edm::LogWarning("PixelVertexProducer") << "No beamspot found. returning vertexes with (0,0,Z) ";
90  } else {
91  const reco::BeamSpot& bs = *bsHandle;
92  x0 = bs.x0();
93  y0 = bs.y0();
94  z0 = bs.z0();
95  dxdz = bs.dxdz();
96  dydz = bs.dydz();
97  }
98 
99  for (int ivc = 0; ivc < nVerticesCPU; ivc++) {
100  auto sic = vsoaCPU.sortInd[ivc];
101  auto zc = vsoaCPU.zv[sic];
102  auto xc = x0 + dxdz * zc;
103  auto yc = y0 + dydz * zc;
104  zc += z0;
105 
106  auto ndofCPU = vsoaCPU.ndof[sic];
107  auto chi2CPU = vsoaCPU.chi2[sic];
108 
109  const int32_t notFound = -1;
110  int32_t closestVtxidx = notFound;
111  float mindz = dzCut_;
112 
113  for (int ivg = 0; ivg < nVerticesGPU; ivg++) {
114  auto sig = vsoaGPU.sortInd[ivg];
115  auto zgc = vsoaGPU.zv[sig] + z0;
116  auto zDist = std::abs(zc - zgc);
117  //insert some matching condition
118  if (zDist > dzCut_)
119  continue;
120  if (mindz > zDist) {
121  mindz = zDist;
122  closestVtxidx = sig;
123  }
124  }
125  if (closestVtxidx == notFound)
126  continue;
127 
128  auto zg = vsoaGPU.zv[closestVtxidx];
129  auto xg = x0 + dxdz * zg;
130  auto yg = y0 + dydz * zg;
131  zg += z0;
132  auto ndofGPU = vsoaGPU.ndof[closestVtxidx];
133  auto chi2GPU = vsoaGPU.chi2[closestVtxidx];
134 
135  hx_->Fill(xc - x0, xg - x0);
136  hy_->Fill(yc - y0, yg - y0);
137  hz_->Fill(zc, zg);
138  hxdiff_->Fill(xc - xg);
139  hydiff_->Fill(yc - yg);
140  hzdiff_->Fill(zc - zg);
141  hchi2_->Fill(chi2CPU, chi2GPU);
142  hchi2oNdof_->Fill(chi2CPU / ndofCPU, chi2GPU / ndofGPU);
143  hptv2_->Fill(vsoaCPU.ptv2[sic], vsoaGPU.ptv2[closestVtxidx]);
144  hntrks_->Fill(ndofCPU + 1, ndofGPU + 1);
145  }
146  hnVertex_->Fill(nVerticesCPU, nVerticesGPU);
147 }
float dydz
const edm::EDGetTokenT< ZVertexHeterogeneous > tokenSoAVertexGPU_
float dxdz
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
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
Definition: Activities.doc:12
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const GlobalPoint notFound(0, 0, 0)
const edm::EDGetTokenT< ZVertexHeterogeneous > tokenSoAVertexCPU_
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< reco::BeamSpot > tokenBeamSpot_

◆ bookHistograms()

void SiPixelPhase1CompareVertexSoA::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
override

Definition at line 152 of file SiPixelPhase1CompareVertexSoA.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2I(), dqm::implementation::NavigatorBase::cd(), hchi2_, hchi2oNdof_, hntrks_, hnVertex_, hptv2_, hx_, hxdiff_, hy_, hydiff_, hz_, hzdiff_, dqm::implementation::NavigatorBase::setCurrentFolder(), and topFolderName_.

154  {
155  ibooker.cd();
157 
158  // 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
159  // these should be moved to a less resource consuming format
160  hnVertex_ = ibooker.book2I("nVertex", "# of Vertex;CPU;GPU", 101, -0.5, 100.5, 101, -0.5, 100.5);
161  hx_ = ibooker.book2I("vx", "Vertez x - Beamspot x;CPU;GPU", 50, -0.1, 0.1, 50, -0.1, 0.1);
162  hy_ = ibooker.book2I("vy", "Vertez y - Beamspot y;CPU;GPU", 50, -0.1, 0.1, 50, -0.1, 0.1);
163  hz_ = ibooker.book2I("vz", "Vertez z;CPU;GPU", 30, -30., 30., 30, -30., 30.);
164  hchi2_ = ibooker.book2I("chi2", "Vertex chi-squared;CPU;GPU", 40, 0., 20., 40, 0., 20.);
165  hchi2oNdof_ = ibooker.book2I("chi2oNdof", "Vertex chi-squared/Ndof;CPU;GPU", 40, 0., 20., 40, 0., 20.);
166  hptv2_ = ibooker.book2I("ptsq", "Vertex p_T squared;CPU;GPU", 200, 0., 200., 200, 0., 200.);
167  hntrks_ = ibooker.book2I("ntrk", "#tracks associated;CPU;GPU", 100, -0.5, 99.5, 100, -0.5, 99.5);
168  hntrks_ = ibooker.book2I("ntrk", "#tracks associated;CPU;GPU", 100, -0.5, 99.5, 100, -0.5, 99.5);
169  hxdiff_ = ibooker.book1D("vxdiff", ";Vertex x difference (CPU - GPU);#entries", 100, -0.001, 0.001);
170  hydiff_ = ibooker.book1D("vydiff", ";Vertex y difference (CPU - GPU);#entries", 100, -0.001, 0.001);
171  hzdiff_ = ibooker.book1D("vzdiff", ";Vertex z difference (CPU - GPU);#entries", 100, -2.5, 2.5);
172 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * book2I(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:296

◆ fillDescriptions()

void SiPixelPhase1CompareVertexSoA::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 174 of file SiPixelPhase1CompareVertexSoA.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, HLT_2022v14_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

174  {
175  // monitorpixelVertexSoA
177  desc.add<edm::InputTag>("pixelVertexSrcCPU", edm::InputTag("pixelVerticesSoA@cpu"));
178  desc.add<edm::InputTag>("pixelVertexSrcGPU", edm::InputTag("pixelVerticesSoA@cuda"));
179  desc.add<edm::InputTag>("beamSpotSrc", edm::InputTag("offlineBeamSpot"));
180  desc.add<std::string>("topFolderName", "SiPixelHeterogeneous/PixelVertexCompareSoAGPUvsCPU");
181  desc.add<double>("dzCut", 1.);
182  descriptions.addWithDefaultLabel(desc);
183 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ dzCut_

const float SiPixelPhase1CompareVertexSoA::dzCut_
private

Definition at line 38 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze().

◆ hchi2_

MonitorElement* SiPixelPhase1CompareVertexSoA::hchi2_
private

Definition at line 43 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hchi2oNdof_

MonitorElement* SiPixelPhase1CompareVertexSoA::hchi2oNdof_
private

Definition at line 44 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hntrks_

MonitorElement* SiPixelPhase1CompareVertexSoA::hntrks_
private

Definition at line 46 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hnVertex_

MonitorElement* SiPixelPhase1CompareVertexSoA::hnVertex_
private

Definition at line 39 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hptv2_

MonitorElement* SiPixelPhase1CompareVertexSoA::hptv2_
private

Definition at line 45 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hx_

MonitorElement* SiPixelPhase1CompareVertexSoA::hx_
private

Definition at line 40 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hxdiff_

MonitorElement* SiPixelPhase1CompareVertexSoA::hxdiff_
private

Definition at line 47 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hy_

MonitorElement* SiPixelPhase1CompareVertexSoA::hy_
private

Definition at line 41 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hydiff_

MonitorElement* SiPixelPhase1CompareVertexSoA::hydiff_
private

Definition at line 48 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hz_

MonitorElement* SiPixelPhase1CompareVertexSoA::hz_
private

Definition at line 42 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hzdiff_

MonitorElement* SiPixelPhase1CompareVertexSoA::hzdiff_
private

Definition at line 49 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ tokenBeamSpot_

const edm::EDGetTokenT<reco::BeamSpot> SiPixelPhase1CompareVertexSoA::tokenBeamSpot_
private

Definition at line 36 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze().

◆ tokenSoAVertexCPU_

const edm::EDGetTokenT<ZVertexHeterogeneous> SiPixelPhase1CompareVertexSoA::tokenSoAVertexCPU_
private

Definition at line 34 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze().

◆ tokenSoAVertexGPU_

const edm::EDGetTokenT<ZVertexHeterogeneous> SiPixelPhase1CompareVertexSoA::tokenSoAVertexGPU_
private

Definition at line 35 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by analyze().

◆ topFolderName_

const std::string SiPixelPhase1CompareVertexSoA::topFolderName_
private

Definition at line 37 of file SiPixelPhase1CompareVertexSoA.cc.

Referenced by bookHistograms().