CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
CaloGeometryEP.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_CALOGEOMETRY_CALOGEOMETRYEP_H
2 #define GEOMETRY_CALOGEOMETRY_CALOGEOMETRYEP_H
3 
4 #include <memory>
14 
15 template <class T, class D>
17 public:
19  using PtrType = typename LoaderType::PtrType;
20 
21  CaloGeometryEP(const edm::ParameterSet& ps) : applyAlignment_(ps.getParameter<bool>("applyAlignment")) {
23 
24  if (applyAlignment_) {
25  alignmentsToken_ = cc.template consumesFrom<Alignments, typename T::AlignmentRecord>(edm::ESInputTag{});
26  globalsToken_ = cc.template consumesFrom<Alignments, GlobalPositionRcd>(edm::ESInputTag{});
27  }
28  cpvToken_ = cc.template consumesFrom<D, IdealGeometryRecord>(edm::ESInputTag{});
29  }
30 
31  ~CaloGeometryEP() override {}
32  PtrType produceAligned(const typename T::AlignedRecord& iRecord) {
33  const Alignments* alignPtr(nullptr);
34  const Alignments* globalPtr(nullptr);
35  if (applyAlignment_) // get ptr if necessary
36  {
37  const auto& alignments = iRecord.get(alignmentsToken_);
38  // require expected size
39  assert(alignments.m_align.size() == T::numberOfAlignments());
40  alignPtr = &alignments;
41 
42  const auto& globals = iRecord.get(globalsToken_);
43  globalPtr = &globals;
44  }
45  edm::ESTransientHandle<D> cpv = iRecord.getTransientHandle(cpvToken_);
46 
48  return loader.load(cpv.product(), alignPtr, globalPtr);
49  }
50 
51 private:
56 };
57 
58 #endif
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
edm::ESGetToken< Alignments, GlobalPositionRcd > globalsToken_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
typename LoaderType::PtrType PtrType
assert(be >=bs)
~CaloGeometryEP() override
edm::ESGetToken< D, IdealGeometryRecord > cpvToken_
CaloGeometryEP(const edm::ParameterSet &ps)
edm::ESGetToken< Alignments, typename T::AlignmentRecord > alignmentsToken_
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
T const * product() const