CMS 3D CMS Logo

SiPixelMonitorVertexSoAAlpaka.cc
Go to the documentation of this file.
1 // -*- C++ -*-
3 // Package: SiPixelMonitorVertexSoAAlpaka
4 // Class: SiPixelMonitorVertexSoAAlpaka
5 //
8 //
9 // Author: Suvankar Roy Chowdhury
10 //
20 // DQM Histograming
26 
28 public:
29  using IndToEdm = std::vector<uint16_t>;
31  ~SiPixelMonitorVertexSoAAlpaka() override = default;
32  void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override;
33  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
34  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
35 
36 private:
48 };
49 
50 //
51 // constructors
52 //
53 
55  : tokenSoAVertex_(consumes<ZVertexHost>(iConfig.getParameter<edm::InputTag>("pixelVertexSrc"))),
56  tokenBeamSpot_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotSrc"))),
57  topFolderName_(iConfig.getParameter<std::string>("topFolderName")) {}
58 
59 //
60 // -- Analyze
61 //
63  const auto& vsoaHandle = iEvent.getHandle(tokenSoAVertex_);
64  if (!vsoaHandle.isValid()) {
65  edm::LogWarning("SiPixelMonitorVertexSoAAlpaka") << "No Vertex SoA found \n returning!" << std::endl;
66  return;
67  }
68 
69  auto const& vsoa = *vsoaHandle;
70  auto vtx_view = vsoa.view<reco::ZVertexSoA>();
71  auto trk_view = vsoa.view<reco::ZVertexTracksSoA>();
72  int nVertices = vtx_view.nvFinal();
73  auto bsHandle = iEvent.getHandle(tokenBeamSpot_);
74  float x0 = 0., y0 = 0., z0 = 0., dxdz = 0., dydz = 0.;
75  if (!bsHandle.isValid()) {
76  edm::LogWarning("SiPixelMonitorVertexSoAAlpaka") << "No beamspot found. returning vertexes with (0,0,Z) ";
77  } else {
78  const reco::BeamSpot& bs = *bsHandle;
79  x0 = bs.x0();
80  y0 = bs.y0();
81  z0 = bs.z0();
82  dxdz = bs.dxdz();
83  dydz = bs.dydz();
84  }
85 
86  for (int iv = 0; iv < nVertices; iv++) {
87  auto si = vtx_view[iv].sortInd();
88  auto z = vtx_view[si].zv();
89  auto x = x0 + dxdz * z;
90  auto y = y0 + dydz * z;
91 
92  z += z0;
93  hx->Fill(x);
94  hy->Fill(y);
95  hz->Fill(z);
96  auto ndof = trk_view[si].ndof();
97  hchi2->Fill(vtx_view[si].chi2());
98  hchi2oNdof->Fill(vtx_view[si].chi2() / ndof);
99  hptv2->Fill(vtx_view[si].ptv2());
100  hntrks->Fill(ndof + 1);
101  }
103 }
104 
105 //
106 // -- Book Histograms
107 //
109  edm::Run const& iRun,
110  edm::EventSetup const& iSetup) {
111  //std::string top_folder = ""//
112  ibooker.cd();
114  hnVertex = ibooker.book1D("nVertex", ";# of Vertices;#entries", 101, -0.5, 100.5);
115  hx = ibooker.book1D("vx", ";Vertex x;#entries", 10, -5., 5.);
116  hy = ibooker.book1D("vy", ";Vertex y;#entries", 10, -5., 5.);
117  hz = ibooker.book1D("vz", ";Vertex z;#entries", 30, -30., 30);
118  hchi2 = ibooker.book1D("chi2", ";Vertex chi-squared;#entries", 40, 0., 20.);
119  hchi2oNdof = ibooker.book1D("chi2oNdof", ";Vertex chi-squared/Ndof;#entries", 40, 0., 20.);
120  hptv2 = ibooker.book1D("ptsq", ";Vertex #sum (p_{T})^{2};#entries", 200, 0., 200.);
121  hntrks = ibooker.book1D("ntrk", ";#tracks associated;#entries", 100, -0.5, 99.5);
122 }
123 
125  // monitorpixelVertexSoA
127  desc.add<edm::InputTag>("pixelVertexSrc", edm::InputTag("pixelVerticesAlpaka"));
128  desc.add<edm::InputTag>("beamSpotSrc", edm::InputTag("offlineBeamSpot"));
129  desc.add<std::string>("topFolderName", "SiPixelHeterogeneous/PixelVertexAlpaka");
130  descriptions.addWithDefaultLabel(desc);
131 }
132 
float dydz
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::BeamSpot > tokenBeamSpot_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
float dxdz
float *__restrict__ ptv2
Definition: gpuSortByPt2.h:26
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
SiPixelMonitorVertexSoAAlpaka(const edm::ParameterSet &)
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
fixed size matrix
HLT enums.
const edm::EDGetTokenT< ZVertexHost > tokenSoAVertex_
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
~SiPixelMonitorVertexSoAAlpaka() override=default
Definition: Run.h:45