CMS 3D CMS Logo

RPCGeometryESModule.cc
Go to the documentation of this file.
1 /*
2 //\class RPCGeometryESModule
3 
4  Description: RPC GeometryESModule from DD & DD4hep
5  DD4hep part added to the original old file (DD version) made by M. Maggi (INFN Bari)
6 //
7 // Author: Sergio Lo Meo (sergio.lo.meo@cern.ch) following what Ianna Osburne made for DTs (DD4HEP migration)
8 // Created: Fri, 20 Sep 2019
9 */
10 
14 
18 
24 
25 #include <unordered_map>
26 
27 #include <memory>
28 
29 using namespace edm;
30 
32  : comp11_{p.getUntrackedParameter<bool>("compatibiltyWith11", true)},
33  useDDD_{p.getUntrackedParameter<bool>("useDDD", true)},
34  useDD4hep_{p.getUntrackedParameter<bool>("useDD4hep", false)} {
35  auto cc = setWhatProduced(this);
36 
37  const edm::ESInputTag kEmptyTag;
38  if (useDDD_) {
39  idealGeomToken_ = cc.consumesFrom<DDCompactView, IdealGeometryRecord>(kEmptyTag);
40  dddConstantsToken_ = cc.consumesFrom<MuonGeometryConstants, IdealGeometryRecord>(kEmptyTag);
41  } else if (useDD4hep_) {
42  idealDD4hepGeomToken_ = cc.consumesFrom<cms::DDCompactView, IdealGeometryRecord>(kEmptyTag);
43  dd4hepConstantsToken_ = cc.consumesFrom<cms::MuonNumbering, MuonNumberingRecord>(kEmptyTag);
44  } else {
45  recoIdealToken_ = cc.consumesFrom<RecoIdealGeometry, RPCRecoGeometryRcd>(kEmptyTag);
46  }
47 }
48 
49 std::unique_ptr<RPCGeometry> RPCGeometryESModule::produce(const MuonGeometryRecord& record) {
50  if (useDDD_) {
52 
53  auto const& mdc = record.get(dddConstantsToken_);
55  return std::unique_ptr<RPCGeometry>(builder.build(&(*cpv), mdc));
56  } else if (useDD4hep_) {
58 
59  auto const& mdc = record.get(dd4hepConstantsToken_);
61  return std::unique_ptr<RPCGeometry>(builder.build(&(*cpv), mdc));
62  } else {
63  auto const& rigrpc = record.get(recoIdealToken_);
65  return std::unique_ptr<RPCGeometry>(builder.build(rigrpc));
66  }
67 }
68 
MuonGeometryConstants
Definition: MuonGeometryConstants.h:20
edm::ESInputTag
Definition: ESInputTag.h:87
ESTransientHandle.h
ESHandle.h
RPCGeometryESModule::recoIdealToken_
edm::ESGetToken< RecoIdealGeometry, RPCRecoGeometryRcd > recoIdealToken_
Definition: RPCGeometryESModule.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RPCGeometryBuilderFromDDD::build
RPCGeometry * build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
Definition: RPCGeometryBuilderFromDDD.cc:46
RPCGeometryBuilderFromCondDB.h
RPCGeometryBuilderFromCondDB
Definition: RPCGeometryBuilderFromCondDB.h:20
RPCGeometryESModule.h
ESProducer.h
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
RPCGeometryESModule::dd4hepConstantsToken_
edm::ESGetToken< cms::MuonNumbering, MuonNumberingRecord > dd4hepConstantsToken_
Definition: RPCGeometryESModule.h:42
RPCGeometryESModule::RPCGeometryESModule
RPCGeometryESModule(const edm::ParameterSet &p)
Definition: RPCGeometryESModule.cc:31
RPCGeometryESModule::useDDD_
const bool useDDD_
Definition: RPCGeometryESModule.h:48
RPCGeometryESModule::dddConstantsToken_
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > dddConstantsToken_
Definition: RPCGeometryESModule.h:39
cc
RPCGeometryESModule::produce
std::unique_ptr< RPCGeometry > produce(const MuonGeometryRecord &record)
Definition: RPCGeometryESModule.cc:49
RPCGeometryESModule::comp11_
const bool comp11_
Definition: RPCGeometryESModule.h:47
RPCGeometryESModule::idealDD4hepGeomToken_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > idealDD4hepGeomToken_
Definition: RPCGeometryESModule.h:41
RPCRecoGeometryRcd
Definition: RPCRecoGeometryRcd.h:5
RPCGeometryBuilderFromCondDB::build
RPCGeometry * build(const RecoIdealGeometry &rgeo)
Definition: RPCGeometryBuilderFromCondDB.cc:32
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
RPCGeometryESModule::useDD4hep_
const bool useDD4hep_
Definition: RPCGeometryESModule.h:49
edm::ParameterSet
Definition: ParameterSet.h:36
MuonBaseNumber.h
RPCGeometryESModule
Definition: RPCGeometryESModule.h:30
cms::MuonNumbering
Definition: DD4hep_MuonNumbering.h:37
RPCGeometryBuilderFromDDD.h
DD4hep_MuonNumbering.h
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
ModuleFactory.h
RPCGeometryBuilderFromDDD
Definition: RPCGeometryBuilderFromDDD.h:35
RPCGeometryESModule::idealGeomToken_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > idealGeomToken_
Definition: RPCGeometryESModule.h:38
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
cms::DDCompactView
Definition: DDCompactView.h:29
EventSetup.h
MuonNumberingRecord
Definition: MuonNumberingRecord.h:30
MuonDDDNumbering.h
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
RecoIdealGeometry
Definition: RecoIdealGeometry.h:28