test
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,
edm::propagate_const
< std::shared_ptr< DataProxy > > > > 
KeyedProxies
 
typedef std::vector
< EventSetupRecordKey
Keys
 
typedef std::map
< EventSetupRecordKey,
KeyedProxies
RecordProxies
 

Public Member Functions

 CaloGeometryDBEP (const edm::ParameterSet &ps)
 
template<>
CaloGeometryDBEP
< HGCalGeometry,
CaloGeometryDBReader >
::PtrType 
produceAligned (const typename HGCalGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< HcalGeometry,
CaloGeometryDBReader >
::PtrType 
produceAligned (const typename HcalGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP< HcalGeometry,
CaloGeometryDBWriter >
::PtrType 
produceAligned (const typename HcalGeometry::AlignedRecord &iRecord)
 
PtrType produceAligned (const typename T::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP
< CaloTowerGeometry,
CaloGeometryDBReader >
::PtrType 
produceAligned (const typename CaloTowerGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP
< CaloTowerGeometry,
CaloGeometryDBWriter >
::PtrType 
produceAligned (const typename CaloTowerGeometry::AlignedRecord &iRecord)
 
template<>
CaloGeometryDBEP
< HGCalGeometry,
CaloGeometryDBWriter >
::PtrType 
produceAligned (const typename HGCalGeometry::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
 
const edm::ParameterSet m_pSet
 

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 37 of file CaloGeometryDBEP.h.

Member Typedef Documentation

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

Definition at line 41 of file CaloGeometryDBEP.h.

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

Definition at line 48 of file CaloGeometryDBEP.h.

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

Definition at line 49 of file CaloGeometryDBEP.h.

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

Definition at line 42 of file CaloGeometryDBEP.h.

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

Definition at line 43 of file CaloGeometryDBEP.h.

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

Definition at line 46 of file CaloGeometryDBEP.h.

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

Definition at line 44 of file CaloGeometryDBEP.h.

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

Definition at line 47 of file CaloGeometryDBEP.h.

Constructor & Destructor Documentation

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

Definition at line 51 of file CaloGeometryDBEP.h.

References edm::ESProducer::setWhatProduced().

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

61 {}

Member Function Documentation

Definition at line 7 of file moduleDB.cc.

References assert(), gather_cfg::cout, FlatTrd::createCorners(), HGCalGeometry::dbString(), relativeConstraints::geom, CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), j, findQualityFiles::jj, HGCalGeometry::k_NumberOfParametersPerShape, HGCalGeometry::k_NumberOfShapes, PV3DBase< T, PVType, FrameType >::mag2(), mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, std::swap(), ecaldqm::topology(), CaloGeometryDBReader::writeFlag(), CaloGeometryDBReader::writeIndexed(), x(), create_public_lumi_plots::xy, detailsBasic3DVector::y, and detailsBasic3DVector::z.

8 {
9  TrVec tvec;
10  DimVec dvec;
11  IVec ivec;
12  IVec dins;
13 
15 
16  name = "HGCalEESensitive";
17  std::cout << "Reading HGCalGeometry " << name.c_str() << "\n";
19  {
21  iRecord.getRecord<IdealGeometryRecord>().get( name, geom );
22 
23  geom->getSummary( tvec, ivec, dvec, dins ) ;
24 
25  CaloGeometryDBReader::writeIndexed( tvec, dvec, ivec, dins, HGCalGeometry::dbString() ) ;
26  }
27  else
28  {
30  iRecord.getRecord<typename HGCalGeometry::PGeometryRecord >().get( pG ) ;
31 
32  tvec = pG->getTranslation() ;
33  dvec = pG->getDimension() ;
34  ivec = pG->getIndexes() ;
35  dins = pG->getDenseIndices();
36  }
37  //*********************************************************************************************
39  iRecord.getRecord<IdealGeometryRecord>().get( name, topology );
40 
41  assert( dvec.size() <= topology->totalGeomModules() * HGCalGeometry::k_NumberOfParametersPerShape );
42  HGCalGeometry* hcg = new HGCalGeometry( *topology );
43  PtrType ptr ( hcg );
44 
45  ptr->allocateCorners( topology->ncells());
46  ptr->allocatePar( HGCalGeometry::k_NumberOfShapes,
48 
49  const unsigned int nTrParm( ptr->numberOfTransformParms());
50  const unsigned int nPerShape( HGCalGeometry::k_NumberOfParametersPerShape );
51 
52  for( auto it : dins )
53  {
54  DetId id = topology->encode( topology->geomDenseId2decId( it ));
55  // get layer
56  int layer = ivec[ it ];
57 
58  // get transformation
59  const unsigned int jj ( it * nTrParm );
60  Tr3D tr;
61  const ROOT::Math::Translation3D tl( tvec[jj], tvec[jj+1], tvec[jj+2]);
62  const ROOT::Math::EulerAngles ea( 6 == nTrParm ?
63  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
65  const ROOT::Math::Transform3D rt( ea, tl );
66  double xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz;
67  rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
68  tr = Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
69  yx, yy, yz,
70  zx, zy, zz ),
71  CLHEP::Hep3Vector( dx, dy, dz));
72 
73  // get parameters
74  DimVec dims;
75  dims.reserve( nPerShape );
76 
77  DimVec::const_iterator dsrc( dvec.begin() + layer * nPerShape );
78  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j )
79  {
80  dims.push_back( *dsrc ) ;
81  ++dsrc ;
82  }
83 
84  std::vector<GlobalPoint> corners( 8 );
85 
86  FlatTrd::createCorners( dims, tr, corners );
87 
88  const CCGFloat* myParm( CaloCellGeometry::getParmPtr( dims,
89  ptr->parMgr(),
90  ptr->parVecVec()));
91  GlobalPoint front ( 0.25*( corners[0].x() +
92  corners[1].x() +
93  corners[2].x() +
94  corners[3].x()),
95  0.25*( corners[0].y() +
96  corners[1].y() +
97  corners[2].y() +
98  corners[3].y()),
99  0.25*( corners[0].z() +
100  corners[1].z() +
101  corners[2].z() +
102  corners[3].z()));
103 
104  GlobalPoint back ( 0.25*( corners[4].x() +
105  corners[5].x() +
106  corners[6].x() +
107  corners[7].x()),
108  0.25*( corners[4].y() +
109  corners[5].y() +
110  corners[6].y() +
111  corners[7].y()),
112  0.25*( corners[4].z() +
113  corners[5].z() +
114  corners[6].z() +
115  corners[7].z()));
116 
117  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
118  std::swap (front, back);
119  std::swap_ranges (corners.begin(), corners.begin()+4, corners.begin()+4);
120  }
121 
122  ptr->newCell( front, back, corners[0], myParm, id );
123  }
124 
125  ptr->initializeParms(); // initializations; must happen after cells filled
126 
127  return ptr ;
128 }
CaloTopology const * topology(0)
assert(m_qm.get())
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
CaloSubdetectorGeometry::IVec IVec
static void writeIndexed(const TrVec &, const DimVec &, const IVec &, const std::vector< uint32_t > &, std::string)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
static std::string dbString()
Definition: HGCalGeometry.h:45
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)
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
CaloCellGeometry::Tr3D Tr3D
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatTrd.cc:136
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
tuple cout
Definition: gather_cfg.py:145

Definition at line 10 of file moduleDB.cc.

References HcalGeometry::alignmentTransformIndexGlobal(), HcalGeometry::alignmentTransformIndexLocal(), assert(), HcalGeometry::dbString(), edm::eventsetup::EventSetupRecord::get(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CaloSubdetectorGeometry::getSummary(), relval_steps::gt, i, edm::ESHandleBase::isValid(), j, findQualityFiles::jj, HcalGeometry::k_NumberOfParametersPerShape, Alignments::m_align, HcalGeometry::numberOfAlignments(), HcalGeometry::producerTag(), edm::ESHandle< class >::product(), AlCaHLTBitMon_QueryRunRegistry::string, CaloGeometryDBReader::writeFlag(), CaloGeometryDBReader::writeIndexed(), and create_public_lumi_plots::xy.

10  {
11  const Alignments* alignPtr ( 0 ) ;
12  const Alignments* globalPtr ( 0 ) ;
13  if( m_applyAlignment ) {// get ptr if necessary
14  edm::ESHandle< Alignments > alignments ;
15  iRecord.getRecord< typename HcalGeometry::AlignmentRecord >().get( alignments ) ;
16 
17  assert( alignments.isValid() && // require valid alignments and expected size
18  ( alignments->m_align.size() == HcalGeometry::numberOfAlignments() ) ) ;
19  alignPtr = alignments.product() ;
20 
22  iRecord.getRecord<GlobalPositionRcd>().get( globals ) ;
23 
24  assert( globals.isValid() ) ;
25  globalPtr = globals.product() ;
26  }
27 
28  TrVec tvec ;
29  DimVec dvec ;
30  IVec ivec ;
31  IVec dins ;
32 
35  iRecord.get( HcalGeometry::producerTag() + std::string("_master"), pG ) ;
36 
37  const CaloSubdetectorGeometry* pGptr ( pG.product() ) ;
38 
39  pGptr->getSummary( tvec, ivec, dvec, dins ) ;
40 
41  CaloGeometryDBReader::writeIndexed( tvec, dvec, ivec, dins, HcalGeometry::dbString() ) ;
42  } else {
44  iRecord.getRecord<typename HcalGeometry::PGeometryRecord >().get( pG ) ;
45 
46  tvec = pG->getTranslation() ;
47  dvec = pG->getDimension() ;
48  ivec = pG->getIndexes() ;
49  dins = pG->getDenseIndices();
50  }
51  //*********************************************************************************************
52 
53 
54  edm::ESHandle<HcalTopology> hcalTopology;
55  iRecord.getRecord<HcalRecNumberingRecord>().get( hcalTopology );
56 
57  // We know that the numer of shapes chanes with changing depth
58  // so, this check is temporary disabled. We need to implement
59  // a way either to store or calculate the number of shapes or be able
60  // to deal with only max numer of shapes.
61  // assert( dvec.size() == hcalTopology->getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape ) ;
62  assert( dvec.size() <= hcalTopology->getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape ) ;
63  HcalGeometry* hcg=new HcalGeometry( *hcalTopology );
64 
65  PtrType ptr ( hcg );
66 
67  const unsigned int nTrParm ( tvec.size()/hcalTopology->ncells() ) ;
68 
69  ptr->fillDefaultNamedParameters() ;
70 
71  ptr->allocateCorners( hcalTopology->ncells()+hcalTopology->getHFSize() );
72 
73  ptr->allocatePar( dvec.size() ,
75 
76  for( unsigned int i ( 0 ) ; i < dins.size() ; ++i ) {
77  const unsigned int nPerShape ( HcalGeometry::k_NumberOfParametersPerShape);
78  DimVec dims ;
79  dims.reserve( nPerShape ) ;
80 
81  const unsigned int indx ( ivec.size()==1 ? 0 : i ) ;
82 
83  DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
84 
85  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j ) {
86  dims.push_back( *dsrc ) ;
87  ++dsrc ;
88  }
89 
90  const CCGFloat* myParm ( CaloCellGeometry::getParmPtr( dims,
91  ptr->parMgr(),
92  ptr->parVecVec() ));
93 
94 
95  const DetId id ( hcalTopology->denseId2detId(dins[i]) );
96 
97  const unsigned int iGlob ( 0 == globalPtr ? 0 :
99 
100  assert( 0 == globalPtr || iGlob < globalPtr->m_align.size() ) ;
101 
102  const AlignTransform* gt ( 0 == globalPtr ? 0 : &globalPtr->m_align[ iGlob ] ) ;
103 
104  assert( 0 == gt || iGlob == HcalGeometry::alignmentTransformIndexGlobal( DetId( gt->rawId() ) ) ) ;
105 
106  const unsigned int iLoc ( 0 == alignPtr ? 0 :
108 
109  assert( 0 == alignPtr || iLoc < alignPtr->m_align.size() ) ;
110 
111  const AlignTransform* at ( 0 == alignPtr ? 0 :
112  &alignPtr->m_align[ iLoc ] ) ;
113 
114  assert( 0 == at || ( HcalGeometry::alignmentTransformIndexLocal( DetId( at->rawId() ) ) == iLoc ) ) ;
115 
116  Pt3D lRef ;
117  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
118  hcg->localCorners( lc, &dims.front(), dins[i], lRef ) ;
119 
120  const Pt3D lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ; // ctr rear face in local
121  const Pt3D lCor ( lc[0] ) ;
122 
123  //----------------------------------- create transform from 6 numbers ---
124  const unsigned int jj ( dins[i]*nTrParm ) ;
125  Tr3D tr ;
126  const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
127  const ROOT::Math::EulerAngles ea (
128  6==nTrParm ?
129  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
131  const ROOT::Math::Transform3D rt ( ea, tl ) ;
132  double xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz;
133  rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
134  tr = Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
135  yx, yy, yz,
136  zx, zy, zz ),
137  CLHEP::Hep3Vector(dx,dy,dz) );
138 
139  // now prepend alignment(s) for final transform
140  const Tr3D atr ( 0 == at ? tr :
141  ( 0 == gt ? at->transform()*tr :
142  at->transform()*gt->transform()*tr ) ) ;
143  //--------------------------------- done making transform ---------------
144 
145  const Pt3D gRef ( atr*lRef ) ;
146  const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
147  const Pt3D gBck ( atr*lBck ) ;
148  const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
149  const Pt3D gCor ( atr*lCor ) ;
150  const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
151 
152  assert( hcalTopology->detId2denseId(id) == dins[i] );
153 
154  ptr->newCell( fCtr, fBck, fCor, myParm, id ) ;
155  }
156 
157  ptr->initializeParms() ; // initializations; must happen after cells filled
158 
159  return ptr ;
160 }
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::Pt3D Pt3D
static unsigned int alignmentTransformIndexLocal(const DetId &id)
assert(m_qm.get())
static std::string producerTag()
Definition: HcalGeometry.h:54
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
CaloSubdetectorGeometry::IVec IVec
static void writeIndexed(const TrVec &, const DimVec &, const IVec &, const std::vector< uint32_t > &, std::string)
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
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:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
static std::string dbString()
Definition: HcalGeometry.h:35
T const * product() const
Definition: ESHandle.h:86
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
bool isValid() const
Definition: ESHandle.h:47
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:66

Definition at line 15 of file calowriters.cc.

References HcalGeometry::alignmentTransformIndexGlobal(), HcalGeometry::alignmentTransformIndexLocal(), assert(), HcalGeometry::dbString(), edm::eventsetup::EventSetupRecord::get(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CaloSubdetectorGeometry::getSummary(), relval_steps::gt, i, edm::ESHandleBase::isValid(), j, findQualityFiles::jj, HcalGeometry::k_NumberOfParametersPerShape, Alignments::m_align, HcalGeometry::numberOfAlignments(), HcalGeometry::producerTag(), edm::ESHandle< class >::product(), AlCaHLTBitMon_QueryRunRegistry::string, CaloGeometryDBWriter::writeFlag(), CaloGeometryDBWriter::writeIndexed(), and create_public_lumi_plots::xy.

16 {
17  const Alignments* alignPtr ( 0 ) ;
18  const Alignments* globalPtr ( 0 ) ;
19  if( m_applyAlignment ) // get ptr if necessary
20  {
21  edm::ESHandle< Alignments > alignments ;
22  iRecord.getRecord< typename HcalGeometry::AlignmentRecord >().get( alignments ) ;
23 
24  assert( alignments.isValid() && // require valid alignments and expected size
25  ( alignments->m_align.size() == HcalGeometry::numberOfAlignments() ) ) ;
26  alignPtr = alignments.product() ;
27 
29  iRecord.getRecord<GlobalPositionRcd>().get( globals ) ;
30 
31  assert( globals.isValid() ) ;
32  globalPtr = globals.product() ;
33  }
34 
35  TrVec tvec ;
36  DimVec dvec ;
37  IVec ivec ;
38  IVec dins ;
39 
41  {
43  iRecord.get( HcalGeometry::producerTag() + std::string("_master"), pG ) ;
44 
45  const CaloSubdetectorGeometry* pGptr ( pG.product() ) ;
46 
47  pGptr->getSummary( tvec, ivec, dvec, dins ) ;
48 
49  CaloGeometryDBWriter::writeIndexed( tvec, dvec, ivec, dins, HcalGeometry::dbString() ) ;
50  }
51  else
52  {
54  iRecord.getRecord<typename HcalGeometry::PGeometryRecord >().get( pG ) ;
55 
56  tvec = pG->getTranslation() ;
57  dvec = pG->getDimension() ;
58  ivec = pG->getIndexes() ;
59  dins = pG->getDenseIndices();
60  }
61  //*********************************************************************************************
62 
63  edm::ESHandle<HcalTopology> hcalTopology;
64  iRecord.getRecord<HcalRecNumberingRecord>().get( hcalTopology );
65 
66  // We know that the numer of shapes chanes with changing depth
67  // so, this check is temporary disabled. We need to implement
68  // a way either to store or calculate the number of shapes or be able
69  // to deal with only max numer of shapes.
70  assert( dvec.size() <= hcalTopology->getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape ) ;
71  HcalGeometry* hcg=new HcalGeometry( *hcalTopology );
72  PtrType ptr ( hcg );
73 
74  const unsigned int nTrParm ( tvec.size()/hcalTopology->ncells() ) ;
75 
76  ptr->fillDefaultNamedParameters() ;
77 
78  ptr->allocateCorners( hcalTopology->ncells() + hcalTopology->getHFSize() ) ;
79 
80  ptr->allocatePar( dvec.size() ,
82 
83  for( unsigned int i ( 0 ) ; i < dins.size(); ++i )
84  {
85  const unsigned int nPerShape ( HcalGeometry::k_NumberOfParametersPerShape ) ;
86  DimVec dims ;
87  dims.reserve( nPerShape ) ;
88 
89  const unsigned int indx ( ivec.size()==1 ? 0 : i ) ;
90 
91  DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
92 
93  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j )
94  {
95  dims.push_back( *dsrc ) ;
96  ++dsrc ;
97  }
98 
99  const CCGFloat* myParm ( CaloCellGeometry::getParmPtr( dims,
100  ptr->parMgr(),
101  ptr->parVecVec() ) ) ;
102 
103 
104  const DetId id ( hcalTopology->denseId2detId(dins[i]) ) ;
105 
106  const unsigned int iGlob ( 0 == globalPtr ? 0 :
108 
109  assert( 0 == globalPtr || iGlob < globalPtr->m_align.size() ) ;
110 
111  const AlignTransform* gt ( 0 == globalPtr ? 0 : &globalPtr->m_align[ iGlob ] ) ;
112 
113  assert( 0 == gt || iGlob == HcalGeometry::alignmentTransformIndexGlobal( DetId( gt->rawId() ) ) ) ;
114 
115  const unsigned int iLoc ( 0 == alignPtr ? 0 :
117 
118  assert( 0 == alignPtr || iLoc < alignPtr->m_align.size() ) ;
119 
120  const AlignTransform* at ( 0 == alignPtr ? 0 :
121  &alignPtr->m_align[ iLoc ] ) ;
122 
123  assert( 0 == at || ( HcalGeometry::alignmentTransformIndexLocal( DetId( at->rawId() ) ) == iLoc ) ) ;
124 
125  Pt3D lRef ;
126  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
127  hcg->localCorners( lc, &dims.front(), dins[i], lRef ) ;
128 
129  const Pt3D lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ; // ctr rear face in local
130  const Pt3D lCor ( lc[0] ) ;
131 
132  //----------------------------------- create transform from 6 numbers ---
133  const unsigned int jj ( dins[i]*nTrParm ) ;
134 
135  Tr3D tr ;
136  const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
137  const ROOT::Math::EulerAngles ea (
138  6==nTrParm ?
139  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
141  const ROOT::Math::Transform3D rt ( ea, tl ) ;
142  double xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz;
143  rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
144  tr = Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
145  yx, yy, yz,
146  zx, zy, zz ),
147  CLHEP::Hep3Vector(dx,dy,dz) );
148 
149  // now prepend alignment(s) for final transform
150  const Tr3D atr ( 0 == at ? tr :
151  ( 0 == gt ? at->transform()*tr :
152  at->transform()*gt->transform()*tr ) ) ;
153  //--------------------------------- done making transform ---------------
154 
155  const Pt3D gRef ( atr*lRef ) ;
156  const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
157  const Pt3D gBck ( atr*lBck ) ;
158  const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
159  const Pt3D gCor ( atr*lCor ) ;
160  const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
161 
162  assert( hcalTopology->detId2denseId(id) == dins[i] );
163  ptr->newCell( fCtr, fBck, fCor, myParm, id ) ;
164  }
165 
166  ptr->initializeParms() ; // initializations; must happen after cells filled
167 
168  return ptr ;
169 }
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::Pt3D Pt3D
static unsigned int alignmentTransformIndexLocal(const DetId &id)
assert(m_qm.get())
static std::string producerTag()
Definition: HcalGeometry.h:54
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
CaloSubdetectorGeometry::IVec IVec
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
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:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
static std::string dbString()
Definition: HcalGeometry.h:35
T const * product() const
Definition: ESHandle.h:86
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
bool isValid() const
Definition: ESHandle.h:47
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, std::string tag)
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:66
template<class T, class U>
PtrType CaloGeometryDBEP< T, U >::produceAligned ( const typename T::AlignedRecord &  iRecord)
inline

Definition at line 63 of file CaloGeometryDBEP.h.

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

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

Definition at line 164 of file moduleDB.cc.

References CaloTowerGeometry::alignmentTransformIndexGlobal(), CaloTowerGeometry::alignmentTransformIndexLocal(), assert(), CaloTowerGeometry::dbString(), edm::eventsetup::EventSetupRecord::get(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CaloSubdetectorGeometry::getSummary(), relval_steps::gt, i, edm::ESHandleBase::isValid(), j, findQualityFiles::jj, CaloTowerGeometry::k_NumberOfParametersPerShape, CaloTowerGeometry::localCorners(), Alignments::m_align, CaloTowerGeometry::numberOfAlignments(), CaloTowerGeometry::numberOfCellsForCorners(), CaloTowerGeometry::numberOfParametersPerShape(), CaloTowerGeometry::numberOfShapes(), CaloTowerGeometry::producerTag(), edm::ESHandle< class >::product(), AlCaHLTBitMon_QueryRunRegistry::string, CaloGeometryDBReader::writeFlag(), CaloGeometryDBReader::writeIndexed(), and create_public_lumi_plots::xy.

164  {
165 
166  const Alignments* alignPtr ( 0 ) ;
167  const Alignments* globalPtr ( 0 ) ;
168  if( m_applyAlignment ) { // get ptr if necessary
169  edm::ESHandle< Alignments > alignments ;
170  iRecord.getRecord< typename CaloTowerGeometry::AlignmentRecord >().get( alignments ) ;
171 
172  assert( alignments.isValid() && // require valid alignments and expected sizet
173  ( alignments->m_align.size() == CaloTowerGeometry::numberOfAlignments() ) ) ;
174  alignPtr = alignments.product() ;
175 
177  iRecord.getRecord<GlobalPositionRcd>().get( globals ) ;
178 
179  assert( globals.isValid() ) ;
180  globalPtr = globals.product() ;
181  }
182 
183  TrVec tvec ;
184  DimVec dvec ;
185  IVec ivec ;
186  IVec dins ;
187 
190  iRecord.get( CaloTowerGeometry::producerTag() + std::string("_master"), pG ) ;
191 
192  const CaloSubdetectorGeometry* pGptr ( pG.product() ) ;
193 
194  pGptr->getSummary( tvec, ivec, dvec, dins ) ;
195 
197  } else {
199  iRecord.getRecord<typename CaloTowerGeometry::PGeometryRecord >().get( pG ) ;
200 
201  tvec = pG->getTranslation() ;
202  dvec = pG->getDimension() ;
203  ivec = pG->getIndexes() ;
204  dins = pG->getDenseIndices();
205  }
206 //*********************************************************************************************
207 
209  iRecord.getRecord<HcalRecNumberingRecord>().get( caloTopology );
210 
211 
212  CaloTowerGeometry* ctg=new CaloTowerGeometry( &*caloTopology );
213 
214  const unsigned int nTrParm ( tvec.size()/ctg->numberOfCellsForCorners() ) ;
215 
217 
218 
219  PtrType ptr ( ctg ) ;
220 
221  ptr->fillDefaultNamedParameters() ;
222 
223  ptr->allocateCorners( ctg->numberOfCellsForCorners() ) ;
224 
225  ptr->allocatePar( dvec.size() ,
227 
228  for( unsigned int i ( 0 ) ; i < dins.size() ; ++i ) {
229  const unsigned int nPerShape ( ctg->numberOfParametersPerShape() ) ;
230  DimVec dims ;
231  dims.reserve( nPerShape ) ;
232 
233  const unsigned int indx ( ivec.size()==1 ? 0 : i ) ;
234 
235  DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
236 
237  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j ) {
238  dims.push_back( *dsrc ) ;
239  ++dsrc ;
240  }
241 
242  const CCGFloat* myParm ( CaloCellGeometry::getParmPtr( dims,
243  ptr->parMgr(),
244  ptr->parVecVec() ));
245 
246 
247  const DetId id ( caloTopology->detIdFromDenseIndex(dins[i]) ) ;
248 
249  const unsigned int iGlob ( 0 == globalPtr ? 0 :
250  ctg->alignmentTransformIndexGlobal( id ) ) ;
251 
252  assert( 0 == globalPtr || iGlob < globalPtr->m_align.size() ) ;
253 
254  const AlignTransform* gt ( 0 == globalPtr ? 0 : &globalPtr->m_align[ iGlob ] ) ;
255 
256  assert( 0 == gt || iGlob == ctg->alignmentTransformIndexGlobal( DetId( gt->rawId() ) ) ) ;
257 
258  const unsigned int iLoc ( 0 == alignPtr ? 0 :
259  ctg->alignmentTransformIndexLocal( id ) ) ;
260 
261  assert( 0 == alignPtr || iLoc < alignPtr->m_align.size() ) ;
262 
263  const AlignTransform* at ( 0 == alignPtr ? 0 :
264  &alignPtr->m_align[ iLoc ] ) ;
265 
266  assert( 0 == at || ( ctg->alignmentTransformIndexLocal( DetId( at->rawId() ) ) == iLoc ) ) ;
267 
268  const CaloGenericDetId gId ( id ) ;
269 
270  Pt3D lRef ;
271  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
272  ctg->localCorners( lc, &dims.front(), dins[i], lRef ) ;
273 
274  const Pt3D lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ; // ctr rear face in local
275  const Pt3D lCor ( lc[0] ) ;
276 
277  //----------------------------------- create transform from 6 numbers ---
278  const unsigned int jj ( i*nTrParm ) ;
279  Tr3D tr ;
280  const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
281  const ROOT::Math::EulerAngles ea (
282  6==nTrParm ?
283  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
285  const ROOT::Math::Transform3D rt ( ea, tl ) ;
286  double xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz;
287  rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
288  tr = Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
289  yx, yy, yz,
290  zx, zy, zz ),
291  CLHEP::Hep3Vector(dx,dy,dz) );
292 
293  // now prepend alignment(s) for final transform
294  const Tr3D atr ( 0 == at ? tr :
295  ( 0 == gt ? at->transform()*tr :
296  at->transform()*gt->transform()*tr ) ) ;
297  //--------------------------------- done making transform ---------------
298 
299  const Pt3D gRef ( atr*lRef ) ;
300  const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
301  const Pt3D gBck ( atr*lBck ) ;
302  const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
303  const Pt3D gCor ( atr*lCor ) ;
304  const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
305 
306  assert( caloTopology->denseIndex(id) == dins[i] );
307 
308  ptr->newCell( fCtr, fBck, fCor, myParm, id ) ;
309  }
310 
311  ptr->initializeParms() ; // initializations; must happen after cells filled
312 
313  return ptr ;
314 }
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::Pt3D Pt3D
virtual unsigned int numberOfCellsForCorners() const
assert(m_qm.get())
unsigned int alignmentTransformIndexLocal(const DetId &id)
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
static std::string producerTag()
CaloSubdetectorGeometry::IVec IVec
static void writeIndexed(const TrVec &, const DimVec &, const IVec &, const std::vector< uint32_t > &, std::string)
virtual unsigned int numberOfParametersPerShape() const
static std::string dbString()
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)
unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
T const * product() const
Definition: ESHandle.h:86
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
virtual unsigned int numberOfShapes() const
CaloSubdetectorGeometry::DimVec DimVec
bool isValid() const
Definition: ESHandle.h:47
static unsigned int numberOfAlignments()

Definition at line 173 of file calowriters.cc.

References CaloTowerGeometry::alignmentTransformIndexGlobal(), CaloTowerGeometry::alignmentTransformIndexLocal(), assert(), CaloTowerGeometry::dbString(), edm::eventsetup::EventSetupRecord::get(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CaloSubdetectorGeometry::getSummary(), relval_steps::gt, i, edm::ESHandleBase::isValid(), j, findQualityFiles::jj, CaloTowerGeometry::k_NumberOfParametersPerShape, CaloTowerGeometry::localCorners(), Alignments::m_align, CaloTowerGeometry::numberOfAlignments(), CaloTowerGeometry::numberOfCellsForCorners(), CaloTowerGeometry::numberOfParametersPerShape(), CaloTowerGeometry::numberOfShapes(), CaloTowerGeometry::producerTag(), edm::ESHandle< class >::product(), AlCaHLTBitMon_QueryRunRegistry::string, CaloGeometryDBWriter::writeFlag(), CaloGeometryDBWriter::writeIndexed(), and create_public_lumi_plots::xy.

173  {
174 
175  const Alignments* alignPtr ( 0 ) ;
176  const Alignments* globalPtr ( 0 ) ;
177  if( m_applyAlignment ) { // get ptr if necessary
178  edm::ESHandle< Alignments > alignments ;
179  iRecord.getRecord< typename CaloTowerGeometry::AlignmentRecord >().get( alignments ) ;
180 
181  assert( alignments.isValid() && // require valid alignments and expected sizet
182  ( alignments->m_align.size() == CaloTowerGeometry::numberOfAlignments() ) ) ;
183  alignPtr = alignments.product() ;
184 
186  iRecord.getRecord<GlobalPositionRcd>().get( globals ) ;
187 
188  assert( globals.isValid() ) ;
189  globalPtr = globals.product() ;
190  }
191 
192  TrVec tvec ;
193  DimVec dvec ;
194  IVec ivec ;
195  IVec dins ;
196 
199  iRecord.get( CaloTowerGeometry::producerTag() + std::string("_master"), pG ) ;
200 
201  const CaloSubdetectorGeometry* pGptr ( pG.product() ) ;
202 
203  pGptr->getSummary( tvec, ivec, dvec, dins ) ;
204 
206  } else {
208  iRecord.getRecord<typename CaloTowerGeometry::PGeometryRecord >().get( pG ) ;
209 
210  tvec = pG->getTranslation() ;
211  dvec = pG->getDimension() ;
212  ivec = pG->getIndexes() ;
213  dins = pG->getDenseIndices();
214  }
215 //*********************************************************************************************
216 
218  iRecord.getRecord<HcalRecNumberingRecord>().get( caloTopology );
219 
220 
221  CaloTowerGeometry* ctg=new CaloTowerGeometry( &*caloTopology );
222 
223  const unsigned int nTrParm ( tvec.size()/ctg->numberOfCellsForCorners() ) ;
224 
226 
227 
228  PtrType ptr ( ctg ) ;
229 
230  ptr->fillDefaultNamedParameters() ;
231 
232  ptr->allocateCorners( ctg->numberOfCellsForCorners() ) ;
233 
234  ptr->allocatePar( dvec.size() ,
236 
237  for( unsigned int i ( 0 ) ; i < dins.size() ; ++i ) {
238  const unsigned int nPerShape ( ctg->numberOfParametersPerShape() ) ;
239  DimVec dims ;
240  dims.reserve( nPerShape ) ;
241 
242  const unsigned int indx ( ivec.size()==1 ? 0 : i ) ;
243 
244  DimVec::const_iterator dsrc ( dvec.begin() + ivec[indx]*nPerShape ) ;
245 
246  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j ) {
247  dims.push_back( *dsrc ) ;
248  ++dsrc ;
249  }
250 
251  const CCGFloat* myParm ( CaloCellGeometry::getParmPtr( dims,
252  ptr->parMgr(),
253  ptr->parVecVec() ));
254 
255 
256  const DetId id ( caloTopology->detIdFromDenseIndex(dins[i]) ) ;
257 
258  const unsigned int iGlob ( 0 == globalPtr ? 0 :
259  ctg->alignmentTransformIndexGlobal( id ) ) ;
260 
261  assert( 0 == globalPtr || iGlob < globalPtr->m_align.size() ) ;
262 
263  const AlignTransform* gt ( 0 == globalPtr ? 0 : &globalPtr->m_align[ iGlob ] ) ;
264 
265  assert( 0 == gt || iGlob == ctg->alignmentTransformIndexGlobal( DetId( gt->rawId() ) ) ) ;
266 
267  const unsigned int iLoc ( 0 == alignPtr ? 0 :
268  ctg->alignmentTransformIndexLocal( id ) ) ;
269 
270  assert( 0 == alignPtr || iLoc < alignPtr->m_align.size() ) ;
271 
272  const AlignTransform* at ( 0 == alignPtr ? 0 :
273  &alignPtr->m_align[ iLoc ] ) ;
274 
275  assert( 0 == at || ( ctg->alignmentTransformIndexLocal( DetId( at->rawId() ) ) == iLoc ) ) ;
276 
277  const CaloGenericDetId gId ( id ) ;
278 
279  Pt3D lRef ;
280  Pt3DVec lc ( 8, Pt3D(0,0,0) ) ;
281  ctg->localCorners( lc, &dims.front(), dins[i], lRef ) ;
282 
283  const Pt3D lBck ( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] ) ) ; // ctr rear face in local
284  const Pt3D lCor ( lc[0] ) ;
285 
286  //----------------------------------- create transform from 6 numbers ---
287  const unsigned int jj ( i*nTrParm ) ;
288  Tr3D tr ;
289  const ROOT::Math::Translation3D tl ( tvec[jj], tvec[jj+1], tvec[jj+2] ) ;
290  const ROOT::Math::EulerAngles ea (
291  6==nTrParm ?
292  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
294  const ROOT::Math::Transform3D rt ( ea, tl ) ;
295  double xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz;
296  rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
297  tr = Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
298  yx, yy, yz,
299  zx, zy, zz ),
300  CLHEP::Hep3Vector(dx,dy,dz) );
301 
302  // now prepend alignment(s) for final transform
303  const Tr3D atr ( 0 == at ? tr :
304  ( 0 == gt ? at->transform()*tr :
305  at->transform()*gt->transform()*tr ) ) ;
306  //--------------------------------- done making transform ---------------
307 
308  const Pt3D gRef ( atr*lRef ) ;
309  const GlobalPoint fCtr ( gRef.x(), gRef.y(), gRef.z() ) ;
310  const Pt3D gBck ( atr*lBck ) ;
311  const GlobalPoint fBck ( gBck.x(), gBck.y(), gBck.z() ) ;
312  const Pt3D gCor ( atr*lCor ) ;
313  const GlobalPoint fCor ( gCor.x(), gCor.y(), gCor.z() ) ;
314 
315  assert( caloTopology->denseIndex(id) == dins[i] );
316 
317  ptr->newCell( fCtr, fBck, fCor, myParm, id ) ;
318  }
319 
320  ptr->initializeParms() ; // initializations; must happen after cells filled
321 
322  return ptr ;
323 }
int i
Definition: DBlmapReader.cc:9
CaloCellGeometry::Pt3D Pt3D
virtual unsigned int numberOfCellsForCorners() const
assert(m_qm.get())
unsigned int alignmentTransformIndexLocal(const DetId &id)
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
static std::string producerTag()
CaloSubdetectorGeometry::IVec IVec
virtual unsigned int numberOfParametersPerShape() const
static std::string dbString()
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)
unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::Pt3D Pt3D
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
T const * product() const
Definition: ESHandle.h:86
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
virtual unsigned int numberOfShapes() const
CaloSubdetectorGeometry::DimVec DimVec
bool isValid() const
Definition: ESHandle.h:47
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, std::string tag)
static unsigned int numberOfAlignments()

