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 */
28 #include <unordered_map>
29 #include <memory>
30 
32 public:
34 
36 
37  std::unique_ptr<RPCGeometry> produce(const MuonGeometryRecord& record);
38 
39 private:
40  //DDD
43  // dd4hep
45  // Reco
47 
48  const bool fromDDD_;
49  const bool fromDD4hep_;
50 };
51 
53  : fromDDD_{p.getUntrackedParameter<bool>("fromDDD", true)},
54  fromDD4hep_{p.getUntrackedParameter<bool>("fromDD4hep", false)} {
55  auto cc = setWhatProduced(this);
56 
57  if (fromDDD_) {
58  idealGeomToken_ = cc.consumes();
59  dddConstantsToken_ = cc.consumes();
60  } else if (fromDD4hep_) {
61  idealDD4hepGeomToken_ = cc.consumes();
62  dddConstantsToken_ = cc.consumes();
63  } else {
64  recoIdealToken_ = cc.consumes();
65  }
66 }
67 
70  desc.addUntracked<bool>("fromDDD", true);
71  desc.addUntracked<bool>("fromDD4hep", false);
72  descriptions.add("RPCGeometryESModule", desc);
73 }
74 
75 std::unique_ptr<RPCGeometry> RPCGeometryESModule::produce(const MuonGeometryRecord& record) {
76  if (fromDDD_) {
77  edm::LogVerbatim("RPCGeoemtryESModule") << "(0) RPCGeometryESModule - DDD ";
79  auto const& mdc = record.get(dddConstantsToken_);
80  RPCGeometryBuilder builder;
81  return std::unique_ptr<RPCGeometry>(builder.build(&(*cpv), mdc));
82  } else if (fromDD4hep_) {
83  edm::LogVerbatim("RPCGeoemtryESModule") << "(0) RPCGeometryESModule - DD4HEP ";
85  auto const& mdc = record.get(dddConstantsToken_);
86  RPCGeometryBuilder builder;
87  return std::unique_ptr<RPCGeometry>(builder.build(&(*cpv), mdc));
88  } else {
89  edm::LogVerbatim("RPCGeoemtryESModule") << "(0) RPCGeometryESModule - DB ";
90  auto const& rigrpc = record.get(recoIdealToken_);
92  return std::unique_ptr<RPCGeometry>(builder.build(rigrpc));
93  }
94 }
95 
ConfigurationDescriptions.h
ESTransientHandle.h
RPCGeometryESModule::fromDD4hep_
const bool fromDD4hep_
Definition: RPCGeometryESModule.cc:49
ESHandle.h
RPCGeometryESModule::recoIdealToken_
edm::ESGetToken< RecoIdealGeometry, RPCRecoGeometryRcd > recoIdealToken_
Definition: RPCGeometryESModule.cc:46
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MuonGeometryConstants.h
RPCGeometryBuilderFromCondDB.h
RPCGeometryBuilderFromCondDB
Definition: RPCGeometryBuilderFromCondDB.h:20
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
RPCGeometryESModule::fromDDD_
const bool fromDDD_
Definition: RPCGeometryESModule.cc:48
RPCGeometryESModule::RPCGeometryESModule
RPCGeometryESModule(const edm::ParameterSet &p)
Definition: RPCGeometryESModule.cc:52
DDCompactView.h
RPCGeometryESModule::dddConstantsToken_
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > dddConstantsToken_
Definition: RPCGeometryESModule.cc:42
RPCGeometryESModule::produce
std::unique_ptr< RPCGeometry > produce(const MuonGeometryRecord &record)
Definition: RPCGeometryESModule.cc:75
RPCGeometryESModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: RPCGeometryESModule.cc:68
RPCGeometryESModule::idealDD4hepGeomToken_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > idealDD4hepGeomToken_
Definition: RPCGeometryESModule.cc:44
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
RPCGeometryESModule
Definition: RPCGeometryESModule.cc:31
IdealGeometryRecord.h
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:41
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