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 1
3 
4 // system include files
5 #include <memory>
6 
7 // user include files
10 
18 
20 
21 //Forward declaration
22 
23 //
24 // class declaration
25 //
26 
27 template <class T>
29 {
30  public:
31 
33  using PtrType = typename LoaderType::PtrType;
34 
36  m_applyAlignment ( ps.getParameter<bool>("applyAlignment") )
37  {
38  setWhatProduced( this,
40 // dependsOn( &CaloGeometryEP<T>::idealRecordCallBack ),
41  edm::es::Label( T::producerTag() ) ) ;
42  }
43 
44  ~CaloGeometryEP<T>() override {}
45  PtrType produceAligned( const typename T::AlignedRecord& iRecord )
46  {
47  const Alignments* alignPtr ( nullptr ) ;
48  const Alignments* globalPtr ( nullptr ) ;
49  if( m_applyAlignment ) // get ptr if necessary
50  {
51  edm::ESHandle< Alignments > alignments ;
52  iRecord.template getRecord< typename T::AlignmentRecord >().get( alignments ) ;
53 
54  assert( alignments.isValid() && // require valid alignments and expected size
55  ( alignments->m_align.size() == T::numberOfAlignments() ) ) ;
56  alignPtr = alignments.product() ;
57 
59  iRecord.template getRecord<GlobalPositionRcd>().get( globals ) ;
60 
61  assert( globals.isValid() ) ;
62  globalPtr = globals.product() ;
63  }
65  iRecord.template getRecord<IdealGeometryRecord>().get( cpv ) ;
66 
68  return loader.load( &(*cpv), alignPtr, globalPtr );
69  }
70 
71  private:
72 
73 
75 };
76 
77 #endif
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
bool isValid() const
Definition: ESHandle.h:44
T const * product() const
Definition: ESHandle.h:86
typename LoaderType::PtrType PtrType