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<MuonDDDConstants, MuonNumberingRecord>(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 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
T getUntrackedParameter(std::string const &, T const &) const
RPCGeometry * build(const RecoIdealGeometry &rgeo)
edm::ESGetToken< DDCompactView, IdealGeometryRecord > idealGeomToken_
JetCorrectorParameters::Record record
Definition: classes.h:7
edm::ESGetToken< MuonDDDConstants, MuonNumberingRecord > dddConstantsToken_
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
RPCGeometry * build(const DDCompactView *cview, const MuonDDDConstants &muonConstants)
RPCGeometryESModule(const edm::ParameterSet &p)
edm::ESGetToken< RecoIdealGeometry, RPCRecoGeometryRcd > recoIdealToken_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::unique_ptr< RPCGeometry > produce(const MuonGeometryRecord &record)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::ESGetToken< cms::MuonNumbering, MuonNumberingRecord > dd4hepConstantsToken_
HLT enums.
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > idealDD4hepGeomToken_