CMS 3D CMS Logo

ProducerSetup.cc
Go to the documentation of this file.
8 
9 #include <memory>
10 
11 using namespace std;
12 using namespace edm;
13 
14 namespace tt {
15 
21  class ProducerSetup : public ESProducer {
22  public:
23  ProducerSetup(const ParameterSet& iConfig);
24  ~ProducerSetup() override {}
25  unique_ptr<Setup> produce(const SetupRcd& setupRcd);
26 
27  private:
37  };
38 
39  ProducerSetup::ProducerSetup(const ParameterSet& iConfig) : iConfig_(iConfig) {
40  fromDD4hep_ = iConfig.getParameter<bool>("fromDD4hep");
41  auto cc = setWhatProduced(this);
42  getTokenTTStubAlgorithm_ = cc.consumes();
43  getTokenMagneticField_ = cc.consumes();
44  getTokenTrackerGeometry_ = cc.consumes();
45  getTokenTrackerTopology_ = cc.consumes();
46  getTokenCablingMap_ = cc.consumes();
47  if (fromDD4hep_)
49  else
51  }
52 
53  unique_ptr<Setup> ProducerSetup::produce(const SetupRcd& setupRcd) {
55  const TrackerGeometry& trackerGeometry = setupRcd.get(getTokenTrackerGeometry_);
56  const TrackerTopology& trackerTopology = setupRcd.get(getTokenTrackerTopology_);
57  const TrackerDetToDTCELinkCablingMap& cablingMap = setupRcd.get(getTokenCablingMap_);
58  const ESHandle<StubAlgorithm> handleStubAlgorithm = setupRcd.getHandle(getTokenTTStubAlgorithm_);
59  const ParameterSetID& pSetIdTTStubAlgorithm = handleStubAlgorithm.description()->pid_;
60  const StubAlgorithmOfficial& stubAlgoritm =
61  *dynamic_cast<const StubAlgorithmOfficial*>(&setupRcd.get(getTokenTTStubAlgorithm_));
62  const ParameterSet& pSetStubAlgorithm = getParameterSet(handleStubAlgorithm.description()->pid_);
63  if (fromDD4hep_) {
64  const ESHandle<cms::DDCompactView> handleGeometryConfiguration =
66  const ParameterSetID& pSetIdGeometryConfiguration = handleGeometryConfiguration.description()->pid_;
67  const ParameterSet& pSetGeometryConfiguration = getParameterSet(handleGeometryConfiguration.description()->pid_);
68  return make_unique<Setup>(iConfig_,
70  trackerGeometry,
71  trackerTopology,
72  cablingMap,
73  stubAlgoritm,
74  pSetStubAlgorithm,
75  pSetGeometryConfiguration,
76  pSetIdTTStubAlgorithm,
77  pSetIdGeometryConfiguration);
78  } else {
79  const ESHandle<DDCompactView> handleGeometryConfiguration = setupRcd.getHandle(getTokenGeometryConfiguration_);
80  const ParameterSetID& pSetIdGeometryConfiguration = handleGeometryConfiguration.description()->pid_;
81  const ParameterSet& pSetGeometryConfiguration = getParameterSet(handleGeometryConfiguration.description()->pid_);
82  return make_unique<Setup>(iConfig_,
84  trackerGeometry,
85  trackerTopology,
86  cablingMap,
87  stubAlgoritm,
88  pSetStubAlgorithm,
89  pSetGeometryConfiguration,
90  pSetIdTTStubAlgorithm,
91  pSetIdGeometryConfiguration);
92  }
93  }
94 } // namespace tt
95 
Class for "official" algorithm to be used in TTStubBuilder.
ESGetToken< MagneticField, IdealMagneticFieldRecord > getTokenMagneticField_
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ESGetToken< cms::DDCompactView, IdealGeometryRecord > getTokenGeometryConfigurationDD4hep_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
~ProducerSetup() override
const ParameterSet iConfig_
ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > getTokenTrackerGeometry_
Definition: TTTypes.h:54
ESHandle< ProductT > getHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
unique_ptr< Setup > produce(const SetupRcd &setupRcd)
ESGetToken< TrackerDetToDTCELinkCablingMap, TrackerDetToDTCELinkCablingMapRcd > getTokenCablingMap_
Class to produce setup of Track Trigger emulators.
edm::eventsetup::ComponentDescription const * description() const
Definition: ESHandle.cc:9
ESGetToken< TrackerTopology, TrackerTopologyRcd > getTokenTrackerTopology_
ParameterSet const & getParameterSet(ParameterSetID const &id)
HLT enums.
ESGetToken< DDCompactView, IdealGeometryRecord > getTokenGeometryConfiguration_
ESGetToken< StubAlgorithm, TTStubAlgorithmRecord > getTokenTTStubAlgorithm_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const