CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CaloGeometryDBEP< T, U > Class Template Reference

#include <CaloGeometryDBEP.h>

Inheritance diagram for CaloGeometryDBEP< T, U >:
edm::ESProducer edm::ESProxyFactoryProducer edm::eventsetup::DataProxyProvider

Public Types

typedef
CaloSubdetectorGeometry::DimVec 
DimVec
 
typedef
CaloSubdetectorGeometry::IVec 
IVec
 
typedef boost::shared_ptr
< CaloSubdetectorGeometry
PtrType
 
typedef
CaloSubdetectorGeometry::TrVec 
TrVec
 
- Public Types inherited from edm::eventsetup::DataProxyProvider
typedef std::vector< std::pair
< DataKey, boost::shared_ptr
< DataProxy > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 

Public Member Functions

 CaloGeometryDBEP (const edm::ParameterSet &ps)
 
PtrType produceAligned (const typename T::AlignedRecord &iRecord)
 
virtual ~CaloGeometryDBEP ()
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
virtual ~ESProducer ()
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer ()
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
 DataProxyProvider ()
 
const ComponentDescriptiondescription () const
 
bool isUsingRecord (const EventSetupRecordKey &) const
 
const KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey) const
 
void resetProxies (const EventSetupRecordKey &iRecordType)
 
void resetProxiesIfTransient (const EventSetupRecordKey &iRecordType)
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider ()
 

Private Attributes

bool m_applyAlignment
 

Additional Inherited Members

- Protected Member Functions inherited from edm::ESProducer
template<typename T >
void setWhatProduced (T *iThis, const es::Label &iLabel=es::Label())
 
template<typename T >
void setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
void setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
void setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel=es::Label())
 
template<typename T , typename TReturn , typename TRecord , typename TArg >
void setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel=es::Label())
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::auto_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::auto_ptr< eventsetup::ProxyFactoryBase > &iFactory, const std::string &iLabel=std::string())
 
virtual void registerProxies (const eventsetup::EventSetupRecordKey &iRecord, KeyedProxies &aProxyList)
 override DataProxyProvider method More...
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
void eraseAll (const EventSetupRecordKey &iRecordKey)
 deletes all the Proxies in aStream More...
 
void invalidateProxies (const EventSetupRecordKey &iRecordKey)
 
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &)
 

Detailed Description

template<class T, class U>
class CaloGeometryDBEP< T, U >

Definition at line 37 of file CaloGeometryDBEP.h.

Member Typedef Documentation

template<class T , class U >
typedef CaloSubdetectorGeometry::DimVec CaloGeometryDBEP< T, U >::DimVec

Definition at line 43 of file CaloGeometryDBEP.h.

template<class T , class U >
typedef CaloSubdetectorGeometry::IVec CaloGeometryDBEP< T, U >::IVec

Definition at line 44 of file CaloGeometryDBEP.h.

template<class T , class U >
typedef boost::shared_ptr< CaloSubdetectorGeometry > CaloGeometryDBEP< T, U >::PtrType

Definition at line 41 of file CaloGeometryDBEP.h.

template<class T , class U >
typedef CaloSubdetectorGeometry::TrVec CaloGeometryDBEP< T, U >::TrVec

Definition at line 42 of file CaloGeometryDBEP.h.

Constructor & Destructor Documentation

template<class T , class U >
CaloGeometryDBEP< T, U >::CaloGeometryDBEP ( const edm::ParameterSet ps)
inline

Definition at line 46 of file CaloGeometryDBEP.h.

References edm::ESProducer::setWhatProduced().

46  :
47  m_applyAlignment ( ps.getParameter<bool>("applyAlignment") )
48  {
49  setWhatProduced( this,
51  edm::es::Label( T::producerTag() ) ) ;//+std::string("TEST") ) ) ;
52  }
T getParameter(std::string const &) const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
template<class T , class U >
virtual CaloGeometryDBEP< T, U >::~CaloGeometryDBEP ( )
inlinevirtual

Definition at line 54 of file CaloGeometryDBEP.h.

54 {}

Member Function Documentation

template<class T , class U >
PtrType CaloGeometryDBEP< T, U >::produceAligned ( const typename T::AlignedRecord &  iRecord)
inline

Definition at line 55 of file CaloGeometryDBEP.h.

References asciidump::at, CaloCellGeometry::getParmPtr(), CaloSubdetectorGeometry::getSummary(), gt, i, edm::ESHandleBase::isValid(), j, Alignments::m_align, CaloGeometryDBEP< T, U >::m_applyAlignment, edm::ESHandle< class >::product(), and xy().

