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 
30 
31 #include <memory>
32 
34 public:
36 
38 
39  std::unique_ptr<ME0Geometry> produce(const MuonGeometryRecord& record);
40 
41 private:
46  // use the DDD or DD4hep as Geometry source
47  bool fromDDD_;
49 };
50 
52  fromDDD_ = p.getParameter<bool>("fromDDD");
53  fromDD4hep_ = p.getParameter<bool>("fromDD4hep");
54  auto cc = setWhatProduced(this);
55  if (fromDDD_) {
56  cpvToken_ = cc.consumes();
57  mdcToken_ = cc.consumes();
58  } else if (fromDD4hep_) {
59  dd4hepcpvToken_ = cc.consumes();
60  mdcToken_ = cc.consumes();
61  } else {
62  rigme0Token_ = cc.consumes();
63  }
64  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::initailized with flags " << fromDDD_ << ":" << fromDD4hep_;
65 }
66 
69  desc.add<bool>("fromDDD", true);
70  desc.add<bool>("fromDD4hep", false);
71  descriptions.add("me0Geometry", desc);
72 }
73 
74 std::unique_ptr<ME0Geometry> ME0GeometryESModule::produce(const MuonGeometryRecord& record) {
75  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::produce with fromDDD = " << fromDDD_ << " fromDD4hep "
76  << fromDD4hep_;
77  if (fromDDD_) {
78  edm::LogVerbatim("ME0GeometryESModule") << "(0) ME0GeometryESModule - DDD ";
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("ME0GeometryESModule") << "(0) ME0GeometryESModule - DD4HEP ";
86  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::produce :: ME0GeometryBuilder builder DD4hep";
87  auto cpv = record.getTransientHandle(dd4hepcpvToken_);
88  const auto& mdc = record.get(mdcToken_);
89  ME0GeometryBuilder builder;
90  return std::unique_ptr<ME0Geometry>(builder.build(cpv.product(), mdc));
91  } else {
92  edm::LogVerbatim("ME0GeometryESModule") << "(0) ME0GeometryESModule - DB ";
93  edm::LogVerbatim("GEMGeometry") << "ME0GeometryESModule::produce :: ME0GeometryBuilderFromCondDB builder";
94  const auto& rigme0 = record.get(rigme0Token_);
96  return std::unique_ptr<ME0Geometry>(builder.build(rigme0));
97  }
98 }
99 
ConfigurationDescriptions.h
ME0GeometryESModule::rigme0Token_
edm::ESGetToken< RecoIdealGeometry, ME0RecoGeometryRcd > rigme0Token_
Definition: ME0GeometryESModule.cc:45
ESTransientHandle.h
ME0GeometryESModule
Definition: ME0GeometryESModule.cc:33
ME0GeometryESModule::fromDDD_
bool fromDDD_
Definition: ME0GeometryESModule.cc:47
MuonGeometryConstants.h
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
ME0GeometryESModule::fromDD4hep_
bool fromDD4hep_
Definition: ME0GeometryESModule.cc:48
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
ME0GeometryBuilderFromCondDB::build
ME0Geometry * build(const RecoIdealGeometry &rgeo)
Definition: ME0GeometryBuilderFromCondDB.cc:33
DDCompactView.h
ME0GeometryESModule::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: ME0GeometryESModule.cc:67
ME0GeometryESModule::mdcToken_
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > mdcToken_
Definition: ME0GeometryESModule.cc:43
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:51
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:42
edm::ParameterSet
Definition: ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
ME0GeometryESModule::produce
std::unique_ptr< ME0Geometry > produce(const MuonGeometryRecord &record)
Definition: ME0GeometryESModule.cc:74
IdealGeometryRecord.h
ME0GeometryBuilder
Definition: ME0GeometryBuilder.h:32
AlCaHarvesting_cff.record
record
Definition: AlCaHarvesting_cff.py:42
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:44
edm::ESProducer
Definition: ESProducer.h:104
ParameterSet.h
MuonGeometryRecord.h
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
ME0GeometryBuilder.h