CMS 3D CMS Logo

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

#include <SiPixelCompareVertices.cc>

Inheritance diagram for SiPixelCompareVertices:
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
 
template<typename U , typename V >
void analyzeSeparate (U tokenRef, V tokenTar, const edm::Event &iEvent)
 
void bookHistograms (DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
 SiPixelCompareVertices (const edm::ParameterSet &)
 
 ~SiPixelCompareVertices () 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< ZVertexHosttokenSoAVertexReferenceSoA_
 
const edm::EDGetTokenT< ZVertexHosttokenSoAVertexTargetSoA_
 
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 27 of file SiPixelCompareVertices.cc.

Member Typedef Documentation

◆ IndToEdm

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

Definition at line 29 of file SiPixelCompareVertices.cc.

Constructor & Destructor Documentation

◆ SiPixelCompareVertices()

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

Definition at line 64 of file SiPixelCompareVertices.cc.

66  consumes<ZVertexHost>(iConfig.getParameter<edm::InputTag>("pixelVertexReferenceSoA"))),
67  tokenSoAVertexTargetSoA_(consumes<ZVertexHost>(iConfig.getParameter<edm::InputTag>("pixelVertexTargetSoA"))),
68  tokenBeamSpot_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotSrc"))),
69  topFolderName_(iConfig.getParameter<std::string>("topFolderName")),
70  dzCut_(iConfig.getParameter<double>("dzCut")) {}
const std::string topFolderName_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< reco::BeamSpot > tokenBeamSpot_
const edm::EDGetTokenT< ZVertexHost > tokenSoAVertexTargetSoA_
const edm::EDGetTokenT< ZVertexHost > tokenSoAVertexReferenceSoA_

◆ ~SiPixelCompareVertices()

SiPixelCompareVertices::~SiPixelCompareVertices ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 160 of file SiPixelCompareVertices.cc.

References analyzeSeparate(), iEvent, tokenSoAVertexReferenceSoA_, and tokenSoAVertexTargetSoA_.

160  {
161  // The default use case is to use vertices from Alpaka reconstructed on CPU and GPU;
162  // The function is left templated if any other cases need to be added
164 }
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< ZVertexHost > tokenSoAVertexTargetSoA_
void analyzeSeparate(U tokenRef, V tokenTar, const edm::Event &iEvent)
const edm::EDGetTokenT< ZVertexHost > tokenSoAVertexReferenceSoA_

◆ analyzeSeparate()

template<typename U , typename V >
void SiPixelCompareVertices::analyzeSeparate ( tokenRef,
tokenTar,
const edm::Event iEvent 
)

Definition at line 73 of file SiPixelCompareVertices.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, PixelVertexMonitor_cff::ndof, notFound, or, MillePedeFileConverter_cfg::out, tokenBeamSpot_, and ppsFastLocalSimulation_cfi::z0.

Referenced by analyze().

