CMS 3D CMS Logo

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 std::shared_ptr< CaloSubdetectorGeometryPtrType
 
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< EventSetupRecordKeyKeys
 
typedef std::map< EventSetupRecordKey, KeyedProxiesRecordProxies
 

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 ()(false)
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
virtual void newInterval (const eventsetup::EventSetupRecordKey &iRecordType, const ValidityInterval &iInterval)
 overrides DataProxyProvider method More...
 
virtual ~ESProxyFactoryProducer () noexcept(false)
 
- 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 () noexcept(false)
 

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::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
virtual void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_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 std::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  m_pSet( ps )
53 
54  {
55  setWhatProduced( this,
57  edm::es::Label( T::producerTag() ) ) ;//+std::string("TEST") ) ) ;
58  }
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 60 of file CaloGeometryDBEP.h.

60 {}

Member Function Documentation

Definition at line 7 of file moduleDB.cc.

References gather_cfg::cout, FlatTrd::createCorners(), HGCalGeometry::dbString(), allConversions_cfi::dz, HGCalTopology::encode(), relativeConstraints::geom, HGCalTopology::geomDenseId2decId(), PCaloGeometry::getDenseIndices(), PCaloGeometry::getDimension(), PCaloGeometry::getIndexes(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), HGCalGeometry::getSummary(), PCaloGeometry::getTranslation(), findQualityFiles::jj, HGCalGeometry::k_NumberOfParametersPerShape, HGCalGeometry::k_NumberOfShapes, PV3DBase< T, PVType, FrameType >::mag2(), dataset::name, CaloSubdetectorTopology::ncells(), AlCaHLTBitMon_QueryRunRegistry::string, std::swap(), ecaldqm::topology(), HGCalTopology::totalGeomModules(), CaloGeometryDBReader::writeFlag(), CaloGeometryDBReader::writeIndexed(), x(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, detailsBasic3DVector::y, geometryCSVtoXML::yy, geometryCSVtoXML::yz, detailsBasic3DVector::z, and geometryCSVtoXML::zz.

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)
std::vector< float > const & getTranslation() const
Definition: PCaloGeometry.h:20
std::shared_ptr< CaloSubdetectorGeometry > PtrType
std::vector< float > const & getDimension() const
Definition: PCaloGeometry.h:21
CaloSubdetectorGeometry::IVec IVec
unsigned int totalGeomModules() const
static void writeIndexed(const TrVec &, const DimVec &, const IVec &, const std::vector< uint32_t > &, std::string)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
DetId encode(const DecodedDetId &id_) const
static std::string dbString()
Definition: HGCalGeometry.h:45
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
DecodedDetId geomDenseId2decId(const uint32_t &hi) const
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
virtual void getSummary(CaloSubdetectorGeometry::TrVec &trVector, CaloSubdetectorGeometry::IVec &iVector, CaloSubdetectorGeometry::DimVec &dimVector, CaloSubdetectorGeometry::IVec &dinsVector) const override
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
std::vector< uint32_t > const & getIndexes() const
Definition: PCaloGeometry.h:22
std::vector< uint32_t > const & getDenseIndices() const
Definition: PCaloGeometry.h:23

Definition at line 10 of file moduleDB.cc.

