CMS 3D CMS Logo

GlobalDetLayerGeometryESProducer.cc
Go to the documentation of this file.
2 
7 
8 #include <memory>
9 #include <string>
10 
11 using namespace edm;
12 
14  std::string myName = p.getParameter<std::string>("ComponentName");
15  auto cc = setWhatProduced(this, myName);
16  trackerToken_ = cc.consumes();
17  muonToken_ = cc.consumes();
18  mtdToken_ = cc.consumes();
19 }
20 
22 
23 std::unique_ptr<DetLayerGeometry> GlobalDetLayerGeometryESProducer::produce(const RecoGeometryRecord& iRecord) {
24  auto const& tracker = iRecord.get(trackerToken_);
25  auto const& muon = iRecord.get(muonToken_);
27 
28  // get the MTD if it is available
29  if (auto mtdRecord = iRecord.tryToGetRecord<MTDRecoGeometryRecord>()) {
30  mtd = mtdRecord->getHandle(mtdToken_);
31  if (!mtd.isValid()) {
32  LogInfo("GlobalDetLayergGeometryBuilder") << "No MTD geometry is available.";
33  }
34  } else {
35  LogInfo("GlobalDetLayerGeometryBuilder") << "No MTDRecoGeometryRecord is available.";
36  }
37 
38  // if we've got MTD initialize it
39  if (mtd.isValid())
40  return std::make_unique<GlobalDetLayerGeometry>(&tracker, &muon, mtd.product());
41 
42  return std::make_unique<GlobalDetLayerGeometry>(&tracker, &muon);
43 }
44 
GlobalDetLayerGeometryESProducer(const edm::ParameterSet &p)
Log< level::Info, false > LogInfo
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
HLT enums.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::unique_ptr< DetLayerGeometry > produce(const RecoGeometryRecord &)