CMS 3D CMS Logo

ME0GeometryESModule.cc
Go to the documentation of this file.
1 /*
2 //\class ME0GeometryESModule
3 
4  Description: ME0 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: 29 Apr 2020
9 */
10 
14 
21 
23 
31 
32 #include <memory>
33 
35 public:
37 
39 
40  std::unique_ptr<ME0Geometry> produce(const MuonGeometryRecord& record);
41 
42 private:
47  // use the DDD or DD4hep as Geometry source
48  bool fromDDD_;
50 };
51 
53  fromDDD_ = p.getParameter<bool>("fromDDD");
54  fromDD4hep_ = p.getParameter<bool>("fromDD4hep");
55  auto cc = setWhatProduced(this);
56  if (fromDDD_) {
57  cpvToken_ = cc.consumes();
58  mdcToken_ = cc.consumes();
59  } else if (fromDD4hep_) {
60  dd4hepcpvToken_ = cc.consumes();
61  mdcToken_ = cc.consumes();
62  } else {
63  rigme0Token_ = cc.consumes();
64  }
65  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::initailized with flags " << fromDDD_ << ":" << fromDD4hep_;
66 }
67 
70  desc.add<bool>("fromDDD", true);
71  desc.add<bool>("fromDD4hep", false);
72  descriptions.add("me0Geometry", desc);
73 }
74 
75 std::unique_ptr<ME0Geometry> ME0GeometryESModule::produce(const MuonGeometryRecord& record) {
76  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::produce with fromDDD = " << fromDDD_ << " fromDD4hep "
77  << fromDD4hep_;
78  if (fromDDD_) {
79  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::produce :: ME0GeometryBuilder builder";
80  auto cpv = record.getTransientHandle(cpvToken_);
81  const auto& mdc = record.get(mdcToken_);
82  ME0GeometryBuilder builder;
83  return std::unique_ptr<ME0Geometry>(builder.build(cpv.product(), mdc));
84  } else if (fromDD4hep_) {
85  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::produce :: ME0GeometryBuilder builder DD4hep";
86  auto cpv = record.getTransientHandle(dd4hepcpvToken_);
87  const auto& mdc = record.get(mdcToken_);
88  ME0GeometryBuilder builder;
89  return std::unique_ptr<ME0Geometry>(builder.build(cpv.product(), mdc));
90  } else {
91  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::produce :: ME0GeometryBuilderFromCondDB builder";
92  const auto& rigme0 = record.get(rigme0Token_);
94  return std::unique_ptr<ME0Geometry>(builder.build(rigme0));
95  }
96 }
97 
ConfigurationDescriptions.h
ME0GeometryESModule::rigme0Token_
edm::ESGetToken< RecoIdealGeometry, ME0RecoGeometryRcd > rigme0Token_
Definition: ME0GeometryESModule.cc:46
ESTransientHandle.h
ESHandle.h
ME0GeometryESModule
Definition: ME0GeometryESModule.cc:34
ME0GeometryESModule::fromDDD_
bool fromDDD_
Definition: ME0GeometryESModule.cc:48
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MuonGeometryConstants.h
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
ME0GeometryESModule::fromDD4hep_
bool fromDD4hep_
Definition: ME0GeometryESModule.cc:49
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
GlobalPosition_Frontier_DevDB_cff.record
record
Definition: GlobalPosition_Frontier_DevDB_cff.py:10
ME0GeometryBuilderFromCondDB::build
ME0Geometry * build(const RecoIdealGeometry &rgeo)
Definition: ME0GeometryBuilderFromCondDB.cc:31
DDCompactView.h
ME0GeometryESModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: ME0GeometryESModule.cc:68
ME0GeometryESModule::mdcToken_
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > mdcToken_
Definition: ME0GeometryESModule.cc:44
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
ME0GeometryESModule::ME0GeometryESModule
ME0GeometryESModule(const edm::ParameterSet &p)
Definition: ME0GeometryESModule.cc:52
ME0GeometryBuilderFromCondDB
Definition: ME0GeometryBuilderFromCondDB.h:20
DDCompactView.h
RecoIdealGeometry.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
ME0GeometryESModule::cpvToken_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvToken_
Definition: ME0GeometryESModule.cc:43
edm::ParameterSet
Definition: ParameterSet.h:47
ME0GeometryESModule::produce
std::unique_ptr< ME0Geometry > produce(const MuonGeometryRecord &record)
Definition: ME0GeometryESModule.cc:75
IdealGeometryRecord.h
ME0GeometryBuilder
Definition: ME0GeometryBuilder.h:31
ME0GeometryBuilder::build
ME0Geometry * build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants)
Definition: ME0GeometryBuilder.cc:41
cc
edm::ESGetToken< DDCompactView, IdealGeometryRecord >
ME0Geometry.h
ModuleFactory.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
ME0GeometryBuilderFromCondDB.h
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
ME0RecoGeometryRcd.h
EventSetup.h
ME0GeometryESModule::dd4hepcpvToken_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4hepcpvToken_
Definition: ME0GeometryESModule.cc:45
edm::ESProducer
Definition: ESProducer.h:104
ParameterSet.h
MuonGeometryRecord.h
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
ME0GeometryBuilder.h