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 Osborne made for DTs (DD4HEP migration)
8 // Created: Fri, 20 Sep 2019
9 // Modified: Fri, 29 May 2020, following what Sunanda Banerjee made in PR #29842 PR #29943 and Ianna Osborne in PR #29954
10 */
27 #include <unordered_map>
28 #include <memory>
29 
31 public:
33 
35 
36  std::unique_ptr<RPCGeometry> produce(const MuonGeometryRecord& record);
37 
38 private:
39  //DDD
42  // dd4hep
44  // Reco
46 
47  const bool fromDDD_;
48  const bool fromDD4hep_;
49 };
50 
52  : fromDDD_{p.getUntrackedParameter<bool>("fromDDD", true)},
53  fromDD4hep_{p.getUntrackedParameter<bool>("fromDD4hep", false)} {
54  auto cc = setWhatProduced(this);
55 
56  if (fromDDD_) {
57  idealGeomToken_ = cc.consumes();
58  dddConstantsToken_ = cc.consumes();
59  } else if (fromDD4hep_) {
60  idealDD4hepGeomToken_ = cc.consumes();
61  dddConstantsToken_ = cc.consumes();
62  } else {
63  recoIdealToken_ = cc.consumes();
64  }
65 }
66 
69  desc.addUntracked<bool>("fromDDD", true);
70  desc.addUntracked<bool>("fromDD4hep", false);
71  descriptions.add("RPCGeometryESModule", desc);
72 }
73 
74 std::unique_ptr<RPCGeometry> RPCGeometryESModule::produce(const MuonGeometryRecord& record) {
75  if (fromDDD_) {
76  edm::LogVerbatim("RPCGeoemtryESModule") << "(0) RPCGeometryESModule - DDD ";
78  auto const& mdc = record.get(dddConstantsToken_);
79  RPCGeometryBuilder builder;
80  return std::unique_ptr<RPCGeometry>(builder.build(&(*cpv), mdc));
81  } else if (fromDD4hep_) {
82  edm::LogVerbatim("RPCGeoemtryESModule") << "(0) RPCGeometryESModule - DD4HEP ";
84  auto const& mdc = record.get(dddConstantsToken_);
85  RPCGeometryBuilder builder;
86  return std::unique_ptr<RPCGeometry>(builder.build(&(*cpv), mdc));
87  } else {
88  edm::LogVerbatim("RPCGeoemtryESModule") << "(0) RPCGeometryESModule - DB ";
89  auto const& rigrpc = record.get(recoIdealToken_);
91  return std::unique_ptr<RPCGeometry>(builder.build(rigrpc));
92  }
93 }
94 
ConfigurationDescriptions.h
ESTransientHandle.h
RPCGeometryESModule::fromDD4hep_
const bool fromDD4hep_
Definition: RPCGeometryESModule.cc:48
RPCGeometryESModule::recoIdealToken_
edm::ESGetToken< RecoIdealGeometry, RPCRecoGeometryRcd > recoIdealToken_
Definition: RPCGeometryESModule.cc:45
MuonGeometryConstants.h
RPCGeometryBuilderFromCondDB.h
RPCGeometryBuilderFromCondDB
Definition: RPCGeometryBuilderFromCondDB.h:20
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
RPCGeometryESModule::fromDDD_
const bool fromDDD_
Definition: RPCGeometryESModule.cc:47
RPCGeometryESModule::RPCGeometryESModule
RPCGeometryESModule(const edm::ParameterSet &p)
Definition: RPCGeometryESModule.cc:51
DDCompactView.h
RPCGeometryESModule::dddConstantsToken_
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > dddConstantsToken_
Definition: RPCGeometryESModule.cc:41
RPCGeometryESModule::produce
std::unique_ptr< RPCGeometry > produce(const MuonGeometryRecord &record)
Definition: RPCGeometryESModule.cc:74
RPCGeometryESModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: RPCGeometryESModule.cc:67
RPCGeometryESModule::idealDD4hepGeomToken_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > idealDD4hepGeomToken_
Definition: RPCGeometryESModule.cc:43
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
RPCGeometryBuilderFromCondDB::build
RPCGeometry * build(const RecoIdealGeometry &rgeo)
Definition: RPCGeometryBuilderFromCondDB.cc:32
RPCRecoGeometryRcd.h
DDCompactView.h
RecoIdealGeometry.h
RPCGeometryBuilder::build
std::unique_ptr< RPCGeometry > build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
Definition: RPCGeometryBuilder.cc:39
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
RPCGeometryBuilder.h
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RPCGeometryESModule
Definition: RPCGeometryESModule.cc:30
IdealGeometryRecord.h
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
cc
edm::ESGetToken< DDCompactView, IdealGeometryRecord >
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
RPCGeometryBuilder
Definition: RPCGeometryBuilder.h:29
ModuleFactory.h
RPCGeometryESModule::idealGeomToken_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > idealGeomToken_
Definition: RPCGeometryESModule.cc:40
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
EventSetup.h
edm::ESProducer
Definition: ESProducer.h:104
ParameterSet.h
MuonGeometryRecord.h
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
RPCGeometry.h