CMS 3D CMS Logo

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<T, D>(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<T, D>() 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
CaloGeometryEP
Definition: CaloGeometryEP.h:16
GlobalPositionRcd.h
electrons_cff.bool
bool
Definition: electrons_cff.py:393
edm::ESInputTag
Definition: ESInputTag.h:87
ESTransientHandle.h
edm::ESTransientHandle::product
T const * product() const
Definition: ESTransientHandle.h:51
CaloGeometryEP::cpvToken_
edm::ESGetToken< D, IdealGeometryRecord > cpvToken_
Definition: CaloGeometryEP.h:54
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
CaloGeometryEP::alignmentsToken_
edm::ESGetToken< Alignments, typename T::AlignmentRecord > alignmentsToken_
Definition: CaloGeometryEP.h:52
ESProducer.h
Alignments.h
cms::cuda::assert
assert(be >=bs)
ESGetToken.h
CaloGeometryEP::produceAligned
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
Definition: CaloGeometryEP.h:32
CaloGeometryLoader.h
edm::es::Label
Definition: es_Label.h:56
CaloSubdetectorGeometry.h
edm::ParameterSet
Definition: ParameterSet.h:47
CaloGeometryEP::PtrType
typename LoaderType::PtrType PtrType
Definition: CaloGeometryEP.h:19
IdealGeometryRecord.h
cc
CaloGeometryEP::globalsToken_
edm::ESGetToken< Alignments, GlobalPositionRcd > globalsToken_
Definition: CaloGeometryEP.h:53
edm::ESGetToken< Alignments, typename T::AlignmentRecord >
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
CaloGeometryEP::applyAlignment_
bool applyAlignment_
Definition: CaloGeometryEP.h:55
ModuleFactory.h
CaloGeometryLoader< T >
edm::ESProducer
Definition: ESProducer.h:104
web.browse_db.loader
loader
Definition: browse_db.py:18
Alignments
Definition: Alignments.h:10