Definition at line 327 of file calowriters.cc.

References assert(), FlatTrd::createCorners(), HGCalGeometry::dbString(), relativeConstraints::geom, CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), j, findQualityFiles::jj, HGCalGeometry::k_NumberOfParametersPerShape, HGCalGeometry::k_NumberOfShapes, PV3DBase< T, PVType, FrameType >::mag2(), mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, std::swap(), ecaldqm::topology(), CaloGeometryDBWriter::writeFlag(), CaloGeometryDBWriter::writeIndexed(), x(), create_public_lumi_plots::xy, detailsBasic3DVector::y, and detailsBasic3DVector::z.

328 {
329  TrVec tvec; // transformation
330  DimVec dvec; // parameters
331  IVec ivec; // layers
332  IVec dins; // valid geom ids
333 
335 
336  name = "HGCalEESensitive";
337 
339  {
341  iRecord.getRecord<IdealGeometryRecord>().get( name, geom );
342 
343  geom->getSummary( tvec, ivec, dvec, dins ) ;
344 
345  CaloGeometryDBWriter::writeIndexed( tvec, dvec, ivec, dins, HGCalGeometry::dbString() ) ;
346  }
347  else
348  {
350  iRecord.getRecord<typename HGCalGeometry::PGeometryRecord >().get( pG ) ;
351 
352  tvec = pG->getTranslation() ;
353  dvec = pG->getDimension() ;
354  ivec = pG->getIndexes() ;
355  dins = pG->getDenseIndices();
356  }
357  //*********************************************************************************************
358 
360  iRecord.getRecord<IdealGeometryRecord>().get( name, topology );
361 
362  assert( dvec.size() <= topology->totalGeomModules() * HGCalGeometry::k_NumberOfParametersPerShape );
363  HGCalGeometry* hcg = new HGCalGeometry( *topology );
364  PtrType ptr ( hcg );
365 
366  ptr->allocateCorners( topology->ncells());
367  ptr->allocatePar( HGCalGeometry::k_NumberOfShapes,
369 
370  const unsigned int nTrParm( ptr->numberOfTransformParms());
371  const unsigned int nPerShape( HGCalGeometry::k_NumberOfParametersPerShape );
372 
373  for( auto it : dins )
374  {
375  DetId id = topology->encode( topology->geomDenseId2decId( it ));
376  // get layer
377  int layer = ivec[ it ];
378 
379  // get transformation
380  const unsigned int jj ( it * nTrParm );
381  Tr3D tr;
382  const ROOT::Math::Translation3D tl( tvec[jj], tvec[jj+1], tvec[jj+2]);
383  const ROOT::Math::EulerAngles ea( 6 == nTrParm ?
384  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
386  const ROOT::Math::Transform3D rt( ea, tl );
387  double xx, xy, xz, dx, yx, yy, yz, dy, zx, zy, zz, dz;
388  rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
389  tr = Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
390  yx, yy, yz,
391  zx, zy, zz ),
392  CLHEP::Hep3Vector( dx, dy, dz));
393 
394  // get parameters
395  DimVec dims;
396  dims.reserve( nPerShape );
397 
398  DimVec::const_iterator dsrc( dvec.begin() + layer * nPerShape );
399  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j )
400  {
401  dims.push_back( *dsrc ) ;
402  ++dsrc ;
403  }
404 
405  std::vector<GlobalPoint> corners( 8 );
406 
407  FlatTrd::createCorners( dims, tr, corners );
408 
409  const CCGFloat* myParm( CaloCellGeometry::getParmPtr( dims,
410  ptr->parMgr(),
411  ptr->parVecVec()));
412  GlobalPoint front ( 0.25*( corners[0].x() +
413  corners[1].x() +
414  corners[2].x() +
415  corners[3].x()),
416  0.25*( corners[0].y() +
417  corners[1].y() +
418  corners[2].y() +
419  corners[3].y()),
420  0.25*( corners[0].z() +
421  corners[1].z() +
422  corners[2].z() +
423  corners[3].z()));
424 
425  GlobalPoint back ( 0.25*( corners[4].x() +
426  corners[5].x() +
427  corners[6].x() +
428  corners[7].x()),
429  0.25*( corners[4].y() +
430  corners[5].y() +
431  corners[6].y() +
432  corners[7].y()),
433  0.25*( corners[4].z() +
434  corners[5].z() +
435  corners[6].z() +
436  corners[7].z()));
437 
438  if (front.mag2() > back.mag2()) { // front should always point to the center, so swap front and back
439  std::swap (front, back);
440  std::swap_ranges (corners.begin(), corners.begin()+4, corners.begin()+4);
441  }
442 
443  ptr->newCell( front, back, corners[0], myParm, id );
444  }
445 
446  ptr->initializeParms(); // initializations; must happen after cells filled
447 
448  return ptr;
449 }
CaloTopology const * topology(0)
assert(m_qm.get())
boost::shared_ptr< CaloSubdetectorGeometry > PtrType
CaloSubdetectorGeometry::IVec IVec
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
static std::string dbString()
Definition: HGCalGeometry.h:45
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)
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
CaloCellGeometry::Tr3D Tr3D
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
Definition: FlatTrd.cc:136
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, std::string tag)

Member Data Documentation

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

Definition at line 213 of file CaloGeometryDBEP.h.

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

template<class T, class U>
const edm::ParameterSet CaloGeometryDBEP< T, U >::m_pSet
private

Definition at line 214 of file CaloGeometryDBEP.h.