73  {
74  const auto& vsoaHandleRef = iEvent.getHandle(tokenRef);
75  const auto& vsoaHandleTar = iEvent.getHandle(tokenTar);
76 
77  if (not vsoaHandleRef or not vsoaHandleTar) {
78  edm::LogWarning out("SiPixelCompareVertices");
79  if (not vsoaHandleRef) {
80  out << "reference vertices not found; ";
81  }
82  if (not vsoaHandleTar) {
83  out << "target vertices not found; ";
84  }
85  out << "the comparison will not run.";
86  return;
87  }
88 
89  auto const& vsoaRef = *vsoaHandleRef;
90  int nVerticesRef = vsoaRef.view().nvFinal();
91  auto const& vsoaTar = *vsoaHandleTar;
92  int nVerticesTar = vsoaTar.view().nvFinal();
93 
94  auto bsHandle = iEvent.getHandle(tokenBeamSpot_);
95  float x0 = 0., y0 = 0., z0 = 0., dxdz = 0., dydz = 0.;
96  if (not bsHandle.isValid()) {
97  edm::LogWarning("SiPixelCompareVertices") << "No beamspot found, returning vertexes with (0,0,Z).";
98  } else {
99  const reco::BeamSpot& bs = *bsHandle;
100  x0 = bs.x0();
101  y0 = bs.y0();
102  z0 = bs.z0();
103  dxdz = bs.dxdz();
104  dydz = bs.dydz();
105  }
106 
107  for (int ivc = 0; ivc < nVerticesRef; ivc++) {
108  auto sic = vsoaRef.view()[ivc].sortInd();
109  auto zc = vsoaRef.view()[sic].zv();
110  auto xc = x0 + dxdz * zc;
111  auto yc = y0 + dydz * zc;
112  zc += z0;
113 
114  auto ndofRef = vsoaRef.template view<reco::ZVertexTracksSoA>()[sic].ndof();
115  auto chi2Ref = vsoaRef.view()[sic].chi2();
116 
117  const int32_t notFound = -1;
118  int32_t closestVtxidx = notFound;
119  float mindz = dzCut_;
120 
121  for (int ivg = 0; ivg < nVerticesTar; ivg++) {
122  auto sig = vsoaTar.view()[ivg].sortInd();
123  auto zgc = vsoaTar.view()[sig].zv() + z0;
124  auto zDist = std::abs(zc - zgc);
125  //insert some matching condition
126  if (zDist > dzCut_)
127  continue;
128  if (mindz > zDist) {
129  mindz = zDist;
130  closestVtxidx = sig;
131  }
132  }
133  if (closestVtxidx == notFound)
134  continue;
135 
136  auto zg = vsoaTar.view()[closestVtxidx].zv();
137  auto xg = x0 + dxdz * zg;
138  auto yg = y0 + dydz * zg;
139  zg += z0;
140  auto ndofTar = vsoaTar.template view<reco::ZVertexTracksSoA>()[closestVtxidx].ndof();
141  auto chi2Tar = vsoaTar.view()[closestVtxidx].chi2();
142 
143  hx_->Fill(xc - x0, xg - x0);
144  hy_->Fill(yc - y0, yg - y0);
145  hz_->Fill(zc, zg);
146  hxdiff_->Fill(xc - xg);
147  hydiff_->Fill(yc - yg);
148  hzdiff_->Fill(zc - zg);
149  hchi2_->Fill(chi2Ref, chi2Tar);
150  hchi2oNdof_->Fill(chi2Ref / ndofRef, chi2Tar / ndofTar);
151  hptv2_->Fill(vsoaRef.view()[sic].ptv2(), vsoaTar.view()[closestVtxidx].ptv2());
152  hntrks_->Fill(ndofRef + 1, ndofTar + 1);
153  }
154  hnVertex_->Fill(nVerticesRef, nVerticesTar);
155 }
float dydz
float dxdz
const edm::EDGetTokenT< reco::BeamSpot > tokenBeamSpot_
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

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 169 of file SiPixelCompareVertices.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_.

171  {
172  ibooker.cd();
174 
175  // 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
176  // these should be moved to a less resource consuming format
177  hnVertex_ = ibooker.book2I("nVertex", "# of Vertices;Reference;Target", 101, -0.5, 100.5, 101, -0.5, 100.5);
178  hx_ = ibooker.book2I("vx", "Vertez x - Beamspot x;Reference;Target", 50, -0.1, 0.1, 50, -0.1, 0.1);
179  hy_ = ibooker.book2I("vy", "Vertez y - Beamspot y;Reference;Target", 50, -0.1, 0.1, 50, -0.1, 0.1);
180  hz_ = ibooker.book2I("vz", "Vertez z;Reference;Target", 30, -30., 30., 30, -30., 30.);
181  hchi2_ = ibooker.book2I("chi2", "Vertex chi-squared;Reference;Target", 40, 0., 20., 40, 0., 20.);
182  hchi2oNdof_ = ibooker.book2I("chi2oNdof", "Vertex chi-squared/Ndof;Reference;Target", 40, 0., 20., 40, 0., 20.);
183  hptv2_ = ibooker.book2I("ptsq", "Vertex #sum (p_{T})^{2};Reference;Target", 200, 0., 200., 200, 0., 200.);
184  hntrks_ = ibooker.book2I("ntrk", "#tracks associated;Reference;Target", 100, -0.5, 99.5, 100, -0.5, 99.5);
185  hntrks_ = ibooker.book2I("ntrk", "#tracks associated;Reference;Target", 100, -0.5, 99.5, 100, -0.5, 99.5);
186  hxdiff_ = ibooker.book1D("vxdiff", ";Vertex x difference (Reference - Target);#entries", 100, -0.001, 0.001);
187  hydiff_ = ibooker.book1D("vydiff", ";Vertex y difference (Reference - Target);#entries", 100, -0.001, 0.001);
188  hzdiff_ = ibooker.book1D("vzdiff", ";Vertex z difference (Reference - Target);#entries", 100, -2.5, 2.5);
189 }
const std::string topFolderName_
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:305

