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.
2 
4 
6 #include "Geometry/CaloEventSetup/interface/CaloGeometryLoader.icc"
7 
9 
11 //#include "DetectorDescription/Core/interface/DDInit.h"
12 
13 
14 #include <iostream>
15 #include <vector>
16 
18 
20 
21 template <>
22 void
24  const EcalEGL::ParmVec& vv ,
25  const HepGeom::Transform3D& tr ,
26  const DetId& id )
27 {
28  std::vector<CCGFloat> pv ;
29  pv.reserve( vv.size() ) ;
30  for( unsigned int i ( 0 ) ; i != vv.size() ; ++i )
31  {
32  const CCGFloat factor ( 1==i || 2==i || 6==i || 10==i ? 1 : k_ScaleFromDDDtoGeant ) ;
33  pv.push_back( factor*vv[i] ) ;
34  }
35 
36  std::vector<GlobalPoint> corners (8);
37 
38  TruncatedPyramid::createCorners( pv, tr, corners ) ;
39 
40  const CCGFloat* parmPtr ( CaloCellGeometry::getParmPtr( pv,
41  geom->parMgr(),
42  geom->parVecVec() ) ) ;
43 
44  const GlobalPoint front ( 0.25*( corners[0].x() +
45  corners[1].x() +
46  corners[2].x() +
47  corners[3].x() ),
48  0.25*( corners[0].y() +
49  corners[1].y() +
50  corners[2].y() +
51  corners[3].y() ),
52  0.25*( corners[0].z() +
53  corners[1].z() +
54  corners[2].z() +
55  corners[3].z() ) ) ;
56 
57  const GlobalPoint back ( 0.25*( corners[4].x() +
58  corners[5].x() +
59  corners[6].x() +
60  corners[7].x() ),
61  0.25*( corners[4].y() +
62  corners[5].y() +
63  corners[6].y() +
64  corners[7].y() ),
65  0.25*( corners[4].z() +
66  corners[5].z() +
67  corners[6].z() +
68  corners[7].z() ) ) ;
69 
70  geom->newCell( front, back, corners[0],
71  parmPtr,
72  id ) ;
73 }
74 
75 template <>
76 void
79 {
80  bool doSubDets = fv.firstChild();
81  while (doSubDets)
82  {
83  DDsvalues_type sv ( fv.mergedSpecifics() ) ;
84 
85  //ncrys
86  DDValue valNcrys("ncrys");
87  if( DDfetch( &sv, valNcrys ) )
88  {
89  const std::vector<double>& fvec = valNcrys.doubles();
90 
91  // this parameter can only appear once
92  assert(fvec.size() == 1);
93  geom->setNumberOfCrystalPerModule((int)fvec[0]);
94  }
95  else
96  continue;
97 
98  //nmods
99  DDValue valNmods("nmods");
100  if( DDfetch( &sv, valNmods ) )
101  {
102  const std::vector<double>& fmvec = valNmods.doubles() ;
103 
104  // there can only be one such value
105  assert(fmvec.size() == 1);
106  geom->setNumberOfModules((int)fmvec[0]);
107  }
108 
109  break;
110 
111  doSubDets = fv.nextSibling(); // go to next layer
112  }
113 }
int i
Definition: DBlmapReader.cc:9
void setNumberOfCrystalPerModule(const int nncrys)
bool nextSibling()
set the current node to the next sibling ...
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:102
void setNumberOfModules(const int nnmods)
double double double z
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)
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