Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernized MTDDetLayerGeometryESProducer #28319

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.h>
#include "BTLDetLayerGeometryBuilder.h"

#include <DataFormats/ForwardDetId/interface/BTLDetId.h>
#include <Geometry/CommonDetUnit/interface/GeomDet.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.h>
#include "ETLDetLayerGeometryBuilder.h"

#include <RecoMTD/DetLayers/interface/MTDRingForwardDoubleLayer.h>
#include <RecoMTD/DetLayers/interface/MTDDetRing.h>
Expand Down
57 changes: 40 additions & 17 deletions RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.cc
Original file line number Diff line number Diff line change
@@ -1,44 +1,60 @@
/** \file
*
* ESProducer for MTDDetLayerGeometry in RecoMTD/DetLayers
*
* \author L. Gray - FNAL
*
*/

#include <RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.h>
#include <Geometry/Records/interface/MTDDigiGeometryRecord.h>

#include <Geometry/MTDGeometryBuilder/interface/MTDGeometry.h>
#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ModuleFactory.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include <RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.h>
#include <RecoMTD/DetLayers/src/BTLDetLayerGeometryBuilder.h>
#include "RecoMTD/Records/interface/MTDRecoGeometryRecord.h"
#include "Geometry/Records/interface/MTDDigiGeometryRecord.h"
#include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h"

#include <FWCore/Framework/interface/EventSetup.h>
#include <FWCore/Framework/interface/ESHandle.h>
#include "ETLDetLayerGeometryBuilder.h"
#include "BTLDetLayerGeometryBuilder.h"
#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h"

#include <FWCore/MessageLogger/interface/MessageLogger.h>
#include <FWCore/Framework/interface/NoProxyException.h>
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <memory>
#include <iostream>

using namespace edm;
class MTDDetLayerGeometryESProducer : public edm::ESProducer {
public:
/// Constructor
MTDDetLayerGeometryESProducer(const edm::ParameterSet& p);

MTDDetLayerGeometryESProducer::MTDDetLayerGeometryESProducer(const edm::ParameterSet& p) { setWhatProduced(this); }
/// Produce MuonDeLayerGeometry.
std::unique_ptr<MTDDetLayerGeometry> produce(const MTDRecoGeometryRecord& record);

MTDDetLayerGeometryESProducer::~MTDDetLayerGeometryESProducer() {}
static void fillDescriptions(edm::ConfigurationDescriptions&);

private:
edm::ESGetToken<MTDGeometry, MTDDigiGeometryRecord> geomToken_;
};

using namespace edm;

MTDDetLayerGeometryESProducer::MTDDetLayerGeometryESProducer(const edm::ParameterSet& p) {
setWhatProduced(this).setConsumes(geomToken_);
}

std::unique_ptr<MTDDetLayerGeometry> MTDDetLayerGeometryESProducer::produce(const MTDRecoGeometryRecord& record) {
const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDDetLayerGeometryESProducer";
auto mtdDetLayerGeometry = std::make_unique<MTDDetLayerGeometry>();

edm::ESHandle<MTDGeometry> mtd;
record.getRecord<MTDDigiGeometryRecord>().get(mtd);
if (mtd.isValid()) {
if (auto mtd = record.getHandle(geomToken_)) {
// Build BTL layers
mtdDetLayerGeometry->addBTLLayers(BTLDetLayerGeometryBuilder::buildLayers(*mtd));
// Build ETL layers
mtdDetLayerGeometry->addETLLayers(ETLDetLayerGeometryBuilder::buildLayers(*mtd));
} else {
const std::string metname = "MTD|RecoMTD|RecoMTDDetLayers|MTDDetLayerGeometryESProducer";
LogInfo(metname) << "No MTD geometry is available.";
}

Expand All @@ -47,3 +63,10 @@ std::unique_ptr<MTDDetLayerGeometry> MTDDetLayerGeometryESProducer::produce(cons

return mtdDetLayerGeometry;
}

void MTDDetLayerGeometryESProducer::fillDescriptions(edm::ConfigurationDescriptions& desc) {
edm::ParameterSetDescription ps;
desc.addDefault(ps);
}

DEFINE_FWK_EVENTSETUP_MODULE(MTDDetLayerGeometryESProducer);
31 changes: 0 additions & 31 deletions RecoMTD/DetLayers/plugins/MTDDetLayerGeometryESProducer.h

This file was deleted.

6 changes: 0 additions & 6 deletions RecoMTD/DetLayers/plugins/SealModule.cc

This file was deleted.