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 CaloCellGeometry::CCGFloat CCGFloat
 
typedef
CaloSubdetectorGeometry::DimVec 
DimVec
 
typedef
CaloSubdetectorGeometry::IVec 
IVec
 
typedef CaloCellGeometry::Pt3D Pt3D
 
typedef CaloCellGeometry::Pt3DVec Pt3DVec
 
typedef boost::shared_ptr
< CaloSubdetectorGeometry
PtrType
 
typedef CaloCellGeometry::Tr3D Tr3D
 
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

- Static Public Member Functions inherited from edm::eventsetup::DataProxyProvider
static void prevalidate (ConfigurationDescriptions &)
 
- 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 36 of file CaloGeometryDBEP.h.

Member Typedef Documentation

template<class T , class U >
typedef CaloCellGeometry::CCGFloat CaloGeometryDBEP< T, U >::CCGFloat

Definition at line 40 of file CaloGeometryDBEP.h.

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

Definition at line 47 of file CaloGeometryDBEP.h.

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

Definition at line 48 of file CaloGeometryDBEP.h.

template<class T , class U >
typedef CaloCellGeometry::Pt3D CaloGeometryDBEP< T, U >::Pt3D

Definition at line 41 of file CaloGeometryDBEP.h.

template<class T , class U >
typedef CaloCellGeometry::Pt3DVec CaloGeometryDBEP< T, U >::Pt3DVec

Definition at line 42 of file CaloGeometryDBEP.h.

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

Definition at line 45 of file CaloGeometryDBEP.h.

template<class T , class U >
typedef CaloCellGeometry::Tr3D CaloGeometryDBEP< T, U >::Tr3D

Definition at line 43 of file CaloGeometryDBEP.h.

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

Definition at line 46 of file CaloGeometryDBEP.h.

Constructor & Destructor Documentation

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

Definition at line 50 of file CaloGeometryDBEP.h.

References edm::ESProducer::setWhatProduced().

50  :
51  m_applyAlignment ( ps.getParameter<bool>("applyAlignment") )
52  {
53  setWhatProduced( this,
55  edm::es::Label( T::producerTag() ) ) ;//+std::string("TEST") ) ) ;
56  }
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 58 of file CaloGeometryDBEP.h.

58 {}

Member Function Documentation

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

Definition at line 59 of file CaloGeometryDBEP.h.

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

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

Member Data Documentation

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

Definition at line 209 of file CaloGeometryDBEP.h.

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