CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GEMGeometryBuilderFromCondDB.cc
Go to the documentation of this file.
1 
8 
12 
16 
19 
21 
22 #include "CLHEP/Units/GlobalSystemOfUnits.h"
23 
24 #include <iostream>
25 #include <algorithm>
26 
28 { }
29 
31 { }
32 
34 {
35  const std::vector<DetId>& detids(rgeo.detIds());
37 
39  std::vector<double>::const_iterator tranStart;
40  std::vector<double>::const_iterator shapeStart;
41  std::vector<double>::const_iterator rotStart;
42  std::vector<std::string>::const_iterator strStart;
43 
44  for (unsigned int id = 0; id < detids.size(); ++id)
45  {
46  GEMDetId gemid(detids[id]);
47  // GEMDetId chid(gemid.region(),gemid.ring(),gemid.station(),
48  // gemid.sector(),gemid.layer(),gemid.subsector(),0);
49 
50  tranStart = rgeo.tranStart(id);
51  shapeStart = rgeo.shapeStart(id);
52  rotStart = rgeo.rotStart(id);
53  strStart = rgeo.strStart(id);
54  name = *(strStart);
55 
56  Surface::PositionType pos(*(tranStart)/cm,*(tranStart+1)/cm, *(tranStart+2)/cm);
57  // CLHEP way
58  Surface::RotationType rot(*(rotStart+0), *(rotStart+1), *(rotStart+2),
59  *(rotStart+3), *(rotStart+4), *(rotStart+5),
60  *(rotStart+6), *(rotStart+7), *(rotStart+8));
61 
62  Bounds* bounds = 0;
63  float be = *(shapeStart+0)/cm;
64  float te = *(shapeStart+1)/cm;
65  float ap = *(shapeStart+2)/cm;
66  float ti = *(shapeStart+3)/cm;
67  float nstrip = *(shapeStart+4);
68  float npad = *(shapeStart+5);
69  // TrapezoidalPlaneBounds*
70  bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
71 
72  std::vector<float> pars;
73  pars.push_back(be); //b/2;
74  pars.push_back(te); //B/2;
75  pars.push_back(ap); //h/2;
76  pars.push_back(nstrip);
77  pars.push_back(npad);
78 
80 
81  //Change of axes for the forward
82  Basic3DVector<float> newX(1.,0.,0.);
83  Basic3DVector<float> newY(0.,0.,1.);
84  // if (tran[2] > 0. )
85  newY *= -1;
86  Basic3DVector<float> newZ(0.,1.,0.);
87  rot.rotateAxes (newX, newY, newZ);
88 
89 
90  BoundPlane* bp = new BoundPlane(pos, rot, bounds);
92  GEMEtaPartition* gep=new GEMEtaPartition(gemid, surf, e_p_specs);
93  geometry->add(gep);
94 
95 
96  std::list<GEMEtaPartition *> gepls;
97  /*
98  if (chids.find(chid)!=chids.end()){
99  gepls = chids[chid];
100  }
101  */
102  gepls.push_back(gep);
103  //chids[chid]=gepls;
104 
105  }
106  /*
107  // Create the GEMChambers and store them on the Geometry
108 
109  for( std::map<GEMDetId, std::list<GEMEtaPartition *> >::iterator ich=chids.begin();
110  ich != chids.end(); ich++){
111  GEMDetId chid = ich->first;
112  std::list<GEMEtaPartition * > gepls = ich->second;
113 
114  // compute the overall boundplane. At the moment we use just the last
115  // surface
116  BoundPlane* bp=0;
117  for(std::list<GEMEtaPartition *>::iterator gepl=gepls.begin();
118  gepl!=gepls.end(); gepl++){
119  const BoundPlane& bps = (*gepl)->surface();
120  bp = const_cast<BoundPlane *>(&bps);
121  }
122 
123  ReferenceCountingPointer<BoundPlane> surf(bp);
124  // Create the chamber
125  GEMChamber* ch = new GEMChamber (chid, surf);
126  // Add the etaps to rhe chamber
127  for(std::list<GEMEtaPartition *>::iterator gepl=gepls.begin();
128  gepl!=gepls.end(); gepl++){
129  ch->add(*gepl);
130  }
131  // Add the chamber to the geometry
132  geometry->add(ch);
133 
134  }
135  */
136  return geometry;
137 }
138 
139 
140 
std::vector< double >::const_iterator rotStart(size_t ind) const
TkRotation & rotateAxes(const Basic3DVector< T > &newX, const Basic3DVector< T > &newY, const Basic3DVector< T > &newZ)
std::vector< std::string >::const_iterator strStart(size_t ind) const
std::vector< double >::const_iterator tranStart(size_t ind) const
GEMGeometry * build(const RecoIdealGeometry &rgeo)
const std::vector< DetId > & detIds() const
ESHandle< TrackerGeometry > geometry
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: Bounds.h:22