References HcalGeometry::alignmentTransformIndexGlobal(), HcalGeometry::alignmentTransformIndexLocal(), HcalGeometry::dbString(), HcalTopology::denseId2detId(), HcalTopology::detId2denseId(), allConversions_cfi::dz, edm::eventsetup::EventSetupRecord::get(), PCaloGeometry::getDenseIndices(), PCaloGeometry::getDimension(), HcalTopology::getHFSize(), PCaloGeometry::getIndexes(), HcalTopology::getNumberOfShapes(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CaloSubdetectorGeometry::getSummary(), PCaloGeometry::getTranslation(), mps_fire::i, hcalTTPDigis_cfi::id, edm::ESHandleBase::isValid(), findQualityFiles::jj, HcalGeometry::k_NumberOfParametersPerShape, Alignments::m_align, HcalTopology::ncells(), HcalGeometry::numberOfAlignments(), HcalGeometry::producerTag(), edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, CaloGeometryDBReader::writeFlag(), CaloGeometryDBReader::writeIndexed(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

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  edm::ESHandle<HcalTopology> hcalTopology;
54  iRecord.getRecord<HcalRecNumberingRecord>().get( hcalTopology );
55 
56  // We know that the numer of shapes chanes with changing depth
57  // so, this check is temporary disabled. We need to implement
58  // a way either to store or calculate the number of shapes or be able
59  // to deal with only max numer of shapes.
60  // assert( dvec.size() == hcalTopology->getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape ) ;
61  assert( dvec.size() <= hcalTopology->getNumberOfShapes() * HcalGeometry::k_NumberOfParametersPerShape ) ;
62  HcalGeometry* hcg = new HcalGeometry( *hcalTopology );
63 
64  PtrType ptr ( hcg );
65 
66  const unsigned int nTrParm( hcg->numberOfTransformParms());
67 
68  ptr->fillDefaultNamedParameters();
69  ptr->allocateCorners( hcalTopology->ncells()+hcalTopology->getHFSize());
70  ptr->allocatePar( dvec.size() ,
72 
73  for( unsigned int i ( 0 ) ; i < dins.size() ; ++i ) {
74  const unsigned int nPerShape ( HcalGeometry::k_NumberOfParametersPerShape );
75  DimVec dims;
76  dims.reserve( nPerShape );
77 
78  const unsigned int indx( ivec.size() == 1 ? 0 : i );
79 
80  DimVec::const_iterator dsrc( dvec.begin() + ivec[indx]*nPerShape );
81 
82  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j ) {
83  dims.push_back( *dsrc ) ;
84  ++dsrc ;
85  }
86 
87  const CCGFloat* myParm( CaloCellGeometry::getParmPtr( dims,
88  ptr->parMgr(),
89  ptr->parVecVec()));
90 
91  const DetId id( hcalTopology->denseId2detId( dins[i]));
92 
93  const unsigned int iGlob( 0 == globalPtr ? 0 :
95 
96  assert( 0 == globalPtr || iGlob < globalPtr->m_align.size());
97 
98  const AlignTransform* gt ( 0 == globalPtr ? 0 : &globalPtr->m_align[ iGlob ] );
99 
100  assert( 0 == gt || iGlob == HcalGeometry::alignmentTransformIndexGlobal( DetId( gt->rawId())));
101 
102  const unsigned int iLoc( 0 == alignPtr ? 0 :
104 
105  assert( 0 == alignPtr || iLoc < alignPtr->m_align.size());
106 
107  const AlignTransform* at( 0 == alignPtr ? 0 :
108  &alignPtr->m_align[ iLoc ]);
109 
110  assert( 0 == at || ( HcalGeometry::alignmentTransformIndexLocal( DetId( at->rawId())) == iLoc ));
111 
112  Pt3D lRef ;
113  Pt3DVec lc( 8, Pt3D( 0, 0, 0 ));
114  hcg->localCorners( lc, &dims.front(), dins[i], lRef );
115 
116  const Pt3D lBck( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] )); // ctr rear face in local
117  const Pt3D lCor( lc[0] );
118 
119  //----------------------------------- create transform from 6 numbers ---
120  const unsigned int jj( i * nTrParm ); // Note: Dence indices are not sorted and
121  // parameters stored according to order of a cell creation
122  Tr3D tr;
123  const ROOT::Math::Translation3D tl( tvec[jj], tvec[jj+1], tvec[jj+2] );
124  const ROOT::Math::EulerAngles ea( 6 == nTrParm ?
125  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
127  const ROOT::Math::Transform3D rt( ea, tl );
128  double xx, xy, xz, dx;
129  double yx, yy, yz, dy;
130  double zx, zy, zz, dz;
131  rt.GetComponents( xx, xy, xz, dx,
132  yx, yy, yz, dy,
133  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 }
unsigned int getHFSize() const
Definition: HcalTopology.h:135
CaloCellGeometry::Pt3D Pt3D
static unsigned int alignmentTransformIndexLocal(const DetId &id)
virtual unsigned int detId2denseId(const DetId &id) const
return a linear packed id
static std::string producerTag()
Definition: HcalGeometry.h:63
std::vector< float > const & getTranslation() const
Definition: PCaloGeometry.h:20
std::shared_ptr< CaloSubdetectorGeometry > PtrType
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
std::vector< float > const & getDimension() const
Definition: PCaloGeometry.h:21
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)
unsigned int getNumberOfShapes() const
Definition: HcalTopology.h:158
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
virtual DetId denseId2detId(unsigned int) const
return a linear packed id
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:41
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
bool isValid() const
Definition: ESHandle.h:47
T const * product() const
Definition: ESHandle.h:86
std::vector< uint32_t > const & getIndexes() const
Definition: PCaloGeometry.h:22
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:75
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
std::vector< uint32_t > const & getDenseIndices() const
Definition: PCaloGeometry.h:23

Definition at line 15 of file calowriters.cc.

References HcalGeometry::alignmentTransformIndexGlobal(), HcalGeometry::alignmentTransformIndexLocal(), HcalGeometry::dbString(), HcalTopology::denseId2detId(), HcalTopology::detId2denseId(), allConversions_cfi::dz, edm::eventsetup::EventSetupRecord::get(), PCaloGeometry::getDenseIndices(), PCaloGeometry::getDimension(), HcalTopology::getHFSize(), PCaloGeometry::getIndexes(), HcalTopology::getNumberOfShapes(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CaloSubdetectorGeometry::getSummary(), PCaloGeometry::getTranslation(), mps_fire::i, hcalTTPDigis_cfi::id, edm::ESHandleBase::isValid(), findQualityFiles::jj, HcalGeometry::k_NumberOfParametersPerShape, Alignments::m_align, HcalTopology::ncells(), HcalGeometry::numberOfAlignments(), HcalGeometry::producerTag(), edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, CaloGeometryDBWriter::writeFlag(), CaloGeometryDBWriter::writeIndexed(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

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 
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* hcalGeometry = new HcalGeometry( *hcalTopology );
72  PtrType ptr( hcalGeometry );
73 
74  const unsigned int nTrParm( hcalGeometry->numberOfTransformParms());
75 
76  ptr->fillDefaultNamedParameters();
77  ptr->allocateCorners( hcalTopology->ncells() + hcalTopology->getHFSize());
78  ptr->allocatePar( hcalGeometry->numberOfShapes(),
80 
81  for( unsigned int i ( 0 ) ; i < dins.size(); ++i )
82  {
83  const unsigned int nPerShape( HcalGeometry::k_NumberOfParametersPerShape );
84  DimVec dims;
85  dims.reserve( nPerShape );
86 
87  const unsigned int indx( ivec.size() == 1 ? 0 : i );
88 
89  DimVec::const_iterator dsrc( dvec.begin() + ivec[indx] * nPerShape );
90 
91  for( unsigned int j ( 0 ) ; j != nPerShape ; ++j )
92  {
93  dims.push_back( *dsrc );
94  ++dsrc ;
95  }
96 
97  const CCGFloat* myParm ( CaloCellGeometry::getParmPtr( dims,
98  ptr->parMgr(),
99  ptr->parVecVec()));
100 
101  const DetId id( hcalTopology->denseId2detId( dins[i]));
102 
103  const unsigned int iGlob( 0 == globalPtr ? 0 :
105 
106  assert( 0 == globalPtr || iGlob < globalPtr->m_align.size());
107 
108  const AlignTransform* gt( 0 == globalPtr ? 0 : &globalPtr->m_align[ iGlob ]);
109 
110  assert( 0 == gt || iGlob == HcalGeometry::alignmentTransformIndexGlobal( DetId( gt->rawId())));
111 
112  const unsigned int iLoc( 0 == alignPtr ? 0 :
114 
115  assert( 0 == alignPtr || iLoc < alignPtr->m_align.size());
116 
117  const AlignTransform* at( 0 == alignPtr ? 0 :
118  &alignPtr->m_align[ iLoc ]);
119 
120  assert( 0 == at || ( HcalGeometry::alignmentTransformIndexLocal( DetId( at->rawId())) == iLoc ));
121 
122  Pt3D lRef;
123  Pt3DVec lc( 8, Pt3D( 0, 0, 0 ));
124  hcalGeometry->localCorners( lc, &dims.front(), dins[i], lRef );
125 
126  const Pt3D lBck( 0.25*(lc[4]+lc[5]+lc[6]+lc[7] )); // ctr rear face in local
127  const Pt3D lCor( lc[0] ) ;
128 
129  //----------------------------------- create transform from 6 numbers ---
130  const unsigned int jj( i * nTrParm );
131 
132  Tr3D tr;
133  const ROOT::Math::Translation3D tl( tvec[jj], tvec[jj+1], tvec[jj+2] );
134  const ROOT::Math::EulerAngles ea( 6 == nTrParm ?
135  ROOT::Math::EulerAngles( tvec[jj+3], tvec[jj+4], tvec[jj+5] ) :
137  const ROOT::Math::Transform3D rt( ea, tl );
138  double xx, xy, xz, dx;
139  double yx, yy, yz, dy;
140  double zx, zy, zz, dz;
141  rt.GetComponents(xx,xy,xz,dx,yx,yy,yz,dy,zx,zy,zz,dz) ;
142  tr = Tr3D( CLHEP::HepRep3x3( xx, xy, xz,
143  yx, yy, yz,
144  zx, zy, zz ),
145  CLHEP::Hep3Vector( dx, dy, dz ));
146 
147  // now prepend alignment(s) for final transform
148  const Tr3D atr( 0 == at ? tr :
149  ( 0 == gt ? at->transform() * tr :
150  at->transform() * gt->transform() * tr ));
151  //--------------------------------- done making transform ---------------
152 
153  const Pt3D gRef( atr*lRef );
154  const GlobalPoint fCtr( gRef.x(), gRef.y(), gRef.z());
155  const Pt3D gBck( atr*lBck );
156  const GlobalPoint fBck( gBck.x(), gBck.y(), gBck.z());
157  const Pt3D gCor( atr*lCor );
158  const GlobalPoint fCor( gCor.x(), gCor.y(), gCor.z());
159 
160  assert( hcalTopology->detId2denseId(id) == dins[i] );
161  ptr->newCell( fCtr, fBck, fCor, myParm, id );
162  }
163 
164  ptr->initializeParms(); // initializations; must happen after cells filled
165 
166  return ptr;
167 }
unsigned int getHFSize() const
Definition: HcalTopology.h:135
CaloCellGeometry::Pt3D Pt3D
static unsigned int alignmentTransformIndexLocal(const DetId &id)
virtual unsigned int detId2denseId(const DetId &id) const
return a linear packed id
static std::string producerTag()
Definition: HcalGeometry.h:63
std::vector< float > const & getTranslation() const
Definition: PCaloGeometry.h:20
std::shared_ptr< CaloSubdetectorGeometry > PtrType
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
std::vector< float > const & getDimension() const
Definition: PCaloGeometry.h:21
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
CaloSubdetectorGeometry::IVec IVec
unsigned int getNumberOfShapes() const
Definition: HcalTopology.h:158
static unsigned int alignmentTransformIndexGlobal(const DetId &id)
CaloCellGeometry::CCGFloat CCGFloat
CaloSubdetectorGeometry::TrVec TrVec
virtual DetId denseId2detId(unsigned int) const
return a linear packed id
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:41
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
CaloSubdetectorGeometry::DimVec DimVec
bool isValid() const
Definition: ESHandle.h:47
T const * product() const
Definition: ESHandle.h:86
static void writeIndexed(const TrVec &tvec, const DimVec &dvec, const IVec &ivec, const IVec &dins, std::string tag)
std::vector< uint32_t > const & getIndexes() const
Definition: PCaloGeometry.h:22
static unsigned int numberOfAlignments()
Definition: HcalGeometry.h:75
virtual unsigned int ncells() const
return a count of valid cells (for dense indexing use)
std::vector< uint32_t > const & getDenseIndices() const
Definition: PCaloGeometry.h:23
template<class T, class U>
PtrType CaloGeometryDBEP< T, U >::produceAligned ( const typename T::AlignedRecord &  iRecord)
inline

Definition at line 62 of file CaloGeometryDBEP.h.

References allConversions_cfi::dz, PCaloGeometry::getDimension(), PCaloGeometry::getIndexes(), CaloCellGeometry::getParmPtr(), CaloSubdetectorGeometry::getSummary(), PCaloGeometry::getTranslation(), mps_fire::i, hcalTTPDigis_cfi::id, edm::ESHandleBase::isValid(), findQualityFiles::jj, Alignments::m_align, CaloGeometryDBEP< T, U >::m_applyAlignment, edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, TriggerAnalyzer::write(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

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

Definition at line 164 of file moduleDB.cc.

References CaloTowerGeometry::alignmentTransformIndexGlobal(), CaloTowerGeometry::alignmentTransformIndexLocal(), CaloTowerGeometry::dbString(), CaloTowerTopology::denseIndex(), CaloTowerTopology::detIdFromDenseIndex(), allConversions_cfi::dz, edm::eventsetup::EventSetupRecord::get(), PCaloGeometry::getDenseIndices(), PCaloGeometry::getDimension(), PCaloGeometry::getIndexes(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CaloSubdetectorGeometry::getSummary(), PCaloGeometry::getTranslation(), mps_fire::i, hcalTTPDigis_cfi::id, edm::ESHandleBase::isValid(), findQualityFiles::jj, CaloTowerGeometry::k_NumberOfParametersPerShape, CaloTowerGeometry::localCorners(), Alignments::m_align, CaloTowerGeometry::numberOfAlignments(), CaloTowerGeometry::numberOfCellsForCorners(), CaloTowerGeometry::numberOfParametersPerShape(), CaloTowerGeometry::numberOfShapes(), CaloTowerGeometry::producerTag(), edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, CaloGeometryDBReader::writeFlag(), CaloGeometryDBReader::writeIndexed(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

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 
216  assert( dvec.size() == ctg->numberOfShapes() * CaloTowerGeometry::k_NumberOfParametersPerShape ) ;
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 }
CaloCellGeometry::Pt3D Pt3D
virtual unsigned int numberOfCellsForCorners() const
unsigned int alignmentTransformIndexLocal(const DetId &id)
std::vector< float > const & getTranslation() const
Definition: PCaloGeometry.h:20
std::shared_ptr< CaloSubdetectorGeometry > PtrType
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
std::vector< float > const & getDimension() const
Definition: PCaloGeometry.h:21
virtual void getSummary(TrVec &trVector, IVec &iVector, DimVec &dimVector, IVec &dinsVector) const
static std::string producerTag()
CaloSubdetectorGeometry::IVec IVec
CaloTowerDetId detIdFromDenseIndex(uint32_t din) const
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()
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
uint32_t denseIndex(const DetId &id) const
static void localCorners(Pt3DVec &lc, const CCGFloat *pv, unsigned int i, Pt3D &ref)
Definition: DetId.h:18
AlgebraicVector EulerAngles
Definition: Definitions.h:36
CaloCellGeometry::Pt3DVec Pt3DVec
CaloCellGeometry::Tr3D Tr3D
CaloCellGeometry::Tr3D Tr3D
virtual unsigned int numberOfShapes() const
CaloSubdetectorGeometry::DimVec DimVec
bool isValid() const
Definition: ESHandle.h:47
T const * product() const
Definition: ESHandle.h:86
std::vector< uint32_t > const & getIndexes() const
Definition: PCaloGeometry.h:22
std::vector< uint32_t > const & getDenseIndices() const
Definition: PCaloGeometry.h:23
static unsigned int numberOfAlignments()

Definition at line 171 of file calowriters.cc.

References CaloTowerGeometry::alignmentTransformIndexGlobal(), CaloTowerGeometry::alignmentTransformIndexLocal(), CaloTowerGeometry::dbString(), CaloTowerTopology::denseIndex(), CaloTowerTopology::detIdFromDenseIndex(), allConversions_cfi::dz, edm::eventsetup::EventSetupRecord::get(), PCaloGeometry::getDenseIndices(), PCaloGeometry::getDimension(), PCaloGeometry::getIndexes(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), CaloSubdetectorGeometry::getSummary(), PCaloGeometry::getTranslation(), mps_fire::i, hcalTTPDigis_cfi::id, edm::ESHandleBase::isValid(), findQualityFiles::jj, CaloTowerGeometry::k_NumberOfParametersPerShape, CaloTowerGeometry::localCorners(), Alignments::m_align, CaloTowerGeometry::numberOfAlignments(), CaloTowerGeometry::numberOfCellsForCorners(), CaloTowerGeometry::numberOfParametersPerShape(), CaloTowerGeometry::numberOfShapes(), CaloTowerGeometry::producerTag(), edm::ESHandle< T >::product(), AlCaHLTBitMon_QueryRunRegistry::string, CaloGeometryDBWriter::writeFlag(), CaloGeometryDBWriter::writeIndexed(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, geometryCSVtoXML::yy, geometryCSVtoXML::yz, and geometryCSVtoXML::zz.

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

Definition at line 325 of file calowriters.cc.

References FlatTrd::createCorners(), HGCalGeometry::dbString(), allConversions_cfi::dz, HGCalTopology::encode(), relativeConstraints::geom, HGCalTopology::geomDenseId2decId(), PCaloGeometry::getDenseIndices(), PCaloGeometry::getDimension(), PCaloGeometry::getIndexes(), CaloCellGeometry::getParmPtr(), edm::eventsetup::DependentRecordImplementation< RecordT, ListT >::getRecord(), HGCalGeometry::getSummary(), PCaloGeometry::getTranslation(), findQualityFiles::jj, HGCalGeometry::k_NumberOfParametersPerShape, HGCalGeometry::k_NumberOfShapes, PV3DBase< T, PVType, FrameType >::mag2(), dataset::name, CaloSubdetectorTopology::ncells(), AlCaHLTBitMon_QueryRunRegistry::string, std::swap(), ecaldqm::topology(), HGCalTopology::totalGeomModules(), CaloGeometryDBWriter::writeFlag(), CaloGeometryDBWriter::writeIndexed(), x(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::xz, detailsBasic3DVector::y, geometryCSVtoXML::yy, geometryCSVtoXML::yz, detailsBasic3DVector::z, and geometryCSVtoXML::zz.

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

Member Data Documentation

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

Definition at line 212 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 213 of file CaloGeometryDBEP.h.