Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sroychow committed Nov 18, 2021
1 parent c70da3c commit 40300f0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ class SiPixelPhase1MonitorTrackSoA : public DQMEDAnalyzer {
private:
edm::EDGetTokenT<PixelTrackHeterogeneous> tokenSoATrack_;
std::string topFolderName_;
bool useQualityCut_;
pixelTrack::Quality minQuality_;
MonitorElement* hnTracks;
MonitorElement* hnHits;
MonitorElement* hchi2;
MonitorElement* hpt;
MonitorElement* heta;
MonitorElement* hphi;
MonitorElement* hz;
MonitorElement* htip;
};

//
Expand All @@ -50,20 +53,21 @@ class SiPixelPhase1MonitorTrackSoA : public DQMEDAnalyzer {
SiPixelPhase1MonitorTrackSoA::SiPixelPhase1MonitorTrackSoA(const edm::ParameterSet& iConfig) {
tokenSoATrack_ = consumes<PixelTrackHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelTrackSrc"));
topFolderName_ = iConfig.getParameter<std::string>("TopFolderName"); //"SiPixelHeterogeneous/PixelTrackSoA";
useQualityCut_ = iConfig.getParameter<bool>("useQualityCut");
minQuality_ = pixelTrack::qualityByName(iConfig.getParameter<std::string>("minQuality"));
}

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();

auto const* quality = tsoa.qualityData();
int32_t nTracks = 0;
for (int32_t it = 0; it < maxTracks; ++it) {
auto nHits = tsoa.nHits(it);
Expand All @@ -72,16 +76,20 @@ void SiPixelPhase1MonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::
float pt = tsoa.pt(it);
if (!(pt > 0.))
continue;
if (useQualityCut_ && quality[it] < minQuality_)
continue;
float chi2 = tsoa.chi2(it);
float phi = tsoa.phi(it);
float zip = tsoa.zip(it);
float eta = tsoa.eta(it);
float tip = tsoa.tip(it);
hchi2->Fill(chi2);
hnHits->Fill(nHits);
hpt->Fill(pt);
heta->Fill(eta);
hphi->Fill(phi);
hz->Fill(zip);
htip->Fill(tip);
nTracks++;
}
hnTracks->Fill(nTracks);
Expand All @@ -93,7 +101,6 @@ void SiPixelPhase1MonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::
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);
Expand All @@ -103,15 +110,16 @@ void SiPixelPhase1MonitorTrackSoA::bookHistograms(DQMStore::IBooker& ibooker,
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.);
htip = ibooker.book1D("tip", "", 100, -0.5, 0.5);
}

void SiPixelPhase1MonitorTrackSoA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
// monitorpixelTrackSoA
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("pixelTrackSrc", edm::InputTag("pixelTracksSoA"));
desc.add<std::string>("TopFolderName", "SiPixelHeterogeneous/PixelTrackSoA");
descriptions.add("monitorpixelTrackSoA", desc);
// or use the following to generate the label from the module's C++ type
//descriptions.addWithDefaultLabel(desc);
desc.add<bool>("useQualityCut", false);
desc.add<std::string>("minQuality", "loose");
descriptions.addWithDefaultLabel(desc);
}
DEFINE_FWK_MODULE(SiPixelPhase1MonitorTrackSoA);
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ SiPixelPhase1MonitorVertexSoA::SiPixelPhase1MonitorVertexSoA(const edm::Paramete
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
Expand Down Expand Up @@ -102,8 +101,8 @@ void SiPixelPhase1MonitorVertexSoA::bookHistograms(DQMStore::IBooker& ibooker,
ibooker.cd();
ibooker.setCurrentFolder(topFolderName_);
hnVertex = ibooker.book1D("nVertex", ";# of Vertex;#entries", 101, -0.5, 100.5);
hx = ibooker.book1D("vx", ";Vertez x;#entries", 30, -30., 30);
hy = ibooker.book1D("vy", ";Vertez y;#entries", 30, -30., 30);
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.);
hptv2 = ibooker.book1D("ptsq", ";Vertex p_T squared;#entries", 200, 0., 200.);
Expand All @@ -115,8 +114,6 @@ void SiPixelPhase1MonitorVertexSoA::fillDescriptions(edm::ConfigurationDescripti
desc.add<edm::InputTag>("pixelVertexSrc", edm::InputTag("pixelVerticesSoA"));
desc.add<edm::InputTag>("beamSpotSrc", edm::InputTag("offlineBeamSpot"));
desc.add<std::string>("TopFolderName", "SiPixelHeterogeneous/PixelVertexSoA");
descriptions.add("monitorpixelVertexSoA", desc);
// or use the following to generate the label from the module's C++ type
//descriptions.addWithDefaultLabel(desc);
descriptions.addWithDefaultLabel(desc);
}
DEFINE_FWK_MODULE(SiPixelPhase1MonitorVertexSoA);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import FWCore.ParameterSet.Config as cms
from DQM.SiPixelPhase1Heterogeneous.monitorpixelTrackSoA_cfi import *
from DQM.SiPixelPhase1Heterogeneous.monitorpixelVertexSoA_cfi import *
from DQM.SiPixelPhase1Heterogeneous.siPixelPhase1MonitorTrackSoA_cfi import *
from DQM.SiPixelPhase1Heterogeneous.siPixelPhase1MonitorVertexSoA_cfi import *

monitorpixelSoASource = cms.Sequence(monitorpixelTrackSoA * monitorpixelVertexSoA)
monitorpixelSoASource = cms.Sequence(siPixelPhase1MonitorTrackSoA * siPixelPhase1MonitorVertexSoA)

0 comments on commit 40300f0

Please sign in to comment.