-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
302 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<use name="DQMServices/Core"/> | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="FWCore/ServiceRegistry"/> | ||
<use name="FWCore/Utilities"/> | ||
<use name="DataFormats/Common"/> | ||
<use name="CUDADataFormats/Common"/> | ||
<use name="CUDADataFormats/SiPixelCluster"/> | ||
<use name="CUDADataFormats/Track"/> | ||
<use name="CUDADataFormats/Vertex"/> | ||
<use name="DataFormats/SiPixelDigi"/> | ||
<use name="DataFormats/BeamSpot"/> | ||
<flags EDM_PLUGIN="1"/> |
128 changes: 128 additions & 0 deletions
128
DQM/SiPixelPhase1Heterogeneous/plugins/SiPixelPhase1MonitorTrackSoA.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// -*- C++ -*- | ||
///bookLayer | ||
// Package: SiPixelPhase1MonitorTrackSoA | ||
// Class: SiPixelPhase1MonitorTrackSoA | ||
// | ||
/**\class SiPixelPhase1MonitorTrackSoA SiPixelPhase1MonitorTrackSoA.cc | ||
*/ | ||
// | ||
// Author: Suvankar Roy Chowdhury | ||
// | ||
#include <memory> | ||
#include<math.h> | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Framework/interface/ESWatcher.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
// DQM Histograming | ||
#include "DQMServices/Core/interface/MonitorElement.h" | ||
#include "DQMServices/Core/interface/DQMEDAnalyzer.h" | ||
#include "DQMServices/Core/interface/DQMStore.h" | ||
#include "CUDADataFormats/Track/interface/PixelTrackHeterogeneous.h" | ||
#include "CUDADataFormats/Common/interface/HostProduct.h" | ||
#include "CUDADataFormats/SiPixelCluster/interface/gpuClusteringConstants.h" | ||
#include "CUDADataFormats/Common/interface/HostProduct.h" | ||
|
||
class SiPixelPhase1MonitorTrackSoA : public DQMEDAnalyzer { | ||
public: | ||
explicit SiPixelPhase1MonitorTrackSoA(const edm::ParameterSet&); | ||
~SiPixelPhase1MonitorTrackSoA() override; | ||
void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override; | ||
void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override; | ||
//static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
||
private: | ||
edm::EDGetTokenT<PixelTrackHeterogeneous> tokenSoATrack_; | ||
std::string topFolderName_; | ||
MonitorElement* hnTracks; | ||
MonitorElement* hnHits; | ||
MonitorElement* hchi2; | ||
MonitorElement* hpt; | ||
MonitorElement* heta; | ||
MonitorElement* hphi; | ||
MonitorElement* hz; | ||
}; | ||
|
||
// | ||
// constructors | ||
// | ||
|
||
SiPixelPhase1MonitorTrackSoA::SiPixelPhase1MonitorTrackSoA(const edm::ParameterSet& iConfig) { | ||
tokenSoATrack_ = consumes<PixelTrackHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelTrackSrc")); | ||
topFolderName_ = iConfig.getParameter<std::string>("TopFolderName");//"SiPixelHeterogeneous/PixelTrackSoA"; | ||
} | ||
|
||
SiPixelPhase1MonitorTrackSoA::~SiPixelPhase1MonitorTrackSoA() { | ||
// do anything here that needs to be done at desctruction time | ||
// (e.g. close files, deallocate resources etc.) | ||
edm::LogInfo("SiPixelPhase1MonitorTrackSoA") << ">>> Destroy SiPixelPhase1MonitorTrackSoA "; | ||
} | ||
|
||
// -- Analyze | ||
// | ||
void SiPixelPhase1MonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { | ||
auto const& tsoa = *iEvent.get(tokenSoATrack_); | ||
auto maxTracks = tsoa.stride(); | ||
//for future if we need to cut on quality | ||
//auto const *quality = tsoa.qualityData(); | ||
//auto const &fit = tsoa.stateAtBS; | ||
//auto const &hitIndices = tsoa.hitIndices; | ||
|
||
int32_t nTracks=0; | ||
for (int32_t it = 0; it < maxTracks; ++it) { | ||
auto nHits = tsoa.nHits(it); | ||
if (nHits == 0) | ||
break; // this is a guard | ||
float pt = tsoa.pt(it); | ||
if(!(pt > 0.)) continue; | ||
float chi2 = tsoa.chi2(it); | ||
float phi = tsoa.phi(it); | ||
float zip = tsoa.zip(it); | ||
float eta = tsoa.eta(it); | ||
std::cout << "Track chi2, pt, phi, z, eta:" | ||
<< chi2 << "\t" | ||
<< pt << "\t" | ||
<< phi << "\t" | ||
<< zip << "\t" | ||
<< eta << "\t" | ||
<< std::endl; | ||
hchi2->Fill(chi2); | ||
hnHits->Fill(nHits); | ||
hpt->Fill(pt); | ||
heta->Fill(eta); | ||
hphi->Fill(phi); | ||
hz->Fill(zip); | ||
nTracks++; | ||
} | ||
std::cout << "Number of SoA tracks>>>" << nTracks << std::endl; | ||
hnTracks->Fill(nTracks); | ||
} | ||
|
||
|
||
// | ||
// -- Book Histograms | ||
// | ||
void SiPixelPhase1MonitorTrackSoA::bookHistograms(DQMStore::IBooker& ibooker, | ||
edm::Run const& iRun, | ||
edm::EventSetup const& iSetup) { | ||
//std::string top_folder = ""// | ||
ibooker.cd(); | ||
ibooker.setCurrentFolder(topFolderName_); | ||
hnTracks = ibooker.book1D("nTracks", ";Number of tracks per event;#entries", 1001, -0.5, 1000.5); | ||
hnHits = ibooker.book1D("nRecHits", ";Number of all RecHits per track;#entries", 41, -0.5, 40.5); | ||
hchi2 = ibooker.book1D("nChi2ndof", ";Track chi-squared over ndof;#entries", 40, 0., 20.); | ||
hpt = ibooker.book1D("pt", ";Track p_T;#entries", 200, 0., 200.); | ||
heta = ibooker.book1D("eta", ";Track #eta;#entries", 30, -3., 3.); | ||
hphi = ibooker.book1D("phi", ";Track #phi;#entries", 30, -M_PI, M_PI); | ||
hz = ibooker.book1D("z", ";Track z;#entries", 30, -30., 30); | ||
} | ||
|
||
//void SiPixelPhase1MonitorTrackSoA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
//} | ||
DEFINE_FWK_MODULE(SiPixelPhase1MonitorTrackSoA); |
120 changes: 120 additions & 0 deletions
120
DQM/SiPixelPhase1Heterogeneous/plugins/SiPixelPhase1MonitorVertexSoA.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// -*- C++ -*- | ||
///bookLayer | ||
// Package: SiPixelPhase1MonitorVertexSoA | ||
// Class: SiPixelPhase1MonitorVertexSoA | ||
// | ||
/**\class SiPixelPhase1MonitorVertexSoA SiPixelPhase1MonitorVertexSoA.cc | ||
*/ | ||
// | ||
// Author: Suvankar Roy Chowdhury | ||
// | ||
#include <memory> | ||
#include "FWCore/Framework/interface/Frameworkfwd.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Framework/interface/ESWatcher.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "DataFormats/Common/interface/Handle.h" | ||
// DQM Histograming | ||
#include "DQMServices/Core/interface/MonitorElement.h" | ||
#include "DQMServices/Core/interface/DQMEDAnalyzer.h" | ||
#include "DQMServices/Core/interface/DQMStore.h" | ||
#include "CUDADataFormats/Vertex/interface/ZVertexHeterogeneous.h" | ||
#include "CUDADataFormats/Common/interface/HostProduct.h" | ||
#include "CUDADataFormats/Common/interface/HostProduct.h" | ||
#include "DataFormats/BeamSpot/interface/BeamSpot.h" | ||
|
||
class SiPixelPhase1MonitorVertexSoA : public DQMEDAnalyzer { | ||
public: | ||
explicit SiPixelPhase1MonitorVertexSoA(const edm::ParameterSet&); | ||
~SiPixelPhase1MonitorVertexSoA() override; | ||
void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) override; | ||
void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override; | ||
//static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); | ||
|
||
private: | ||
edm::EDGetTokenT<ZVertexHeterogeneous> tokenSoAVertex_; | ||
edm::EDGetTokenT<reco::BeamSpot> tokenBeamSpot_; | ||
std::string topFolderName_; | ||
MonitorElement* hnVertex; | ||
MonitorElement* hx; | ||
MonitorElement* hy; | ||
MonitorElement* hz; | ||
MonitorElement* hchi2; | ||
MonitorElement* hptv2; | ||
}; | ||
|
||
// | ||
// constructors | ||
// | ||
|
||
SiPixelPhase1MonitorVertexSoA::SiPixelPhase1MonitorVertexSoA(const edm::ParameterSet& iConfig) { | ||
tokenSoAVertex_ = consumes<ZVertexHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelVertexSrc")); | ||
tokenBeamSpot_ = consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpotSrc")); | ||
topFolderName_ = iConfig.getParameter<std::string>("TopFolderName"); | ||
} | ||
|
||
SiPixelPhase1MonitorVertexSoA::~SiPixelPhase1MonitorVertexSoA() { | ||
// do anything here that needs to be done at desctruction time | ||
// (e.g. close files, deallocate resources etc.) | ||
edm::LogInfo("SiPixelPhase1MonitorVertexSoA") << ">>> Destroy SiPixelPhase1MonitorVertexSoA "; | ||
} | ||
|
||
// -- Analyze | ||
// | ||
void SiPixelPhase1MonitorVertexSoA::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { | ||
auto const &vsoa = *(iEvent.get(tokenSoAVertex_).get()); | ||
int nVertices = vsoa.nvFinal; | ||
std::cout << "nVertices>>>>" << nVertices << std::endl; | ||
auto bsHandle = iEvent.getHandle(tokenBeamSpot_); | ||
float x0 = 0, y0 = 0, z0 = 0, dxdz = 0, dydz = 0; | ||
if (!bsHandle.isValid()) { | ||
edm::LogWarning("PixelVertexProducer") << "No beamspot found. returning vertexes with (0,0,Z) "; | ||
} else { | ||
const reco::BeamSpot &bs = *bsHandle; | ||
x0 = bs.x0(); | ||
y0 = bs.y0(); | ||
z0 = bs.z0(); | ||
dxdz = bs.dxdz(); | ||
dydz = bs.dydz(); | ||
} | ||
for(int iv = 0; iv < nVertices; iv++) { | ||
auto z = vsoa.zv[iv]; | ||
auto x = x0 + dxdz * z; | ||
auto y = y0 + dydz * z; | ||
z+=z0; | ||
hx->Fill(x); | ||
hy->Fill(y); | ||
hz->Fill(z); | ||
if(vsoa.ndof[iv] != 0) | ||
hchi2->Fill(vsoa.chi2[iv]/vsoa.ndof[iv]); | ||
hptv2->Fill(vsoa.ptv2[iv]); | ||
} | ||
hnVertex->Fill(nVertices); | ||
} | ||
|
||
|
||
// | ||
// -- Book Histograms | ||
// | ||
void SiPixelPhase1MonitorVertexSoA::bookHistograms(DQMStore::IBooker& ibooker, | ||
edm::Run const& iRun, | ||
edm::EventSetup const& iSetup) { | ||
//std::string top_folder = ""// | ||
ibooker.cd(); | ||
ibooker.setCurrentFolder(topFolderName_); | ||
hnVertex = ibooker.book1D("nVertex", ";# of Vertex;#entries", 201, -0.5, 200.5); | ||
hx = ibooker.book1D("vx", ";Vertez x;#entries", 30, -30., 30); | ||
hy = ibooker.book1D("vy", ";Vertez y;#entries", 30, -30., 30); | ||
hz = ibooker.book1D("vz", ";Vertez z;#entries", 30, -30., 30); | ||
hchi2 = ibooker.book1D("chi2", ";Vertex chi-squared over ndof;#entries", 40, 0., 20.); | ||
hptv2 = ibooker.book1D("ptsq", ";Vertex p_T squared;#entries", 200, 0., 200.); | ||
} | ||
|
||
//void SiPixelPhase1MonitorVertexSoA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { | ||
//} | ||
DEFINE_FWK_MODULE(SiPixelPhase1MonitorVertexSoA); |
27 changes: 27 additions & 0 deletions
27
DQM/SiPixelPhase1Heterogeneous/python/SiPixelPhase1MonitorTrackSoA_cfi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from Configuration.ProcessModifiers.gpu_cff import gpu | ||
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer | ||
|
||
|
||
monitorpixelTrackSoA = DQMEDAnalyzer('SiPixelPhase1MonitorTrackSoA', | ||
pixelTrackSrc = cms.InputTag("pixelTracksSoA@cpu"), | ||
TopFolderName = cms.string("SiPixelHeterogeneous/PixelTrackSoA"), | ||
) | ||
|
||
gpu.toModify(monitorpixelTrackSoA, | ||
pixelTrackSrc = cms.InputTag("pixelTracksSoA@cuda") | ||
) | ||
|
||
''' | ||
from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA | ||
monitorpixelTrackSoA = SwitchProducerCUDA( | ||
cpu = DQMEDAnalyzer('SiPixelPhase1MonitorTrackSoA', | ||
pixelTrackSrc = cms.InputTag("pixelTracksSoA@cpu"), | ||
TopFolderName = cms.string("SiPixelHeterogeneous/PixelTrackSoA"), | ||
), | ||
cuda = DQMEDAnalyzer('SiPixelPhase1MonitorTrackSoA', | ||
pixelTrackSrc = cms.InputTag("pixelTracksSoA@cuda"), | ||
TopFolderName = cms.string("SiPixelHeterogeneous/PixelTrackSoA"), | ||
), | ||
) | ||
''' |
14 changes: 14 additions & 0 deletions
14
DQM/SiPixelPhase1Heterogeneous/python/SiPixelPhase1MonitorVertexSoA_cfi.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from Configuration.ProcessModifiers.gpu_cff import gpu | ||
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer | ||
#from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA | ||
|
||
monitorpixelVertexSoA = DQMEDAnalyzer('SiPixelPhase1MonitorVertexSoA', | ||
pixelVertexSrc = cms.InputTag("pixelVerticesSoA@cpu"), | ||
beamSpotSrc = cms.InputTag("offlineBeamSpot"), | ||
TopFolderName = cms.string("SiPixelHeterogeneous/PixelVertexSoA"), | ||
) | ||
|
||
gpu.toModify(monitorpixelVertexSoA, | ||
pixelVertexSrc = cms.InputTag("pixelVerticesSoA@cuda") | ||
) |