Skip to content

Commit

Permalink
simplify ntracks
Browse files Browse the repository at this point in the history
  • Loading branch information
sroychow committed Nov 19, 2021
1 parent 15b20da commit 5079789
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class SiPixelPhase1MonitorVertexSoA : public DQMEDAnalyzer {
private:
edm::EDGetTokenT<ZVertexHeterogeneous> tokenSoAVertex_;
edm::EDGetTokenT<reco::BeamSpot> tokenBeamSpot_;
edm::EDGetTokenT<IndToEdm> tokenTracks_;
std::string topFolderName_;
MonitorElement* hnVertex;
MonitorElement* hx;
Expand All @@ -54,7 +53,6 @@ class SiPixelPhase1MonitorVertexSoA : public DQMEDAnalyzer {
SiPixelPhase1MonitorVertexSoA::SiPixelPhase1MonitorVertexSoA(const edm::ParameterSet& iConfig) {
tokenSoAVertex_ = consumes<ZVertexHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelVertexSrc"));
tokenBeamSpot_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotSrc"));
tokenTracks_ = consumes<IndToEdm>(iConfig.getParameter<edm::InputTag>("pixelTrackSrc"));
topFolderName_ = iConfig.getParameter<std::string>("TopFolderName");
}

Expand All @@ -68,7 +66,6 @@ SiPixelPhase1MonitorVertexSoA::~SiPixelPhase1MonitorVertexSoA() {
void SiPixelPhase1MonitorVertexSoA::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
auto const& vsoa = *(iEvent.get(tokenSoAVertex_).get());
int nVertices = vsoa.nvFinal;
auto const& pixtrks = iEvent.get(tokenTracks_);
auto bsHandle = iEvent.getHandle(tokenBeamSpot_);
float x0 = 0., y0 = 0., z0 = 0., dxdz = 0., dydz = 0.;
if (!bsHandle.isValid()) {
Expand All @@ -82,21 +79,18 @@ void SiPixelPhase1MonitorVertexSoA::analyze(const edm::Event& iEvent, const edm:
dydz = bs.dydz();
}
for (int iv = 0; iv < nVertices; iv++) {
auto z = vsoa.zv[iv];
auto si = vsoa.sortInd[iv];
auto z = vsoa.zv[si];
auto x = x0 + dxdz * z;
auto y = y0 + dydz * z;
z += z0;
hx->Fill(x);
hy->Fill(y);
hz->Fill(z);
hchi2->Fill(vsoa.chi2[iv]);
hptv2->Fill(vsoa.ptv2[iv]);
unsigned int ntk = 0;
for (auto k = 0U; k < pixtrks.size(); ++k) {
if (vsoa.idv[k] == int16_t(vsoa.sortInd[iv]))
ntk++;
}
hntrks->Fill(ntk);
auto ndof = vsoa.ndof[si];
hchi2->Fill(vsoa.chi2[si] / ndof);
hptv2->Fill(vsoa.ptv2[si]);
hntrks->Fill(ndof + 1);
}
hnVertex->Fill(nVertices);
}
Expand All @@ -123,7 +117,6 @@ void SiPixelPhase1MonitorVertexSoA::fillDescriptions(edm::ConfigurationDescripti
// monitorpixelVertexSoA
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("pixelVertexSrc", edm::InputTag("pixelVerticesSoA"));
desc.add<edm::InputTag>("pixelTrackSrc", edm::InputTag("pixelTracks"));
desc.add<edm::InputTag>("beamSpotSrc", edm::InputTag("offlineBeamSpot"));
desc.add<std::string>("TopFolderName", "SiPixelHeterogeneous/PixelVertexSoA");
descriptions.addWithDefaultLabel(desc);
Expand Down

0 comments on commit 5079789

Please sign in to comment.