Skip to content

Commit

Permalink
Merge pull request #27699 from jandrea/SiStripMonitor_ConditionsOutsi…
Browse files Browse the repository at this point in the history
…deLoop

[TkDQM] Update of SiStripMonitorTrack : ES access put outside tracks loop
  • Loading branch information
cmsbuild committed Aug 10, 2019
2 parents ef3ec84 + 92353aa commit 32b1f6c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 20 deletions.
13 changes: 13 additions & 0 deletions DQM/SiStripMonitorTrack/interface/SiStripMonitorTrack.h
Expand Up @@ -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"
//***************************************************/
Expand Down Expand Up @@ -167,6 +172,14 @@ class SiStripMonitorTrack : public DQMEDAnalyzer {

std::string topFolderName_;

const TrackerTopology* tTopo_;
edm::ESWatcher<TrackerTopologyRcd> watchertTopo_;

const SiStripGain* stripGain_;
edm::ESWatcher<SiStripGainRcd> watcherStripGain_;

const SiStripQuality* stripQuality_;

//******* TkHistoMaps*/
std::unique_ptr<TkHistoMap> tkhisto_StoNCorrOnTrack, tkhisto_NumOnTrack, tkhisto_NumOffTrack;
std::unique_ptr<TkHistoMap> tkhisto_ClChPerCMfromOrigin, tkhisto_ClChPerCMfromTrack;
Expand Down
48 changes: 28 additions & 20 deletions DQM/SiStripMonitorTrack/src/SiStripMonitorTrack.cc
Expand Up @@ -79,6 +79,14 @@ void SiStripMonitorTrack::dqmBeginRun(const edm::Run& run, const edm::EventSetup
<< " detectors instantiated in the geometry" << std::endl;
es.get<SiStripDetCablingRcd>().get(SiStripDetCabling_);

edm::ESHandle<TrackerTopology> tTopoHandle;
es.get<TrackerTopologyRcd>().get(tTopoHandle);
tTopo_ = tTopoHandle.product();

edm::ESHandle<SiStripGain> gainHandle;
es.get<SiStripGainRcd>().get(gainHandle);
stripGain_ = gainHandle.product();

// Initialize the GenericTriggerEventFlag
if (genTriggerEventFlag_->on())
genTriggerEventFlag_->initRun(run, es);
Expand Down Expand Up @@ -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<TrackerTopology> tTopoHandle;
es.get<TrackerTopologyRcd>().get(tTopoHandle);
tTopo_ = tTopoHandle.product();
}

if (watcherStripGain_.check(es)) {
edm::ESHandle<SiStripGain> gainHandle;
es.get<SiStripGainRcd>().get(gainHandle);
stripGain_ = gainHandle.product();
}

edm::ESHandle<SiStripQuality> qualityHandle;
es.get<SiStripQualityRcd>().get("", qualityHandle);
stripQuality_ = qualityHandle.product();

//Perform track study
trackStudy(e, es);

Expand Down Expand Up @@ -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<TrackerTopology> tTopoHandle;
es.get<TrackerTopologyRcd>().get(tTopoHandle);
const TrackerTopology* const tTopo = tTopoHandle.product();

// Getting SiStrip Gain settings
edm::ESHandle<SiStripGain> gainHandle;
es.get<SiStripGainRcd>().get(gainHandle);
const SiStripGain* const stripGain = gainHandle.product();

edm::ESHandle<SiStripQuality> qualityHandle;
es.get<SiStripQualityRcd>().get("", qualityHandle);
const SiStripQuality* stripQuality = qualityHandle.product();

//Get SiStripCluster from SiStripRecHit
if (tkrecHit != nullptr && tkrecHit->isValid()) {
const DetId detid = tkrecHit->geographicalId();
Expand All @@ -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)) {
Expand Down

0 comments on commit 32b1f6c

Please sign in to comment.