test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalBarrelGeometryLoaderFromDDD.cc
Go to the documentation of this file.
5 
7 
8 template <>
9 void
11  const EcalBGL::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 EcalBGL::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 :
37 
38  pv.push_back( factor*vv[i] ) ;
39  }
40 
41  std::vector<GlobalPoint> corners (8);
42 
43  TruncatedPyramid::createCorners( pv, tr, corners ) ;
44 
45  const CCGFloat* parmPtr ( CaloCellGeometry::getParmPtr( pv,
46  geom->parMgr(),
47  geom->parVecVec() ) ) ;
48 
49  const GlobalPoint front ( 0.25*( corners[0].x() +
50  corners[1].x() +
51  corners[2].x() +
52  corners[3].x() ),
53  0.25*( corners[0].y() +
54  corners[1].y() +
55  corners[2].y() +
56  corners[3].y() ),
57  0.25*( corners[0].z() +
58  corners[1].z() +
59  corners[2].z() +
60  corners[3].z() ) ) ;
61 
62  const GlobalPoint back ( 0.25*( corners[4].x() +
63  corners[5].x() +
64  corners[6].x() +
65  corners[7].x() ),
66  0.25*( corners[4].y() +
67  corners[5].y() +
68  corners[6].y() +
69  corners[7].y() ),
70  0.25*( corners[4].z() +
71  corners[5].z() +
72  corners[6].z() +
73  corners[7].z() ) ) ;
74 
75  geom->newCell( front, back, corners[0],
76  parmPtr,
77  id ) ;
78 }
79 
80 template <>
81 void
84 {
85  DDFilteredView fv = _fv;
86  bool doSubDets = fv.firstChild();
87 
88  while( doSubDets )
89  {
91 
92  //nxtalPhi
93  DDValue valnPhi("nxtalPhi");
94  if( DDfetch( &sv, valnPhi ) )
95  {
96  const std::vector<double>& fvec = valnPhi.doubles();
97 
98  // this parameter can only appear once
99  assert(fvec.size() == 1);
100  geom->setNumXtalsPhiDirection((int)fvec[0]);
101  }
102  else
103  continue;
104 
105 
106  DDValue valnEta("nxtalEta");
107  if( DDfetch( &sv, valnEta ) )
108  {
109  const std::vector<double>& fmvec = valnEta.doubles();
110 
111  // there can only be one such value
112  assert(fmvec.size() == 1);
113 
114  geom->setNumXtalsEtaDirection((int)fmvec[0]);
115  }
116  else
117  // once we find nxtalPhi, the rest must also be defined
118  assert( 1 == 0 );
119 
120  //EtaBaskets
121  DDValue valEtaB("EtaBaskets");
122  if( DDfetch( &sv, valEtaB ) )
123  {
124  const std::vector<double>& ebvec = valEtaB.doubles();
125  assert(ebvec.size() > 0);
126  std::vector<int> EtaBaskets;
127  EtaBaskets.resize(ebvec.size());
128  for (unsigned i = 0; i<ebvec.size(); ++i)
129  EtaBaskets[i] = (int) ebvec[i];
130  geom->setEtaBaskets(EtaBaskets);
131  }
132  else
133  // once we find nxtalPhi, the rest must also be defined
134  assert( 1 == 0 );
135 
136  //PhiBaskets
137  DDValue valPhi("PhiBaskets");
138  if (DDfetch(&sv,valPhi))
139  {
140  const std::vector<double> & pvec = valPhi.doubles();
141  assert(pvec.size() > 0);
142  geom->setBasketSizeInPhi((int)pvec[0]);
143  }
144  else
145  // once we find nxtalPhi, the rest must also be defined
146  assert( 1 == 0 );
147 
148  break;
149 
150  doSubDets = fv.nextSibling(); // go to next layer
151  }
152 }
153 
int i
Definition: DBlmapReader.cc:9
void setNumXtalsEtaDirection(const int &nnxtalEta)
bool nextSibling()
set the current node to the next sibling ...
assert(m_qm.get())
void setBasketSizeInPhi(const int &PhiBaskets)
std::vector< double > ParmVec
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
void setEtaBaskets(const std::vector< int > &EtaBaskets)
void setNumXtalsPhiDirection(const int &nnxtalPhi)
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)
virtual void newCell(const GlobalPoint &f1, const GlobalPoint &f2, const GlobalPoint &f3, const CCGFloat *parm, const DetId &detId)
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 ...
CaloGeometryLoader< EcalBarrelGeometry > EcalBGL