Skip to content

Commit

Permalink
Merge pull request #34297 from mmusich/migrate_to_esConsumes_Alignmen…
Browse files Browse the repository at this point in the history
…tCocoaApplication_and_AlignmentLaserDQM

Migrate to es Consumes `Alignment/CocoaApplication` and `Alignment/LaserDQM`
  • Loading branch information
cmsbuild committed Jul 5, 2021
2 parents e8d3158 + bd8b9df commit 1fea914
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
13 changes: 6 additions & 7 deletions Alignment/CocoaApplication/src/CocoaAnalyzer.cc
Expand Up @@ -46,12 +46,14 @@ class CocoaAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
void runCocoa();

private:
edm::ESGetToken<OpticalAlignments, OpticalAlignmentsRcd> optAliToken;
edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> ddcvToken;
OpticalAlignments oaList_;
OpticalAlignMeasurements measList_;
std::string theCocoaDaqRootFileName_;
};

CocoaAnalyzer::CocoaAnalyzer(edm::ParameterSet const& pset) {
CocoaAnalyzer::CocoaAnalyzer(edm::ParameterSet const& pset) : optAliToken(esConsumes()), ddcvToken(esConsumes()) {
theCocoaDaqRootFileName_ = pset.getParameter<std::string>("cocoaDaqRootFile");
int maxEvents = pset.getParameter<int32_t>("maxEvents");
GlobalOptionMgr::getInstance()->setDefaultGlobalOptions();
Expand Down Expand Up @@ -83,9 +85,7 @@ void CocoaAnalyzer::analyze(const edm::Event& evt, const edm::EventSetup& evts)
* Resulting optical alignment info is stored in oaList_ and measList_.
*/
void CocoaAnalyzer::readXMLFile(const edm::EventSetup& evts) {
edm::ESTransientHandle<cms::DDCompactView> myCompactView;
evts.get<IdealGeometryRecord>().get(myCompactView);

edm::ESTransientHandle<cms::DDCompactView> myCompactView = evts.getTransientHandle(ddcvToken);
const cms::DDDetector* mySystem = myCompactView->detector();

if (mySystem) {
Expand Down Expand Up @@ -453,9 +453,8 @@ std::vector<OpticalAlignInfo> CocoaAnalyzer::readCalibrationDB(const edm::EventS
}

using namespace edm::eventsetup;
edm::ESHandle<OpticalAlignments> pObjs;
evts.get<OpticalAlignmentsRcd>().get(pObjs);
const std::vector<OpticalAlignInfo>& infoFromDB = pObjs.product()->opticalAlignments_;
const OpticalAlignments* pObjs = &evts.getData(optAliToken);
const std::vector<OpticalAlignInfo>& infoFromDB = pObjs->opticalAlignments_;

if (ALIUtils::debug >= 5) {
edm::LogInfo("Alignment") << "CocoaAnalyzer::readCalibrationDB: Number of OpticalAlignInfo READ "
Expand Down
4 changes: 3 additions & 1 deletion Alignment/LaserDQM/plugins/LaserDQM.cc
Expand Up @@ -14,7 +14,9 @@
#include "FWCore/ServiceRegistry/interface/Service.h"

LaserDQM::LaserDQM(edm::ParameterSet const &theConf)
: theDebugLevel(theConf.getUntrackedParameter<int>("DebugLevel", 0)),
: tTopoToken(esConsumes()),
tGeoToken(esConsumes()),
theDebugLevel(theConf.getUntrackedParameter<int>("DebugLevel", 0)),
theSearchPhiTIB(theConf.getUntrackedParameter<double>("SearchWindowPhiTIB", 0.05)),
theSearchPhiTOB(theConf.getUntrackedParameter<double>("SearchWindowPhiTOB", 0.05)),
theSearchPhiTEC(theConf.getUntrackedParameter<double>("SearchWindowPhiTEC", 0.05)),
Expand Down
12 changes: 10 additions & 2 deletions Alignment/LaserDQM/plugins/LaserDQM.h
Expand Up @@ -11,14 +11,19 @@

#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/one/EDAnalyzer.h"

// DQM
#include "DQMServices/Core/interface/DQMStore.h"

#include <iostream>

class LaserDQM : public edm::EDAnalyzer {
class TrackerTopology;
class TrackerTopologyRcd;
class TrackerGeometry;
class TrackerDigiGeometryRecord;

class LaserDQM : public edm::one::EDAnalyzer<> {
public:
typedef dqm::legacy::DQMStore DQMStore;
typedef dqm::legacy::MonitorElement MonitorElement;
Expand Down Expand Up @@ -47,6 +52,9 @@ class LaserDQM : public edm::EDAnalyzer {
void trackerStatistics(edm::Event const &theEvent, edm::EventSetup const &theSetup);

private:
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken;
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> tGeoToken;

int theDebugLevel;
double theSearchPhiTIB;
double theSearchPhiTOB;
Expand Down
8 changes: 2 additions & 6 deletions Alignment/LaserDQM/plugins/LaserDQMStatistics.cc
Expand Up @@ -25,14 +25,10 @@

void LaserDQM::trackerStatistics(edm::Event const &theEvent, edm::EventSetup const &theSetup) {
// Retrieve tracker topology from geometry
edm::ESHandle<TrackerTopology> tTopoHandle;
theSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
const TrackerTopology *const tTopo = tTopoHandle.product();
const TrackerTopology *const tTopo = &theSetup.getData(tTopoToken);

// access the tracker
edm::ESHandle<TrackerGeometry> theTrackerGeometry;
theSetup.get<TrackerDigiGeometryRecord>().get(theTrackerGeometry);
const TrackerGeometry &theTracker(*theTrackerGeometry);
const TrackerGeometry &theTracker = theSetup.getData(tGeoToken);

// get the StripDigiCollection
// get the StripDigiCollection
Expand Down

0 comments on commit 1fea914

Please sign in to comment.