From 2c556d6edadb59da6c2ad2367f06ff9aa3963f76 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Fri, 2 Oct 2020 01:48:41 +0200 Subject: [PATCH 01/12] adding phase2 IT rechit validation module --- .../interface/Phase2ValidationUtil.h | 71 ++++ .../SiTrackerPhase2V/plugins/BuildFile.xml | 22 +- .../plugins/Phase2ITValidateRecHit.cc | 379 ++++++++++++++++++ .../plugins/Phase2ITValidateRecHit.h | 89 ++++ .../python/Phase2ITValidateRecHit_cfi.py | 37 ++ ...idateRecHit_TrackerPhase2Standalone_cfg.py | 98 +++++ 6 files changed, 691 insertions(+), 5 deletions(-) create mode 100644 Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h create mode 100644 Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc create mode 100644 Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h create mode 100644 Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py create mode 100644 Validation/SiTrackerPhase2V/test/ValidateRecHit_TrackerPhase2Standalone_cfg.py diff --git a/Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h b/Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h new file mode 100644 index 0000000000000..9d0bbd599cab8 --- /dev/null +++ b/Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h @@ -0,0 +1,71 @@ +#ifndef _Validation_SiTrackerPhase2V_Phase2TrackierValidationUtil_h +#define _Validation_SiTrackerPhase2V_Phase2TrackierValidationUtil_h +#include "SimDataFormats/TrackingHit/interface/PSimHit.h" +#include "SimDataFormats/Track/interface/SimTrack.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include +#include + +namespace Phase2TkUtil { + +bool isPrimary(const SimTrack& simTrk, const PSimHit* simHit){ + bool retval = false; + unsigned int trkId = simTrk.trackId(); + if (trkId != simHit->trackId()) + return retval; + int vtxIndex = simTrk.vertIndex(); + int ptype = simHit->processType(); + if ((vtxIndex == 0) && (ptype == 0)) + return true; + return false; +} + +std::string getITHistoId(uint32_t det_id, const TrackerTopology* tTopo) { + std::string Disc; + std::ostringstream fname1; + int layer = tTopo->getITPixelLayerNumber(det_id); + + if(layer < 0) + return ""; + if (layer < 100) { + fname1 << "Barrel/"; + fname1 << "Layer" << layer; + fname1 << ""; + } else { + int side = tTopo->pxfSide(det_id); + fname1 << "EndCap_Side" << side << "/"; + int disc = tTopo->pxfDisk(det_id); + Disc = (disc < 9) ? "EPix" : "FPix";; + fname1 << Disc << "/"; + int ring = tTopo->pxfBlade(det_id); + fname1 << "Ring" << ring; + } + return fname1.str(); +} + +std::string getOTHistoId(uint32_t det_id, const TrackerTopology* tTopo) { + std::string Disc; + std::ostringstream fname1; + int layer = tTopo->getOTLayerNumber(det_id); + + if(layer < 0) + return ""; + if (layer < 100) { + fname1 << "Barrel/"; + fname1 << "Layer" << layer; + fname1 << ""; + } else { + int side = layer / 100; + fname1 << "EndCap_Side" << side << "/"; + int disc = layer - side * 100; + Disc = (disc < 3) ? "TEDD_1" : "TEDD_2"; + fname1 << Disc << "/"; + int ring = tTopo->tidRing(det_id); + fname1 << "Ring" << ring; + } + return fname1.str(); +} + +} + +#endif diff --git a/Validation/SiTrackerPhase2V/plugins/BuildFile.xml b/Validation/SiTrackerPhase2V/plugins/BuildFile.xml index eff5680c0ac29..ef4098ba4d1f2 100644 --- a/Validation/SiTrackerPhase2V/plugins/BuildFile.xml +++ b/Validation/SiTrackerPhase2V/plugins/BuildFile.xml @@ -1,14 +1,26 @@ + - - + + + + + + + + + + + + + + - + - - + diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc new file mode 100644 index 0000000000000..46d9284a8750c --- /dev/null +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -0,0 +1,379 @@ +// Package: Phase2ITValidateRecHit +// Class: Phase2ITValidateRecHit +// +/**\class Phase2ITValidateRecHit Phase2ITValidateRecHit.cc + Description: Plugin for Phase2 RecHit validation +*/ +// +// Author: Shubhi Parolia, Suvankar Roy Chowdhury +// Date: June 2020 +// +// system include files +#include +#include "Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h" +#include "Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/CommonDetUnit/interface/TrackerGeomDet.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/GeometrySurface/interface/LocalError.h" +#include "DataFormats/GeometryVector/interface/LocalPoint.h" +//--- for SimHit association +#include "SimDataFormats/Track/interface/SimTrackContainer.h" +#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" +#include "SimDataFormats/TrackingHit/interface/PSimHit.h" +#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" +#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" +#include "SimDataFormats/Vertex/interface/SimVertexContainer.h" +// DQM Histograming +#include "DQMServices/Core/interface/MonitorElement.h" +// +// constructors +// +Phase2ITValidateRecHit::Phase2ITValidateRecHit(const edm::ParameterSet& iConfig): + config_(iConfig), + trackerHitAssociatorConfig_(iConfig, consumesCollector()), + simtrackminpt_(iConfig.getParameter("SimTrackMinPt")), + tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))), + simTracksToken_(consumes(iConfig.getParameter("simTracksSrc"))) +{ + edm::LogInfo("Phase2ITValidateRecHit") << ">>> Construct Phase2ITValidateRecHit "; + for (const auto& itag : config_.getParameter >("PSimHitSource")) + simHitTokens_.push_back(consumes(itag)); +} + +// +// destructor +// +Phase2ITValidateRecHit::~Phase2ITValidateRecHit() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) + edm::LogInfo("Phase2ITValidateRecHit") << ">>> Destroy Phase2ITValidateRecHit "; +} +// +// -- DQM Begin Run +// +// -- Analyze +// +void Phase2ITValidateRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + + // Get the geometry + edm::ESHandle geomHandle; + iSetup.get().get(geomHandle); + const TrackerGeometry* tkGeom = &(*geomHandle); + + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + const TrackerTopology* tTopo = tTopoHandle.product(); + + std::vector> simHits; + for (const auto& itoken : simHitTokens_) { + edm::Handle simHitHandle; + iEvent.getByToken(itoken, simHitHandle); + if (!simHitHandle.isValid()) + continue; + simHits.emplace_back(simHitHandle); + } + // Get the SimTracks and push them in a map of id, SimTrack + edm::Handle simTracks; + iEvent.getByToken(simTracksToken_, simTracks); + + std::map selectedSimTrackMap; + for (edm::SimTrackContainer::const_iterator simTrackIt(simTracks->begin()); simTrackIt != simTracks->end(); + ++simTrackIt) { + if (simTrackIt->momentum().pt() > simtrackminpt_) { + selectedSimTrackMap.insert(std::make_pair(simTrackIt->trackId(), *simTrackIt)); + } + } + TrackerHitAssociator associateRecHit(iEvent, trackerHitAssociatorConfig_); + fillITHistos(iEvent, tTopo, tkGeom, associateRecHit, simHits, selectedSimTrackMap); +} + +void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, + const TrackerTopology* tTopo, + const TrackerGeometry* tkGeom, + const TrackerHitAssociator& associateRecHit, + const std::vector>& simHits, + const std::map& selectedSimTrackMap) { + // Get the RecHits + edm::Handle rechits; + iEvent.getByToken(tokenRecHitsIT_, rechits); + if(!rechits.isValid()) return; + std::map nrechitLayerMap; + std::map nrechitLayerMap_primary; + unsigned long int nTotrechitsinevt = 0; + // Loop over modules + SiPixelRecHitCollection::const_iterator DSViter; + for (DSViter = rechits->begin(); DSViter != rechits->end(); ++DSViter) { + // Get the detector unit's id + unsigned int rawid(DSViter->detId()); + DetId detId(rawid); + // Get the geomdet + const GeomDetUnit* geomDetunit(tkGeom->idToDetUnit(detId)); + if (!geomDetunit) + continue; + // determine the detector we are in + std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo); + nTotrechitsinevt += DSViter->size(); + if(nrechitLayerMap.find(key) == nrechitLayerMap.end()) { + nrechitLayerMap.insert(std::make_pair(key, DSViter->size())); + nrechitLayerMap_primary.insert(std::make_pair(key, DSViter->size())); + } else { + nrechitLayerMap[key] += DSViter->size(); + nrechitLayerMap_primary[key] += DSViter->size(); + } + + edmNew::DetSet::const_iterator rechitIt; + //loop over rechits for a single detId + for(rechitIt = DSViter->begin(); rechitIt != DSViter->end(); ++rechitIt) { + LocalPoint lp = rechitIt->localPosition(); + Global3DPoint globalPos = geomDetunit->surface().toGlobal(lp); + //in mm + double gx = globalPos.x()*10.; + double gy = globalPos.y()*10.; + double gz = globalPos.z()*10.; + double gr = globalPos.perp()*10.; + //Fill global positions + globalXY_->Fill(gx, gy); + globalRZ_->Fill(gz, gr); + //layer wise histo + layerMEs_[key].clusterSize->Fill(rechitIt->cluster()->size()); + layerMEs_[key].globalPosXY->Fill(gx, gy); + layerMEs_[key].localPosXY->Fill(lp.x(), lp.y()); + + //GetSimHits + const std::vector& matchedId = associateRecHit.associateHitId(*rechitIt); + //std::cout << "Nmatched SimHits = " << matchedId.size() << ","; + const PSimHit* simhitClosest = 0; + float minx = 10000; + for (unsigned int si = 0; si < simHits.size(); ++si) { + for(edm::PSimHitContainer::const_iterator simhitIt = simHits.at(si)->begin(); + simhitIt != simHits.at(si)->end(); ++simhitIt) { + if(detId.rawId() != simhitIt->detUnitId()) continue; + for(auto& mId : matchedId) { + if(simhitIt->trackId() == mId.first) { + if (!simhitClosest || fabs(simhitIt->localPosition().x() - lp.x()) < minx) { + minx = fabs(simhitIt->localPosition().x() - lp.x()); + simhitClosest = &*simhitIt; + } + } + } + }//end loop over PSimhitcontainers + }//end loop over simHits + if(!simhitClosest) continue; + auto simTrackIt(selectedSimTrackMap.find(simhitClosest->trackId())); + bool isPrimary = false; + //check if simhit is primary + if(simTrackIt != selectedSimTrackMap.end()) isPrimary = Phase2TkUtil::isPrimary(simTrackIt->second, simhitClosest); + Local3DPoint simlp(simhitClosest->localPosition()); + const LocalError& lperr = rechitIt->localPositionError(); + double dx = lp.x() - simlp.x(); + double dy = lp.y() - simlp.y(); + double pullx = 999.; + double pully = 999.; + if (lperr.xx()) + pullx = (lp.x() - simlp.x()) / std::sqrt(lperr.xx()); + if (lperr.yy()) + pully = (lp.y() - simlp.y()) / std::sqrt(lperr.yy()); + float eta = globalPos.eta(); + layerMEs_[key].deltaX->Fill(dx); + layerMEs_[key].deltaY->Fill(dy); + layerMEs_[key].pullX->Fill(pullx); + layerMEs_[key].pullY->Fill(pully); + layerMEs_[key].deltaX_eta->Fill(eta,dx); + layerMEs_[key].deltaY_eta->Fill(eta,dy); + layerMEs_[key].pullX_eta->Fill(eta,pullx); + layerMEs_[key].pullY_eta->Fill(eta,pully); + if(isPrimary) { + layerMEs_[key].deltaX_primary->Fill(dx); + layerMEs_[key].deltaY_primary->Fill(dy); + layerMEs_[key].pullX_primary->Fill(pullx); + layerMEs_[key].pullY_primary->Fill(pully); + } else + nrechitLayerMap_primary[key]--; + }//end loop over rechits of a detId + } //End loop over DetSetVector + + //fill nRecHits per event + numberRecHits_->Fill(nTotrechitsinevt); + //fill nRecHit counter per layer + for(auto& lme : nrechitLayerMap) { + layerMEs_[lme.first].numberRecHits->Fill(lme.second); + layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]); + } +} +// +// -- Book Histograms +// +void Phase2ITValidateRecHit::bookHistograms(DQMStore::IBooker& ibooker, + edm::Run const& iRun, + edm::EventSetup const& iSetup) { + + std::string top_folder = config_.getParameter("TopFolderName"); + //std::stringstream folder_name; + + ibooker.cd(); + //edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << folder_name.str(); + std::cout << "Booking Histograms in : " << top_folder << std::endl; + std::string dir = top_folder; + ibooker.setCurrentFolder(dir); + + std::stringstream HistoName; + //Global histos for OT + HistoName.str(""); + HistoName << "NumberRecHits"; + numberRecHits_ = ibooker.book1D(HistoName.str(), HistoName.str(), 50, 0., 0.); + HistoName.str(""); + HistoName << "Global_Position_XY_IT"; + globalXY_ = ibooker.book2D(HistoName.str(), HistoName.str(), 1250, -1250., 1250., 1250, -1250., 1250.); + HistoName.str(""); + HistoName << "Global_Position_RZ_IT"; + globalRZ_ = ibooker.book2D(HistoName.str(), HistoName.str(), 1500, -3000., 3000., 1250., 0., 1250); + + //Now book layer wise histos + + edm::ESWatcher theTkDigiGeomWatcher; + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + const TrackerTopology* const tTopo = tTopoHandle.product(); + + if (theTkDigiGeomWatcher.check(iSetup)) { + edm::ESHandle geom_handle; + iSetup.get().get(geomType_, geom_handle); + const TrackerGeometry* tGeom = geom_handle.product(); + + for (auto const& det_u : tGeom->detUnits()) { + //Always check TrackerNumberingBuilder before changing this part + if(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB + || det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) + continue; + unsigned int detId_raw = det_u->geographicalId().rawId(); + std::cout << "Detid:" << detId_raw + <<"\tsubdet=" << det_u->subDetector() + << "\t key=" << Phase2TkUtil::getITHistoId(detId_raw, tTopo) + << std::endl; + bookLayerHistos(ibooker, detId_raw, tTopo, dir); + } + } + +} + +// +// -- Book Layer Histograms +// +void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, + unsigned int det_id, + const TrackerTopology* tTopo, + std::string& subdir) { + + int layer, side; + int idisc {0}; + layer = tTopo->getITPixelLayerNumber(det_id); + if (layer < 0) + return; + std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo); + + //std::map::iterator pos = layerMEs_.find(key); + if (layerMEs_.find(key) == layerMEs_.end()) { + if (layer > 100) { + side = layer / 100; + idisc = layer - side * 100; + idisc = (idisc < 3) ? 12 : 345; + } + + bool forDisc12UptoRing10 = (idisc == 12 && tTopo->tidRing(det_id) <= 10) ? true : false; + bool forDisc345UptoRing7 = (idisc == 345 && tTopo->tidRing(det_id) <= 7) ? true : false; + //bool forS = (pixelFlag_) ? false : true; + //this handles the PSP + bool forP = (layer < 4 || (layer > 6 && (forDisc12UptoRing10 || forDisc345UptoRing7))) ? true : false; + + ibooker.cd(); + RecHitME local_histos; + std::ostringstream histoName; + ibooker.setCurrentFolder(subdir+"/"+key); + std::cout<< "Setting subfolder>>>" << subdir << "\t" << key << std::endl; + edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << key; + + histoName.str(""); + histoName << "Number_RecHits"; + local_histos.numberRecHits = ibooker.book1D(histoName.str(), histoName.str(), 50, 0., 0.); + + histoName.str(""); + histoName << "Cluster_Size"; + local_histos.clusterSize = ibooker.book1D(histoName.str(), histoName.str(), 21, -0.5, 20.5); + + histoName.str(""); + histoName << "Globalosition_XY"; + local_histos.globalPosXY = ibooker.book2D(histoName.str(), histoName.str(), 1250, -1250., 1250., 1250, -1250., 1250.); + + histoName.str(""); + histoName << "Local_Position_XY_P" ; + local_histos.localPosXY = ibooker.book2D(histoName.str(), histoName.str(), 500, 0., 0., 500, 0., 0.); + + histoName.str(""); + histoName << "Delta_X"; + local_histos.deltaX = ibooker.book1D(histoName.str(), histoName.str(), 100, -0.02, 0.02); + + histoName.str(""); + histoName << "Delta_Y"; + local_histos.deltaY = ibooker.book1D(histoName.str(), histoName.str(), 100, -0.02, 0.02); + + histoName.str(""); + histoName << "Pull_X"; + local_histos.pullX = ibooker.book1D(histoName.str(), histoName.str(), 100, -4., 4.); + + histoName.str(""); + histoName << "Pull_Y"; + local_histos.pullY = ibooker.book1D(histoName.str(), histoName.str(), 100, -4., 4.); + + histoName.str(""); + histoName << "Delta_X_vs_Eta"; + local_histos.deltaX_eta = ibooker.bookProfile(histoName.str(), histoName.str(), 82, -4.1, 4.1, 100, -0.02, 0.02); + + histoName.str(""); + histoName << "Delta_Y_vs_Eta"; + local_histos.deltaY_eta = ibooker.bookProfile(histoName.str(), histoName.str(), 82, -4.1, 4.1, 100, -0.02, 0.02); + + histoName.str(""); + histoName << "Pull_X_vs_Eta"; + local_histos.pullX_eta = ibooker.bookProfile(histoName.str(), histoName.str(), 82, -4.1, 4.1, 100, -4., 4.); + + histoName.str(""); + histoName << "Pull_Y_vs_Eta"; + local_histos.pullY_eta = ibooker.bookProfile(histoName.str(), histoName.str(), 82, -4.1, 4.1, 100, -4., 4.); + + ibooker.setCurrentFolder(subdir+"/"+key+"/PrimarySimHits"); + //all histos for Primary particles + histoName.str(""); + histoName << "Number_RecHits_matched_PrimarySimTrack_P"; + local_histos.numberRecHitsprimary = ibooker.book1D(histoName.str(), histoName.str(), 50, 0., 0.); + + histoName.str(""); + histoName << "Delta_X_SimHitPrimary"; + local_histos.deltaX_primary = ibooker.book1D(histoName.str(), histoName.str(), 100, -0.02, 0.02); + + histoName.str(""); + histoName << "Delta_Y_SimHitPrimary"; + local_histos.deltaY_primary = ibooker.book1D(histoName.str(), histoName.str(), 100, -0.02, 0.02); + + histoName.str(""); + histoName << "Pull_X_SimHitPrimary"; + local_histos.pullX_primary = ibooker.book1D(histoName.str(), histoName.str(), 100, -3., 3.); + + histoName.str(""); + histoName << "Pull_Y_SimHitPrimary"; + local_histos.pullY_primary = ibooker.book1D(histoName.str(), histoName.str(), 100, -3., 3.); + + layerMEs_.insert(std::make_pair(key, local_histos)); + } +} + +//define this as a plug-in +DEFINE_FWK_MODULE(Phase2ITValidateRecHit); + diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h new file mode 100644 index 0000000000000..f9b28cd9f17bb --- /dev/null +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h @@ -0,0 +1,89 @@ +#ifndef _Validation_SiTrackerPhase2V_Phase2ITValidateRecHit_h +#define _Validation_SiTrackerPhase2V_Phase2ITValidateRecHit_h +#include +#include +#include +#include +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" +#include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" + + +// DQM Histograming +class PixelDigiSimLink; +class SimTrack; +class SimHit; +class TrackerTopology; +class TrackerGeometry; + +class Phase2ITValidateRecHit : public DQMEDAnalyzer { +public: + explicit Phase2ITValidateRecHit(const edm::ParameterSet&); + ~Phase2ITValidateRecHit() 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; + + private: + void fillITHistos(const edm::Event& iEvent, + const TrackerTopology* tTopo, + const TrackerGeometry* tkGeom, + const TrackerHitAssociator& associateRecHit, + const std::vector>& simHits, + const std::map& selectedSimTrackMap); + + + void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, const TrackerTopology* tTopo, std::string& subdir); + + edm::ParameterSet config_; + bool pixelFlag_; + TrackerHitAssociator::Config trackerHitAssociatorConfig_; + const double simtrackminpt_; + std::string geomType_; + const edm::EDGetTokenT tokenRecHitsIT_; + const edm::EDGetTokenT simTracksToken_; + std::vector > simHitTokens_; + + + MonitorElement* numberRecHits_; + MonitorElement* globalXY_; + MonitorElement* globalRZ_; + + struct RecHitME { + // use TH1D instead of TH1F to avoid stauration at 2^31 + // above this increments with +1 don't work for float, need double + MonitorElement* numberRecHits = nullptr; + MonitorElement* globalPosXY = nullptr; + MonitorElement* localPosXY = nullptr; + MonitorElement* deltaX = nullptr; + MonitorElement* clusterSize = nullptr; + MonitorElement* deltaY = nullptr; + MonitorElement* pullX = nullptr; + MonitorElement* pullY = nullptr; + MonitorElement* deltaX_eta = nullptr; + MonitorElement* deltaY_eta = nullptr; + MonitorElement* pullX_eta = nullptr; + MonitorElement* pullY_eta = nullptr; + //For rechits matched to simhits from highPT tracks + MonitorElement* numberRecHitsprimary = nullptr; + MonitorElement* pullX_primary; + MonitorElement* pullY_primary; + MonitorElement* deltaX_primary; + MonitorElement* deltaY_primary; + }; + std::map layerMEs_; +}; +#endif diff --git a/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py b/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py new file mode 100644 index 0000000000000..2a174e54deffd --- /dev/null +++ b/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py @@ -0,0 +1,37 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +rechitValidIT = DQMEDAnalyzer('Phase2TrackerValidateRecHit', + Verbosity = cms.bool(False), + TopFolderName = cms.string("Phase2TrackerRecHitV"), + ITPlotFillingFlag = cms.bool(False), + rechitsIT = cms.InputTag("siPixelRecHits"), + InnerPixelDigiSource = cms.InputTag("simSiPixelDigis","Pixel"), + InnerPixelDigiSimLinkSource = cms.InputTag("simSiPixelDigis", "Pixel"), + PSimHitSource = cms.VInputTag('g4SimHits:TrackerHitsPixelBarrelLowTof', + 'g4SimHits:TrackerHitsPixelBarrelHighTof', + 'g4SimHits:TrackerHitsPixelEndcapLowTof', + 'g4SimHits:TrackerHitsPixelEndcapHighTof', + 'g4SimHits:TrackerHitsTIBLowTof', + 'g4SimHits:TrackerHitsTIBHighTof', + 'g4SimHits:TrackerHitsTIDLowTof', + 'g4SimHits:TrackerHitsTIDHighTof', + 'g4SimHits:TrackerHitsTOBLowTof', + 'g4SimHits:TrackerHitsTOBHighTof', + 'g4SimHits:TrackerHitsTECLowTof', + 'g4SimHits:TrackerHitsTECHighTof'), + SimTrackSource = cms.InputTag("g4SimHits"), + SimVertexSource = cms.InputTag("g4SimHits"), + usePhase2Tracker = cms.bool(True),#these are used by simHit assoc. + associatePixel = cms.bool(True), + associateRecoTracks = cms.bool(False), + associateStrip = cms.bool(False), + associateHitbySimTrack = cms.bool(True), + pixelSimLinkSrc = cms.InputTag("simSiPixelDigis","Pixel"), + ROUList = cms.vstring('g4SimHitsTrackerHitsPixelBarrelLowTof', + 'g4SimHitsTrackerHitsPixelBarrelHighTof', + 'g4SimHitsTrackerHitsPixelEndcapLowTof', + 'g4SimHitsTrackerHitsPixelEndcapHighTof', + ), + +) diff --git a/Validation/SiTrackerPhase2V/test/ValidateRecHit_TrackerPhase2Standalone_cfg.py b/Validation/SiTrackerPhase2V/test/ValidateRecHit_TrackerPhase2Standalone_cfg.py new file mode 100644 index 0000000000000..b8d0126e3a8b1 --- /dev/null +++ b/Validation/SiTrackerPhase2V/test/ValidateRecHit_TrackerPhase2Standalone_cfg.py @@ -0,0 +1,98 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Era_Phase2_cff import Phase2 +process = cms.Process('recHitTest',Phase2) + +#process.MessageLogger = cms.Service("MessageLogger", +# debugModules = cms.untracked.vstring('siPixelRawData'), +# destinations = cms.untracked.vstring("cout"), +# cout = cms.untracked.PSet( +# threshold = cms.untracked.string('ERROR') +# ) +#) +process.load('Configuration.StandardSequences.Services_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.RawToDigi_cff') +process.load('Configuration.StandardSequences.L1Reco_cff') +process.load('Configuration.StandardSequences.Reconstruction_cff') +process.load('Configuration.StandardSequences.RecoSim_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +#process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') + +# list of files + +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + 'file:/eos/cms/store/relval/CMSSW_11_2_0_pre5/RelValTTbar_14TeV/GEN-SIM-RECO/PU25ns_110X_mcRun4_realistic_v3_2026D49PU200-v1/20000/CA4DC8DF-AAEC-DA43-931B-BF234D979A9D.root' + ) +) +# Production Info +process.configurationMetadata = cms.untracked.PSet( + version = cms.untracked.string('$Revision: 1.19 $'), + annotation = cms.untracked.string('step1 nevts:1'), + name = cms.untracked.string('Applications') +) +# Output definition + +process.DQMoutput = cms.OutputModule("PoolOutputModule", + splitLevel = cms.untracked.int32(0), + outputCommands = process.DQMEventContent.outputCommands, + fileName = cms.untracked.string('step1_rechitTest.root'), + dataset = cms.untracked.PSet( + filterName = cms.untracked.string(''), + dataTier = cms.untracked.string('') + ) +) + +process.load('RecoLocalTracker.SiPhase2Clusterizer.phase2TrackerClusterizer_cfi') +process.load('RecoLocalTracker.Phase2TrackerRecHits.Phase2StripCPEESProducer_cfi') +process.load('RecoLocalTracker.Phase2TrackerRecHits.Phase2TrackerRecHits_cfi') +process.load('RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi') +#process.rechits_step = cms.Path(process.siPhase2RecHits * process.siPixelRecHits) +process.rechits_step = cms.Path(process.siPixelRecHits) + + +#Setup FWK for multithreaded +process.options.numberOfThreads=cms.untracked.uint32(8) +process.options.numberOfStreams=cms.untracked.uint32(0) +process.options.numberOfConcurrentLuminosityBlocks=cms.untracked.uint32(1) + +#process.load('Validation.SiTrackerPhase2V.Phase2OTValidateRecHit_cfi') +process.load('Validation.SiTrackerPhase2V.Phase2ITValidateRecHit_cfi') + +#process.rechitval_seq = cms.Sequence(process.rechitValidIT) + +process.load('DQMServices.Components.DQMEventInfo_cfi') +#process.dqmEnv.subSystemFolder = cms.untracked.string('Ph2Tk') +process.dqm_comm = cms.Sequence(process.dqmEnv) + +# Path and EndPath definitions +process.endjob_step = cms.EndPath(process.endOfProcess) +process.DQMoutput_step = cms.EndPath(process.DQMoutput) +''' +process.Timing = cms.Service("Timing", + summaryOnly = cms.untracked.bool(False), + useJobReport = cms.untracked.bool(True) +) + +process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck", + ignoreTotal = cms.untracked.int32(1), + moduleMemorySummary = cms.untracked.bool(True) +) +''' +process.p = cms.Path(process.siPixelRecHits + #*process.siPhase2RecHits + #* process.rechitValidIT + #* process.rechitValidOT + * process.dqm_comm ) From 98177f2aa35e9b162123ac07c00aba1a668f8575 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 5 Oct 2020 13:29:56 +0200 Subject: [PATCH 02/12] adding phase2 IT rechit dqm module --- DQM/SiTrackerPhase2/plugins/BuildFile.xml | 4 +- .../plugins/Phase2ITMonitorRecHit.cc | 266 +++++++++++++++ .../plugins/Phase2ITMonitorRecHit.h | 68 ++++ .../python/Phase2ITMonitorRecHit_cfi.py | 120 +++++++ .../python/Phase2TrackerDQMFirstStep_cff.py | 7 +- .../interface/Phase2ValidationUtil.h | 71 ---- .../plugins/Phase2ITValidateRecHit.cc | 314 ++++++------------ .../plugins/Phase2ITValidateRecHit.h | 34 +- .../python/Phase2ITValidateRecHit_cfi.py | 99 +++++- .../Phase2TrackerValidationFirstStep_cff.py | 7 +- ...idateRecHit_TrackerPhase2Standalone_cfg.py | 2 +- 11 files changed, 683 insertions(+), 309 deletions(-) create mode 100644 DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc create mode 100644 DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h create mode 100644 DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cfi.py delete mode 100644 Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h diff --git a/DQM/SiTrackerPhase2/plugins/BuildFile.xml b/DQM/SiTrackerPhase2/plugins/BuildFile.xml index 5d433e7811726..ffc0d608890b5 100644 --- a/DQM/SiTrackerPhase2/plugins/BuildFile.xml +++ b/DQM/SiTrackerPhase2/plugins/BuildFile.xml @@ -1,12 +1,14 @@ + + - + diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc new file mode 100644 index 0000000000000..d69214993394b --- /dev/null +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc @@ -0,0 +1,266 @@ +// Package: Phase2ITMonitorRecHit +// Class: Phase2ITMonitorRecHit +// +/**\class Phase2ITMonitorRecHit Phase2ITMonitorRecHit.cc + Description: Plugin for Phase2 RecHit validation +*/ +// +// Author: Shubhi Parolia, Suvankar Roy Chowdhury +// Date: July 2020 +// +// system include files +#include +#include "DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h" +#include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/CommonDetUnit/interface/TrackerGeomDet.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/GeometrySurface/interface/LocalError.h" +#include "DataFormats/GeometryVector/interface/LocalPoint.h" +// DQM Histograming +#include "DQMServices/Core/interface/MonitorElement.h" +// +// constructors +// +Phase2ITMonitorRecHit::Phase2ITMonitorRecHit(const edm::ParameterSet& iConfig): + config_(iConfig), + tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))) +{ + edm::LogInfo("Phase2ITMonitorRecHit") << ">>> Construct Phase2ITMonitorRecHit "; +} + +Phase2ITMonitorRecHit::~Phase2ITMonitorRecHit() { + edm::LogInfo("Phase2ITMonitorRecHit") << ">>> Destroy Phase2ITMonitorRecHit "; +} +// -- Analyze +void Phase2ITMonitorRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + + // Get the geometry + edm::ESHandle geomHandle; + iSetup.get().get(geomHandle); + const TrackerGeometry* tkGeom = &(*geomHandle); + + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + const TrackerTopology* tTopo = tTopoHandle.product(); + + fillITHistos(iEvent, tTopo, tkGeom); +} + +void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent, + const TrackerTopology* tTopo, + const TrackerGeometry* tkGeom) { + // Get the RecHits + edm::Handle rechits; + iEvent.getByToken(tokenRecHitsIT_, rechits); + if(!rechits.isValid()) return; + std::map nrechitLayerMap; + unsigned long int nTotrechitsinevt = 0; + // Loop over modules + SiPixelRecHitCollection::const_iterator DSViter; + for (DSViter = rechits->begin(); DSViter != rechits->end(); ++DSViter) { + // Get the detector id + unsigned int rawid(DSViter->detId()); + DetId detId(rawid); + // Get the geomdet + const GeomDetUnit* geomDetunit(tkGeom->idToDetUnit(detId)); + if (!geomDetunit) + continue; + std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo); + nTotrechitsinevt += DSViter->size(); + if(nrechitLayerMap.find(key) == nrechitLayerMap.end()) { + nrechitLayerMap.insert(std::make_pair(key, DSViter->size())); + } else { + nrechitLayerMap[key] += DSViter->size(); + } + + edmNew::DetSet::const_iterator rechitIt; + //loop over rechits for a single detId + for(rechitIt = DSViter->begin(); rechitIt != DSViter->end(); ++rechitIt) { + LocalPoint lp = rechitIt->localPosition(); + Global3DPoint globalPos = geomDetunit->surface().toGlobal(lp); + //in mm + double gx = globalPos.x()*10.; + double gy = globalPos.y()*10.; + double gz = globalPos.z()*10.; + double gr = globalPos.perp()*10.; + //Fill global positions + if(geomDetunit->subDetector() == GeomDetEnumerators::SubDetector::P2PXB) { + globalXY_barrel_->Fill(gx, gy); + globalRZ_barrel_->Fill(gz, gr); + } else if(geomDetunit->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) { + globalXY_endcap_->Fill(gx, gy); + globalRZ_endcap_->Fill(gz, gr); + } + //layer wise histo + if(layerMEs_[key].clusterSizeX) layerMEs_[key].clusterSizeX->Fill(rechitIt->cluster()->sizeX()); + if(layerMEs_[key].clusterSizeY) layerMEs_[key].clusterSizeY->Fill(rechitIt->cluster()->sizeY()); + if(layerMEs_[key].globalPosXY) layerMEs_[key].globalPosXY->Fill(gx, gy); + if(layerMEs_[key].globalPosRZ) layerMEs_[key].globalPosRZ->Fill(gz, gr); + if(layerMEs_[key].localPosXY) layerMEs_[key].localPosXY->Fill(lp.x(), lp.y()); + if(layerMEs_[key].posX) layerMEs_[key].posX->Fill(lp.x()); + if(layerMEs_[key].posY) layerMEs_[key].posX->Fill(lp.y()); + if(layerMEs_[key].posX) layerMEs_[key].poserrX->Fill(rechitIt->localPositionError().xx()); + if(layerMEs_[key].posY) layerMEs_[key].poserrY->Fill(rechitIt->localPositionError().yy()); + }//end loop over rechits of a detId + } //End loop over DetSetVector + + //fill nRecHits per event + numberRecHits_->Fill(nTotrechitsinevt); + //fill nRecHit counter per layer + for(auto& lme : nrechitLayerMap) + if(layerMEs_[lme.first].numberRecHits) + layerMEs_[lme.first].numberRecHits->Fill(lme.second); +} +void Phase2ITMonitorRecHit::bookHistograms(DQMStore::IBooker& ibooker, + edm::Run const& iRun, + edm::EventSetup const& iSetup) { + + std::string top_folder = config_.getParameter("TopFolderName"); + ibooker.cd(); + edm::LogInfo("Phase2ITMonitorRecHit") << " Booking Histograms in : " << top_folder; + std::string dir = top_folder; + ibooker.setCurrentFolder(dir); + std::stringstream HistoName; + //Global histos for IT + HistoName.str(""); + HistoName << "NumberRecHits"; + numberRecHits_ = Phase2TkUtil::book1DFromPSet(config_.getParameter("GlobalNumberRecHits"), + HistoName.str(), + ibooker); + HistoName.str(""); + HistoName << "Global_Position_XY_IT_barrel"; + globalXY_barrel_ = Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionXY_PXB"), + HistoName.str(), + ibooker); + HistoName.str(""); + HistoName << "Global_Position_RZ_IT_barrel"; + globalRZ_barrel_ = Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionRZ_PXB"), + HistoName.str(), + ibooker); + HistoName.str(""); + HistoName << "Global_Position_XY_IT_endcap"; + globalXY_endcap_ = Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionXY_PXEC"), + HistoName.str(), + ibooker); + HistoName.str(""); + HistoName << "Global_Position_RZ_IT_endcap"; + globalRZ_endcap_ = Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionRZ_PXEC"), + HistoName.str(), + ibooker); + + //Now book layer wise histos + edm::ESWatcher theTkDigiGeomWatcher; + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + const TrackerTopology* const tTopo = tTopoHandle.product(); + if (theTkDigiGeomWatcher.check(iSetup)) { + edm::ESHandle geom_handle; + iSetup.get().get(geomType_, geom_handle); + const TrackerGeometry* tGeom = geom_handle.product(); + for (auto const& det_u : tGeom->detUnits()) { + //Always check TrackerNumberingBuilder before changing this part + if(!(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB + || det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC)) + continue; + unsigned int detId_raw = det_u->geographicalId().rawId(); + edm::LogInfo("Phase2ITMonitorRecHit") << "Detid:" << detId_raw + <<"\tsubdet=" << det_u->subDetector() + << "\t key=" << Phase2TkUtil::getITHistoId(detId_raw, tTopo) + << std::endl; + bookLayerHistos(ibooker, detId_raw, tTopo, dir); + } + } +} +// -- Book Layer Histograms +void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, + unsigned int det_id, + const TrackerTopology* tTopo, + std::string& subdir) { + std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo); + if(key.empty()) return; + if (layerMEs_.find(key) == layerMEs_.end()) { + ibooker.cd(); + RecHitME local_histos; + std::ostringstream histoName; + ibooker.setCurrentFolder(subdir+"/"+key); + std::cout<< "Setting subfolder>>>" << subdir << "\t" << key << std::endl; + edm::LogInfo("Phase2ITMonitorRecHit") << " Booking Histograms in : " << (subdir+"/"+key); + histoName.str(""); + histoName << "Number_RecHits"; + local_histos.numberRecHits = + Phase2TkUtil::book1DFromPSet(config_.getParameter("LocalNumberRecHits"), + histoName.str(), + ibooker); + histoName.str(""); + histoName << "RecHit_X"; + local_histos.posX = + Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosX"), + histoName.str(), + ibooker); + + histoName.str(""); + histoName << "RecHit_Y"; + local_histos.posY = + Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosY"), + histoName.str(), + ibooker); + + histoName.str(""); + histoName << "RecHit_X_error"; + local_histos.poserrX = + Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosErrorX"), + histoName.str(), + ibooker); + + histoName.str(""); + histoName << "RecHit_Y_error"; + local_histos.poserrY = + Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosErrorY"), + histoName.str(), + ibooker); + + histoName.str(""); + histoName << "Cluster_SizeX"; + local_histos.clusterSizeX = + Phase2TkUtil::book1DFromPSet(config_.getParameter("LocalClusterSizeX"), + histoName.str(), + ibooker); + histoName.str(""); + histoName << "Cluster_SizeY"; + local_histos.clusterSizeY = + Phase2TkUtil::book1DFromPSet(config_.getParameter("LocalClusterSizeY"), + histoName.str(), + ibooker); + + histoName.str(""); + histoName << "Global_Position_XY"; + local_histos.globalPosXY = + Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionXY_perlayer"), + histoName.str(), + ibooker); + + histoName.str(""); + histoName << "Global_Position_RZ"; + local_histos.globalPosRZ = + Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionRZ_perlayer"), + histoName.str(), + ibooker); + histoName.str(""); + histoName << "Local_Position_XY" ; + local_histos.localPosXY = + Phase2TkUtil::book2DFromPSet(config_.getParameter("LocalPositionXY"), + histoName.str(), + ibooker); + layerMEs_.insert(std::make_pair(key, local_histos)); + } +} +//define this as a plug-in +DEFINE_FWK_MODULE(Phase2ITMonitorRecHit); diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h new file mode 100644 index 0000000000000..d1d709c68e4c0 --- /dev/null +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h @@ -0,0 +1,68 @@ +#ifndef _Validation_SiTrackerPhase2V_Phase2ITMonitorRecHit_h +#define _Validation_SiTrackerPhase2V_Phase2ITMonitorRecHit_h +#include +#include +#include +#include +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" + + +// DQM Histograming +class TrackerTopology; +class TrackerGeometry; + +class Phase2ITMonitorRecHit : public DQMEDAnalyzer { +public: + explicit Phase2ITMonitorRecHit(const edm::ParameterSet&); + ~Phase2ITMonitorRecHit() 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; + + private: + void fillITHistos(const edm::Event& iEvent, + const TrackerTopology* tTopo, + const TrackerGeometry* tkGeom); + + void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, const TrackerTopology* tTopo, std::string& subdir); + + edm::ParameterSet config_; + std::string geomType_; + const edm::EDGetTokenT tokenRecHitsIT_; + + MonitorElement* numberRecHits_; + MonitorElement* globalXY_barrel_; + MonitorElement* globalXY_endcap_; + MonitorElement* globalRZ_barrel_; + MonitorElement* globalRZ_endcap_; + + struct RecHitME { + MonitorElement* numberRecHits = nullptr; + MonitorElement* globalPosXY = nullptr; + MonitorElement* globalPosRZ = nullptr; + MonitorElement* localPosXY = nullptr; + MonitorElement* posX = nullptr; + MonitorElement* posY = nullptr; + MonitorElement* poserrX = nullptr; + MonitorElement* poserrY = nullptr; + MonitorElement* clusterSizeX = nullptr; + MonitorElement* clusterSizeY = nullptr; + + }; + std::map layerMEs_; +}; +#endif diff --git a/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cfi.py b/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cfi.py new file mode 100644 index 0000000000000..44febc6bbf1d9 --- /dev/null +++ b/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cfi.py @@ -0,0 +1,120 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +rechitMonitorIT = DQMEDAnalyzer('Phase2ITMonitorRecHit', + Verbosity = cms.bool(False), + TopFolderName = cms.string("TrackerPhase2ITRecHit"), + rechitsSrc = cms.InputTag("siPixelRecHits"), + GlobalNumberRecHits = cms.PSet( + NxBins = cms.int32(50), + xmin = cms.double(0.), + xmax = cms.double(0.), + switch = cms.bool(True) + ), + GlobalPositionXY_PXB = cms.PSet( + NxBins = cms.int32(600), + xmin = cms.double(-300.), + xmax = cms.double(300.), + NyBins = cms.int32(600), + ymin = cms.double(-300.), + ymax = cms.double(300.), + switch = cms.bool(True) + ), + GlobalPositionXY_PXEC = cms.PSet( + NxBins = cms.int32(600), + xmin = cms.double(-300.), + xmax = cms.double(300.), + NyBins = cms.int32(600), + ymin = cms.double(-300.), + ymax = cms.double(300.), + switch = cms.bool(True) + ), + GlobalPositionRZ_PXB = cms.PSet( + NxBins = cms.int32(1500), + xmin = cms.double(-3000.), + xmax = cms.double(3000.), + NyBins = cms.int32(300), + ymin = cms.double(0.), + ymax = cms.double(300.), + switch = cms.bool(True) + ), + GlobalPositionRZ_PXEC = cms.PSet( + NxBins = cms.int32(1500), + xmin = cms.double(-3000.), + xmax = cms.double(3000.), + NyBins = cms.int32(300), + ymin = cms.double(0.), + ymax = cms.double(300.), + switch = cms.bool(True) + ), + LocalNumberRecHits = cms.PSet( + NxBins = cms.int32(50), + xmin = cms.double(0.), + xmax = cms.double(0.), + switch = cms.bool(True) + ), + RecHitPosX = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(-2.5), + xmax = cms.double(2.5), + switch = cms.bool(True) + ), + RecHitPosY = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(-2.5), + xmax = cms.double(2.5), + switch = cms.bool(True) + ), + RecHitPosErrorX = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(0.), + xmax = cms.double(0.2), + switch = cms.bool(True) + ), + RecHitPosErrorY = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(0.), + xmax = cms.double(0.2), + switch = cms.bool(True) + ), + LocalClusterSizeX = cms.PSet( + NxBins = cms.int32(21), + xmin = cms.double(-0.5), + xmax = cms.double(20.5), + switch = cms.bool(True) + ), + LocalClusterSizeY = cms.PSet( + NxBins = cms.int32(21), + xmin = cms.double(-0.5), + xmax = cms.double(20.5), + switch = cms.bool(True) + ), + GlobalPositionXY_perlayer = cms.PSet( + NxBins = cms.int32(600), + xmin = cms.double(-300.), + xmax = cms.double(300.), + NyBins = cms.int32(600), + ymin = cms.double(-300.), + ymax = cms.double(300.), + switch = cms.bool(True) + ), + GlobalPositionRZ_perlayer = cms.PSet( + NxBins = cms.int32(1500), + xmin = cms.double(-3000.), + xmax = cms.double(3000.), + NyBins = cms.int32(300), + ymin = cms.double(0.), + ymax = cms.double(300.), + switch = cms.bool(True) + ), + LocalPositionXY = cms.PSet( + NxBins = cms.int32(500), + xmin = cms.double(0.), + xmax = cms.double(0.), + NyBins = cms.int32(500), + ymin = cms.double(0.), + ymax = cms.double(0.), + switch = cms.bool(True) + ), + +) diff --git a/DQM/SiTrackerPhase2/python/Phase2TrackerDQMFirstStep_cff.py b/DQM/SiTrackerPhase2/python/Phase2TrackerDQMFirstStep_cff.py index 9e0540cdc71f0..9a5841d2e45ff 100644 --- a/DQM/SiTrackerPhase2/python/Phase2TrackerDQMFirstStep_cff.py +++ b/DQM/SiTrackerPhase2/python/Phase2TrackerDQMFirstStep_cff.py @@ -1,7 +1,8 @@ import FWCore.ParameterSet.Config as cms from DQM.SiTrackerPhase2.Phase2TrackerMonitorDigi_cff import * +from DQM.SiTrackerPhase2.Phase2ITMonitorRecHit_cfi import * -trackerphase2DQMSource = cms.Sequence( - pixDigiMon - + otDigiMon +trackerphase2DQMSource = cms.Sequence( pixDigiMon + + otDigiMon + +rechitMonitorIT ) diff --git a/Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h b/Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h deleted file mode 100644 index 9d0bbd599cab8..0000000000000 --- a/Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _Validation_SiTrackerPhase2V_Phase2TrackierValidationUtil_h -#define _Validation_SiTrackerPhase2V_Phase2TrackierValidationUtil_h -#include "SimDataFormats/TrackingHit/interface/PSimHit.h" -#include "SimDataFormats/Track/interface/SimTrack.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include -#include - -namespace Phase2TkUtil { - -bool isPrimary(const SimTrack& simTrk, const PSimHit* simHit){ - bool retval = false; - unsigned int trkId = simTrk.trackId(); - if (trkId != simHit->trackId()) - return retval; - int vtxIndex = simTrk.vertIndex(); - int ptype = simHit->processType(); - if ((vtxIndex == 0) && (ptype == 0)) - return true; - return false; -} - -std::string getITHistoId(uint32_t det_id, const TrackerTopology* tTopo) { - std::string Disc; - std::ostringstream fname1; - int layer = tTopo->getITPixelLayerNumber(det_id); - - if(layer < 0) - return ""; - if (layer < 100) { - fname1 << "Barrel/"; - fname1 << "Layer" << layer; - fname1 << ""; - } else { - int side = tTopo->pxfSide(det_id); - fname1 << "EndCap_Side" << side << "/"; - int disc = tTopo->pxfDisk(det_id); - Disc = (disc < 9) ? "EPix" : "FPix";; - fname1 << Disc << "/"; - int ring = tTopo->pxfBlade(det_id); - fname1 << "Ring" << ring; - } - return fname1.str(); -} - -std::string getOTHistoId(uint32_t det_id, const TrackerTopology* tTopo) { - std::string Disc; - std::ostringstream fname1; - int layer = tTopo->getOTLayerNumber(det_id); - - if(layer < 0) - return ""; - if (layer < 100) { - fname1 << "Barrel/"; - fname1 << "Layer" << layer; - fname1 << ""; - } else { - int side = layer / 100; - fname1 << "EndCap_Side" << side << "/"; - int disc = layer - side * 100; - Disc = (disc < 3) ? "TEDD_1" : "TEDD_2"; - fname1 << Disc << "/"; - int ring = tTopo->tidRing(det_id); - fname1 << "Ring" << ring; - } - return fname1.str(); -} - -} - -#endif diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index 46d9284a8750c..6567d20512a30 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -11,7 +11,8 @@ // system include files #include #include "Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h" -#include "Validation/SiTrackerPhase2V/interface/Phase2ValidationUtil.h" +#include "Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h" +#include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ESWatcher.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" @@ -33,36 +34,21 @@ #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" // DQM Histograming #include "DQMServices/Core/interface/MonitorElement.h" -// -// constructors -// -Phase2ITValidateRecHit::Phase2ITValidateRecHit(const edm::ParameterSet& iConfig): - config_(iConfig), - trackerHitAssociatorConfig_(iConfig, consumesCollector()), - simtrackminpt_(iConfig.getParameter("SimTrackMinPt")), - tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))), - simTracksToken_(consumes(iConfig.getParameter("simTracksSrc"))) -{ +Phase2ITValidateRecHit::Phase2ITValidateRecHit(const edm::ParameterSet& iConfig) + : config_(iConfig), + trackerHitAssociatorConfig_(iConfig, consumesCollector()), + simtrackminpt_(iConfig.getParameter("SimTrackMinPt")), + tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))), + simTracksToken_(consumes(iConfig.getParameter("simTracksSrc"))) { edm::LogInfo("Phase2ITValidateRecHit") << ">>> Construct Phase2ITValidateRecHit "; - for (const auto& itag : config_.getParameter >("PSimHitSource")) + for (const auto& itag : config_.getParameter>("PSimHitSource")) simHitTokens_.push_back(consumes(itag)); } - -// -// destructor // Phase2ITValidateRecHit::~Phase2ITValidateRecHit() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) edm::LogInfo("Phase2ITValidateRecHit") << ">>> Destroy Phase2ITValidateRecHit "; } -// -// -- DQM Begin Run -// -// -- Analyze -// void Phase2ITValidateRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // Get the geometry edm::ESHandle geomHandle; iSetup.get().get(geomHandle); @@ -95,21 +81,20 @@ void Phase2ITValidateRecHit::analyze(const edm::Event& iEvent, const edm::EventS fillITHistos(iEvent, tTopo, tkGeom, associateRecHit, simHits, selectedSimTrackMap); } -void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, - const TrackerTopology* tTopo, - const TrackerGeometry* tkGeom, - const TrackerHitAssociator& associateRecHit, - const std::vector>& simHits, - const std::map& selectedSimTrackMap) { +void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, + const TrackerTopology* tTopo, + const TrackerGeometry* tkGeom, + const TrackerHitAssociator& associateRecHit, + const std::vector>& simHits, + const std::map& selectedSimTrackMap) { // Get the RecHits edm::Handle rechits; iEvent.getByToken(tokenRecHitsIT_, rechits); - if(!rechits.isValid()) return; - std::map nrechitLayerMap; - std::map nrechitLayerMap_primary; - unsigned long int nTotrechitsinevt = 0; + if (!rechits.isValid()) + return; + std::map nrechitLayerMap_primary; // Loop over modules - SiPixelRecHitCollection::const_iterator DSViter; + SiPixelRecHitCollection::const_iterator DSViter; for (DSViter = rechits->begin(); DSViter != rechits->end(); ++DSViter) { // Get the detector unit's id unsigned int rawid(DSViter->detId()); @@ -120,91 +105,74 @@ void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, continue; // determine the detector we are in std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo); - nTotrechitsinevt += DSViter->size(); - if(nrechitLayerMap.find(key) == nrechitLayerMap.end()) { - nrechitLayerMap.insert(std::make_pair(key, DSViter->size())); - nrechitLayerMap_primary.insert(std::make_pair(key, DSViter->size())); + if (nrechitLayerMap_primary.find(key) == nrechitLayerMap_primary.end()) { + nrechitLayerMap_primary.insert(std::make_pair(key, DSViter->size())); } else { - nrechitLayerMap[key] += DSViter->size(); nrechitLayerMap_primary[key] += DSViter->size(); } - + edmNew::DetSet::const_iterator rechitIt; //loop over rechits for a single detId - for(rechitIt = DSViter->begin(); rechitIt != DSViter->end(); ++rechitIt) { - LocalPoint lp = rechitIt->localPosition(); - Global3DPoint globalPos = geomDetunit->surface().toGlobal(lp); - //in mm - double gx = globalPos.x()*10.; - double gy = globalPos.y()*10.; - double gz = globalPos.z()*10.; - double gr = globalPos.perp()*10.; - //Fill global positions - globalXY_->Fill(gx, gy); - globalRZ_->Fill(gz, gr); - //layer wise histo - layerMEs_[key].clusterSize->Fill(rechitIt->cluster()->size()); - layerMEs_[key].globalPosXY->Fill(gx, gy); - layerMEs_[key].localPosXY->Fill(lp.x(), lp.y()); - + for (rechitIt = DSViter->begin(); rechitIt != DSViter->end(); ++rechitIt) { //GetSimHits const std::vector& matchedId = associateRecHit.associateHitId(*rechitIt); - //std::cout << "Nmatched SimHits = " << matchedId.size() << ","; - const PSimHit* simhitClosest = 0; + const PSimHit* simhitClosest = nullptr; float minx = 10000; + LocalPoint lp = rechitIt->localPosition(); for (unsigned int si = 0; si < simHits.size(); ++si) { - for(edm::PSimHitContainer::const_iterator simhitIt = simHits.at(si)->begin(); - simhitIt != simHits.at(si)->end(); ++simhitIt) { - if(detId.rawId() != simhitIt->detUnitId()) continue; - for(auto& mId : matchedId) { - if(simhitIt->trackId() == mId.first) { - if (!simhitClosest || fabs(simhitIt->localPosition().x() - lp.x()) < minx) { - minx = fabs(simhitIt->localPosition().x() - lp.x()); - simhitClosest = &*simhitIt; - } - } - } - }//end loop over PSimhitcontainers - }//end loop over simHits - if(!simhitClosest) continue; + for (edm::PSimHitContainer::const_iterator simhitIt = simHits.at(si)->begin(); + simhitIt != simHits.at(si)->end(); + ++simhitIt) { + if (detId.rawId() != simhitIt->detUnitId()) + continue; + for (auto& mId : matchedId) { + if (simhitIt->trackId() == mId.first) { + if (!simhitClosest || fabs(simhitIt->localPosition().x() - lp.x()) < minx) { + minx = fabs(simhitIt->localPosition().x() - lp.x()); + simhitClosest = &*simhitIt; + } + } + } + } //end loop over PSimhitcontainers + } //end loop over simHits + if (!simhitClosest) + continue; auto simTrackIt(selectedSimTrackMap.find(simhitClosest->trackId())); bool isPrimary = false; //check if simhit is primary - if(simTrackIt != selectedSimTrackMap.end()) isPrimary = Phase2TkUtil::isPrimary(simTrackIt->second, simhitClosest); + if (simTrackIt != selectedSimTrackMap.end()) + isPrimary = Phase2TkUtil::isPrimary(simTrackIt->second, simhitClosest); Local3DPoint simlp(simhitClosest->localPosition()); const LocalError& lperr = rechitIt->localPositionError(); double dx = lp.x() - simlp.x(); double dy = lp.y() - simlp.y(); double pullx = 999.; double pully = 999.; - if (lperr.xx()) - pullx = (lp.x() - simlp.x()) / std::sqrt(lperr.xx()); - if (lperr.yy()) - pully = (lp.y() - simlp.y()) / std::sqrt(lperr.yy()); - float eta = globalPos.eta(); + if (lperr.xx()) + pullx = (lp.x() - simlp.x()) / std::sqrt(lperr.xx()); + if (lperr.yy()) + pully = (lp.y() - simlp.y()) / std::sqrt(lperr.yy()); + float eta = geomDetunit->surface().toGlobal(lp).eta(); layerMEs_[key].deltaX->Fill(dx); layerMEs_[key].deltaY->Fill(dy); layerMEs_[key].pullX->Fill(pullx); layerMEs_[key].pullY->Fill(pully); - layerMEs_[key].deltaX_eta->Fill(eta,dx); - layerMEs_[key].deltaY_eta->Fill(eta,dy); - layerMEs_[key].pullX_eta->Fill(eta,pullx); - layerMEs_[key].pullY_eta->Fill(eta,pully); - if(isPrimary) { - layerMEs_[key].deltaX_primary->Fill(dx); - layerMEs_[key].deltaY_primary->Fill(dy); - layerMEs_[key].pullX_primary->Fill(pullx); - layerMEs_[key].pullY_primary->Fill(pully); - } else - nrechitLayerMap_primary[key]--; - }//end loop over rechits of a detId - } //End loop over DetSetVector - - //fill nRecHits per event - numberRecHits_->Fill(nTotrechitsinevt); + layerMEs_[key].deltaX_eta->Fill(eta, dx); + layerMEs_[key].deltaY_eta->Fill(eta, dy); + layerMEs_[key].pullX_eta->Fill(eta, pullx); + layerMEs_[key].pullY_eta->Fill(eta, pully); + if (isPrimary) { + layerMEs_[key].deltaX_primary->Fill(dx); + layerMEs_[key].deltaY_primary->Fill(dy); + layerMEs_[key].pullX_primary->Fill(pullx); + layerMEs_[key].pullY_primary->Fill(pully); + } else + nrechitLayerMap_primary[key]--; + } //end loop over rechits of a detId + } //End loop over DetSetVector + //fill nRecHit counter per layer - for(auto& lme : nrechitLayerMap) { - layerMEs_[lme.first].numberRecHits->Fill(lme.second); + for (auto& lme : nrechitLayerMap_primary) { layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]); } } @@ -212,168 +180,102 @@ void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, // -- Book Histograms // void Phase2ITValidateRecHit::bookHistograms(DQMStore::IBooker& ibooker, - edm::Run const& iRun, - edm::EventSetup const& iSetup) { - + edm::Run const& iRun, + edm::EventSetup const& iSetup) { std::string top_folder = config_.getParameter("TopFolderName"); - //std::stringstream folder_name; - - ibooker.cd(); - //edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << folder_name.str(); - std::cout << "Booking Histograms in : " << top_folder << std::endl; - std::string dir = top_folder; - ibooker.setCurrentFolder(dir); - - std::stringstream HistoName; - //Global histos for OT - HistoName.str(""); - HistoName << "NumberRecHits"; - numberRecHits_ = ibooker.book1D(HistoName.str(), HistoName.str(), 50, 0., 0.); - HistoName.str(""); - HistoName << "Global_Position_XY_IT"; - globalXY_ = ibooker.book2D(HistoName.str(), HistoName.str(), 1250, -1250., 1250., 1250, -1250., 1250.); - HistoName.str(""); - HistoName << "Global_Position_RZ_IT"; - globalRZ_ = ibooker.book2D(HistoName.str(), HistoName.str(), 1500, -3000., 3000., 1250., 0., 1250); - - //Now book layer wise histos - + edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << top_folder; edm::ESWatcher theTkDigiGeomWatcher; edm::ESHandle tTopoHandle; iSetup.get().get(tTopoHandle); const TrackerTopology* const tTopo = tTopoHandle.product(); - if (theTkDigiGeomWatcher.check(iSetup)) { edm::ESHandle geom_handle; iSetup.get().get(geomType_, geom_handle); const TrackerGeometry* tGeom = geom_handle.product(); - for (auto const& det_u : tGeom->detUnits()) { //Always check TrackerNumberingBuilder before changing this part - if(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB - || det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) - continue; + if (!(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB || + det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC)) + continue; unsigned int detId_raw = det_u->geographicalId().rawId(); - std::cout << "Detid:" << detId_raw - <<"\tsubdet=" << det_u->subDetector() - << "\t key=" << Phase2TkUtil::getITHistoId(detId_raw, tTopo) - << std::endl; - bookLayerHistos(ibooker, detId_raw, tTopo, dir); + bookLayerHistos(ibooker, detId_raw, tTopo, top_folder); } } - } - -// -// -- Book Layer Histograms // void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, - unsigned int det_id, - const TrackerTopology* tTopo, - std::string& subdir) { - - int layer, side; - int idisc {0}; - layer = tTopo->getITPixelLayerNumber(det_id); - if (layer < 0) - return; + unsigned int det_id, + const TrackerTopology* tTopo, + std::string& subdir) { + ibooker.cd(); std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo); - - //std::map::iterator pos = layerMEs_.find(key); + if (key.empty()) + return; if (layerMEs_.find(key) == layerMEs_.end()) { - if (layer > 100) { - side = layer / 100; - idisc = layer - side * 100; - idisc = (idisc < 3) ? 12 : 345; - } - - bool forDisc12UptoRing10 = (idisc == 12 && tTopo->tidRing(det_id) <= 10) ? true : false; - bool forDisc345UptoRing7 = (idisc == 345 && tTopo->tidRing(det_id) <= 7) ? true : false; - //bool forS = (pixelFlag_) ? false : true; - //this handles the PSP - bool forP = (layer < 4 || (layer > 6 && (forDisc12UptoRing10 || forDisc345UptoRing7))) ? true : false; - ibooker.cd(); RecHitME local_histos; std::ostringstream histoName; - ibooker.setCurrentFolder(subdir+"/"+key); - std::cout<< "Setting subfolder>>>" << subdir << "\t" << key << std::endl; + ibooker.setCurrentFolder(subdir + "/" + key); + std::cout << "Setting subfolder>>>" << subdir << "\t" << key << std::endl; edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << key; - histoName.str(""); - histoName << "Number_RecHits"; - local_histos.numberRecHits = ibooker.book1D(histoName.str(), histoName.str(), 50, 0., 0.); - - histoName.str(""); - histoName << "Cluster_Size"; - local_histos.clusterSize = ibooker.book1D(histoName.str(), histoName.str(), 21, -0.5, 20.5); - - histoName.str(""); - histoName << "Globalosition_XY"; - local_histos.globalPosXY = ibooker.book2D(histoName.str(), histoName.str(), 1250, -1250., 1250., 1250, -1250., 1250.); - - histoName.str(""); - histoName << "Local_Position_XY_P" ; - local_histos.localPosXY = ibooker.book2D(histoName.str(), histoName.str(), 500, 0., 0., 500, 0., 0.); - histoName.str(""); histoName << "Delta_X"; - local_histos.deltaX = ibooker.book1D(histoName.str(), histoName.str(), 100, -0.02, 0.02); - + local_histos.deltaX = + Phase2TkUtil::book1DFromPSet(config_.getParameter("DeltaX"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_Y"; - local_histos.deltaY = ibooker.book1D(histoName.str(), histoName.str(), 100, -0.02, 0.02); - + local_histos.deltaY = + Phase2TkUtil::book1DFromPSet(config_.getParameter("DeltaX"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_X"; - local_histos.pullX = ibooker.book1D(histoName.str(), histoName.str(), 100, -4., 4.); - + local_histos.pullX = + Phase2TkUtil::book1DFromPSet(config_.getParameter("PullX"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_Y"; - local_histos.pullY = ibooker.book1D(histoName.str(), histoName.str(), 100, -4., 4.); - + local_histos.pullY = + Phase2TkUtil::book1DFromPSet(config_.getParameter("PullY"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_X_vs_Eta"; - local_histos.deltaX_eta = ibooker.bookProfile(histoName.str(), histoName.str(), 82, -4.1, 4.1, 100, -0.02, 0.02); - + local_histos.deltaX_eta = Phase2TkUtil::bookProfile1DFromPSet( + config_.getParameter("DeltaX_eta"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_Y_vs_Eta"; - local_histos.deltaY_eta = ibooker.bookProfile(histoName.str(), histoName.str(), 82, -4.1, 4.1, 100, -0.02, 0.02); - + local_histos.deltaY_eta = Phase2TkUtil::bookProfile1DFromPSet( + config_.getParameter("DeltaX_eta"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_X_vs_Eta"; - local_histos.pullX_eta = ibooker.bookProfile(histoName.str(), histoName.str(), 82, -4.1, 4.1, 100, -4., 4.); - + local_histos.pullX_eta = Phase2TkUtil::bookProfile1DFromPSet( + config_.getParameter("PullX_eta"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_Y_vs_Eta"; - local_histos.pullY_eta = ibooker.bookProfile(histoName.str(), histoName.str(), 82, -4.1, 4.1, 100, -4., 4.); - - ibooker.setCurrentFolder(subdir+"/"+key+"/PrimarySimHits"); + local_histos.pullY_eta = Phase2TkUtil::bookProfile1DFromPSet( + config_.getParameter("PullY_eta"), histoName.str(), ibooker); + ibooker.setCurrentFolder(subdir + "/" + key + "/PrimarySimHits"); //all histos for Primary particles histoName.str(""); - histoName << "Number_RecHits_matched_PrimarySimTrack_P"; - local_histos.numberRecHitsprimary = ibooker.book1D(histoName.str(), histoName.str(), 50, 0., 0.); - + histoName << "Number_RecHits_matched_PrimarySimTrack"; + local_histos.numberRecHitsprimary = Phase2TkUtil::book1DFromPSet( + config_.getParameter("nRecHits_primary"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_X_SimHitPrimary"; - local_histos.deltaX_primary = ibooker.book1D(histoName.str(), histoName.str(), 100, -0.02, 0.02); - + local_histos.deltaX_primary = Phase2TkUtil::book1DFromPSet( + config_.getParameter("DeltaX_primary"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_Y_SimHitPrimary"; - local_histos.deltaY_primary = ibooker.book1D(histoName.str(), histoName.str(), 100, -0.02, 0.02); - + local_histos.deltaY_primary = Phase2TkUtil::book1DFromPSet( + config_.getParameter("DeltaY_primary"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_X_SimHitPrimary"; - local_histos.pullX_primary = ibooker.book1D(histoName.str(), histoName.str(), 100, -3., 3.); - + local_histos.pullX_primary = Phase2TkUtil::book1DFromPSet( + config_.getParameter("PullX_primary"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_Y_SimHitPrimary"; - local_histos.pullY_primary = ibooker.book1D(histoName.str(), histoName.str(), 100, -3., 3.); - + local_histos.pullY_primary = Phase2TkUtil::book1DFromPSet( + config_.getParameter("PullY_primary"), histoName.str(), ibooker); layerMEs_.insert(std::make_pair(key, local_histos)); } } - + //define this as a plug-in DEFINE_FWK_MODULE(Phase2ITValidateRecHit); - diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h index f9b28cd9f17bb..691942933f42d 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h @@ -22,7 +22,6 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" - // DQM Histograming class PixelDigiSimLink; class SimTrack; @@ -36,17 +35,19 @@ class Phase2ITValidateRecHit : public DQMEDAnalyzer { ~Phase2ITValidateRecHit() 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; - - private: - void fillITHistos(const edm::Event& iEvent, - const TrackerTopology* tTopo, - const TrackerGeometry* tkGeom, - const TrackerHitAssociator& associateRecHit, - const std::vector>& simHits, - const std::map& selectedSimTrackMap); +private: + void fillITHistos(const edm::Event& iEvent, + const TrackerTopology* tTopo, + const TrackerGeometry* tkGeom, + const TrackerHitAssociator& associateRecHit, + const std::vector>& simHits, + const std::map& selectedSimTrackMap); - void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, const TrackerTopology* tTopo, std::string& subdir); + void bookLayerHistos(DQMStore::IBooker& ibooker, + unsigned int det_id, + const TrackerTopology* tTopo, + std::string& subdir); edm::ParameterSet config_; bool pixelFlag_; @@ -55,21 +56,12 @@ class Phase2ITValidateRecHit : public DQMEDAnalyzer { std::string geomType_; const edm::EDGetTokenT tokenRecHitsIT_; const edm::EDGetTokenT simTracksToken_; - std::vector > simHitTokens_; - - - MonitorElement* numberRecHits_; - MonitorElement* globalXY_; - MonitorElement* globalRZ_; + std::vector> simHitTokens_; struct RecHitME { // use TH1D instead of TH1F to avoid stauration at 2^31 // above this increments with +1 don't work for float, need double - MonitorElement* numberRecHits = nullptr; - MonitorElement* globalPosXY = nullptr; - MonitorElement* localPosXY = nullptr; MonitorElement* deltaX = nullptr; - MonitorElement* clusterSize = nullptr; MonitorElement* deltaY = nullptr; MonitorElement* pullX = nullptr; MonitorElement* pullY = nullptr; @@ -84,6 +76,6 @@ class Phase2ITValidateRecHit : public DQMEDAnalyzer { MonitorElement* deltaX_primary; MonitorElement* deltaY_primary; }; - std::map layerMEs_; + std::map layerMEs_; }; #endif diff --git a/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py b/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py index 2a174e54deffd..4a0525db5f8b3 100644 --- a/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py +++ b/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py @@ -1,11 +1,11 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -rechitValidIT = DQMEDAnalyzer('Phase2TrackerValidateRecHit', +rechitValidIT = DQMEDAnalyzer('Phase2ITValidateRecHit', Verbosity = cms.bool(False), - TopFolderName = cms.string("Phase2TrackerRecHitV"), + TopFolderName = cms.string("TrackerPhase2ITRecHitV"), ITPlotFillingFlag = cms.bool(False), - rechitsIT = cms.InputTag("siPixelRecHits"), + rechitsSrc = cms.InputTag("siPixelRecHits"), InnerPixelDigiSource = cms.InputTag("simSiPixelDigis","Pixel"), InnerPixelDigiSimLinkSource = cms.InputTag("simSiPixelDigis", "Pixel"), PSimHitSource = cms.VInputTag('g4SimHits:TrackerHitsPixelBarrelLowTof', @@ -20,6 +20,8 @@ 'g4SimHits:TrackerHitsTOBHighTof', 'g4SimHits:TrackerHitsTECLowTof', 'g4SimHits:TrackerHitsTECHighTof'), + simTracksSrc = cms.InputTag("g4SimHits"), + SimTrackMinPt = cms.double(2.), SimTrackSource = cms.InputTag("g4SimHits"), SimVertexSource = cms.InputTag("g4SimHits"), usePhase2Tracker = cms.bool(True),#these are used by simHit assoc. @@ -33,5 +35,94 @@ 'g4SimHitsTrackerHitsPixelEndcapLowTof', 'g4SimHitsTrackerHitsPixelEndcapHighTof', ), - + DeltaX = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(-0.2), + xmax = cms.double(0.2), + switch = cms.bool(True) + ), + DeltaY = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(-0.2), + xmax = cms.double(0.2), + switch = cms.bool(True) + ), + PullX = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(-4.), + xmax = cms.double(4.), + switch = cms.bool(True) + ), + PullY = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(-4.), + xmax = cms.double(4.), + switch = cms.bool(True) + ), + DeltaX_eta = cms.PSet( + NxBins = cms.int32(82), + xmin = cms.double(-4.1), + xmax = cms.double(4.1), + ymin = cms.double(-0.02), + ymax = cms.double(0.02), + switch = cms.bool(True) + ), + DeltaY_eta = cms.PSet( + NxBins = cms.int32(82), + xmin = cms.double(-4.1), + xmax = cms.double(4.1), + ymin = cms.double(-0.02), + ymax = cms.double(0.02), + switch = cms.bool(True) + ), + PullX_eta = cms.PSet( + NxBins = cms.int32(82), + xmin = cms.double(-4.1), + xmax = cms.double(4.1), + ymin = cms.double(-4.), + ymax = cms.double(4.), + switch = cms.bool(True) + ), + PullY_eta = cms.PSet( + NxBins = cms.int32(82), + xmin = cms.double(-4.1), + xmax = cms.double(4.1), + ymin = cms.double(-4.), + ymax = cms.double(4.), + switch = cms.bool(True) + ), + nRecHits_primary = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(0.), + xmax = cms.double(0.), + switch = cms.bool(True) + ), + DeltaX_primary = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(-0.2), + xmax = cms.double(0.2), + switch = cms.bool(True) + ), + DeltaY_primary = cms.PSet( + NxBins = cms.int32(100), + xmin = cms.double(-0.2), + xmax = cms.double(0.2), + switch = cms.bool(True) + ), + PullX_primary = cms.PSet( + NxBins = cms.int32(82), + xmin = cms.double(-4.1), + xmax = cms.double(4.1), + ymin = cms.double(-4.), + ymax = cms.double(4.), + switch = cms.bool(True) + ), + PullY_primary = cms.PSet( + NxBins = cms.int32(82), + xmin = cms.double(-4.1), + xmax = cms.double(4.1), + ymin = cms.double(-4.), + ymax = cms.double(4.), + switch = cms.bool(True) + ) ) diff --git a/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py b/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py index 47cfa29845a05..ae65faa17f373 100644 --- a/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py +++ b/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py @@ -1,4 +1,7 @@ import FWCore.ParameterSet.Config as cms from Validation.SiTrackerPhase2V.Phase2TrackerValidateDigi_cff import * - -trackerphase2ValidationSource = cms.Sequence(pixDigiValid + otDigiValid ) +from Validation.SiTrackerPhase2V.Phase2ITValidateRecHit_cfi import * +trackerphase2ValidationSource = cms.Sequence(pixDigiValid + + otDigiValid + + rechitValidIT +) diff --git a/Validation/SiTrackerPhase2V/test/ValidateRecHit_TrackerPhase2Standalone_cfg.py b/Validation/SiTrackerPhase2V/test/ValidateRecHit_TrackerPhase2Standalone_cfg.py index b8d0126e3a8b1..2eb196b01c90e 100644 --- a/Validation/SiTrackerPhase2V/test/ValidateRecHit_TrackerPhase2Standalone_cfg.py +++ b/Validation/SiTrackerPhase2V/test/ValidateRecHit_TrackerPhase2Standalone_cfg.py @@ -93,6 +93,6 @@ ''' process.p = cms.Path(process.siPixelRecHits #*process.siPhase2RecHits - #* process.rechitValidIT + * process.rechitValidIT #* process.rechitValidOT * process.dqm_comm ) From 5e2292a9f2ed8f4dd165568a4646ea33b95e51ed Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 5 Oct 2020 13:31:51 +0200 Subject: [PATCH 03/12] adding utility headers --- .../interface/TrackerPhase2DQMUtil.h | 102 ++++++++++++++++++ .../interface/TrackerPhase2ValidationUtil.h | 23 ++++ 2 files changed, 125 insertions(+) create mode 100644 DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h create mode 100644 Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h diff --git a/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h b/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h new file mode 100644 index 0000000000000..9d29fed3d004d --- /dev/null +++ b/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h @@ -0,0 +1,102 @@ +#ifndef _Validation_SiTrackerPhase2V_Phase2TrackierValidationUtil_h +#define _Validation_SiTrackerPhase2V_Phase2TrackierValidationUtil_h +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMStore.h" +#include +#include + +namespace Phase2TkUtil { + +std::string getITHistoId(uint32_t det_id, const TrackerTopology* tTopo) { + std::string Disc; + std::ostringstream fname1; + int layer = tTopo->getITPixelLayerNumber(det_id); + + if(layer < 0) + return ""; + if (layer < 100) { + fname1 << "Barrel/"; + fname1 << "Layer" << layer; + fname1 << ""; + } else { + int side = tTopo->pxfSide(det_id); + fname1 << "EndCap_Side" << side << "/"; + int disc = tTopo->pxfDisk(det_id); + Disc = (disc < 9) ? "EPix" : "FPix";; + fname1 << Disc << "/"; + int ring = tTopo->pxfBlade(det_id); + fname1 << "Ring" << ring; + } + return fname1.str(); +} + +std::string getOTHistoId(uint32_t det_id, const TrackerTopology* tTopo) { + std::string Disc; + std::ostringstream fname1; + int layer = tTopo->getOTLayerNumber(det_id); + + if(layer < 0) + return ""; + if (layer < 100) { + fname1 << "Barrel/"; + fname1 << "Layer" << layer; + fname1 << ""; + } else { + int side = tTopo->tidSide(det_id); + fname1 << "EndCap_Side" << side << "/"; + int disc = tTopo->tidWheel(det_id); + Disc = (disc < 3) ? "TEDD_1" : "TEDD_2"; + fname1 << Disc << "/"; + int ring = tTopo->tidRing(det_id); + fname1 << "Ring" << ring; + } + return fname1.str(); +} + +typedef dqm::reco::MonitorElement MonitorElement; +typedef dqm::reco::DQMStore DQMStore; +MonitorElement* book1DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { + MonitorElement* temp = nullptr; + if(hpars.getParameter("switch")) { + temp = ibooker.book1D(hname, + hname, + hpars.getParameter("NxBins"), + hpars.getParameter("xmin"), + hpars.getParameter("xmax")); + } + return temp; +} + +MonitorElement* book2DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { + MonitorElement* temp = nullptr; + if(hpars.getParameter("switch")) { + temp = ibooker.book2D(hname, + hname, + hpars.getParameter("NxBins"), + hpars.getParameter("xmin"), + hpars.getParameter("xmax"), + hpars.getParameter("NyBins"), + hpars.getParameter("ymin"), + hpars.getParameter("ymax")); + } + return temp; +} + +MonitorElement* bookProfile1DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { + MonitorElement* temp = nullptr; + if(hpars.getParameter("switch")) { + temp = ibooker.bookProfile(hname, + hname, + hpars.getParameter("NxBins"), + hpars.getParameter("xmin"), + hpars.getParameter("xmax"), + hpars.getParameter("ymin"), + hpars.getParameter("ymax")); + } + return temp; +} +} + +#endif diff --git a/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h b/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h new file mode 100644 index 0000000000000..0b32f0408fe5c --- /dev/null +++ b/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h @@ -0,0 +1,23 @@ +#ifndef _Validation_SiTrackerPhase2V_TrackerPhase2ValidationUtil_h +#define _Validation_SiTrackerPhase2V_TrackerPhase2ValidationUtil_h +#include "SimDataFormats/TrackingHit/interface/PSimHit.h" +#include "SimDataFormats/Track/interface/SimTrack.h" +#include +#include + +namespace Phase2TkUtil { + +bool isPrimary(const SimTrack& simTrk, const PSimHit* simHit){ + bool retval = false; + unsigned int trkId = simTrk.trackId(); + if (trkId != simHit->trackId()) + return retval; + int vtxIndex = simTrk.vertIndex(); + int ptype = simHit->processType(); + if ((vtxIndex == 0) && (ptype == 0)) + return true; + return false; +} + +} +#endif From 66cc13528f720dbf444c9d7603151b232820e623 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 5 Oct 2020 13:43:06 +0200 Subject: [PATCH 04/12] correcting code format --- .../interface/TrackerPhase2DQMUtil.h | 169 +++++++------- .../plugins/Phase2ITMonitorRecHit.cc | 213 ++++++++---------- .../plugins/Phase2ITMonitorRecHit.h | 17 +- .../interface/TrackerPhase2ValidationUtil.h | 28 +-- 4 files changed, 205 insertions(+), 222 deletions(-) diff --git a/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h b/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h index 9d29fed3d004d..bb32e0cb90f77 100644 --- a/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h +++ b/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h @@ -4,99 +4,102 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DQMServices/Core/interface/MonitorElement.h" #include "DQMServices/Core/interface/DQMStore.h" -#include -#include +#include +#include namespace Phase2TkUtil { -std::string getITHistoId(uint32_t det_id, const TrackerTopology* tTopo) { - std::string Disc; - std::ostringstream fname1; - int layer = tTopo->getITPixelLayerNumber(det_id); - - if(layer < 0) - return ""; - if (layer < 100) { - fname1 << "Barrel/"; - fname1 << "Layer" << layer; - fname1 << ""; - } else { - int side = tTopo->pxfSide(det_id); - fname1 << "EndCap_Side" << side << "/"; - int disc = tTopo->pxfDisk(det_id); - Disc = (disc < 9) ? "EPix" : "FPix";; - fname1 << Disc << "/"; - int ring = tTopo->pxfBlade(det_id); - fname1 << "Ring" << ring; + std::string getITHistoId(uint32_t det_id, const TrackerTopology* tTopo) { + std::string Disc; + std::ostringstream fname1; + int layer = tTopo->getITPixelLayerNumber(det_id); + + if (layer < 0) + return ""; + if (layer < 100) { + fname1 << "Barrel/"; + fname1 << "Layer" << layer; + fname1 << ""; + } else { + int side = tTopo->pxfSide(det_id); + fname1 << "EndCap_Side" << side << "/"; + int disc = tTopo->pxfDisk(det_id); + Disc = (disc < 9) ? "EPix" : "FPix"; + ; + fname1 << Disc << "/"; + int ring = tTopo->pxfBlade(det_id); + fname1 << "Ring" << ring; + } + return fname1.str(); } - return fname1.str(); -} -std::string getOTHistoId(uint32_t det_id, const TrackerTopology* tTopo) { - std::string Disc; - std::ostringstream fname1; - int layer = tTopo->getOTLayerNumber(det_id); - - if(layer < 0) - return ""; - if (layer < 100) { - fname1 << "Barrel/"; - fname1 << "Layer" << layer; - fname1 << ""; - } else { - int side = tTopo->tidSide(det_id); - fname1 << "EndCap_Side" << side << "/"; - int disc = tTopo->tidWheel(det_id); - Disc = (disc < 3) ? "TEDD_1" : "TEDD_2"; - fname1 << Disc << "/"; - int ring = tTopo->tidRing(det_id); - fname1 << "Ring" << ring; + std::string getOTHistoId(uint32_t det_id, const TrackerTopology* tTopo) { + std::string Disc; + std::ostringstream fname1; + int layer = tTopo->getOTLayerNumber(det_id); + + if (layer < 0) + return ""; + if (layer < 100) { + fname1 << "Barrel/"; + fname1 << "Layer" << layer; + fname1 << ""; + } else { + int side = tTopo->tidSide(det_id); + fname1 << "EndCap_Side" << side << "/"; + int disc = tTopo->tidWheel(det_id); + Disc = (disc < 3) ? "TEDD_1" : "TEDD_2"; + fname1 << Disc << "/"; + int ring = tTopo->tidRing(det_id); + fname1 << "Ring" << ring; + } + return fname1.str(); } - return fname1.str(); -} -typedef dqm::reco::MonitorElement MonitorElement; -typedef dqm::reco::DQMStore DQMStore; -MonitorElement* book1DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { - MonitorElement* temp = nullptr; - if(hpars.getParameter("switch")) { - temp = ibooker.book1D(hname, - hname, - hpars.getParameter("NxBins"), - hpars.getParameter("xmin"), - hpars.getParameter("xmax")); + typedef dqm::reco::MonitorElement MonitorElement; + typedef dqm::reco::DQMStore DQMStore; + MonitorElement* book1DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { + MonitorElement* temp = nullptr; + if (hpars.getParameter("switch")) { + temp = ibooker.book1D(hname, + hname, + hpars.getParameter("NxBins"), + hpars.getParameter("xmin"), + hpars.getParameter("xmax")); + } + return temp; } - return temp; -} -MonitorElement* book2DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { - MonitorElement* temp = nullptr; - if(hpars.getParameter("switch")) { - temp = ibooker.book2D(hname, - hname, - hpars.getParameter("NxBins"), - hpars.getParameter("xmin"), - hpars.getParameter("xmax"), - hpars.getParameter("NyBins"), - hpars.getParameter("ymin"), - hpars.getParameter("ymax")); + MonitorElement* book2DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { + MonitorElement* temp = nullptr; + if (hpars.getParameter("switch")) { + temp = ibooker.book2D(hname, + hname, + hpars.getParameter("NxBins"), + hpars.getParameter("xmin"), + hpars.getParameter("xmax"), + hpars.getParameter("NyBins"), + hpars.getParameter("ymin"), + hpars.getParameter("ymax")); + } + return temp; } - return temp; -} -MonitorElement* bookProfile1DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { - MonitorElement* temp = nullptr; - if(hpars.getParameter("switch")) { - temp = ibooker.bookProfile(hname, - hname, - hpars.getParameter("NxBins"), - hpars.getParameter("xmin"), - hpars.getParameter("xmax"), - hpars.getParameter("ymin"), - hpars.getParameter("ymax")); + MonitorElement* bookProfile1DFromPSet(const edm::ParameterSet& hpars, + const std::string& hname, + DQMStore::IBooker& ibooker) { + MonitorElement* temp = nullptr; + if (hpars.getParameter("switch")) { + temp = ibooker.bookProfile(hname, + hname, + hpars.getParameter("NxBins"), + hpars.getParameter("xmin"), + hpars.getParameter("xmax"), + hpars.getParameter("ymin"), + hpars.getParameter("ymax")); + } + return temp; } - return temp; -} -} - +} // namespace Phase2TkUtil + #endif diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc index d69214993394b..85a9405549d09 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc @@ -29,10 +29,9 @@ // // constructors // -Phase2ITMonitorRecHit::Phase2ITMonitorRecHit(const edm::ParameterSet& iConfig): - config_(iConfig), - tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))) -{ +Phase2ITMonitorRecHit::Phase2ITMonitorRecHit(const edm::ParameterSet& iConfig) + : config_(iConfig), + tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))) { edm::LogInfo("Phase2ITMonitorRecHit") << ">>> Construct Phase2ITMonitorRecHit "; } @@ -41,7 +40,6 @@ Phase2ITMonitorRecHit::~Phase2ITMonitorRecHit() { } // -- Analyze void Phase2ITMonitorRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // Get the geometry edm::ESHandle geomHandle; iSetup.get().get(geomHandle); @@ -54,17 +52,18 @@ void Phase2ITMonitorRecHit::analyze(const edm::Event& iEvent, const edm::EventSe fillITHistos(iEvent, tTopo, tkGeom); } -void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent, - const TrackerTopology* tTopo, - const TrackerGeometry* tkGeom) { +void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent, + const TrackerTopology* tTopo, + const TrackerGeometry* tkGeom) { // Get the RecHits edm::Handle rechits; iEvent.getByToken(tokenRecHitsIT_, rechits); - if(!rechits.isValid()) return; - std::map nrechitLayerMap; + if (!rechits.isValid()) + return; + std::map nrechitLayerMap; unsigned long int nTotrechitsinevt = 0; // Loop over modules - SiPixelRecHitCollection::const_iterator DSViter; + SiPixelRecHitCollection::const_iterator DSViter; for (DSViter = rechits->begin(); DSViter != rechits->end(); ++DSViter) { // Get the detector id unsigned int rawid(DSViter->detId()); @@ -75,54 +74,62 @@ void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent, continue; std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo); nTotrechitsinevt += DSViter->size(); - if(nrechitLayerMap.find(key) == nrechitLayerMap.end()) { - nrechitLayerMap.insert(std::make_pair(key, DSViter->size())); + if (nrechitLayerMap.find(key) == nrechitLayerMap.end()) { + nrechitLayerMap.insert(std::make_pair(key, DSViter->size())); } else { nrechitLayerMap[key] += DSViter->size(); } - + edmNew::DetSet::const_iterator rechitIt; //loop over rechits for a single detId - for(rechitIt = DSViter->begin(); rechitIt != DSViter->end(); ++rechitIt) { + for (rechitIt = DSViter->begin(); rechitIt != DSViter->end(); ++rechitIt) { LocalPoint lp = rechitIt->localPosition(); Global3DPoint globalPos = geomDetunit->surface().toGlobal(lp); //in mm - double gx = globalPos.x()*10.; - double gy = globalPos.y()*10.; - double gz = globalPos.z()*10.; - double gr = globalPos.perp()*10.; + double gx = globalPos.x() * 10.; + double gy = globalPos.y() * 10.; + double gz = globalPos.z() * 10.; + double gr = globalPos.perp() * 10.; //Fill global positions - if(geomDetunit->subDetector() == GeomDetEnumerators::SubDetector::P2PXB) { - globalXY_barrel_->Fill(gx, gy); - globalRZ_barrel_->Fill(gz, gr); - } else if(geomDetunit->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) { - globalXY_endcap_->Fill(gx, gy); - globalRZ_endcap_->Fill(gz, gr); + if (geomDetunit->subDetector() == GeomDetEnumerators::SubDetector::P2PXB) { + globalXY_barrel_->Fill(gx, gy); + globalRZ_barrel_->Fill(gz, gr); + } else if (geomDetunit->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC) { + globalXY_endcap_->Fill(gx, gy); + globalRZ_endcap_->Fill(gz, gr); } //layer wise histo - if(layerMEs_[key].clusterSizeX) layerMEs_[key].clusterSizeX->Fill(rechitIt->cluster()->sizeX()); - if(layerMEs_[key].clusterSizeY) layerMEs_[key].clusterSizeY->Fill(rechitIt->cluster()->sizeY()); - if(layerMEs_[key].globalPosXY) layerMEs_[key].globalPosXY->Fill(gx, gy); - if(layerMEs_[key].globalPosRZ) layerMEs_[key].globalPosRZ->Fill(gz, gr); - if(layerMEs_[key].localPosXY) layerMEs_[key].localPosXY->Fill(lp.x(), lp.y()); - if(layerMEs_[key].posX) layerMEs_[key].posX->Fill(lp.x()); - if(layerMEs_[key].posY) layerMEs_[key].posX->Fill(lp.y()); - if(layerMEs_[key].posX) layerMEs_[key].poserrX->Fill(rechitIt->localPositionError().xx()); - if(layerMEs_[key].posY) layerMEs_[key].poserrY->Fill(rechitIt->localPositionError().yy()); - }//end loop over rechits of a detId - } //End loop over DetSetVector - + if (layerMEs_[key].clusterSizeX) + layerMEs_[key].clusterSizeX->Fill(rechitIt->cluster()->sizeX()); + if (layerMEs_[key].clusterSizeY) + layerMEs_[key].clusterSizeY->Fill(rechitIt->cluster()->sizeY()); + if (layerMEs_[key].globalPosXY) + layerMEs_[key].globalPosXY->Fill(gx, gy); + if (layerMEs_[key].globalPosRZ) + layerMEs_[key].globalPosRZ->Fill(gz, gr); + if (layerMEs_[key].localPosXY) + layerMEs_[key].localPosXY->Fill(lp.x(), lp.y()); + if (layerMEs_[key].posX) + layerMEs_[key].posX->Fill(lp.x()); + if (layerMEs_[key].posY) + layerMEs_[key].posX->Fill(lp.y()); + if (layerMEs_[key].posX) + layerMEs_[key].poserrX->Fill(rechitIt->localPositionError().xx()); + if (layerMEs_[key].posY) + layerMEs_[key].poserrY->Fill(rechitIt->localPositionError().yy()); + } //end loop over rechits of a detId + } //End loop over DetSetVector + //fill nRecHits per event numberRecHits_->Fill(nTotrechitsinevt); //fill nRecHit counter per layer - for(auto& lme : nrechitLayerMap) - if(layerMEs_[lme.first].numberRecHits) + for (auto& lme : nrechitLayerMap) + if (layerMEs_[lme.first].numberRecHits) layerMEs_[lme.first].numberRecHits->Fill(lme.second); } void Phase2ITMonitorRecHit::bookHistograms(DQMStore::IBooker& ibooker, - edm::Run const& iRun, - edm::EventSetup const& iSetup) { - + edm::Run const& iRun, + edm::EventSetup const& iSetup) { std::string top_folder = config_.getParameter("TopFolderName"); ibooker.cd(); edm::LogInfo("Phase2ITMonitorRecHit") << " Booking Histograms in : " << top_folder; @@ -132,29 +139,24 @@ void Phase2ITMonitorRecHit::bookHistograms(DQMStore::IBooker& ibooker, //Global histos for IT HistoName.str(""); HistoName << "NumberRecHits"; - numberRecHits_ = Phase2TkUtil::book1DFromPSet(config_.getParameter("GlobalNumberRecHits"), - HistoName.str(), - ibooker); + numberRecHits_ = Phase2TkUtil::book1DFromPSet( + config_.getParameter("GlobalNumberRecHits"), HistoName.str(), ibooker); HistoName.str(""); HistoName << "Global_Position_XY_IT_barrel"; - globalXY_barrel_ = Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionXY_PXB"), - HistoName.str(), - ibooker); + globalXY_barrel_ = Phase2TkUtil::book2DFromPSet( + config_.getParameter("GlobalPositionXY_PXB"), HistoName.str(), ibooker); HistoName.str(""); HistoName << "Global_Position_RZ_IT_barrel"; - globalRZ_barrel_ = Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionRZ_PXB"), - HistoName.str(), - ibooker); + globalRZ_barrel_ = Phase2TkUtil::book2DFromPSet( + config_.getParameter("GlobalPositionRZ_PXB"), HistoName.str(), ibooker); HistoName.str(""); HistoName << "Global_Position_XY_IT_endcap"; - globalXY_endcap_ = Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionXY_PXEC"), - HistoName.str(), - ibooker); + globalXY_endcap_ = Phase2TkUtil::book2DFromPSet( + config_.getParameter("GlobalPositionXY_PXEC"), HistoName.str(), ibooker); HistoName.str(""); HistoName << "Global_Position_RZ_IT_endcap"; - globalRZ_endcap_ = Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionRZ_PXEC"), - HistoName.str(), - ibooker); + globalRZ_endcap_ = Phase2TkUtil::book2DFromPSet( + config_.getParameter("GlobalPositionRZ_PXEC"), HistoName.str(), ibooker); //Now book layer wise histos edm::ESWatcher theTkDigiGeomWatcher; @@ -167,100 +169,79 @@ void Phase2ITMonitorRecHit::bookHistograms(DQMStore::IBooker& ibooker, const TrackerGeometry* tGeom = geom_handle.product(); for (auto const& det_u : tGeom->detUnits()) { //Always check TrackerNumberingBuilder before changing this part - if(!(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB - || det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC)) - continue; + if (!(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB || + det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC)) + continue; unsigned int detId_raw = det_u->geographicalId().rawId(); - edm::LogInfo("Phase2ITMonitorRecHit") << "Detid:" << detId_raw - <<"\tsubdet=" << det_u->subDetector() - << "\t key=" << Phase2TkUtil::getITHistoId(detId_raw, tTopo) - << std::endl; + edm::LogInfo("Phase2ITMonitorRecHit") << "Detid:" << detId_raw << "\tsubdet=" << det_u->subDetector() + << "\t key=" << Phase2TkUtil::getITHistoId(detId_raw, tTopo) << std::endl; bookLayerHistos(ibooker, detId_raw, tTopo, dir); } } } // -- Book Layer Histograms void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, - unsigned int det_id, - const TrackerTopology* tTopo, - std::string& subdir) { + unsigned int det_id, + const TrackerTopology* tTopo, + std::string& subdir) { std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo); - if(key.empty()) return; + if (key.empty()) + return; if (layerMEs_.find(key) == layerMEs_.end()) { ibooker.cd(); RecHitME local_histos; std::ostringstream histoName; - ibooker.setCurrentFolder(subdir+"/"+key); - std::cout<< "Setting subfolder>>>" << subdir << "\t" << key << std::endl; - edm::LogInfo("Phase2ITMonitorRecHit") << " Booking Histograms in : " << (subdir+"/"+key); + ibooker.setCurrentFolder(subdir + "/" + key); + std::cout << "Setting subfolder>>>" << subdir << "\t" << key << std::endl; + edm::LogInfo("Phase2ITMonitorRecHit") << " Booking Histograms in : " << (subdir + "/" + key); histoName.str(""); histoName << "Number_RecHits"; - local_histos.numberRecHits = - Phase2TkUtil::book1DFromPSet(config_.getParameter("LocalNumberRecHits"), - histoName.str(), - ibooker); + local_histos.numberRecHits = Phase2TkUtil::book1DFromPSet( + config_.getParameter("LocalNumberRecHits"), histoName.str(), ibooker); histoName.str(""); histoName << "RecHit_X"; - local_histos.posX = - Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosX"), - histoName.str(), - ibooker); + local_histos.posX = + Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosX"), histoName.str(), ibooker); histoName.str(""); histoName << "RecHit_Y"; - local_histos.posY = - Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosY"), - histoName.str(), - ibooker); + local_histos.posY = + Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosY"), histoName.str(), ibooker); histoName.str(""); histoName << "RecHit_X_error"; - local_histos.poserrX = - Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosErrorX"), - histoName.str(), - ibooker); + local_histos.poserrX = Phase2TkUtil::book1DFromPSet( + config_.getParameter("RecHitPosErrorX"), histoName.str(), ibooker); histoName.str(""); histoName << "RecHit_Y_error"; - local_histos.poserrY = - Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosErrorY"), - histoName.str(), - ibooker); + local_histos.poserrY = Phase2TkUtil::book1DFromPSet( + config_.getParameter("RecHitPosErrorY"), histoName.str(), ibooker); histoName.str(""); histoName << "Cluster_SizeX"; - local_histos.clusterSizeX = - Phase2TkUtil::book1DFromPSet(config_.getParameter("LocalClusterSizeX"), - histoName.str(), - ibooker); + local_histos.clusterSizeX = Phase2TkUtil::book1DFromPSet( + config_.getParameter("LocalClusterSizeX"), histoName.str(), ibooker); histoName.str(""); histoName << "Cluster_SizeY"; - local_histos.clusterSizeY = - Phase2TkUtil::book1DFromPSet(config_.getParameter("LocalClusterSizeY"), - histoName.str(), - ibooker); + local_histos.clusterSizeY = Phase2TkUtil::book1DFromPSet( + config_.getParameter("LocalClusterSizeY"), histoName.str(), ibooker); histoName.str(""); - histoName << "Global_Position_XY"; - local_histos.globalPosXY = - Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionXY_perlayer"), - histoName.str(), - ibooker); + histoName << "Global_Position_XY"; + local_histos.globalPosXY = Phase2TkUtil::book2DFromPSet( + config_.getParameter("GlobalPositionXY_perlayer"), histoName.str(), ibooker); - histoName.str(""); - histoName << "Global_Position_RZ"; - local_histos.globalPosRZ = - Phase2TkUtil::book2DFromPSet(config_.getParameter("GlobalPositionRZ_perlayer"), - histoName.str(), - ibooker); histoName.str(""); - histoName << "Local_Position_XY" ; - local_histos.localPosXY = - Phase2TkUtil::book2DFromPSet(config_.getParameter("LocalPositionXY"), - histoName.str(), - ibooker); + histoName << "Global_Position_RZ"; + local_histos.globalPosRZ = Phase2TkUtil::book2DFromPSet( + config_.getParameter("GlobalPositionRZ_perlayer"), histoName.str(), ibooker); + histoName.str(""); + histoName << "Local_Position_XY"; + local_histos.localPosXY = Phase2TkUtil::book2DFromPSet( + config_.getParameter("LocalPositionXY"), histoName.str(), ibooker); layerMEs_.insert(std::make_pair(key, local_histos)); } -} +} //define this as a plug-in DEFINE_FWK_MODULE(Phase2ITMonitorRecHit); diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h index d1d709c68e4c0..9640153e7d3d1 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h @@ -21,7 +21,6 @@ #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" - // DQM Histograming class TrackerTopology; class TrackerGeometry; @@ -32,13 +31,14 @@ class Phase2ITMonitorRecHit : public DQMEDAnalyzer { ~Phase2ITMonitorRecHit() 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; - - private: - void fillITHistos(const edm::Event& iEvent, - const TrackerTopology* tTopo, - const TrackerGeometry* tkGeom); - void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, const TrackerTopology* tTopo, std::string& subdir); +private: + void fillITHistos(const edm::Event& iEvent, const TrackerTopology* tTopo, const TrackerGeometry* tkGeom); + + void bookLayerHistos(DQMStore::IBooker& ibooker, + unsigned int det_id, + const TrackerTopology* tTopo, + std::string& subdir); edm::ParameterSet config_; std::string geomType_; @@ -61,8 +61,7 @@ class Phase2ITMonitorRecHit : public DQMEDAnalyzer { MonitorElement* poserrY = nullptr; MonitorElement* clusterSizeX = nullptr; MonitorElement* clusterSizeY = nullptr; - }; - std::map layerMEs_; + std::map layerMEs_; }; #endif diff --git a/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h b/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h index 0b32f0408fe5c..0dc8bcf66f9c1 100644 --- a/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h +++ b/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h @@ -2,22 +2,22 @@ #define _Validation_SiTrackerPhase2V_TrackerPhase2ValidationUtil_h #include "SimDataFormats/TrackingHit/interface/PSimHit.h" #include "SimDataFormats/Track/interface/SimTrack.h" -#include -#include +#include +#include namespace Phase2TkUtil { -bool isPrimary(const SimTrack& simTrk, const PSimHit* simHit){ - bool retval = false; - unsigned int trkId = simTrk.trackId(); - if (trkId != simHit->trackId()) - return retval; - int vtxIndex = simTrk.vertIndex(); - int ptype = simHit->processType(); - if ((vtxIndex == 0) && (ptype == 0)) - return true; - return false; -} + bool isPrimary(const SimTrack& simTrk, const PSimHit* simHit) { + bool retval = false; + unsigned int trkId = simTrk.trackId(); + if (trkId != simHit->trackId()) + return retval; + int vtxIndex = simTrk.vertIndex(); + int ptype = simHit->processType(); + if ((vtxIndex == 0) && (ptype == 0)) + return true; + return false; + } -} +} // namespace Phase2TkUtil #endif From 14b04a8525855ff57e25670e85ce356bd3215b14 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 5 Oct 2020 16:04:56 +0200 Subject: [PATCH 05/12] removing cout;using esconsume --- .../plugins/Phase2ITMonitorRecHit.cc | 56 ++++++++----------- .../plugins/Phase2ITMonitorRecHit.h | 15 +++-- .../plugins/Phase2ITValidateRecHit.cc | 52 +++++++++-------- .../plugins/Phase2ITValidateRecHit.h | 17 +++--- 4 files changed, 65 insertions(+), 75 deletions(-) diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc index 85a9405549d09..af63ab4cdcddb 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc @@ -20,6 +20,8 @@ #include "Geometry/CommonDetUnit/interface/TrackerGeomDet.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/GeometrySurface/interface/LocalError.h" @@ -31,7 +33,9 @@ // Phase2ITMonitorRecHit::Phase2ITMonitorRecHit(const edm::ParameterSet& iConfig) : config_(iConfig), - tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))) { + tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))), + geomToken_(esConsumes()), + topoToken_(esConsumes()) { edm::LogInfo("Phase2ITMonitorRecHit") << ">>> Construct Phase2ITMonitorRecHit "; } @@ -39,22 +43,9 @@ Phase2ITMonitorRecHit::~Phase2ITMonitorRecHit() { edm::LogInfo("Phase2ITMonitorRecHit") << ">>> Destroy Phase2ITMonitorRecHit "; } // -- Analyze -void Phase2ITMonitorRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // Get the geometry - edm::ESHandle geomHandle; - iSetup.get().get(geomHandle); - const TrackerGeometry* tkGeom = &(*geomHandle); - - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* tTopo = tTopoHandle.product(); - - fillITHistos(iEvent, tTopo, tkGeom); -} +void Phase2ITMonitorRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { fillITHistos(iEvent); } -void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent, - const TrackerTopology* tTopo, - const TrackerGeometry* tkGeom) { +void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent) { // Get the RecHits edm::Handle rechits; iEvent.getByToken(tokenRecHitsIT_, rechits); @@ -69,10 +60,10 @@ void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent, unsigned int rawid(DSViter->detId()); DetId detId(rawid); // Get the geomdet - const GeomDetUnit* geomDetunit(tkGeom->idToDetUnit(detId)); + const GeomDetUnit* geomDetunit(tkGeom_->idToDetUnit(detId)); if (!geomDetunit) continue; - std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo); + std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo_); nTotrechitsinevt += DSViter->size(); if (nrechitLayerMap.find(key) == nrechitLayerMap.end()) { nrechitLayerMap.insert(std::make_pair(key, DSViter->size())); @@ -127,6 +118,14 @@ void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent, if (layerMEs_[lme.first].numberRecHits) layerMEs_[lme.first].numberRecHits->Fill(lme.second); } + +void Phase2ITMonitorRecHit::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + edm::ESHandle geomHandle = iSetup.getHandle(geomToken_); + tkGeom_ = &(*geomHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(topoToken_); + tTopo_ = tTopoHandle.product(); +} + void Phase2ITMonitorRecHit::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const& iSetup) { @@ -160,31 +159,23 @@ void Phase2ITMonitorRecHit::bookHistograms(DQMStore::IBooker& ibooker, //Now book layer wise histos edm::ESWatcher theTkDigiGeomWatcher; - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); if (theTkDigiGeomWatcher.check(iSetup)) { - edm::ESHandle geom_handle; - iSetup.get().get(geomType_, geom_handle); - const TrackerGeometry* tGeom = geom_handle.product(); - for (auto const& det_u : tGeom->detUnits()) { + edm::ESHandle geomHandle = iSetup.getHandle(geomToken_); + for (auto const& det_u : tkGeom_->detUnits()) { //Always check TrackerNumberingBuilder before changing this part if (!(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB || det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC)) continue; unsigned int detId_raw = det_u->geographicalId().rawId(); edm::LogInfo("Phase2ITMonitorRecHit") << "Detid:" << detId_raw << "\tsubdet=" << det_u->subDetector() - << "\t key=" << Phase2TkUtil::getITHistoId(detId_raw, tTopo) << std::endl; - bookLayerHistos(ibooker, detId_raw, tTopo, dir); + << "\t key=" << Phase2TkUtil::getITHistoId(detId_raw, tTopo_) << std::endl; + bookLayerHistos(ibooker, detId_raw, dir); } } } // -- Book Layer Histograms -void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, - unsigned int det_id, - const TrackerTopology* tTopo, - std::string& subdir) { - std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo); +void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir) { + std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo_); if (key.empty()) return; if (layerMEs_.find(key) == layerMEs_.end()) { @@ -192,7 +183,6 @@ void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, RecHitME local_histos; std::ostringstream histoName; ibooker.setCurrentFolder(subdir + "/" + key); - std::cout << "Setting subfolder>>>" << subdir << "\t" << key << std::endl; edm::LogInfo("Phase2ITMonitorRecHit") << " Booking Histograms in : " << (subdir + "/" + key); histoName.str(""); histoName << "Number_RecHits"; diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h index 9640153e7d3d1..da4deef8329b4 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h @@ -24,25 +24,28 @@ // DQM Histograming class TrackerTopology; class TrackerGeometry; - +class TrackerDigiGeometryRecord; +class TrackerTopologyRcd; class Phase2ITMonitorRecHit : public DQMEDAnalyzer { public: explicit Phase2ITMonitorRecHit(const edm::ParameterSet&); ~Phase2ITMonitorRecHit() 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; + void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup); private: - void fillITHistos(const edm::Event& iEvent, const TrackerTopology* tTopo, const TrackerGeometry* tkGeom); + void fillITHistos(const edm::Event& iEvent); - void bookLayerHistos(DQMStore::IBooker& ibooker, - unsigned int det_id, - const TrackerTopology* tTopo, - std::string& subdir); + void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir); edm::ParameterSet config_; std::string geomType_; const edm::EDGetTokenT tokenRecHitsIT_; + const edm::ESGetToken geomToken_; + const edm::ESGetToken topoToken_; + const TrackerGeometry* tkGeom_ = nullptr; + const TrackerTopology* tTopo_ = nullptr; MonitorElement* numberRecHits_; MonitorElement* globalXY_barrel_; diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index 6567d20512a30..5705f4905b087 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -21,6 +21,8 @@ #include "Geometry/CommonDetUnit/interface/TrackerGeomDet.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "DataFormats/GeometrySurface/interface/LocalError.h" @@ -39,7 +41,9 @@ Phase2ITValidateRecHit::Phase2ITValidateRecHit(const edm::ParameterSet& iConfig) trackerHitAssociatorConfig_(iConfig, consumesCollector()), simtrackminpt_(iConfig.getParameter("SimTrackMinPt")), tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))), - simTracksToken_(consumes(iConfig.getParameter("simTracksSrc"))) { + simTracksToken_(consumes(iConfig.getParameter("simTracksSrc"))), + geomToken_(esConsumes()), + topoToken_(esConsumes()) { edm::LogInfo("Phase2ITValidateRecHit") << ">>> Construct Phase2ITValidateRecHit "; for (const auto& itag : config_.getParameter>("PSimHitSource")) simHitTokens_.push_back(consumes(itag)); @@ -50,14 +54,14 @@ Phase2ITValidateRecHit::~Phase2ITValidateRecHit() { } void Phase2ITValidateRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // Get the geometry - edm::ESHandle geomHandle; - iSetup.get().get(geomHandle); + /* edm::ESHandle geomHandle = iSetup.getHandle(geomToken_); + //iSetup.get().get(geomHandle); const TrackerGeometry* tkGeom = &(*geomHandle); - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(topoToken_); + //iSetup.get().get(tTopoHandle); const TrackerTopology* tTopo = tTopoHandle.product(); - + */ std::vector> simHits; for (const auto& itoken : simHitTokens_) { edm::Handle simHitHandle; @@ -78,12 +82,10 @@ void Phase2ITValidateRecHit::analyze(const edm::Event& iEvent, const edm::EventS } } TrackerHitAssociator associateRecHit(iEvent, trackerHitAssociatorConfig_); - fillITHistos(iEvent, tTopo, tkGeom, associateRecHit, simHits, selectedSimTrackMap); + fillITHistos(iEvent, associateRecHit, simHits, selectedSimTrackMap); } void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, - const TrackerTopology* tTopo, - const TrackerGeometry* tkGeom, const TrackerHitAssociator& associateRecHit, const std::vector>& simHits, const std::map& selectedSimTrackMap) { @@ -100,11 +102,11 @@ void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, unsigned int rawid(DSViter->detId()); DetId detId(rawid); // Get the geomdet - const GeomDetUnit* geomDetunit(tkGeom->idToDetUnit(detId)); + const GeomDetUnit* geomDetunit(tkGeom_->idToDetUnit(detId)); if (!geomDetunit) continue; // determine the detector we are in - std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo); + std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo_); if (nrechitLayerMap_primary.find(key) == nrechitLayerMap_primary.end()) { nrechitLayerMap_primary.insert(std::make_pair(key, DSViter->size())); } else { @@ -176,6 +178,13 @@ void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]); } } + +void Phase2ITValidateRecHit::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + edm::ESHandle geomHandle = iSetup.getHandle(geomToken_); + tkGeom_ = &(*geomHandle); + edm::ESHandle tTopoHandle = iSetup.getHandle(topoToken_); + tTopo_ = tTopoHandle.product(); +} // // -- Book Histograms // @@ -185,30 +194,21 @@ void Phase2ITValidateRecHit::bookHistograms(DQMStore::IBooker& ibooker, std::string top_folder = config_.getParameter("TopFolderName"); edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << top_folder; edm::ESWatcher theTkDigiGeomWatcher; - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); if (theTkDigiGeomWatcher.check(iSetup)) { - edm::ESHandle geom_handle; - iSetup.get().get(geomType_, geom_handle); - const TrackerGeometry* tGeom = geom_handle.product(); - for (auto const& det_u : tGeom->detUnits()) { + for (auto const& det_u : tkGeom_->detUnits()) { //Always check TrackerNumberingBuilder before changing this part if (!(det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB || det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC)) continue; unsigned int detId_raw = det_u->geographicalId().rawId(); - bookLayerHistos(ibooker, detId_raw, tTopo, top_folder); + bookLayerHistos(ibooker, detId_raw, top_folder); } } } // -void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, - unsigned int det_id, - const TrackerTopology* tTopo, - std::string& subdir) { +void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir) { ibooker.cd(); - std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo); + std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo_); if (key.empty()) return; if (layerMEs_.find(key) == layerMEs_.end()) { @@ -216,9 +216,7 @@ void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, RecHitME local_histos; std::ostringstream histoName; ibooker.setCurrentFolder(subdir + "/" + key); - std::cout << "Setting subfolder>>>" << subdir << "\t" << key << std::endl; - edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << key; - + edm::LogInfo("Phase2ITValidateRecHit") << " Booking Histograms in : " << (subdir + "/" + key); histoName.str(""); histoName << "Delta_X"; local_histos.deltaX = diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h index 691942933f42d..3a4cbb6f3fb32 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h @@ -28,36 +28,35 @@ class SimTrack; class SimHit; class TrackerTopology; class TrackerGeometry; - +class TrackerDigiGeometryRecord; +class TrackerTopologyRcd; class Phase2ITValidateRecHit : public DQMEDAnalyzer { public: explicit Phase2ITValidateRecHit(const edm::ParameterSet&); ~Phase2ITValidateRecHit() 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; + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; private: void fillITHistos(const edm::Event& iEvent, - const TrackerTopology* tTopo, - const TrackerGeometry* tkGeom, const TrackerHitAssociator& associateRecHit, const std::vector>& simHits, const std::map& selectedSimTrackMap); - void bookLayerHistos(DQMStore::IBooker& ibooker, - unsigned int det_id, - const TrackerTopology* tTopo, - std::string& subdir); + void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir); edm::ParameterSet config_; - bool pixelFlag_; TrackerHitAssociator::Config trackerHitAssociatorConfig_; const double simtrackminpt_; std::string geomType_; const edm::EDGetTokenT tokenRecHitsIT_; const edm::EDGetTokenT simTracksToken_; std::vector> simHitTokens_; - + const edm::ESGetToken geomToken_; + const edm::ESGetToken topoToken_; + const TrackerGeometry* tkGeom_ = nullptr; + const TrackerTopology* tTopo_ = nullptr; struct RecHitME { // use TH1D instead of TH1F to avoid stauration at 2^31 // above this increments with +1 don't work for float, need double From 182d4edaeba41b758d86b7297f6ff83176c7fcca Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 5 Oct 2020 21:02:07 +0200 Subject: [PATCH 06/12] code cleanups;adding fill descriptions;customize for premix wf --- .../plugins/Phase2ITMonitorRecHit.cc | 153 +++++++++++++++++ .../plugins/Phase2ITMonitorRecHit.h | 3 +- .../python/Phase2ITMonitorRecHit_cff.py | 5 + .../python/Phase2ITMonitorRecHit_cfi.py | 120 ------------- .../python/Phase2TrackerDQMFirstStep_cff.py | 2 +- .../plugins/Phase2ITValidateRecHit.cc | 157 ++++++++++++++++-- .../plugins/Phase2ITValidateRecHit.h | 1 + .../python/Phase2ITValidateRecHit_cff.py | 8 + .../python/Phase2ITValidateRecHit_cfi.py | 128 -------------- .../Phase2TrackerValidationFirstStep_cff.py | 2 +- 10 files changed, 316 insertions(+), 263 deletions(-) create mode 100644 DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cff.py delete mode 100644 DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cfi.py create mode 100644 Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cff.py delete mode 100644 Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc index af63ab4cdcddb..5d84526adb5e3 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc @@ -14,6 +14,10 @@ #include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ESWatcher.h" +#include +#include +#include +#include #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" @@ -233,5 +237,154 @@ void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned layerMEs_.insert(std::make_pair(key, local_histos)); } } + +void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + // rechitMonitorIT + edm::ParameterSetDescription desc; + desc.add("TopFolderName", "TrackerPhase2ITRecHit"); + desc.add("rechitsSrc", edm::InputTag("siPixelRecHits")); + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", 0.0); + psd0.add("switch", true); + psd0.add("xmax", 0.0); + psd0.add("NxBins", 50); + desc.add("LocalNumberRecHits", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 300.0); + psd0.add("NxBins", 1500); + psd0.add("NyBins", 300); + psd0.add("switch", true); + psd0.add("xmax", 3000.0); + psd0.add("xmin", -3000.0); + psd0.add("ymin", 0.0); + desc.add("GlobalPositionRZ_perlayer", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 300.0); + psd0.add("NxBins", 1500); + psd0.add("NyBins", 300); + psd0.add("switch", true); + psd0.add("xmax", 3000.0); + psd0.add("xmin", -3000.0); + psd0.add("ymin", 0.0); + desc.add("GlobalPositionRZ_PXB", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 300.0); + psd0.add("NxBins", 600); + psd0.add("NyBins", 600); + psd0.add("switch", true); + psd0.add("xmax", 300.0); + psd0.add("xmin", -300.0); + psd0.add("ymin", -300.0); + desc.add("GlobalPositionXY_PXB", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 300.0); + psd0.add("NxBins", 1500); + psd0.add("NyBins", 300); + psd0.add("switch", true); + psd0.add("xmax", 3000.0); + psd0.add("xmin", -3000.0); + psd0.add("ymin", 0.0); + desc.add("GlobalPositionRZ_PXEC", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", 0.0); + psd0.add("switch", true); + psd0.add("xmax", 0.2); + psd0.add("NxBins", 100); + desc.add("RecHitPosErrorX", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 300.0); + psd0.add("NxBins", 600); + psd0.add("NyBins", 600); + psd0.add("switch", true); + psd0.add("xmax", 300.0); + psd0.add("xmin", -300.0); + psd0.add("ymin", -300.0); + desc.add("GlobalPositionXY_perlayer", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", 0.0); + psd0.add("switch", true); + psd0.add("xmax", 0.0); + psd0.add("NxBins", 50); + desc.add("GlobalNumberRecHits", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -0.5); + psd0.add("switch", true); + psd0.add("xmax", 20.5); + psd0.add("NxBins", 21); + desc.add("LocalClusterSizeX", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -2.5); + psd0.add("switch", true); + psd0.add("xmax", 2.5); + psd0.add("NxBins", 100); + desc.add("RecHitPosY", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", 0.0); + psd0.add("switch", true); + psd0.add("xmax", 0.2); + psd0.add("NxBins", 100); + desc.add("RecHitPosErrorY", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 0.0); + psd0.add("NxBins", 500); + psd0.add("NyBins", 500); + psd0.add("switch", true); + psd0.add("xmax", 0.0); + psd0.add("xmin", 0.0); + psd0.add("ymin", 0.0); + desc.add("LocalPositionXY", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 300.0); + psd0.add("NxBins", 600); + psd0.add("NyBins", 600); + psd0.add("switch", true); + psd0.add("xmax", 300.0); + psd0.add("xmin", -300.0); + psd0.add("ymin", -300.0); + desc.add("GlobalPositionXY_PXEC", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -0.5); + psd0.add("switch", true); + psd0.add("xmax", 20.5); + psd0.add("NxBins", 21); + desc.add("LocalClusterSizeY", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -2.5); + psd0.add("switch", true); + psd0.add("xmax", 2.5); + psd0.add("NxBins", 100); + desc.add("RecHitPosX", psd0); + } + descriptions.add("Phase2ITMonitorRecHit", desc); +} //define this as a plug-in DEFINE_FWK_MODULE(Phase2ITMonitorRecHit); diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h index da4deef8329b4..c2c6ec8f43b2b 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h @@ -32,7 +32,8 @@ class Phase2ITMonitorRecHit : public DQMEDAnalyzer { ~Phase2ITMonitorRecHit() 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; - void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup); + void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: void fillITHistos(const edm::Event& iEvent); diff --git a/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cff.py b/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cff.py new file mode 100644 index 0000000000000..a72ec04912847 --- /dev/null +++ b/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cff.py @@ -0,0 +1,5 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +from DQM.SiTrackerPhase2.Phase2ITMonitorRecHit_cfi import Phase2ITMonitorRecHit + +rechitMonitorIT = Phase2ITMonitorRecHit.clone() diff --git a/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cfi.py b/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cfi.py deleted file mode 100644 index 44febc6bbf1d9..0000000000000 --- a/DQM/SiTrackerPhase2/python/Phase2ITMonitorRecHit_cfi.py +++ /dev/null @@ -1,120 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -rechitMonitorIT = DQMEDAnalyzer('Phase2ITMonitorRecHit', - Verbosity = cms.bool(False), - TopFolderName = cms.string("TrackerPhase2ITRecHit"), - rechitsSrc = cms.InputTag("siPixelRecHits"), - GlobalNumberRecHits = cms.PSet( - NxBins = cms.int32(50), - xmin = cms.double(0.), - xmax = cms.double(0.), - switch = cms.bool(True) - ), - GlobalPositionXY_PXB = cms.PSet( - NxBins = cms.int32(600), - xmin = cms.double(-300.), - xmax = cms.double(300.), - NyBins = cms.int32(600), - ymin = cms.double(-300.), - ymax = cms.double(300.), - switch = cms.bool(True) - ), - GlobalPositionXY_PXEC = cms.PSet( - NxBins = cms.int32(600), - xmin = cms.double(-300.), - xmax = cms.double(300.), - NyBins = cms.int32(600), - ymin = cms.double(-300.), - ymax = cms.double(300.), - switch = cms.bool(True) - ), - GlobalPositionRZ_PXB = cms.PSet( - NxBins = cms.int32(1500), - xmin = cms.double(-3000.), - xmax = cms.double(3000.), - NyBins = cms.int32(300), - ymin = cms.double(0.), - ymax = cms.double(300.), - switch = cms.bool(True) - ), - GlobalPositionRZ_PXEC = cms.PSet( - NxBins = cms.int32(1500), - xmin = cms.double(-3000.), - xmax = cms.double(3000.), - NyBins = cms.int32(300), - ymin = cms.double(0.), - ymax = cms.double(300.), - switch = cms.bool(True) - ), - LocalNumberRecHits = cms.PSet( - NxBins = cms.int32(50), - xmin = cms.double(0.), - xmax = cms.double(0.), - switch = cms.bool(True) - ), - RecHitPosX = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(-2.5), - xmax = cms.double(2.5), - switch = cms.bool(True) - ), - RecHitPosY = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(-2.5), - xmax = cms.double(2.5), - switch = cms.bool(True) - ), - RecHitPosErrorX = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(0.), - xmax = cms.double(0.2), - switch = cms.bool(True) - ), - RecHitPosErrorY = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(0.), - xmax = cms.double(0.2), - switch = cms.bool(True) - ), - LocalClusterSizeX = cms.PSet( - NxBins = cms.int32(21), - xmin = cms.double(-0.5), - xmax = cms.double(20.5), - switch = cms.bool(True) - ), - LocalClusterSizeY = cms.PSet( - NxBins = cms.int32(21), - xmin = cms.double(-0.5), - xmax = cms.double(20.5), - switch = cms.bool(True) - ), - GlobalPositionXY_perlayer = cms.PSet( - NxBins = cms.int32(600), - xmin = cms.double(-300.), - xmax = cms.double(300.), - NyBins = cms.int32(600), - ymin = cms.double(-300.), - ymax = cms.double(300.), - switch = cms.bool(True) - ), - GlobalPositionRZ_perlayer = cms.PSet( - NxBins = cms.int32(1500), - xmin = cms.double(-3000.), - xmax = cms.double(3000.), - NyBins = cms.int32(300), - ymin = cms.double(0.), - ymax = cms.double(300.), - switch = cms.bool(True) - ), - LocalPositionXY = cms.PSet( - NxBins = cms.int32(500), - xmin = cms.double(0.), - xmax = cms.double(0.), - NyBins = cms.int32(500), - ymin = cms.double(0.), - ymax = cms.double(0.), - switch = cms.bool(True) - ), - -) diff --git a/DQM/SiTrackerPhase2/python/Phase2TrackerDQMFirstStep_cff.py b/DQM/SiTrackerPhase2/python/Phase2TrackerDQMFirstStep_cff.py index 9a5841d2e45ff..9ce8db692ceee 100644 --- a/DQM/SiTrackerPhase2/python/Phase2TrackerDQMFirstStep_cff.py +++ b/DQM/SiTrackerPhase2/python/Phase2TrackerDQMFirstStep_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from DQM.SiTrackerPhase2.Phase2TrackerMonitorDigi_cff import * -from DQM.SiTrackerPhase2.Phase2ITMonitorRecHit_cfi import * +from DQM.SiTrackerPhase2.Phase2ITMonitorRecHit_cff import * trackerphase2DQMSource = cms.Sequence( pixDigiMon + otDigiMon diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index 5705f4905b087..94543f8e963bf 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -45,23 +45,15 @@ Phase2ITValidateRecHit::Phase2ITValidateRecHit(const edm::ParameterSet& iConfig) geomToken_(esConsumes()), topoToken_(esConsumes()) { edm::LogInfo("Phase2ITValidateRecHit") << ">>> Construct Phase2ITValidateRecHit "; - for (const auto& itag : config_.getParameter>("PSimHitSource")) - simHitTokens_.push_back(consumes(itag)); + for (const auto& itName : config_.getParameter>("ROUList")) { + simHitTokens_.push_back(consumes>(edm::InputTag("g4SimHits", itName))); + } } // Phase2ITValidateRecHit::~Phase2ITValidateRecHit() { edm::LogInfo("Phase2ITValidateRecHit") << ">>> Destroy Phase2ITValidateRecHit "; } void Phase2ITValidateRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // Get the geometry - /* edm::ESHandle geomHandle = iSetup.getHandle(geomToken_); - //iSetup.get().get(geomHandle); - const TrackerGeometry* tkGeom = &(*geomHandle); - - edm::ESHandle tTopoHandle = iSetup.getHandle(topoToken_); - //iSetup.get().get(tTopoHandle); - const TrackerTopology* tTopo = tTopoHandle.product(); - */ std::vector> simHits; for (const auto& itoken : simHitTokens_) { edm::Handle simHitHandle; @@ -274,6 +266,147 @@ void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigne layerMEs_.insert(std::make_pair(key, local_histos)); } } - +void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + // rechitValidIT + edm::ParameterSetDescription desc; + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 4.0); + psd0.add("NxBins", 82); + psd0.add("switch", true); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymin", -4.0); + desc.add("PullY_primary", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -0.2); + psd0.add("switch", true); + psd0.add("xmax", 0.2); + psd0.add("NxBins", 100); + desc.add("DeltaY_primary", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 0.02); + psd0.add("NxBins", 82); + psd0.add("switch", true); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymin", -0.02); + desc.add("DeltaY_eta", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", 0.0); + psd0.add("switch", true); + psd0.add("xmax", 0.0); + psd0.add("NxBins", 100); + desc.add("nRecHits_primary", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 4.0); + psd0.add("NxBins", 82); + psd0.add("switch", true); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymin", -4.0); + desc.add("PullX_eta", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -0.2); + psd0.add("switch", true); + psd0.add("xmax", 0.2); + psd0.add("NxBins", 100); + desc.add("DeltaX", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -0.2); + psd0.add("switch", true); + psd0.add("xmax", 0.2); + psd0.add("NxBins", 100); + desc.add("DeltaY", psd0); + } + desc.add("Verbosity", false); + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 4.0); + psd0.add("NxBins", 82); + psd0.add("switch", true); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymin", -4.0); + desc.add("PullY_eta", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -4.0); + psd0.add("switch", true); + psd0.add("xmax", 4.0); + psd0.add("NxBins", 100); + desc.add("PullY", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 4.0); + psd0.add("NxBins", 82); + psd0.add("switch", true); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymin", -4.0); + desc.add("PullX_primary", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("ymax", 0.02); + psd0.add("NxBins", 82); + psd0.add("switch", true); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymin", -0.02); + desc.add("DeltaX_eta", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -4.0); + psd0.add("switch", true); + psd0.add("xmax", 4.0); + psd0.add("NxBins", 100); + desc.add("PullX", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("xmin", -0.2); + psd0.add("switch", true); + psd0.add("xmax", 0.2); + psd0.add("NxBins", 100); + desc.add("DeltaX_primary", psd0); + } + //to be used in TrackerHitAssociator + desc.add("associatePixel", true); + desc.add("associateStrip", false); + desc.add("usePhase2Tracker", true); + desc.add("associateRecoTracks", false); + desc.add("associateHitbySimTrack", true); + desc.add("pixelSimLinkSrc", edm::InputTag("simSiPixelDigis", "Pixel")); + desc.add>("ROUList", + { + "TrackerHitsPixelBarrelLowTof", + "TrackerHitsPixelBarrelHighTof", + "TrackerHitsPixelEndcapLowTof", + "TrackerHitsPixelEndcapHighTof", + }); + // + desc.add("simTracksSrc", edm::InputTag("g4SimHits")); + desc.add("SimVertexSource", edm::InputTag("g4SimHits")); + desc.add("SimTrackMinPt", 2.0); + desc.add("rechitsSrc", edm::InputTag("siPixelRecHits")); + desc.add("TopFolderName", "TrackerPhase2ITRecHitV"); + descriptions.add("Phase2ITValidateRecHit", desc); +} //define this as a plug-in DEFINE_FWK_MODULE(Phase2ITValidateRecHit); diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h index 3a4cbb6f3fb32..05ddc936ed1fc 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h @@ -37,6 +37,7 @@ class Phase2ITValidateRecHit : public DQMEDAnalyzer { 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; void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: void fillITHistos(const edm::Event& iEvent, diff --git a/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cff.py b/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cff.py new file mode 100644 index 0000000000000..affc43237f52c --- /dev/null +++ b/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cff.py @@ -0,0 +1,8 @@ +import FWCore.ParameterSet.Config as cms +from Validation.SiTrackerPhase2V.Phase2ITValidateRecHit_cfi import Phase2ITValidateRecHit +rechitValidIT = Phase2ITValidateRecHit.clone() + +from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 +premix_stage2.toModify(rechitValidIT, + pixelSimLinkSrc = "mixData:PixelDigiSimLink", +) diff --git a/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py b/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py deleted file mode 100644 index 4a0525db5f8b3..0000000000000 --- a/Validation/SiTrackerPhase2V/python/Phase2ITValidateRecHit_cfi.py +++ /dev/null @@ -1,128 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -rechitValidIT = DQMEDAnalyzer('Phase2ITValidateRecHit', - Verbosity = cms.bool(False), - TopFolderName = cms.string("TrackerPhase2ITRecHitV"), - ITPlotFillingFlag = cms.bool(False), - rechitsSrc = cms.InputTag("siPixelRecHits"), - InnerPixelDigiSource = cms.InputTag("simSiPixelDigis","Pixel"), - InnerPixelDigiSimLinkSource = cms.InputTag("simSiPixelDigis", "Pixel"), - PSimHitSource = cms.VInputTag('g4SimHits:TrackerHitsPixelBarrelLowTof', - 'g4SimHits:TrackerHitsPixelBarrelHighTof', - 'g4SimHits:TrackerHitsPixelEndcapLowTof', - 'g4SimHits:TrackerHitsPixelEndcapHighTof', - 'g4SimHits:TrackerHitsTIBLowTof', - 'g4SimHits:TrackerHitsTIBHighTof', - 'g4SimHits:TrackerHitsTIDLowTof', - 'g4SimHits:TrackerHitsTIDHighTof', - 'g4SimHits:TrackerHitsTOBLowTof', - 'g4SimHits:TrackerHitsTOBHighTof', - 'g4SimHits:TrackerHitsTECLowTof', - 'g4SimHits:TrackerHitsTECHighTof'), - simTracksSrc = cms.InputTag("g4SimHits"), - SimTrackMinPt = cms.double(2.), - SimTrackSource = cms.InputTag("g4SimHits"), - SimVertexSource = cms.InputTag("g4SimHits"), - usePhase2Tracker = cms.bool(True),#these are used by simHit assoc. - associatePixel = cms.bool(True), - associateRecoTracks = cms.bool(False), - associateStrip = cms.bool(False), - associateHitbySimTrack = cms.bool(True), - pixelSimLinkSrc = cms.InputTag("simSiPixelDigis","Pixel"), - ROUList = cms.vstring('g4SimHitsTrackerHitsPixelBarrelLowTof', - 'g4SimHitsTrackerHitsPixelBarrelHighTof', - 'g4SimHitsTrackerHitsPixelEndcapLowTof', - 'g4SimHitsTrackerHitsPixelEndcapHighTof', - ), - DeltaX = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(-0.2), - xmax = cms.double(0.2), - switch = cms.bool(True) - ), - DeltaY = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(-0.2), - xmax = cms.double(0.2), - switch = cms.bool(True) - ), - PullX = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(-4.), - xmax = cms.double(4.), - switch = cms.bool(True) - ), - PullY = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(-4.), - xmax = cms.double(4.), - switch = cms.bool(True) - ), - DeltaX_eta = cms.PSet( - NxBins = cms.int32(82), - xmin = cms.double(-4.1), - xmax = cms.double(4.1), - ymin = cms.double(-0.02), - ymax = cms.double(0.02), - switch = cms.bool(True) - ), - DeltaY_eta = cms.PSet( - NxBins = cms.int32(82), - xmin = cms.double(-4.1), - xmax = cms.double(4.1), - ymin = cms.double(-0.02), - ymax = cms.double(0.02), - switch = cms.bool(True) - ), - PullX_eta = cms.PSet( - NxBins = cms.int32(82), - xmin = cms.double(-4.1), - xmax = cms.double(4.1), - ymin = cms.double(-4.), - ymax = cms.double(4.), - switch = cms.bool(True) - ), - PullY_eta = cms.PSet( - NxBins = cms.int32(82), - xmin = cms.double(-4.1), - xmax = cms.double(4.1), - ymin = cms.double(-4.), - ymax = cms.double(4.), - switch = cms.bool(True) - ), - nRecHits_primary = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(0.), - xmax = cms.double(0.), - switch = cms.bool(True) - ), - DeltaX_primary = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(-0.2), - xmax = cms.double(0.2), - switch = cms.bool(True) - ), - DeltaY_primary = cms.PSet( - NxBins = cms.int32(100), - xmin = cms.double(-0.2), - xmax = cms.double(0.2), - switch = cms.bool(True) - ), - PullX_primary = cms.PSet( - NxBins = cms.int32(82), - xmin = cms.double(-4.1), - xmax = cms.double(4.1), - ymin = cms.double(-4.), - ymax = cms.double(4.), - switch = cms.bool(True) - ), - PullY_primary = cms.PSet( - NxBins = cms.int32(82), - xmin = cms.double(-4.1), - xmax = cms.double(4.1), - ymin = cms.double(-4.), - ymax = cms.double(4.), - switch = cms.bool(True) - ) -) diff --git a/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py b/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py index ae65faa17f373..49948e6688d0d 100644 --- a/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py +++ b/Validation/SiTrackerPhase2V/python/Phase2TrackerValidationFirstStep_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from Validation.SiTrackerPhase2V.Phase2TrackerValidateDigi_cff import * -from Validation.SiTrackerPhase2V.Phase2ITValidateRecHit_cfi import * +from Validation.SiTrackerPhase2V.Phase2ITValidateRecHit_cff import * trackerphase2ValidationSource = cms.Sequence(pixDigiValid + otDigiValid + rechitValidIT From 516628c187ee930f302d640d45ebaf3b067c4e3e Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Wed, 7 Oct 2020 09:07:29 +0200 Subject: [PATCH 07/12] bug fixes;fill descriptions update; --- .../interface/TrackerPhase2DQMUtil.h | 16 +- .../plugins/Phase2ITMonitorRecHit.cc | 155 +++++++++++------- .../plugins/Phase2ITMonitorRecHit.h | 6 +- .../plugins/Phase2ITValidateRecHit.cc | 123 ++++++++------ 4 files changed, 183 insertions(+), 117 deletions(-) diff --git a/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h b/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h index bb32e0cb90f77..22585960d98e8 100644 --- a/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h +++ b/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h @@ -1,5 +1,5 @@ -#ifndef _Validation_SiTrackerPhase2V_Phase2TrackierValidationUtil_h -#define _Validation_SiTrackerPhase2V_Phase2TrackierValidationUtil_h +#ifndef _DQM_SiTrackerPhase2_Phase2TrackerValidationUtil_h +#define _DQM_SiTrackerPhase2_Phase2TrackerValidationUtil_h #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DQMServices/Core/interface/MonitorElement.h" @@ -61,8 +61,8 @@ namespace Phase2TkUtil { MonitorElement* book1DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { MonitorElement* temp = nullptr; if (hpars.getParameter("switch")) { - temp = ibooker.book1D(hname, - hname, + temp = ibooker.book1D(hpars.getParameter("name"), + hpars.getParameter("title"), hpars.getParameter("NxBins"), hpars.getParameter("xmin"), hpars.getParameter("xmax")); @@ -73,8 +73,8 @@ namespace Phase2TkUtil { MonitorElement* book2DFromPSet(const edm::ParameterSet& hpars, const std::string& hname, DQMStore::IBooker& ibooker) { MonitorElement* temp = nullptr; if (hpars.getParameter("switch")) { - temp = ibooker.book2D(hname, - hname, + temp = ibooker.book2D(hpars.getParameter("name"), + hpars.getParameter("title"), hpars.getParameter("NxBins"), hpars.getParameter("xmin"), hpars.getParameter("xmax"), @@ -90,8 +90,8 @@ namespace Phase2TkUtil { DQMStore::IBooker& ibooker) { MonitorElement* temp = nullptr; if (hpars.getParameter("switch")) { - temp = ibooker.bookProfile(hname, - hname, + temp = ibooker.bookProfile(hpars.getParameter("name"), + hpars.getParameter("title"), hpars.getParameter("NxBins"), hpars.getParameter("xmin"), hpars.getParameter("xmax"), diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc index 5d84526adb5e3..8fa54220378cd 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc @@ -107,11 +107,12 @@ void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent) { if (layerMEs_[key].posX) layerMEs_[key].posX->Fill(lp.x()); if (layerMEs_[key].posY) - layerMEs_[key].posX->Fill(lp.y()); - if (layerMEs_[key].posX) - layerMEs_[key].poserrX->Fill(rechitIt->localPositionError().xx()); - if (layerMEs_[key].posY) - layerMEs_[key].poserrY->Fill(rechitIt->localPositionError().yy()); + layerMEs_[key].posY->Fill(lp.y()); + float eta = geomDetunit->surface().toGlobal(lp).eta(); + if (layerMEs_[key].poserrX) + layerMEs_[key].poserrX->Fill(eta, million * rechitIt->localPositionError().xx()); + if (layerMEs_[key].poserrY) + layerMEs_[key].poserrY->Fill(eta, million * rechitIt->localPositionError().yy()); } //end loop over rechits of a detId } //End loop over DetSetVector @@ -192,6 +193,7 @@ void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned histoName << "Number_RecHits"; local_histos.numberRecHits = Phase2TkUtil::book1DFromPSet( config_.getParameter("LocalNumberRecHits"), histoName.str(), ibooker); + histoName.str(""); histoName << "RecHit_X"; local_histos.posX = @@ -203,19 +205,20 @@ void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosY"), histoName.str(), ibooker); histoName.str(""); - histoName << "RecHit_X_error"; - local_histos.poserrX = Phase2TkUtil::book1DFromPSet( - config_.getParameter("RecHitPosErrorX"), histoName.str(), ibooker); + histoName << "RecHit_X_error_Vs_eta"; + local_histos.poserrX = Phase2TkUtil::bookProfile1DFromPSet( + config_.getParameter("RecHitPosErrorX_Eta"), histoName.str(), ibooker); histoName.str(""); - histoName << "RecHit_Y_error"; - local_histos.poserrY = Phase2TkUtil::book1DFromPSet( - config_.getParameter("RecHitPosErrorY"), histoName.str(), ibooker); + histoName << "RecHit_Y_error_Vs_eta"; + local_histos.poserrY = Phase2TkUtil::bookProfile1DFromPSet( + config_.getParameter("RecHitPosErrorY_Eta"), histoName.str(), ibooker); histoName.str(""); histoName << "Cluster_SizeX"; local_histos.clusterSizeX = Phase2TkUtil::book1DFromPSet( config_.getParameter("LocalClusterSizeX"), histoName.str(), ibooker); + histoName.str(""); histoName << "Cluster_SizeY"; local_histos.clusterSizeY = Phase2TkUtil::book1DFromPSet( @@ -230,6 +233,7 @@ void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned histoName << "Global_Position_RZ"; local_histos.globalPosRZ = Phase2TkUtil::book2DFromPSet( config_.getParameter("GlobalPositionRZ_perlayer"), histoName.str(), ibooker); + histoName.str(""); histoName << "Local_Position_XY"; local_histos.localPosXY = Phase2TkUtil::book2DFromPSet( @@ -241,29 +245,20 @@ void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { // rechitMonitorIT edm::ParameterSetDescription desc; - desc.add("TopFolderName", "TrackerPhase2ITRecHit"); - desc.add("rechitsSrc", edm::InputTag("siPixelRecHits")); { edm::ParameterSetDescription psd0; + psd0.add("name", "NumberRecHits"); + psd0.add("title", "NumberRecHits;Number of RecHits;"); psd0.add("xmin", 0.0); psd0.add("switch", true); psd0.add("xmax", 0.0); psd0.add("NxBins", 50); - desc.add("LocalNumberRecHits", psd0); - } - { - edm::ParameterSetDescription psd0; - psd0.add("ymax", 300.0); - psd0.add("NxBins", 1500); - psd0.add("NyBins", 300); - psd0.add("switch", true); - psd0.add("xmax", 3000.0); - psd0.add("xmin", -3000.0); - psd0.add("ymin", 0.0); - desc.add("GlobalPositionRZ_perlayer", psd0); + desc.add("GlobalNumberRecHits", psd0); } { edm::ParameterSetDescription psd0; + psd0.add("name", "Global_Position_RZ_IT_barrel"); + psd0.add("title", "Global_Position_RZ_IT_barrel;z [mm];r [mm]"); psd0.add("ymax", 300.0); psd0.add("NxBins", 1500); psd0.add("NyBins", 300); @@ -275,6 +270,8 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des } { edm::ParameterSetDescription psd0; + psd0.add("name", "Global_Position_XY_IT_barrel"); + psd0.add("title", "Global_Position_XY_IT_barrel;x [mm];y [mm];"); psd0.add("ymax", 300.0); psd0.add("NxBins", 600); psd0.add("NyBins", 600); @@ -286,6 +283,8 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des } { edm::ParameterSetDescription psd0; + psd0.add("name", "Global_Position_RZ_IT_endcap"); + psd0.add("title", "Global_Position_RZ_IT_endcap;z [mm];r [mm]"); psd0.add("ymax", 300.0); psd0.add("NxBins", 1500); psd0.add("NyBins", 300); @@ -297,14 +296,8 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des } { edm::ParameterSetDescription psd0; - psd0.add("xmin", 0.0); - psd0.add("switch", true); - psd0.add("xmax", 0.2); - psd0.add("NxBins", 100); - desc.add("RecHitPosErrorX", psd0); - } - { - edm::ParameterSetDescription psd0; + psd0.add("name", "Global_Position_XY_IT_endcap"); + psd0.add("title", "Global_Position_XY_IT_endcap; x [mm]; y [mm]"); psd0.add("ymax", 300.0); psd0.add("NxBins", 600); psd0.add("NyBins", 600); @@ -312,42 +305,49 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des psd0.add("xmax", 300.0); psd0.add("xmin", -300.0); psd0.add("ymin", -300.0); - desc.add("GlobalPositionXY_perlayer", psd0); + desc.add("GlobalPositionXY_PXEC", psd0); } + //Per layer/ring histos { edm::ParameterSetDescription psd0; + psd0.add("name", "LocalNumberRecHits"); + psd0.add("title", "NumberRecHits;Number of RecHits;"); psd0.add("xmin", 0.0); psd0.add("switch", true); psd0.add("xmax", 0.0); psd0.add("NxBins", 50); - desc.add("GlobalNumberRecHits", psd0); - } - { - edm::ParameterSetDescription psd0; - psd0.add("xmin", -0.5); - psd0.add("switch", true); - psd0.add("xmax", 20.5); - psd0.add("NxBins", 21); - desc.add("LocalClusterSizeX", psd0); + desc.add("LocalNumberRecHits", psd0); } { edm::ParameterSetDescription psd0; - psd0.add("xmin", -2.5); + psd0.add("name", "Global_Position_RZ"); + psd0.add("title", "Global_Position_RZ;z [mm];r [mm]"); + psd0.add("ymax", 300.0); + psd0.add("NxBins", 1500); + psd0.add("NyBins", 300); psd0.add("switch", true); - psd0.add("xmax", 2.5); - psd0.add("NxBins", 100); - desc.add("RecHitPosY", psd0); + psd0.add("xmax", 3000.0); + psd0.add("xmin", -3000.0); + psd0.add("ymin", 0.0); + desc.add("GlobalPositionRZ_perlayer", psd0); } { edm::ParameterSetDescription psd0; - psd0.add("xmin", 0.0); + psd0.add("name", "Global_Position_XY"); + psd0.add("title", "Global_Position_XY;x [mm]; y[mm]"); + psd0.add("ymax", 300.0); + psd0.add("NxBins", 600); + psd0.add("NyBins", 600); psd0.add("switch", true); - psd0.add("xmax", 0.2); - psd0.add("NxBins", 100); - desc.add("RecHitPosErrorY", psd0); + psd0.add("xmax", 300.0); + psd0.add("xmin", -300.0); + psd0.add("ymin", -300.0); + desc.add("GlobalPositionXY_perlayer", psd0); } { edm::ParameterSetDescription psd0; + psd0.add("name", "Local_Position_XY"); + psd0.add("title", "Local_Position_XY; x; y"); psd0.add("ymax", 0.0); psd0.add("NxBins", 500); psd0.add("NyBins", 500); @@ -359,17 +359,18 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des } { edm::ParameterSetDescription psd0; - psd0.add("ymax", 300.0); - psd0.add("NxBins", 600); - psd0.add("NyBins", 600); + psd0.add("name", "Cluster_SizeX"); + psd0.add("title", "Cluster_SizeX; cluster size y;"); + psd0.add("xmin", -0.5); psd0.add("switch", true); - psd0.add("xmax", 300.0); - psd0.add("xmin", -300.0); - psd0.add("ymin", -300.0); - desc.add("GlobalPositionXY_PXEC", psd0); + psd0.add("xmax", 20.5); + psd0.add("NxBins", 21); + desc.add("LocalClusterSizeX", psd0); } { edm::ParameterSetDescription psd0; + psd0.add("name", "Cluster_SizeY"); + psd0.add("title", "Cluster_SizeY;cluster size y;"); psd0.add("xmin", -0.5); psd0.add("switch", true); psd0.add("xmax", 20.5); @@ -378,12 +379,50 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des } { edm::ParameterSetDescription psd0; + psd0.add("name", "RecHit_X"); + psd0.add("title", "RecHit_X;RecHit position X dimension;"); psd0.add("xmin", -2.5); psd0.add("switch", true); psd0.add("xmax", 2.5); psd0.add("NxBins", 100); desc.add("RecHitPosX", psd0); } + { + edm::ParameterSetDescription psd0; + psd0.add("name", "RecHit_Y"); + psd0.add("title", "RecHit_Y;RecHit position X dimension;"); + psd0.add("xmin", -2.5); + psd0.add("switch", true); + psd0.add("xmax", 2.5); + psd0.add("NxBins", 100); + desc.add("RecHitPosY", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("name", "RecHit_X_error_Vs_eta"); + psd0.add("title", "RecHit_X_error_Vs_eta;#eta;x error #times 10^{6}"); + psd0.add("switch", true); + psd0.add("NxBins", 82); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymax", 10.0); + psd0.add("ymin", 0.); + desc.add("RecHitPosErrorX_Eta", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("name", "RecHit_Y_error_Vs_eta"); + psd0.add("title", "RecHit_Y_error_Vs_eta;#eta;y error #times 10^{6}"); + psd0.add("switch", true); + psd0.add("NxBins", 82); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymax", 10.0); + psd0.add("ymin", 0.); + desc.add("RecHitPosErrorY_Eta", psd0); + } + desc.add("TopFolderName", "TrackerPhase2ITRecHit"); + desc.add("rechitsSrc", edm::InputTag("siPixelRecHits")); descriptions.add("Phase2ITMonitorRecHit", desc); } //define this as a plug-in diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h index c2c6ec8f43b2b..9e4ac031e9b7b 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h @@ -1,5 +1,5 @@ -#ifndef _Validation_SiTrackerPhase2V_Phase2ITMonitorRecHit_h -#define _Validation_SiTrackerPhase2V_Phase2ITMonitorRecHit_h +#ifndef _DQM_SiTrackerPhase2_Phase2ITMonitorRecHit_h +#define _DQM_SiTrackerPhase2_Phase2ITMonitorRecHit_h #include #include #include @@ -47,7 +47,7 @@ class Phase2ITMonitorRecHit : public DQMEDAnalyzer { const edm::ESGetToken topoToken_; const TrackerGeometry* tkGeom_ = nullptr; const TrackerTopology* tTopo_ = nullptr; - + static constexpr float million = 1e6; MonitorElement* numberRecHits_; MonitorElement* globalXY_barrel_; MonitorElement* globalXY_endcap_; diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index 94543f8e963bf..eb5b525804d99 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -271,42 +271,72 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de edm::ParameterSetDescription desc; { edm::ParameterSetDescription psd0; - psd0.add("ymax", 4.0); - psd0.add("NxBins", 82); + psd0.add("name", "Delta_X"); + psd0.add("title", "Delta_X;RecHit resolution X dimensiom"); + psd0.add("xmin", -0.2); psd0.add("switch", true); - psd0.add("xmax", 4.1); - psd0.add("xmin", -4.1); - psd0.add("ymin", -4.0); - desc.add("PullY_primary", psd0); + psd0.add("xmax", 0.2); + psd0.add("NxBins", 100); + desc.add("DeltaX", psd0); } { edm::ParameterSetDescription psd0; + psd0.add("name", "Delta_Y"); + psd0.add("title", "Delta_Y;RecHit resolution Y dimensiom;"); psd0.add("xmin", -0.2); psd0.add("switch", true); psd0.add("xmax", 0.2); psd0.add("NxBins", 100); - desc.add("DeltaY_primary", psd0); + desc.add("DeltaY", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("name", "Pull_X"); + psd0.add("title", "Pull_X;pull x;"); + psd0.add("xmin", -4.0); + psd0.add("switch", true); + psd0.add("xmax", 4.0); + psd0.add("NxBins", 100); + desc.add("PullX", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.add("name", "Pull_Y"); + psd0.add("title", "Pull_Y;pull y;"); + psd0.add("xmin", -4.0); + psd0.add("switch", true); + psd0.add("xmax", 4.0); + psd0.add("NxBins", 100); + desc.add("PullY", psd0); } { edm::ParameterSetDescription psd0; + psd0.add("name", "Delta_X_vs_Eta"); + psd0.add("title", "Delta_X_vs_Eta;#eta;#Delta x"); psd0.add("ymax", 0.02); psd0.add("NxBins", 82); psd0.add("switch", true); psd0.add("xmax", 4.1); psd0.add("xmin", -4.1); psd0.add("ymin", -0.02); - desc.add("DeltaY_eta", psd0); + desc.add("DeltaX_eta", psd0); } { edm::ParameterSetDescription psd0; - psd0.add("xmin", 0.0); + psd0.add("name", "Delta_Y_vs_Eta"); + psd0.add("title", "Delta_Y_vs_Eta;#eta;#Delta y"); + psd0.add("ymax", 0.02); + psd0.add("NxBins", 82); psd0.add("switch", true); - psd0.add("xmax", 0.0); - psd0.add("NxBins", 100); - desc.add("nRecHits_primary", psd0); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymin", -0.02); + desc.add("DeltaY_eta", psd0); } { edm::ParameterSetDescription psd0; + psd0.add("name", "Pull_X_vs_Eta"); + psd0.add("title", "Pull_X_vs_Eta;#eta;pull x"); psd0.add("ymax", 4.0); psd0.add("NxBins", 82); psd0.add("switch", true); @@ -317,41 +347,51 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de } { edm::ParameterSetDescription psd0; - psd0.add("xmin", -0.2); + psd0.add("name", "Pull_Y_vs_Eta"); + psd0.add("title", "Pull_Y_vs_Eta;#eta;pull y"); + psd0.add("ymax", 4.0); + psd0.add("NxBins", 82); psd0.add("switch", true); - psd0.add("xmax", 0.2); - psd0.add("NxBins", 100); - desc.add("DeltaX", psd0); + psd0.add("xmax", 4.1); + psd0.add("xmin", -4.1); + psd0.add("ymin", -4.0); + desc.add("PullY_eta", psd0); } + //simhits primary { edm::ParameterSetDescription psd0; - psd0.add("xmin", -0.2); + psd0.add("name", "Number_RecHits_matched_PrimarySimTrack"); + psd0.add("title", "Number of RecHits matched to primary SimTrack;;"); + psd0.add("xmin", 0.0); psd0.add("switch", true); - psd0.add("xmax", 0.2); + psd0.add("xmax", 0.0); psd0.add("NxBins", 100); - desc.add("DeltaY", psd0); + desc.add("nRecHits_primary", psd0); } - desc.add("Verbosity", false); { edm::ParameterSetDescription psd0; - psd0.add("ymax", 4.0); - psd0.add("NxBins", 82); + psd0.add("name", "Delta_X_SimHitPrimary"); + psd0.add("title", "Delta_X_SimHitPrimary;#delta x;"); + psd0.add("xmin", -0.2); psd0.add("switch", true); - psd0.add("xmax", 4.1); - psd0.add("xmin", -4.1); - psd0.add("ymin", -4.0); - desc.add("PullY_eta", psd0); + psd0.add("xmax", 0.2); + psd0.add("NxBins", 100); + desc.add("DeltaX_primary", psd0); } { edm::ParameterSetDescription psd0; - psd0.add("xmin", -4.0); + psd0.add("name", "Delta_Y_SimHitPrimary"); + psd0.add("title", "Delta_Y_SimHitPrimary;#Delta y;"); + psd0.add("xmin", -0.2); psd0.add("switch", true); - psd0.add("xmax", 4.0); + psd0.add("xmax", 0.2); psd0.add("NxBins", 100); - desc.add("PullY", psd0); + desc.add("DeltaY_primary", psd0); } { edm::ParameterSetDescription psd0; + psd0.add("name", "Pull_X_SimHitPrimary"); + psd0.add("title", "Pull_X_SimHitPrimary;pull x;"); psd0.add("ymax", 4.0); psd0.add("NxBins", 82); psd0.add("switch", true); @@ -362,29 +402,15 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de } { edm::ParameterSetDescription psd0; - psd0.add("ymax", 0.02); + psd0.add("name", "Pull_Y_SimHitPrimary"); + psd0.add("title", "Pull_Y_SimHitPrimary;pull y;"); + psd0.add("ymax", 4.0); psd0.add("NxBins", 82); psd0.add("switch", true); psd0.add("xmax", 4.1); psd0.add("xmin", -4.1); - psd0.add("ymin", -0.02); - desc.add("DeltaX_eta", psd0); - } - { - edm::ParameterSetDescription psd0; - psd0.add("xmin", -4.0); - psd0.add("switch", true); - psd0.add("xmax", 4.0); - psd0.add("NxBins", 100); - desc.add("PullX", psd0); - } - { - edm::ParameterSetDescription psd0; - psd0.add("xmin", -0.2); - psd0.add("switch", true); - psd0.add("xmax", 0.2); - psd0.add("NxBins", 100); - desc.add("DeltaX_primary", psd0); + psd0.add("ymin", -4.0); + desc.add("PullY_primary", psd0); } //to be used in TrackerHitAssociator desc.add("associatePixel", true); @@ -406,6 +432,7 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de desc.add("SimTrackMinPt", 2.0); desc.add("rechitsSrc", edm::InputTag("siPixelRecHits")); desc.add("TopFolderName", "TrackerPhase2ITRecHitV"); + desc.add("Verbosity", false); descriptions.add("Phase2ITValidateRecHit", desc); } //define this as a plug-in From c36609d05cb1ed4d4f7690b7197f0a6e58bc58cc Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Fri, 9 Oct 2020 09:21:04 +0200 Subject: [PATCH 08/12] address changes from review --- .../interface/TrackerPhase2DQMUtil.h | 53 +----- DQM/SiTrackerPhase2/plugins/BuildFile.xml | 1 + .../plugins/Phase2ITMonitorRecHit.cc | 148 ++++++++++----- .../plugins/Phase2ITMonitorRecHit.h | 71 -------- DQM/SiTrackerPhase2/src/BuildFile.xml | 5 + .../src/TrackerPhase2DQMUtil.cc | 47 +++++ .../interface/TrackerPhase2ValidationUtil.h | 18 +- .../SiTrackerPhase2V/plugins/BuildFile.xml | 3 +- .../plugins/Phase2ITValidateRecHit.cc | 168 ++++++++++++------ .../plugins/Phase2ITValidateRecHit.h | 81 --------- Validation/SiTrackerPhase2V/src/BuildFile.xml | 5 + .../src/TrackerPhase2ValidationUtil.cc | 12 ++ 12 files changed, 290 insertions(+), 322 deletions(-) delete mode 100644 DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h create mode 100644 DQM/SiTrackerPhase2/src/BuildFile.xml create mode 100644 DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc delete mode 100644 Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h create mode 100644 Validation/SiTrackerPhase2V/src/BuildFile.xml create mode 100644 Validation/SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc diff --git a/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h b/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h index 22585960d98e8..c6a73cd4bf54c 100644 --- a/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h +++ b/DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h @@ -7,54 +7,10 @@ #include #include -namespace Phase2TkUtil { +namespace phase2tkutil { - std::string getITHistoId(uint32_t det_id, const TrackerTopology* tTopo) { - std::string Disc; - std::ostringstream fname1; - int layer = tTopo->getITPixelLayerNumber(det_id); - - if (layer < 0) - return ""; - if (layer < 100) { - fname1 << "Barrel/"; - fname1 << "Layer" << layer; - fname1 << ""; - } else { - int side = tTopo->pxfSide(det_id); - fname1 << "EndCap_Side" << side << "/"; - int disc = tTopo->pxfDisk(det_id); - Disc = (disc < 9) ? "EPix" : "FPix"; - ; - fname1 << Disc << "/"; - int ring = tTopo->pxfBlade(det_id); - fname1 << "Ring" << ring; - } - return fname1.str(); - } - - std::string getOTHistoId(uint32_t det_id, const TrackerTopology* tTopo) { - std::string Disc; - std::ostringstream fname1; - int layer = tTopo->getOTLayerNumber(det_id); - - if (layer < 0) - return ""; - if (layer < 100) { - fname1 << "Barrel/"; - fname1 << "Layer" << layer; - fname1 << ""; - } else { - int side = tTopo->tidSide(det_id); - fname1 << "EndCap_Side" << side << "/"; - int disc = tTopo->tidWheel(det_id); - Disc = (disc < 3) ? "TEDD_1" : "TEDD_2"; - fname1 << Disc << "/"; - int ring = tTopo->tidRing(det_id); - fname1 << "Ring" << ring; - } - return fname1.str(); - } + std::string getITHistoId(uint32_t det_id, const TrackerTopology* tTopo); + std::string getOTHistoId(uint32_t det_id, const TrackerTopology* tTopo); typedef dqm::reco::MonitorElement MonitorElement; typedef dqm::reco::DQMStore DQMStore; @@ -100,6 +56,5 @@ namespace Phase2TkUtil { } return temp; } -} // namespace Phase2TkUtil - +} // namespace phase2tkutil #endif diff --git a/DQM/SiTrackerPhase2/plugins/BuildFile.xml b/DQM/SiTrackerPhase2/plugins/BuildFile.xml index ffc0d608890b5..b4d852597bbd3 100644 --- a/DQM/SiTrackerPhase2/plugins/BuildFile.xml +++ b/DQM/SiTrackerPhase2/plugins/BuildFile.xml @@ -8,6 +8,7 @@ + diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc index 8fa54220378cd..a75e7f7b8072c 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc @@ -10,31 +10,83 @@ // // system include files #include -#include "DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h" -#include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include +#include +#include #include "FWCore/Framework/interface/ESWatcher.h" -#include -#include -#include -#include -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/GeometrySurface/interface/LocalError.h" +#include "DataFormats/GeometryVector/interface/LocalPoint.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/CommonDetUnit/interface/TrackerGeomDet.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "DataFormats/GeometrySurface/interface/LocalError.h" -#include "DataFormats/GeometryVector/interface/LocalPoint.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" // DQM Histograming #include "DQMServices/Core/interface/MonitorElement.h" -// -// constructors -// +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" + +class Phase2ITMonitorRecHit : public DQMEDAnalyzer { +public: + explicit Phase2ITMonitorRecHit(const edm::ParameterSet&); + ~Phase2ITMonitorRecHit() 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; + void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void fillITHistos(const edm::Event& iEvent); + void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir); + + edm::ParameterSet config_; + std::string geomType_; + const edm::EDGetTokenT tokenRecHitsIT_; + const edm::ESGetToken geomToken_; + const edm::ESGetToken topoToken_; + const TrackerGeometry* tkGeom_ = nullptr; + const TrackerTopology* tTopo_ = nullptr; + static constexpr float million = 1e6; + MonitorElement* numberRecHits_; + MonitorElement* globalXY_barrel_; + MonitorElement* globalXY_endcap_; + MonitorElement* globalRZ_barrel_; + MonitorElement* globalRZ_endcap_; + + struct RecHitME { + MonitorElement* numberRecHits = nullptr; + MonitorElement* globalPosXY = nullptr; + MonitorElement* globalPosRZ = nullptr; + MonitorElement* localPosXY = nullptr; + MonitorElement* posX = nullptr; + MonitorElement* posY = nullptr; + MonitorElement* poserrX = nullptr; + MonitorElement* poserrY = nullptr; + MonitorElement* clusterSizeX = nullptr; + MonitorElement* clusterSizeY = nullptr; + }; + std::map layerMEs_; +}; + Phase2ITMonitorRecHit::Phase2ITMonitorRecHit(const edm::ParameterSet& iConfig) : config_(iConfig), tokenRecHitsIT_(consumes(iConfig.getParameter("rechitsSrc"))), @@ -58,27 +110,25 @@ void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent) { std::map nrechitLayerMap; unsigned long int nTotrechitsinevt = 0; // Loop over modules - SiPixelRecHitCollection::const_iterator DSViter; - for (DSViter = rechits->begin(); DSViter != rechits->end(); ++DSViter) { + for (const auto& DSViter : *rechits) { // Get the detector id - unsigned int rawid(DSViter->detId()); + unsigned int rawid(DSViter.detId()); DetId detId(rawid); // Get the geomdet const GeomDetUnit* geomDetunit(tkGeom_->idToDetUnit(detId)); if (!geomDetunit) continue; - std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo_); - nTotrechitsinevt += DSViter->size(); + std::string key = phase2tkutil::getITHistoId(detId.rawId(), tTopo_); + nTotrechitsinevt += DSViter.size(); if (nrechitLayerMap.find(key) == nrechitLayerMap.end()) { - nrechitLayerMap.insert(std::make_pair(key, DSViter->size())); + nrechitLayerMap.emplace(key, DSViter.size()); } else { - nrechitLayerMap[key] += DSViter->size(); + nrechitLayerMap[key] += DSViter.size(); } - edmNew::DetSet::const_iterator rechitIt; //loop over rechits for a single detId - for (rechitIt = DSViter->begin(); rechitIt != DSViter->end(); ++rechitIt) { - LocalPoint lp = rechitIt->localPosition(); + for (const auto& rechit : DSViter) { + LocalPoint lp = rechit.localPosition(); Global3DPoint globalPos = geomDetunit->surface().toGlobal(lp); //in mm double gx = globalPos.x() * 10.; @@ -95,9 +145,9 @@ void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent) { } //layer wise histo if (layerMEs_[key].clusterSizeX) - layerMEs_[key].clusterSizeX->Fill(rechitIt->cluster()->sizeX()); + layerMEs_[key].clusterSizeX->Fill(rechit.cluster()->sizeX()); if (layerMEs_[key].clusterSizeY) - layerMEs_[key].clusterSizeY->Fill(rechitIt->cluster()->sizeY()); + layerMEs_[key].clusterSizeY->Fill(rechit.cluster()->sizeY()); if (layerMEs_[key].globalPosXY) layerMEs_[key].globalPosXY->Fill(gx, gy); if (layerMEs_[key].globalPosRZ) @@ -110,16 +160,16 @@ void Phase2ITMonitorRecHit::fillITHistos(const edm::Event& iEvent) { layerMEs_[key].posY->Fill(lp.y()); float eta = geomDetunit->surface().toGlobal(lp).eta(); if (layerMEs_[key].poserrX) - layerMEs_[key].poserrX->Fill(eta, million * rechitIt->localPositionError().xx()); + layerMEs_[key].poserrX->Fill(eta, million * rechit.localPositionError().xx()); if (layerMEs_[key].poserrY) - layerMEs_[key].poserrY->Fill(eta, million * rechitIt->localPositionError().yy()); + layerMEs_[key].poserrY->Fill(eta, million * rechit.localPositionError().yy()); } //end loop over rechits of a detId } //End loop over DetSetVector //fill nRecHits per event numberRecHits_->Fill(nTotrechitsinevt); //fill nRecHit counter per layer - for (auto& lme : nrechitLayerMap) + for (const auto& lme : nrechitLayerMap) if (layerMEs_[lme.first].numberRecHits) layerMEs_[lme.first].numberRecHits->Fill(lme.second); } @@ -143,23 +193,23 @@ void Phase2ITMonitorRecHit::bookHistograms(DQMStore::IBooker& ibooker, //Global histos for IT HistoName.str(""); HistoName << "NumberRecHits"; - numberRecHits_ = Phase2TkUtil::book1DFromPSet( + numberRecHits_ = phase2tkutil::book1DFromPSet( config_.getParameter("GlobalNumberRecHits"), HistoName.str(), ibooker); HistoName.str(""); HistoName << "Global_Position_XY_IT_barrel"; - globalXY_barrel_ = Phase2TkUtil::book2DFromPSet( + globalXY_barrel_ = phase2tkutil::book2DFromPSet( config_.getParameter("GlobalPositionXY_PXB"), HistoName.str(), ibooker); HistoName.str(""); HistoName << "Global_Position_RZ_IT_barrel"; - globalRZ_barrel_ = Phase2TkUtil::book2DFromPSet( + globalRZ_barrel_ = phase2tkutil::book2DFromPSet( config_.getParameter("GlobalPositionRZ_PXB"), HistoName.str(), ibooker); HistoName.str(""); HistoName << "Global_Position_XY_IT_endcap"; - globalXY_endcap_ = Phase2TkUtil::book2DFromPSet( + globalXY_endcap_ = phase2tkutil::book2DFromPSet( config_.getParameter("GlobalPositionXY_PXEC"), HistoName.str(), ibooker); HistoName.str(""); HistoName << "Global_Position_RZ_IT_endcap"; - globalRZ_endcap_ = Phase2TkUtil::book2DFromPSet( + globalRZ_endcap_ = phase2tkutil::book2DFromPSet( config_.getParameter("GlobalPositionRZ_PXEC"), HistoName.str(), ibooker); //Now book layer wise histos @@ -173,14 +223,14 @@ void Phase2ITMonitorRecHit::bookHistograms(DQMStore::IBooker& ibooker, continue; unsigned int detId_raw = det_u->geographicalId().rawId(); edm::LogInfo("Phase2ITMonitorRecHit") << "Detid:" << detId_raw << "\tsubdet=" << det_u->subDetector() - << "\t key=" << Phase2TkUtil::getITHistoId(detId_raw, tTopo_) << std::endl; + << "\t key=" << phase2tkutil::getITHistoId(detId_raw, tTopo_) << std::endl; bookLayerHistos(ibooker, detId_raw, dir); } } } // -- Book Layer Histograms void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir) { - std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo_); + std::string key = phase2tkutil::getITHistoId(det_id, tTopo_); if (key.empty()) return; if (layerMEs_.find(key) == layerMEs_.end()) { @@ -191,54 +241,54 @@ void Phase2ITMonitorRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned edm::LogInfo("Phase2ITMonitorRecHit") << " Booking Histograms in : " << (subdir + "/" + key); histoName.str(""); histoName << "Number_RecHits"; - local_histos.numberRecHits = Phase2TkUtil::book1DFromPSet( + local_histos.numberRecHits = phase2tkutil::book1DFromPSet( config_.getParameter("LocalNumberRecHits"), histoName.str(), ibooker); histoName.str(""); histoName << "RecHit_X"; local_histos.posX = - Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosX"), histoName.str(), ibooker); + phase2tkutil::book1DFromPSet(config_.getParameter("RecHitPosX"), histoName.str(), ibooker); histoName.str(""); histoName << "RecHit_Y"; local_histos.posY = - Phase2TkUtil::book1DFromPSet(config_.getParameter("RecHitPosY"), histoName.str(), ibooker); + phase2tkutil::book1DFromPSet(config_.getParameter("RecHitPosY"), histoName.str(), ibooker); histoName.str(""); histoName << "RecHit_X_error_Vs_eta"; - local_histos.poserrX = Phase2TkUtil::bookProfile1DFromPSet( + local_histos.poserrX = phase2tkutil::bookProfile1DFromPSet( config_.getParameter("RecHitPosErrorX_Eta"), histoName.str(), ibooker); histoName.str(""); histoName << "RecHit_Y_error_Vs_eta"; - local_histos.poserrY = Phase2TkUtil::bookProfile1DFromPSet( + local_histos.poserrY = phase2tkutil::bookProfile1DFromPSet( config_.getParameter("RecHitPosErrorY_Eta"), histoName.str(), ibooker); histoName.str(""); histoName << "Cluster_SizeX"; - local_histos.clusterSizeX = Phase2TkUtil::book1DFromPSet( + local_histos.clusterSizeX = phase2tkutil::book1DFromPSet( config_.getParameter("LocalClusterSizeX"), histoName.str(), ibooker); histoName.str(""); histoName << "Cluster_SizeY"; - local_histos.clusterSizeY = Phase2TkUtil::book1DFromPSet( + local_histos.clusterSizeY = phase2tkutil::book1DFromPSet( config_.getParameter("LocalClusterSizeY"), histoName.str(), ibooker); histoName.str(""); histoName << "Global_Position_XY"; - local_histos.globalPosXY = Phase2TkUtil::book2DFromPSet( + local_histos.globalPosXY = phase2tkutil::book2DFromPSet( config_.getParameter("GlobalPositionXY_perlayer"), histoName.str(), ibooker); histoName.str(""); histoName << "Global_Position_RZ"; - local_histos.globalPosRZ = Phase2TkUtil::book2DFromPSet( + local_histos.globalPosRZ = phase2tkutil::book2DFromPSet( config_.getParameter("GlobalPositionRZ_perlayer"), histoName.str(), ibooker); histoName.str(""); histoName << "Local_Position_XY"; - local_histos.localPosXY = Phase2TkUtil::book2DFromPSet( + local_histos.localPosXY = phase2tkutil::book2DFromPSet( config_.getParameter("LocalPositionXY"), histoName.str(), ibooker); - layerMEs_.insert(std::make_pair(key, local_histos)); + layerMEs_.emplace(key, local_histos); } } diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h deleted file mode 100644 index 9e4ac031e9b7b..0000000000000 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _DQM_SiTrackerPhase2_Phase2ITMonitorRecHit_h -#define _DQM_SiTrackerPhase2_Phase2ITMonitorRecHit_h -#include -#include -#include -#include -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/Common/interface/DetSetVectorNew.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" - -// DQM Histograming -class TrackerTopology; -class TrackerGeometry; -class TrackerDigiGeometryRecord; -class TrackerTopologyRcd; -class Phase2ITMonitorRecHit : public DQMEDAnalyzer { -public: - explicit Phase2ITMonitorRecHit(const edm::ParameterSet&); - ~Phase2ITMonitorRecHit() 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; - void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void fillITHistos(const edm::Event& iEvent); - - void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir); - - edm::ParameterSet config_; - std::string geomType_; - const edm::EDGetTokenT tokenRecHitsIT_; - const edm::ESGetToken geomToken_; - const edm::ESGetToken topoToken_; - const TrackerGeometry* tkGeom_ = nullptr; - const TrackerTopology* tTopo_ = nullptr; - static constexpr float million = 1e6; - MonitorElement* numberRecHits_; - MonitorElement* globalXY_barrel_; - MonitorElement* globalXY_endcap_; - MonitorElement* globalRZ_barrel_; - MonitorElement* globalRZ_endcap_; - - struct RecHitME { - MonitorElement* numberRecHits = nullptr; - MonitorElement* globalPosXY = nullptr; - MonitorElement* globalPosRZ = nullptr; - MonitorElement* localPosXY = nullptr; - MonitorElement* posX = nullptr; - MonitorElement* posY = nullptr; - MonitorElement* poserrX = nullptr; - MonitorElement* poserrY = nullptr; - MonitorElement* clusterSizeX = nullptr; - MonitorElement* clusterSizeY = nullptr; - }; - std::map layerMEs_; -}; -#endif diff --git a/DQM/SiTrackerPhase2/src/BuildFile.xml b/DQM/SiTrackerPhase2/src/BuildFile.xml new file mode 100644 index 0000000000000..6e0fbf4cc057f --- /dev/null +++ b/DQM/SiTrackerPhase2/src/BuildFile.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc b/DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc new file mode 100644 index 0000000000000..2fe9fa5515825 --- /dev/null +++ b/DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc @@ -0,0 +1,47 @@ +#include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" +std::string phase2tkutil::getITHistoId(uint32_t det_id, const TrackerTopology* tTopo) { + std::string Disc; + std::ostringstream fname1; + int layer = tTopo->getITPixelLayerNumber(det_id); + + if (layer < 0) + return ""; + if (layer < 100) { + fname1 << "Barrel/"; + fname1 << "Layer" << layer; + fname1 << ""; + } else { + int side = tTopo->pxfSide(det_id); + fname1 << "EndCap_Side" << side << "/"; + int disc = tTopo->pxfDisk(det_id); + Disc = (disc < 9) ? "EPix" : "FPix"; + fname1 << Disc << "/"; + int ring = tTopo->pxfBlade(det_id); + fname1 << "Ring" << ring; + } + return fname1.str(); +} + +std::string phase2tkutil::getOTHistoId(uint32_t det_id, const TrackerTopology* tTopo) { + std::string Disc; + std::ostringstream fname1; + int layer = tTopo->getOTLayerNumber(det_id); + + if (layer < 0) + return ""; + if (layer < 100) { + fname1 << "Barrel/"; + fname1 << "Layer" << layer; + fname1 << ""; + } else { + int side = tTopo->tidSide(det_id); + fname1 << "EndCap_Side" << side << "/"; + int disc = tTopo->tidWheel(det_id); + Disc = (disc < 3) ? "TEDD_1" : "TEDD_2"; + fname1 << Disc << "/"; + int ring = tTopo->tidRing(det_id); + fname1 << "Ring" << ring; + } + return fname1.str(); +} + diff --git a/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h b/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h index 0dc8bcf66f9c1..a3b492be26e36 100644 --- a/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h +++ b/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h @@ -2,22 +2,10 @@ #define _Validation_SiTrackerPhase2V_TrackerPhase2ValidationUtil_h #include "SimDataFormats/TrackingHit/interface/PSimHit.h" #include "SimDataFormats/Track/interface/SimTrack.h" -#include -#include -namespace Phase2TkUtil { +namespace phase2tkutil { - bool isPrimary(const SimTrack& simTrk, const PSimHit* simHit) { - bool retval = false; - unsigned int trkId = simTrk.trackId(); - if (trkId != simHit->trackId()) - return retval; - int vtxIndex = simTrk.vertIndex(); - int ptype = simHit->processType(); - if ((vtxIndex == 0) && (ptype == 0)) - return true; - return false; - } + bool isPrimary(const SimTrack& simTrk, const PSimHit* simHit); -} // namespace Phase2TkUtil +} // namespace phase2tkutil #endif diff --git a/Validation/SiTrackerPhase2V/plugins/BuildFile.xml b/Validation/SiTrackerPhase2V/plugins/BuildFile.xml index ef4098ba4d1f2..611a15d830f3f 100644 --- a/Validation/SiTrackerPhase2V/plugins/BuildFile.xml +++ b/Validation/SiTrackerPhase2V/plugins/BuildFile.xml @@ -20,7 +20,8 @@ + + - diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index eb5b525804d99..cbfbd91b0c2bd 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -10,32 +10,93 @@ // // system include files #include -#include "Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h" -#include "Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h" -#include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" +#include +#include +#include #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/ESWatcher.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/ESHandle.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" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/DetId/interface/DetId.h" +#include "DataFormats/GeometrySurface/interface/LocalError.h" +#include "DataFormats/GeometryVector/interface/LocalPoint.h" +#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" +#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/CommonDetUnit/interface/TrackerGeomDet.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "DataFormats/GeometrySurface/interface/LocalError.h" -#include "DataFormats/GeometryVector/interface/LocalPoint.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" //--- for SimHit association #include "SimDataFormats/Track/interface/SimTrackContainer.h" -#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" #include "SimDataFormats/TrackingHit/interface/PSimHit.h" #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" -#include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" -#include "SimDataFormats/Vertex/interface/SimVertexContainer.h" -// DQM Histograming +#include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" +//DQM +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/MonitorElement.h" +#include "Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h" +#include "DQM/SiTrackerPhase2/interface/TrackerPhase2DQMUtil.h" + +class Phase2ITValidateRecHit : public DQMEDAnalyzer { +public: + explicit Phase2ITValidateRecHit(const edm::ParameterSet&); + ~Phase2ITValidateRecHit() 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; + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void fillITHistos(const edm::Event& iEvent, + const TrackerHitAssociator& associateRecHit, + const std::vector>& simHits, + const std::map& selectedSimTrackMap); + + void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir); + + edm::ParameterSet config_; + TrackerHitAssociator::Config trackerHitAssociatorConfig_; + const double simtrackminpt_; + std::string geomType_; + const edm::EDGetTokenT tokenRecHitsIT_; + const edm::EDGetTokenT simTracksToken_; + std::vector> simHitTokens_; + const edm::ESGetToken geomToken_; + const edm::ESGetToken topoToken_; + const TrackerGeometry* tkGeom_ = nullptr; + const TrackerTopology* tTopo_ = nullptr; + struct RecHitME { + MonitorElement* deltaX = nullptr; + MonitorElement* deltaY = nullptr; + MonitorElement* pullX = nullptr; + MonitorElement* pullY = nullptr; + MonitorElement* deltaX_eta = nullptr; + MonitorElement* deltaY_eta = nullptr; + MonitorElement* pullX_eta = nullptr; + MonitorElement* pullY_eta = nullptr; + //For rechits matched to primary simhits + MonitorElement* numberRecHitsprimary = nullptr; + MonitorElement* pullX_primary; + MonitorElement* pullY_primary; + MonitorElement* deltaX_primary; + MonitorElement* deltaY_primary; + }; + std::map layerMEs_; +}; + Phase2ITValidateRecHit::Phase2ITValidateRecHit(const edm::ParameterSet& iConfig) : config_(iConfig), trackerHitAssociatorConfig_(iConfig, consumesCollector()), @@ -53,6 +114,7 @@ Phase2ITValidateRecHit::Phase2ITValidateRecHit(const edm::ParameterSet& iConfig) Phase2ITValidateRecHit::~Phase2ITValidateRecHit() { edm::LogInfo("Phase2ITValidateRecHit") << ">>> Destroy Phase2ITValidateRecHit "; } + void Phase2ITValidateRecHit::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { std::vector> simHits; for (const auto& itoken : simHitTokens_) { @@ -67,10 +129,9 @@ void Phase2ITValidateRecHit::analyze(const edm::Event& iEvent, const edm::EventS iEvent.getByToken(simTracksToken_, simTracks); std::map selectedSimTrackMap; - for (edm::SimTrackContainer::const_iterator simTrackIt(simTracks->begin()); simTrackIt != simTracks->end(); - ++simTrackIt) { - if (simTrackIt->momentum().pt() > simtrackminpt_) { - selectedSimTrackMap.insert(std::make_pair(simTrackIt->trackId(), *simTrackIt)); + for (const auto& simTrackIt : *simTracks) { + if (simTrackIt.momentum().pt() > simtrackminpt_) { + selectedSimTrackMap.insert(std::make_pair(simTrackIt.trackId(), simTrackIt)); } } TrackerHitAssociator associateRecHit(iEvent, trackerHitAssociatorConfig_); @@ -88,42 +149,37 @@ void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, return; std::map nrechitLayerMap_primary; // Loop over modules - SiPixelRecHitCollection::const_iterator DSViter; - for (DSViter = rechits->begin(); DSViter != rechits->end(); ++DSViter) { + for (const auto& DSViter : *rechits) { // Get the detector unit's id - unsigned int rawid(DSViter->detId()); + unsigned int rawid(DSViter.detId()); DetId detId(rawid); // Get the geomdet const GeomDetUnit* geomDetunit(tkGeom_->idToDetUnit(detId)); if (!geomDetunit) continue; // determine the detector we are in - std::string key = Phase2TkUtil::getITHistoId(detId.rawId(), tTopo_); + std::string key = phase2tkutil::getITHistoId(detId.rawId(), tTopo_); if (nrechitLayerMap_primary.find(key) == nrechitLayerMap_primary.end()) { - nrechitLayerMap_primary.insert(std::make_pair(key, DSViter->size())); + nrechitLayerMap_primary.emplace(key, DSViter.size()); } else { - nrechitLayerMap_primary[key] += DSViter->size(); + nrechitLayerMap_primary[key] += DSViter.size(); } - - edmNew::DetSet::const_iterator rechitIt; //loop over rechits for a single detId - for (rechitIt = DSViter->begin(); rechitIt != DSViter->end(); ++rechitIt) { + for (const auto& rechit : DSViter) { //GetSimHits - const std::vector& matchedId = associateRecHit.associateHitId(*rechitIt); + const std::vector& matchedId = associateRecHit.associateHitId(rechit); const PSimHit* simhitClosest = nullptr; float minx = 10000; - LocalPoint lp = rechitIt->localPosition(); - for (unsigned int si = 0; si < simHits.size(); ++si) { - for (edm::PSimHitContainer::const_iterator simhitIt = simHits.at(si)->begin(); - simhitIt != simHits.at(si)->end(); - ++simhitIt) { - if (detId.rawId() != simhitIt->detUnitId()) + LocalPoint lp = rechit.localPosition(); + for (const auto& simHitCol : simHits) { + for (const auto& simhitIt : *simHitCol) { + if (detId.rawId() != simhitIt.detUnitId()) continue; - for (auto& mId : matchedId) { - if (simhitIt->trackId() == mId.first) { - if (!simhitClosest || fabs(simhitIt->localPosition().x() - lp.x()) < minx) { - minx = fabs(simhitIt->localPosition().x() - lp.x()); - simhitClosest = &*simhitIt; + for (const auto& mId : matchedId) { + if (simhitIt.trackId() == mId.first) { + if (!simhitClosest || abs(simhitIt.localPosition().x() - lp.x()) < minx) { + minx = abs(simhitIt.localPosition().x() - lp.x()); + simhitClosest = &simhitIt; } } } @@ -135,9 +191,9 @@ void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, bool isPrimary = false; //check if simhit is primary if (simTrackIt != selectedSimTrackMap.end()) - isPrimary = Phase2TkUtil::isPrimary(simTrackIt->second, simhitClosest); + isPrimary = phase2tkutil::isPrimary(simTrackIt->second, simhitClosest); Local3DPoint simlp(simhitClosest->localPosition()); - const LocalError& lperr = rechitIt->localPositionError(); + const LocalError& lperr = rechit.localPositionError(); double dx = lp.x() - simlp.x(); double dy = lp.y() - simlp.y(); double pullx = 999.; @@ -166,7 +222,7 @@ void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, } //End loop over DetSetVector //fill nRecHit counter per layer - for (auto& lme : nrechitLayerMap_primary) { + for (const auto& lme : nrechitLayerMap_primary) { layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]); } } @@ -200,7 +256,7 @@ void Phase2ITValidateRecHit::bookHistograms(DQMStore::IBooker& ibooker, // void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir) { ibooker.cd(); - std::string key = Phase2TkUtil::getITHistoId(det_id, tTopo_); + std::string key = phase2tkutil::getITHistoId(det_id, tTopo_); if (key.empty()) return; if (layerMEs_.find(key) == layerMEs_.end()) { @@ -212,58 +268,58 @@ void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigne histoName.str(""); histoName << "Delta_X"; local_histos.deltaX = - Phase2TkUtil::book1DFromPSet(config_.getParameter("DeltaX"), histoName.str(), ibooker); + phase2tkutil::book1DFromPSet(config_.getParameter("DeltaX"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_Y"; local_histos.deltaY = - Phase2TkUtil::book1DFromPSet(config_.getParameter("DeltaX"), histoName.str(), ibooker); + phase2tkutil::book1DFromPSet(config_.getParameter("DeltaX"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_X"; local_histos.pullX = - Phase2TkUtil::book1DFromPSet(config_.getParameter("PullX"), histoName.str(), ibooker); + phase2tkutil::book1DFromPSet(config_.getParameter("PullX"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_Y"; local_histos.pullY = - Phase2TkUtil::book1DFromPSet(config_.getParameter("PullY"), histoName.str(), ibooker); + phase2tkutil::book1DFromPSet(config_.getParameter("PullY"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_X_vs_Eta"; - local_histos.deltaX_eta = Phase2TkUtil::bookProfile1DFromPSet( + local_histos.deltaX_eta = phase2tkutil::bookProfile1DFromPSet( config_.getParameter("DeltaX_eta"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_Y_vs_Eta"; - local_histos.deltaY_eta = Phase2TkUtil::bookProfile1DFromPSet( + local_histos.deltaY_eta = phase2tkutil::bookProfile1DFromPSet( config_.getParameter("DeltaX_eta"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_X_vs_Eta"; - local_histos.pullX_eta = Phase2TkUtil::bookProfile1DFromPSet( + local_histos.pullX_eta = phase2tkutil::bookProfile1DFromPSet( config_.getParameter("PullX_eta"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_Y_vs_Eta"; - local_histos.pullY_eta = Phase2TkUtil::bookProfile1DFromPSet( + local_histos.pullY_eta = phase2tkutil::bookProfile1DFromPSet( config_.getParameter("PullY_eta"), histoName.str(), ibooker); ibooker.setCurrentFolder(subdir + "/" + key + "/PrimarySimHits"); //all histos for Primary particles histoName.str(""); histoName << "Number_RecHits_matched_PrimarySimTrack"; - local_histos.numberRecHitsprimary = Phase2TkUtil::book1DFromPSet( + local_histos.numberRecHitsprimary = phase2tkutil::book1DFromPSet( config_.getParameter("nRecHits_primary"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_X_SimHitPrimary"; - local_histos.deltaX_primary = Phase2TkUtil::book1DFromPSet( + local_histos.deltaX_primary = phase2tkutil::book1DFromPSet( config_.getParameter("DeltaX_primary"), histoName.str(), ibooker); histoName.str(""); histoName << "Delta_Y_SimHitPrimary"; - local_histos.deltaY_primary = Phase2TkUtil::book1DFromPSet( + local_histos.deltaY_primary = phase2tkutil::book1DFromPSet( config_.getParameter("DeltaY_primary"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_X_SimHitPrimary"; - local_histos.pullX_primary = Phase2TkUtil::book1DFromPSet( + local_histos.pullX_primary = phase2tkutil::book1DFromPSet( config_.getParameter("PullX_primary"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_Y_SimHitPrimary"; - local_histos.pullY_primary = Phase2TkUtil::book1DFromPSet( + local_histos.pullY_primary = phase2tkutil::book1DFromPSet( config_.getParameter("PullY_primary"), histoName.str(), ibooker); - layerMEs_.insert(std::make_pair(key, local_histos)); + layerMEs_.emplace(key, local_histos); } } void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h deleted file mode 100644 index 05ddc936ed1fc..0000000000000 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef _Validation_SiTrackerPhase2V_Phase2ITValidateRecHit_h -#define _Validation_SiTrackerPhase2V_Phase2ITValidateRecHit_h -#include -#include -#include -#include -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/Framework/interface/ESHandle.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/Common/interface/DetSetVectorNew.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" -#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h" -#include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" -#include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" - -// DQM Histograming -class PixelDigiSimLink; -class SimTrack; -class SimHit; -class TrackerTopology; -class TrackerGeometry; -class TrackerDigiGeometryRecord; -class TrackerTopologyRcd; -class Phase2ITValidateRecHit : public DQMEDAnalyzer { -public: - explicit Phase2ITValidateRecHit(const edm::ParameterSet&); - ~Phase2ITValidateRecHit() 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; - void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void fillITHistos(const edm::Event& iEvent, - const TrackerHitAssociator& associateRecHit, - const std::vector>& simHits, - const std::map& selectedSimTrackMap); - - void bookLayerHistos(DQMStore::IBooker& ibooker, unsigned int det_id, std::string& subdir); - - edm::ParameterSet config_; - TrackerHitAssociator::Config trackerHitAssociatorConfig_; - const double simtrackminpt_; - std::string geomType_; - const edm::EDGetTokenT tokenRecHitsIT_; - const edm::EDGetTokenT simTracksToken_; - std::vector> simHitTokens_; - const edm::ESGetToken geomToken_; - const edm::ESGetToken topoToken_; - const TrackerGeometry* tkGeom_ = nullptr; - const TrackerTopology* tTopo_ = nullptr; - struct RecHitME { - // use TH1D instead of TH1F to avoid stauration at 2^31 - // above this increments with +1 don't work for float, need double - MonitorElement* deltaX = nullptr; - MonitorElement* deltaY = nullptr; - MonitorElement* pullX = nullptr; - MonitorElement* pullY = nullptr; - MonitorElement* deltaX_eta = nullptr; - MonitorElement* deltaY_eta = nullptr; - MonitorElement* pullX_eta = nullptr; - MonitorElement* pullY_eta = nullptr; - //For rechits matched to simhits from highPT tracks - MonitorElement* numberRecHitsprimary = nullptr; - MonitorElement* pullX_primary; - MonitorElement* pullY_primary; - MonitorElement* deltaX_primary; - MonitorElement* deltaY_primary; - }; - std::map layerMEs_; -}; -#endif diff --git a/Validation/SiTrackerPhase2V/src/BuildFile.xml b/Validation/SiTrackerPhase2V/src/BuildFile.xml new file mode 100644 index 0000000000000..f03a5a7df2841 --- /dev/null +++ b/Validation/SiTrackerPhase2V/src/BuildFile.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Validation/SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc b/Validation/SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc new file mode 100644 index 0000000000000..e14f858372017 --- /dev/null +++ b/Validation/SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc @@ -0,0 +1,12 @@ +#include "Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h" +bool phase2tkutil::isPrimary(const SimTrack& simTrk, const PSimHit* simHit) { + bool retval = false; + unsigned int trkId = simTrk.trackId(); + if (trkId != simHit->trackId()) + return retval; + int vtxIndex = simTrk.vertIndex(); + int ptype = simHit->processType(); + return ((vtxIndex == 0) && (ptype == 0)); +} + + From 73d5cca3df1e32fb0264cbaffa17d444ecb3083e Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Fri, 9 Oct 2020 09:24:30 +0200 Subject: [PATCH 09/12] typo fix --- Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index cbfbd91b0c2bd..f0c221d3a6484 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -328,7 +328,7 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X"); - psd0.add("title", "Delta_X;RecHit resolution X dimensiom"); + psd0.add("title", "Delta_X;RecHit resolution X dimension"); psd0.add("xmin", -0.2); psd0.add("switch", true); psd0.add("xmax", 0.2); @@ -338,7 +338,7 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y"); - psd0.add("title", "Delta_Y;RecHit resolution Y dimensiom;"); + psd0.add("title", "Delta_Y;RecHit resolution Y dimension;"); psd0.add("xmin", -0.2); psd0.add("switch", true); psd0.add("xmax", 0.2); From 5a416943131ab5b5ff31c7eb2aa57d1b4beb27ec Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Fri, 9 Oct 2020 09:27:40 +0200 Subject: [PATCH 10/12] buildfile fix --- DQM/SiTrackerPhase2/plugins/BuildFile.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/DQM/SiTrackerPhase2/plugins/BuildFile.xml b/DQM/SiTrackerPhase2/plugins/BuildFile.xml index b4d852597bbd3..546493369403a 100644 --- a/DQM/SiTrackerPhase2/plugins/BuildFile.xml +++ b/DQM/SiTrackerPhase2/plugins/BuildFile.xml @@ -12,4 +12,3 @@ - From 10bea8a6a4db87693c078c377bc13f395e042aad Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Fri, 9 Oct 2020 09:38:07 +0200 Subject: [PATCH 11/12] resolve code format issues --- DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc | 5 ++--- .../SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc b/DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc index 2fe9fa5515825..77523e0f06501 100644 --- a/DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc +++ b/DQM/SiTrackerPhase2/src/TrackerPhase2DQMUtil.cc @@ -3,7 +3,7 @@ std::string phase2tkutil::getITHistoId(uint32_t det_id, const TrackerTopology* t std::string Disc; std::ostringstream fname1; int layer = tTopo->getITPixelLayerNumber(det_id); - + if (layer < 0) return ""; if (layer < 100) { @@ -26,7 +26,7 @@ std::string phase2tkutil::getOTHistoId(uint32_t det_id, const TrackerTopology* t std::string Disc; std::ostringstream fname1; int layer = tTopo->getOTLayerNumber(det_id); - + if (layer < 0) return ""; if (layer < 100) { @@ -44,4 +44,3 @@ std::string phase2tkutil::getOTHistoId(uint32_t det_id, const TrackerTopology* t } return fname1.str(); } - diff --git a/Validation/SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc b/Validation/SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc index e14f858372017..66d8867a57f4f 100644 --- a/Validation/SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc +++ b/Validation/SiTrackerPhase2V/src/TrackerPhase2ValidationUtil.cc @@ -8,5 +8,3 @@ bool phase2tkutil::isPrimary(const SimTrack& simTrk, const PSimHit* simHit) { int ptype = simHit->processType(); return ((vtxIndex == 0) && (ptype == 0)); } - - From 49ac5cf617738adf0cd26338f9938461c49b69fc Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Mon, 12 Oct 2020 12:54:02 +0200 Subject: [PATCH 12/12] fix deltaY histo creation. --- Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index f0c221d3a6484..e44f339b943c4 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -272,7 +272,7 @@ void Phase2ITValidateRecHit::bookLayerHistos(DQMStore::IBooker& ibooker, unsigne histoName.str(""); histoName << "Delta_Y"; local_histos.deltaY = - phase2tkutil::book1DFromPSet(config_.getParameter("DeltaX"), histoName.str(), ibooker); + phase2tkutil::book1DFromPSet(config_.getParameter("DeltaY"), histoName.str(), ibooker); histoName.str(""); histoName << "Pull_X"; local_histos.pullX =