CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 #include "boost/shared_ptr.hpp"
7 
8 // user include files
11 
19 
21 
22 //Forward declaration
23 
24 //
25 // class declaration
26 //
27 
28 template <class T>
30 {
31  public:
32 
34  typedef typename LoaderType::PtrType PtrType ;
35 
37  m_applyAlignment ( ps.getParameter<bool>("applyAlignment") )
38  {
39  setWhatProduced( this,
41 // dependsOn( &CaloGeometryEP<T>::idealRecordCallBack ),
42  edm::es::Label( T::producerTag() ) ) ;
43  }
44 
45  virtual ~CaloGeometryEP<T>() {}
46  PtrType produceAligned( const typename T::AlignedRecord& iRecord )
47  {
48  const Alignments* alignPtr ( 0 ) ;
49  const Alignments* globalPtr ( 0 ) ;
50  if( m_applyAlignment ) // get ptr if necessary
51  {
52  edm::ESHandle< Alignments > alignments ;
53  iRecord.template getRecord< typename T::AlignmentRecord >().get( alignments ) ;
54 
55  assert( alignments.isValid() && // require valid alignments and expected size
56  ( alignments->m_align.size() == T::numberOfAlignments() ) ) ;
57  alignPtr = alignments.product() ;
58 
60  iRecord.template getRecord<GlobalPositionRcd>().get( globals ) ;
61 
62  assert( globals.isValid() ) ;
63  globalPtr = globals.product() ;
64  }
66  iRecord.template getRecord<IdealGeometryRecord>().get( cpv ) ;
67 
68  LoaderType loader ;
69  PtrType ptr ( loader.load( &(*cpv), alignPtr, globalPtr ) ) ; // no temporaries for shared+ptr!!
70 
71  return ptr ;
72  }
73 
74  private:
75 
76 
78 };
79 
80 #endif
PtrType produceAligned(const typename T::AlignedRecord &iRecord)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
T const * product() const
Definition: ESHandle.h:62
CaloGeometryLoader< T > LoaderType
PtrType load(const DDCompactView *cpv, const Alignments *alignments=0, const Alignments *globals=0)
bool isValid() const
Definition: ESHandle.h:37
LoaderType::PtrType PtrType