CMS 3D CMS Logo

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

#include <SiPixelCompareVertexSoA.cc>

Inheritance diagram for SiPixelCompareVertexSoA:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Types

using IndToEdm = std::vector< uint16_t >
 
- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

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
 
 SiPixelCompareVertexSoA (const edm::ParameterSet &)
 
 ~SiPixelCompareVertexSoA () override=default
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 

Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 24 of file SiPixelCompareVertexSoA.cc.

Member Typedef Documentation

◆ IndToEdm

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

Definition at line 26 of file SiPixelCompareVertexSoA.cc.

Constructor & Destructor Documentation

◆ SiPixelCompareVertexSoA()

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

Definition at line 57 of file SiPixelCompareVertexSoA.cc.

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

◆ ~SiPixelCompareVertexSoA()

SiPixelCompareVertexSoA::~SiPixelCompareVertexSoA ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiPixelCompareVertexSoA::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 67 of file SiPixelCompareVertexSoA.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.

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

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 153 of file SiPixelCompareVertexSoA.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_.

155  {
156  ibooker.cd();
158 
159  // 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
160  // these should be moved to a less resource consuming format
161  hnVertex_ = ibooker.book2I("nVertex", "# of Vertices;CPU;GPU", 101, -0.5, 100.5, 101, -0.5, 100.5);
162  hx_ = ibooker.book2I("vx", "Vertez x - Beamspot x;CPU;GPU", 50, -0.1, 0.1, 50, -0.1, 0.1);
163  hy_ = ibooker.book2I("vy", "Vertez y - Beamspot y;CPU;GPU", 50, -0.1, 0.1, 50, -0.1, 0.1);
164  hz_ = ibooker.book2I("vz", "Vertez z;CPU;GPU", 30, -30., 30., 30, -30., 30.);
165  hchi2_ = ibooker.book2I("chi2", "Vertex chi-squared;CPU;GPU", 40, 0., 20., 40, 0., 20.);
166  hchi2oNdof_ = ibooker.book2I("chi2oNdof", "Vertex chi-squared/Ndof;CPU;GPU", 40, 0., 20., 40, 0., 20.);
167  hptv2_ = ibooker.book2I("ptsq", "Vertex #sum (p_{T})^{2};CPU;GPU", 200, 0., 200., 200, 0., 200.);
168  hntrks_ = ibooker.book2I("ntrk", "#tracks associated;CPU;GPU", 100, -0.5, 99.5, 100, -0.5, 99.5);
169  hntrks_ = ibooker.book2I("ntrk", "#tracks associated;CPU;GPU", 100, -0.5, 99.5, 100, -0.5, 99.5);
170  hxdiff_ = ibooker.book1D("vxdiff", ";Vertex x difference (CPU - GPU);#entries", 100, -0.001, 0.001);
171  hydiff_ = ibooker.book1D("vydiff", ";Vertex y difference (CPU - GPU);#entries", 100, -0.001, 0.001);
172  hzdiff_ = ibooker.book1D("vzdiff", ";Vertex z difference (CPU - GPU);#entries", 100, -2.5, 2.5);
173 }
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 SiPixelCompareVertexSoA::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 175 of file SiPixelCompareVertexSoA.cc.

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

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

Member Data Documentation

◆ dzCut_

const float SiPixelCompareVertexSoA::dzCut_
private

Definition at line 38 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze().

◆ hchi2_

MonitorElement* SiPixelCompareVertexSoA::hchi2_
private

Definition at line 43 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hchi2oNdof_

MonitorElement* SiPixelCompareVertexSoA::hchi2oNdof_
private

Definition at line 44 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hntrks_

MonitorElement* SiPixelCompareVertexSoA::hntrks_
private

Definition at line 46 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hnVertex_

MonitorElement* SiPixelCompareVertexSoA::hnVertex_
private

Definition at line 39 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hptv2_

MonitorElement* SiPixelCompareVertexSoA::hptv2_
private

Definition at line 45 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hx_

MonitorElement* SiPixelCompareVertexSoA::hx_
private

Definition at line 40 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hxdiff_

MonitorElement* SiPixelCompareVertexSoA::hxdiff_
private

Definition at line 47 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hy_

MonitorElement* SiPixelCompareVertexSoA::hy_
private

Definition at line 41 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hydiff_

MonitorElement* SiPixelCompareVertexSoA::hydiff_
private

Definition at line 48 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hz_

MonitorElement* SiPixelCompareVertexSoA::hz_
private

Definition at line 42 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ hzdiff_

MonitorElement* SiPixelCompareVertexSoA::hzdiff_
private

Definition at line 49 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze(), and bookHistograms().

◆ tokenBeamSpot_

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

Definition at line 36 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze().

◆ tokenSoAVertexCPU_

const edm::EDGetTokenT<ZVertexSoAHost> SiPixelCompareVertexSoA::tokenSoAVertexCPU_
private

Definition at line 34 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze().

◆ tokenSoAVertexGPU_

const edm::EDGetTokenT<ZVertexSoAHost> SiPixelCompareVertexSoA::tokenSoAVertexGPU_
private

Definition at line 35 of file SiPixelCompareVertexSoA.cc.

Referenced by analyze().

◆ topFolderName_

const std::string SiPixelCompareVertexSoA::topFolderName_
private

Definition at line 37 of file SiPixelCompareVertexSoA.cc.

Referenced by bookHistograms().