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.
2 
4 
6 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
7 
9 
10 //#include "DetectorDescription/Core/interface/DDInit.h"
12 
14 
16 
17 template <>
18 void
20  const EcalBGL::ParmVec& vv ,
21  const HepGeom::Transform3D& tr ,
22  const DetId& id )
23 {
24  std::vector<CCGFloat> pv ;
25  pv.reserve( vv.size() ) ;
26  for( unsigned int i ( 0 ) ; i != vv.size() ; ++i )
27  {
28  const CCGFloat factor ( 1==i || 2==i || 6==i || 10==i ? 1 :
30 
31  pv.push_back( factor*vv[i] ) ;
32  }
33 
34  std::vector<GlobalPoint> corners (8);
35 
36  TruncatedPyramid::createCorners( pv, tr, corners ) ;
37 
38  const CCGFloat* parmPtr ( CaloCellGeometry::getParmPtr( pv,
39  geom->parMgr(),
40  geom->parVecVec() ) ) ;
41 
42  const GlobalPoint front ( 0.25*( corners[0].x() +
43  corners[1].x() +
44  corners[2].x() +
45  corners[3].x() ),
46  0.25*( corners[0].y() +
47  corners[1].y() +
48  corners[2].y() +
49  corners[3].y() ),
50  0.25*( corners[0].z() +
51  corners[1].z() +
52  corners[2].z() +
53  corners[3].z() ) ) ;
54 
55  const GlobalPoint back ( 0.25*( corners[4].x() +
56  corners[5].x() +
57  corners[6].x() +
58  corners[7].x() ),
59  0.25*( corners[4].y() +
60  corners[5].y() +
61  corners[6].y() +
62  corners[7].y() ),
63  0.25*( corners[4].z() +
64  corners[5].z() +
65  corners[6].z() +
66  corners[7].z() ) ) ;
67 
68  geom->newCell( front, back, corners[0],
69  parmPtr,
70  id ) ;
71 }
72 
73 template <>
74 void
77 {
78  bool doSubDets = fv.firstChild();
79 
80  while( doSubDets )
81  {
83 
84  //nxtalPhi
85  DDValue valnPhi("nxtalPhi");
86  if( DDfetch( &sv, valnPhi ) )
87  {
88  const std::vector<double>& fvec = valnPhi.doubles();
89 
90  // this parameter can only appear once
91  assert(fvec.size() == 1);
92  geom->setNumXtalsPhiDirection((int)fvec[0]);
93  }
94  else
95  continue;
96 
97 
98  DDValue valnEta("nxtalEta");
99  if( DDfetch( &sv, valnEta ) )
100  {
101  const std::vector<double>& fmvec = valnEta.doubles();
102 
103  // there can only be one such value
104  assert(fmvec.size() == 1);
105 
106  geom->setNumXtalsEtaDirection((int)fmvec[0]);
107  }
108  else
109  // once we find nxtalPhi, the rest must also be defined
110  assert( 1 == 0 );
111 
112  //EtaBaskets
113  DDValue valEtaB("EtaBaskets");
114  if( DDfetch( &sv, valEtaB ) )
115  {
116  const std::vector<double>& ebvec = valEtaB.doubles();
117  assert(ebvec.size() > 0);
118  std::vector<int> EtaBaskets;
119  EtaBaskets.resize(ebvec.size());
120  for (unsigned i = 0; i<ebvec.size(); ++i)
121  EtaBaskets[i] = (int) ebvec[i];
122  geom->setEtaBaskets(EtaBaskets);
123  }
124  else
125  // once we find nxtalPhi, the rest must also be defined
126  assert( 1 == 0 );
127 
128  //PhiBaskets
129  DDValue valPhi("PhiBaskets");
130  if (DDfetch(&sv,valPhi))
131  {
132  const std::vector<double> & pvec = valPhi.doubles();
133  assert(pvec.size() > 0);
134  geom->setBasketSizeInPhi((int)pvec[0]);
135  }
136  else
137  // once we find nxtalPhi, the rest must also be defined
138  assert( 1 == 0 );
139 
140  break;
141 
142  doSubDets = fv.nextSibling(); // go to next layer
143  }
144 }
145 
int i
Definition: DBlmapReader.cc:9
void setNumXtalsEtaDirection(const int &nnxtalEta)
bool nextSibling()
set the current node to the next sibling ...
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:102
void setEtaBaskets(const std::vector< int > &EtaBaskets)
double double double z
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)
void fillNamedParams(DDFilteredView fv, T *geom)
Definition: DetId.h:20
DDsvalues_type mergedSpecifics() const
void fillGeom(T *geom, const ParmVec &pv, const HepGeom::Transform3D &tr, const DetId &id)
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 ...
x
Definition: VDTMath.h:216
CaloGeometryLoader< EcalBarrelGeometry > EcalBGL