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  typedef typename LoaderType::PtrType 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  virtual ~CaloGeometryEP<T>() {}
45  PtrType produceAligned( const typename T::AlignedRecord& iRecord )
46  {
47  const Alignments* alignPtr ( 0 ) ;
48  const Alignments* globalPtr ( 0 ) ;
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 
67  LoaderType loader ;
68  PtrType ptr ( loader.load( &(*cpv), alignPtr, globalPtr ) ) ; // no temporaries for shared+ptr!!
69 
70  return ptr ;
71  }
72 
73  private:
74 
75 
77 };
78 
79 #endif
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
CaloGeometryLoader< T > LoaderType
bool isValid() const
Definition: ESHandle.h:47
LoaderType::PtrType PtrType
T const * product() const
Definition: ESHandle.h:86