◆ fillDescriptions()

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

Definition at line 191 of file SiPixelCompareVertices.cc.

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

191  {
192  // monitorpixelVertexSoA
194  desc.add<edm::InputTag>("pixelVertexReferenceSoA", edm::InputTag("pixelVerticesAlpakaSerial"));
195  desc.add<edm::InputTag>("pixelVertexTargetSoA", edm::InputTag("pixelVerticesAlpaka"));
196  desc.add<edm::InputTag>("beamSpotSrc", edm::InputTag("offlineBeamSpot"));
197  desc.add<std::string>("topFolderName", "SiPixelHeterogeneous/PixelVertexCompareSoADeviceVSHost");
198  desc.add<double>("dzCut", 1.);
199  descriptions.addWithDefaultLabel(desc);
200 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ dzCut_

const float SiPixelCompareVertices::dzCut_
private

Definition at line 46 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate().

◆ hchi2_

MonitorElement* SiPixelCompareVertices::hchi2_
private

Definition at line 51 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hchi2oNdof_

MonitorElement* SiPixelCompareVertices::hchi2oNdof_
private

Definition at line 52 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hntrks_

MonitorElement* SiPixelCompareVertices::hntrks_
private

Definition at line 54 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hnVertex_

MonitorElement* SiPixelCompareVertices::hnVertex_
private

Definition at line 47 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hptv2_

MonitorElement* SiPixelCompareVertices::hptv2_
private

Definition at line 53 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hx_

MonitorElement* SiPixelCompareVertices::hx_
private

Definition at line 48 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hxdiff_

MonitorElement* SiPixelCompareVertices::hxdiff_
private

Definition at line 55 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hy_

MonitorElement* SiPixelCompareVertices::hy_
private

Definition at line 49 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hydiff_

MonitorElement* SiPixelCompareVertices::hydiff_
private

Definition at line 56 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hz_

MonitorElement* SiPixelCompareVertices::hz_
private

Definition at line 50 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ hzdiff_

MonitorElement* SiPixelCompareVertices::hzdiff_
private

Definition at line 57 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate(), and bookHistograms().

◆ tokenBeamSpot_

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

Definition at line 44 of file SiPixelCompareVertices.cc.

Referenced by analyzeSeparate().

◆ tokenSoAVertexReferenceSoA_

const edm::EDGetTokenT<ZVertexHost> SiPixelCompareVertices::tokenSoAVertexReferenceSoA_
private

Definition at line 42 of file SiPixelCompareVertices.cc.

Referenced by analyze().

◆ tokenSoAVertexTargetSoA_

const edm::EDGetTokenT<ZVertexHost> SiPixelCompareVertices::tokenSoAVertexTargetSoA_
private

Definition at line 43 of file SiPixelCompareVertices.cc.

Referenced by analyze().

◆ topFolderName_

const std::string SiPixelCompareVertices::topFolderName_
private

Definition at line 45 of file SiPixelCompareVertices.cc.

Referenced by bookHistograms().