Skip to content

Commit

Permalink
add plot for ntracks associated
Browse files Browse the repository at this point in the history
  • Loading branch information
sroychow committed Nov 19, 2021
1 parent 40300f0 commit 15b20da
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

class SiPixelPhase1MonitorVertexSoA : public DQMEDAnalyzer {
public:
using IndToEdm = std::vector<uint16_t>;
explicit SiPixelPhase1MonitorVertexSoA(const edm::ParameterSet&);
~SiPixelPhase1MonitorVertexSoA() override;
void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override;
Expand All @@ -35,13 +36,15 @@ 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;
MonitorElement* hy;
MonitorElement* hz;
MonitorElement* hchi2;
MonitorElement* hptv2;
MonitorElement* hntrks;
};

//
Expand All @@ -51,6 +54,7 @@ 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 @@ -64,6 +68,7 @@ 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 @@ -84,9 +89,14 @@ void SiPixelPhase1MonitorVertexSoA::analyze(const edm::Event& iEvent, const edm:
hx->Fill(x);
hy->Fill(y);
hz->Fill(z);
if (vsoa.ndof[iv] != 0)
hchi2->Fill(vsoa.chi2[iv] / vsoa.ndof[iv]);
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);
}
hnVertex->Fill(nVertices);
}
Expand All @@ -104,14 +114,16 @@ void SiPixelPhase1MonitorVertexSoA::bookHistograms(DQMStore::IBooker& ibooker,
hx = ibooker.book1D("vx", ";Vertez x;#entries", 10, -5., 5.);
hy = ibooker.book1D("vy", ";Vertez y;#entries", 10, -5., 5.);
hz = ibooker.book1D("vz", ";Vertez z;#entries", 30, -30., 30);
hchi2 = ibooker.book1D("chi2", ";Vertex chi-squared over ndof;#entries", 40, 0., 20.);
hchi2 = ibooker.book1D("chi2", ";Vertex chi-squared;#entries", 40, 0., 20.);
hptv2 = ibooker.book1D("ptsq", ";Vertex p_T squared;#entries", 200, 0., 200.);
hntrks = ibooker.book1D("ntrk", ";#tracks associated;#entries", 100, -0.5, 99.5);
}

void SiPixelPhase1MonitorVertexSoA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
// 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 15b20da

Please sign in to comment.