56  {
57  const Alignments* alignPtr ( 0 ) ;
58  const Alignments* globalPtr ( 0 ) ;
59  if( m_applyAlignment ) // get ptr if necessary
60  {
61  edm::ESHandle< Alignments > alignments ;
62  iRecord.template getRecord< typename T::AlignmentRecord >().get( alignments ) ;
63 
64  assert( alignments.isValid() && // require valid alignments and expected size
65  ( alignments->m_align.size() == T::numberOfAlignments() ) ) ;
66  alignPtr = alignments.product() ;
67 
69  iRecord.template getRecord<GlobalPositionRcd>().get( globals ) ;
70 
71  assert( globals.isValid() ) ;
72  globalPtr = globals.product() ;
73  }
74 
75  TrVec tvec ;
76  DimVec dvec ;
77  IVec ivec ;
78 
79  if( U::writeFlag() )
80  {
82  iRecord.get( T::producerTag() + std::string("_master"), pG ) ;
83 
84  const CaloSubdetectorGeometry* pGptr ( pG.product() ) ;
85 
86  pGptr->getSummary( tvec, ivec, dvec ) ;
87 
88  U::write( tvec, dvec, ivec, T::dbString() ) ;
89  }
90  else
91  {
92  //std::cout<<"Getting Geometry from DB for "<<T::producerTag()<<std::endl ;
94  iRecord.template getRecord<typename T::PGeometryRecord >().get( pG ) ;
95 
96  tvec = pG->getTranslation() ;
97  dvec = pG->getDimension() ;
98  ivec = pG->getIndexes() ;
99  }
100 //*********************************************************************************************
101 
102  const unsigned int nTrParm ( tvec.size()/T::k_NumberOfCellsForCorners ) ;
103 
104  assert( dvec.size() == T::k_NumberOfShapes * T::k_NumberOfParametersPerShape ) ;
105 
106  PtrType ptr ( new T ) ;
107 
108  ptr->fillDefaultNamedParameters() ;
109 
110  ptr->allocateCorners( T::k_NumberOfCellsForCorners ) ;
111 
112  ptr->allocatePar( dvec.size() ,
113  T::k_NumberOfParametersPerShape ) ;
114 
115  for( unsigned int i ( 0 ) ; i != T::k_NumberOfCellsForCorners ; ++i )
116  {
117  const unsigned int nPerShape ( T::k_NumberOfParametersPerShape ) ;
118  DimVec dims ;
119  dims.reserve( nPerShape ) ;
120 
121  const unsigned int indx ( ivec.size()==1 ? 0 : i ) ;
122 
123  DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
124 
125  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j )
126  {
127  dims.push_back( *dsrc ) ;
128  ++dsrc ;
129  }
130 
131  const double* myParm ( CaloCellGeometry::getParmPtr( dims,
132  ptr->parMgr(),
133  ptr->parVecVec() ) ) ;
134 
135 
136  const DetId id ( T::DetIdType::detIdFromDenseIndex( i ) ) ;
137 
138  const unsigned int iGlob ( 0 == globalPtr ? 0 :
139  T::alignmentTransformIndexGlobal( id ) ) ;
140 
141  assert( 0 == globalPtr || iGlob < globalPtr->m_align.size() ) ;
142 
143  const AlignTransform* gt ( 0 == globalPtr ? 0 : &globalPtr->m_align[ iGlob ] ) ;
144 
145  assert( 0 == gt || iGlob == T::alignmentTransformIndexGlobal( DetId( gt->rawId() ) ) ) ;
146 
147  const unsigned int iLoc ( 0 == alignPtr ? 0 :
148  T::alignmentTransformIndexLocal( id ) ) ;
149 
150  assert( 0 == alignPtr || iLoc < alignPtr->m_align.size() ) ;
151 
152  const AlignTransform* at ( 0 == alignPtr ? 0 :
153  &alignPtr->m_align[ iLoc ] ) ;
154 
155  assert( 0 == at || ( T::alignmentTransformIndexLocal( DetId( at->rawId() ) ) == iLoc ) ) ;
156 
157  const CaloGenericDetId gId ( id ) ;
158 
159  HepGeom::Point3D<double> lRef ;
160  const std::vector<HepGeom::Point3D<double> > lc ( T::localCorners( &dims.front(), i, lRef ) ) ;
161 
162  const HepGeom::Point3D<double> lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ; // ctr rear face in local
163  const HepGeom::Point3D<double> lCor ( lc[0] ) ;
164 
165  //----------------------------------- create transform from 6 numbers ---
166  const unsigned int jj ( i*nTrParm ) ;
167  HepGeom::Transform3D tr ;
168  const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
169  const ROOT::Math::EulerAngles ea (
170  6==nTrParm ?
171  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
173  const ROOT::Math::Transform3D rt ( ea, tl ) ;
174  double xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz;
175  rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
176  tr = HepGeom::Transform3D( CLHEP::HepRep3x3( xx, xy, xz,
177  yx, yy, yz,
178  zx, zy, zz ),
179  CLHEP::Hep3Vector(dx,dy,dz) );
180 
181  // now prepend alignment(s) for final transform
182  const HepGeom::Transform3D atr ( 0 == at ? tr :
183  ( 0 == gt ? at->transform()*tr :
184  at->transform()*gt->transform()*tr ) ) ;
185  //--------------------------------- done making transform ---------------
186 
187  const HepGeom::Point3D<double> gRef ( atr*lRef ) ;
188  const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
189  const HepGeom::Point3D<double> gBck ( atr*lBck ) ;
190  const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
191  const HepGeom::Point3D<double> gCor ( atr*lCor ) ;
192  const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
193 
194  CaloCellGeometry* cell ( T::newCell( fCtr, fBck, fCor,
195  ptr->cornersMgr() , myParm, id ) ) ;
196 
197  ptr->addCell( id, cell ) ;
198  }
199 
200  ptr->initializeParms() ; // initializations; must happen after cells filled
201 
202  return ptr ;
203  }
int i
Definition: DBlmapReader.cc:9
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
CaloSubdetectorGeometry::IVec IVec
int j
Definition: DBlmapReader.cc:9
CaloSubdetectorGeometry::TrVec TrVec
Basic2DVector< T > xy() const
Definition: DetId.h:20
void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector) const
AlgebraicVector EulerAngles
Definition: Definitions.h:36
T const * product() const
Definition: ESHandle.h:62
static const double * getParmPtr(const std::vector< double > &vd, ParMgr *mgr, ParVecVec &pvv)
CaloSubdetectorGeometry::DimVec DimVec
bool isValid() const
Definition: ESHandle.h:37
long double T
DTDigi & gt
list at
Definition: asciidump.py:428

Member Data Documentation

template<class T , class U >
bool CaloGeometryDBEP< T, U >::m_applyAlignment
private

Definition at line 207 of file CaloGeometryDBEP.h.

Referenced by CaloGeometryDBEP< T, U >::produceAligned().