CMS 3D CMS Logo

TrackerGeometricDetESModule.cc
Go to the documentation of this file.
15 
16 #include <memory>
17 
19 public:
21  ~TrackerGeometricDetESModule(void) override;
22  std::unique_ptr<GeometricDet> produce(const IdealGeometryRecord&);
23 
24  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
25 
26 private:
30  bool fromDDD_;
32 };
33 
34 using namespace edm;
35 
37  : fromDDD_(p.getParameter<bool>("fromDDD")), fromDD4hep_(p.getParameter<bool>("fromDD4hep")) {
38  edm::LogVerbatim("TrackerGeom") << "TrackerGeometricDetESModule::fromDDD " << fromDDD_ << " fromDD4hep "
39  << fromDD4hep_;
40  auto cc = setWhatProduced(this);
41  if (fromDDD_) {
42  ddToken_ = cc.consumes<DDCompactView>(edm::ESInputTag());
43  } else if (fromDD4hep_) {
45  } else {
46  pgToken_ = cc.consumes<PGeometricDet>(edm::ESInputTag());
47  }
48 }
49 
51 
54  descDB.add<bool>("fromDDD", false);
55  descDB.add<bool>("fromDD4hep", false);
56  descriptions.add("trackerNumberingGeometryDB", descDB);
57 
59  desc.add<bool>("fromDDD", true);
60  desc.add<bool>("fromDD4hep", false);
61  descriptions.add("trackerNumberingGeometry", desc);
62 
64  descDD4hep.add<bool>("fromDDD", false);
65  descDD4hep.add<bool>("fromDD4hep", true);
66  descriptions.add("DD4hep_trackerNumberingGeometry", descDD4hep);
67 }
68 
69 std::unique_ptr<GeometricDet> TrackerGeometricDetESModule::produce(const IdealGeometryRecord& iRecord) {
70  if (fromDDD_) {
72 
73  return DDDCmsTrackerContruction::construct(*cpv, dbl_to_int(cpv->vector("detIdShifts")));
74  } else if (fromDD4hep_) {
76 
77  return DDDCmsTrackerContruction::construct(*cpv, cpv->getVector<int>("detIdShifts"));
78  } else {
79  auto const& pgd = iRecord.get(pgToken_);
80 
82  }
83 }
84 
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Log< level::Info, true > LogVerbatim
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
std::vector< T > getVector(const std::string &) const
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddToken_
static std::unique_ptr< GeometricDet > construct(const PGeometricDet &pgd)
std::unique_ptr< GeometricDet > produce(const IdealGeometryRecord &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4hepToken_
std::unique_ptr< GeometricDet > construct(DDCompactView const &cpv, std::vector< int > const &detidShifts)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< PGeometricDet, IdealGeometryRecord > pgToken_
TrackerGeometricDetESModule(const edm::ParameterSet &p)