test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalEndcapGeometryLoaderFromDDD.cc
Go to the documentation of this file.
5 
7 
8 template <>
9 void
11  const EcalEGL::ParmVec& vv,
12  const HepGeom::Transform3D& tr,
13  const DetId& id );
14 template <>
15 void
18 
19 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
20 
23 
24 template <>
25 void
27  const EcalEGL::ParmVec& vv,
28  const HepGeom::Transform3D& tr,
29  const DetId& id )
30 {
31  std::vector<CCGFloat> pv ;
32  pv.reserve( vv.size() ) ;
33  for( unsigned int i ( 0 ) ; i != vv.size() ; ++i )
34  {
35  const CCGFloat factor ( 1==i || 2==i || 6==i || 10==i ? 1 : k_ScaleFromDDDtoGeant ) ;
36  pv.push_back( factor*vv[i] ) ;
37  }
38 
39  std::vector<GlobalPoint> corners (8);
40 
41  TruncatedPyramid::createCorners( pv, tr, corners ) ;
42 
43  const CCGFloat* parmPtr ( CaloCellGeometry::getParmPtr( pv,
44  geom->parMgr(),
45  geom->parVecVec() ) ) ;
46 
47  const GlobalPoint front ( 0.25*( corners[0].x() +
48  corners[1].x() +
49  corners[2].x() +
50  corners[3].x() ),
51  0.25*( corners[0].y() +
52  corners[1].y() +
53  corners[2].y() +
54  corners[3].y() ),
55  0.25*( corners[0].z() +
56  corners[1].z() +
57  corners[2].z() +
58  corners[3].z() ) ) ;
59 
60  const GlobalPoint back ( 0.25*( corners[4].x() +
61  corners[5].x() +
62  corners[6].x() +
63  corners[7].x() ),
64  0.25*( corners[4].y() +
65  corners[5].y() +
66  corners[6].y() +
67  corners[7].y() ),
68  0.25*( corners[4].z() +
69  corners[5].z() +
70  corners[6].z() +
71  corners[7].z() ) ) ;
72 
73  geom->newCell( front, back, corners[0],
74  parmPtr,
75  id ) ;
76 }
77 
78 template <>
79 void
82 {
83  DDFilteredView fv = _fv;
84  bool doSubDets = fv.firstChild();
85  while (doSubDets)
86  {
87  DDsvalues_type sv ( fv.mergedSpecifics() ) ;
88 
89  //ncrys
90  DDValue valNcrys("ncrys");
91  if( DDfetch( &sv, valNcrys ) )
92  {
93  const std::vector<double>& fvec = valNcrys.doubles();
94 
95  // this parameter can only appear once
96  assert(fvec.size() == 1);
97  geom->setNumberOfCrystalPerModule((int)fvec[0]);
98  }
99  else
100  continue;
101 
102  //nmods
103  DDValue valNmods("nmods");
104  if( DDfetch( &sv, valNmods ) )
105  {
106  const std::vector<double>& fmvec = valNmods.doubles() ;
107 
108  // there can only be one such value
109  assert(fmvec.size() == 1);
110  geom->setNumberOfModules((int)fmvec[0]);
111  }
112 
113  break;
114 
115  doSubDets = fv.nextSibling(); // go to next layer
116  }
117 }
int i
Definition: DBlmapReader.cc:9
void setNumberOfCrystalPerModule(const int nncrys)
bool nextSibling()
set the current node to the next sibling ...
assert(m_qm.get())
CaloGeometryLoader< EcalEndcapGeometry > EcalEGL
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
std::vector< double > ParmVec
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
void setNumberOfModules(const int nnmods)
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:19
CaloCellGeometry::CCGFloat CCGFloat
static const CCGFloat * getParmPtr(const std::vector< CCGFloat > &vd, ParMgr *mgr, ParVecVec &pvv)
Definition: DetId.h:18
DDsvalues_type mergedSpecifics() const
void fillGeom(T *geom, const ParmVec &pv, const HepGeom::Transform3D &tr, const DetId &id)
void fillNamedParams(const DDFilteredView &fv, T *geom)
static const double k_ScaleFromDDDtoGeant
static void createCorners(const std::vector< CCGFloat > &pv, const Tr3D &tr, std::vector< GlobalPoint > &co)
bool firstChild()
set the current node to the first child ...