From 461429d8815beb2f3ea7f853b8dc6ac561effbc1 Mon Sep 17 00:00:00 2001 From: Jeremy Andrea Date: Mon, 5 Aug 2019 23:11:14 +0200 Subject: [PATCH 1/2] put reading of conditions outside loops on tracks... --- .../interface/SiStripMonitorTrack.h | 15 ++++++ .../src/SiStripMonitorTrack.cc | 54 +++++++++++-------- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h b/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h index 6449d096d4c4d..9812fad0c94e6 100644 --- a/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h +++ b/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h @@ -43,6 +43,12 @@ #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "CalibTracker/Records/interface/SiStripGainRcd.h" +#include "CalibTracker/Records/interface/SiStripQualityRcd.h" + + //******** Single include for the TkMap *************/ #include "DQM/SiStripCommon/interface/TkHistoMap.h" //***************************************************/ @@ -166,6 +172,15 @@ class SiStripMonitorTrack : public DQMEDAnalyzer { float iOrbitSec, iLumisection; std::string topFolderName_; + + + const TrackerTopology* tTopo_ ; + edm::ESWatcher watchertTopo_ ; + + const SiStripGain* stripGain_ ; + edm::ESWatcher watcherStripGain_; + + const SiStripQuality* stripQuality_ ; //******* TkHistoMaps*/ std::unique_ptr tkhisto_StoNCorrOnTrack, tkhisto_NumOnTrack, tkhisto_NumOffTrack; diff --git a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc index 2ee4d19050e53..b12cee723ff9b 100644 --- a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc +++ b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc @@ -78,7 +78,16 @@ void SiStripMonitorTrack::dqmBeginRun(const edm::Run& run, const edm::EventSetup LogDebug("SiStripMonitorTrack") << "[SiStripMonitorTrack::beginRun] There are " << tkgeom_->detUnits().size() << " detectors instantiated in the geometry" << std::endl; es.get().get(SiStripDetCabling_); - + + edm::ESHandle tTopoHandle; + es.get().get(tTopoHandle); + tTopo_ = tTopoHandle.product(); + + edm::ESHandle gainHandle; + es.get().get(gainHandle); + stripGain_ = gainHandle.product(); + + // Initialize the GenericTriggerEventFlag if (genTriggerEventFlag_->on()) genTriggerEventFlag_->initRun(run, es); @@ -121,6 +130,25 @@ void SiStripMonitorTrack::analyze(const edm::Event& e, const edm::EventSetup& es iSubDet->second.totNClustersOffTrack = 0; } + if (watchertTopo_.check(es) ) { + edm::ESHandle tTopoHandle; + es.get().get(tTopoHandle); + tTopo_ = tTopoHandle.product(); + } + + + if (watcherStripGain_.check(es) ) { + edm::ESHandle gainHandle; + es.get().get(gainHandle); + stripGain_ = gainHandle.product(); + } + + + edm::ESHandle qualityHandle; + es.get().get("", qualityHandle); + stripQuality_ = qualityHandle.product(); + + //Perform track study trackStudy(e, es); @@ -1222,22 +1250,6 @@ void SiStripMonitorTrack::RecHitInfo(const T* tkrecHit, << tkgeom_->idToDet(tkrecHit->geographicalId())->surface().toGlobal(tkrecHit->localPosition()) << "\n\t\tRecHit trackLocal vector " << LV.x() << " " << LV.y() << " " << LV.z() << std::endl; - // FIXME: MOVE ALL THE EV AND ES ACCESS OUTSIDE THE LOOP!!!! - - //Retrieve tracker topology from geometry - edm::ESHandle tTopoHandle; - es.get().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); - - // Getting SiStrip Gain settings - edm::ESHandle gainHandle; - es.get().get(gainHandle); - const SiStripGain* const stripGain = gainHandle.product(); - - edm::ESHandle qualityHandle; - es.get().get("", qualityHandle); - const SiStripQuality* stripQuality = qualityHandle.product(); - //Get SiStripCluster from SiStripRecHit if (tkrecHit != nullptr && tkrecHit->isValid()) { const DetId detid = tkrecHit->geographicalId(); @@ -1259,16 +1271,16 @@ void SiStripMonitorTrack::RecHitInfo(const T* tkrecHit, const SiStripCluster* SiStripCluster_ = &*(tkrecHit->cluster()); SiStripClusterInfo SiStripClusterInfo_(*SiStripCluster_, es, detid); - const Det2MEs MEs = findMEs(tTopo, detid); + const Det2MEs MEs = findMEs(tTopo_, detid); if (clusterInfos(&SiStripClusterInfo_, detid, OnTrack, track_ok, LV, MEs, - tTopo, - stripGain, - stripQuality, + tTopo_, + stripGain_, + stripQuality_, digilist, clust_Pos1, clust_Pos2)) { From 92353aa18d8e222a03e333bb6299088dc33cd815 Mon Sep 17 00:00:00 2001 From: Jeremy Andrea Date: Tue, 6 Aug 2019 08:54:26 +0200 Subject: [PATCH 2/2] fix coding style of the PR --- .../interface/SiStripMonitorTrack.h | 16 +++++++-------- .../src/SiStripMonitorTrack.cc | 20 ++++++++----------- 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h b/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h index 9812fad0c94e6..727c775db1545 100644 --- a/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h +++ b/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h @@ -48,7 +48,6 @@ #include "CalibTracker/Records/interface/SiStripGainRcd.h" #include "CalibTracker/Records/interface/SiStripQualityRcd.h" - //******** Single include for the TkMap *************/ #include "DQM/SiStripCommon/interface/TkHistoMap.h" //***************************************************/ @@ -172,15 +171,14 @@ class SiStripMonitorTrack : public DQMEDAnalyzer { float iOrbitSec, iLumisection; std::string topFolderName_; - - - const TrackerTopology* tTopo_ ; - edm::ESWatcher watchertTopo_ ; - - const SiStripGain* stripGain_ ; + + const TrackerTopology* tTopo_; + edm::ESWatcher watchertTopo_; + + const SiStripGain* stripGain_; edm::ESWatcher watcherStripGain_; - - const SiStripQuality* stripQuality_ ; + + const SiStripQuality* stripQuality_; //******* TkHistoMaps*/ std::unique_ptr tkhisto_StoNCorrOnTrack, tkhisto_NumOnTrack, tkhisto_NumOffTrack; diff --git a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc index b12cee723ff9b..042b8a97f902b 100644 --- a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc +++ b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc @@ -78,16 +78,15 @@ void SiStripMonitorTrack::dqmBeginRun(const edm::Run& run, const edm::EventSetup LogDebug("SiStripMonitorTrack") << "[SiStripMonitorTrack::beginRun] There are " << tkgeom_->detUnits().size() << " detectors instantiated in the geometry" << std::endl; es.get().get(SiStripDetCabling_); - + edm::ESHandle tTopoHandle; es.get().get(tTopoHandle); tTopo_ = tTopoHandle.product(); - + edm::ESHandle gainHandle; es.get().get(gainHandle); stripGain_ = gainHandle.product(); - - + // Initialize the GenericTriggerEventFlag if (genTriggerEventFlag_->on()) genTriggerEventFlag_->initRun(run, es); @@ -130,25 +129,22 @@ void SiStripMonitorTrack::analyze(const edm::Event& e, const edm::EventSetup& es iSubDet->second.totNClustersOffTrack = 0; } - if (watchertTopo_.check(es) ) { + if (watchertTopo_.check(es)) { edm::ESHandle tTopoHandle; es.get().get(tTopoHandle); tTopo_ = tTopoHandle.product(); } - - if (watcherStripGain_.check(es) ) { + if (watcherStripGain_.check(es)) { edm::ESHandle gainHandle; es.get().get(gainHandle); - stripGain_ = gainHandle.product(); + stripGain_ = gainHandle.product(); } - - + edm::ESHandle qualityHandle; es.get().get("", qualityHandle); stripQuality_ = qualityHandle.product(); - - + //Perform track study trackStudy(e, es);