diff --git a/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h b/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h index 6449d096d4c4d..727c775db1545 100644 --- a/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h +++ b/DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h @@ -43,6 +43,11 @@ #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" //***************************************************/ @@ -167,6 +172,14 @@ class SiStripMonitorTrack : public DQMEDAnalyzer { 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; std::unique_ptr tkhisto_ClChPerCMfromOrigin, tkhisto_ClChPerCMfromTrack; diff --git a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc index 2ee4d19050e53..042b8a97f902b 100644 --- a/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc +++ b/DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc @@ -79,6 +79,14 @@ void SiStripMonitorTrack::dqmBeginRun(const edm::Run& run, const edm::EventSetup << " 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 +129,22 @@ 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 +1246,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 +1267,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)) {