CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ProducerES.cc
Go to the documentation of this file.
10 
11 #include <memory>
12 
13 using namespace std;
14 using namespace edm;
15 
16 namespace trackerDTC {
17 
23  class ProducerES : public ESProducer {
24  public:
26  ~ProducerES() override {}
27  unique_ptr<Setup> produce(const SetupRcd& setupRcd);
28 
29  private:
39  };
40 
41  ProducerES::ProducerES(const ParameterSet& iConfig) : iConfig_(iConfig) {
42  fromDD4hep_ = iConfig.getParameter<bool>("fromDD4hep");
43  auto cc = setWhatProduced(this);
44  getTokenTTStubAlgorithm_ = cc.consumes();
45  getTokenMagneticField_ = cc.consumes();
46  getTokenTrackerGeometry_ = cc.consumes();
47  getTokenTrackerTopology_ = cc.consumes();
48  getTokenCablingMap_ = cc.consumes();
49  if (fromDD4hep_)
51  else
52  getTokenGeometryConfiguration_ = cc.consumes();
53  }
54 
55  unique_ptr<Setup> ProducerES::produce(const SetupRcd& setupRcd) {
57  const TrackerGeometry& trackerGeometry = setupRcd.get(getTokenTrackerGeometry_);
58  const TrackerTopology& trackerTopology = setupRcd.get(getTokenTrackerTopology_);
59  const TrackerDetToDTCELinkCablingMap& cablingMap = setupRcd.get(getTokenCablingMap_);
60  const ESHandle<StubAlgorithm> handleStubAlgorithm = setupRcd.getHandle(getTokenTTStubAlgorithm_);
61  const ParameterSetID& pSetIdTTStubAlgorithm = handleStubAlgorithm.description()->pid_;
62  const StubAlgorithmOfficial& stubAlgoritm =
63  *dynamic_cast<const StubAlgorithmOfficial*>(&setupRcd.get(getTokenTTStubAlgorithm_));
64  const ParameterSet& pSetStubAlgorithm = getParameterSet(handleStubAlgorithm.description()->pid_);
65  if (fromDD4hep_) {
66  const ESHandle<cms::DDCompactView> handleGeometryConfiguration =
68  const ParameterSetID& pSetIdGeometryConfiguration = handleGeometryConfiguration.description()->pid_;
69  const ParameterSet& pSetGeometryConfiguration = getParameterSet(handleGeometryConfiguration.description()->pid_);
70  return make_unique<Setup>(iConfig_,
72  trackerGeometry,
73  trackerTopology,
74  cablingMap,
75  stubAlgoritm,
76  pSetStubAlgorithm,
77  pSetGeometryConfiguration,
78  pSetIdTTStubAlgorithm,
79  pSetIdGeometryConfiguration);
80  } else {
81  const ESHandle<DDCompactView> handleGeometryConfiguration = setupRcd.getHandle(getTokenGeometryConfiguration_);
82  const ParameterSetID& pSetIdGeometryConfiguration = handleGeometryConfiguration.description()->pid_;
83  const ParameterSet& pSetGeometryConfiguration = getParameterSet(handleGeometryConfiguration.description()->pid_);
84  return make_unique<Setup>(iConfig_,
86  trackerGeometry,
87  trackerTopology,
88  cablingMap,
89  stubAlgoritm,
90  pSetStubAlgorithm,
91  pSetGeometryConfiguration,
92  pSetIdTTStubAlgorithm,
93  pSetIdGeometryConfiguration);
94  }
95  }
96 } // namespace trackerDTC
97 
Class for &quot;official&quot; algorithm to be used in TTStubBuilder.
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
ESGetToken< DDCompactView, IdealGeometryRecord > getTokenGeometryConfiguration_
Definition: ProducerES.cc:36
ESGetToken< cms::DDCompactView, IdealGeometryRecord > getTokenGeometryConfigurationDD4hep_
Definition: ProducerES.cc:37
ESGetToken< TrackerTopology, TrackerTopologyRcd > getTokenTrackerTopology_
Definition: ProducerES.cc:34
ESGetToken< StubAlgorithm, TTStubAlgorithmRecord > getTokenTTStubAlgorithm_
Definition: ProducerES.cc:31
ParameterSet const & getParameterSet(ParameterSetID const &id)
~ProducerES() override
Definition: ProducerES.cc:26
const ParameterSet iConfig_
Definition: ProducerES.cc:30
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
tuple magneticField
ESGetToken< MagneticField, IdealMagneticFieldRecord > getTokenMagneticField_
Definition: ProducerES.cc:32
edm::eventsetup::ComponentDescription const * description() const
Definition: ESHandle.cc:9
Class to produce setup of Track Trigger emulators.
Definition: ProducerES.cc:23
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
ESGetToken< TrackerDetToDTCELinkCablingMap, TrackerDetToDTCELinkCablingMapRcd > getTokenCablingMap_
Definition: ProducerES.cc:35
ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > getTokenTrackerGeometry_
Definition: ProducerES.cc:33
unique_ptr< Setup > produce(const SetupRcd &setupRcd)
Definition: ProducerES.cc:55
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60