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  theComp11Flag(comp11)
29 { }
30 
32 { }
33 
35 {
36  const std::vector<DetId>& detids(rgeo.detIds());
38 
40  std::vector<double>::const_iterator tranStart;
41  std::vector<double>::const_iterator shapeStart;
42  std::vector<double>::const_iterator rotStart;
43  std::vector<std::string>::const_iterator strStart;
44 
45  for (unsigned int id = 0; id < detids.size(); ++id)
46  {
47  GEMDetId gemid(detids[id]);
48  // GEMDetId chid(gemid.region(),gemid.ring(),gemid.station(),
49  // gemid.sector(),gemid.layer(),gemid.subsector(),0);
50 
51  tranStart = rgeo.tranStart(id);
52  shapeStart = rgeo.shapeStart(id);
53  rotStart = rgeo.rotStart(id);
54  strStart = rgeo.strStart(id);
55  name = *(strStart);
56 
57  Surface::PositionType pos(*(tranStart)/cm,*(tranStart+1)/cm, *(tranStart+2)/cm);
58  // CLHEP way
59  Surface::RotationType rot(*(rotStart+0), *(rotStart+1), *(rotStart+2),
60  *(rotStart+3), *(rotStart+4), *(rotStart+5),
61  *(rotStart+6), *(rotStart+7), *(rotStart+8));
62 
63  Bounds* bounds = 0;
64  float be = *(shapeStart+0)/cm;
65  float te = *(shapeStart+1)/cm;
66  float ap = *(shapeStart+2)/cm;
67  float ti = *(shapeStart+3)/cm;
68  float nstrip = *(shapeStart+4);
69  float npad = *(shapeStart+5);
70  // TrapezoidalPlaneBounds*
71  bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
72 
73  std::vector<float> pars;
74  pars.push_back(be); //b/2;
75  pars.push_back(te); //B/2;
76  pars.push_back(ap); //h/2;
77  pars.push_back(nstrip);
78  pars.push_back(npad);
79 
81 
82  //Change of axes for the forward
83  Basic3DVector<float> newX(1.,0.,0.);
84  Basic3DVector<float> newY(0.,0.,1.);
85  // if (tran[2] > 0. )
86  newY *= -1;
87  Basic3DVector<float> newZ(0.,1.,0.);
88  rot.rotateAxes (newX, newY, newZ);
89 
90 
91  BoundPlane* bp = new BoundPlane(pos, rot, bounds);
93  GEMEtaPartition* gep=new GEMEtaPartition(gemid, surf, e_p_specs);
94  geometry->add(gep);
95 
96 
97  std::list<GEMEtaPartition *> gepls;
98  /*
99  if (chids.find(chid)!=chids.end()){
100  gepls = chids[chid];
101  }
102  */
103  gepls.push_back(gep);
104  //chids[chid]=gepls;
105 
106  }
107  /*
108  // Create the GEMChambers and store them on the Geometry
109 
110  for( std::map<GEMDetId, std::list<GEMEtaPartition *> >::iterator ich=chids.begin();
111  ich != chids.end(); ich++){
112  GEMDetId chid = ich->first;
113  std::list<GEMEtaPartition * > gepls = ich->second;
114 
115  // compute the overall boundplane. At the moment we use just the last
116  // surface
117  BoundPlane* bp=0;
118  for(std::list<GEMEtaPartition *>::iterator gepl=gepls.begin();
119  gepl!=gepls.end(); gepl++){
120  const BoundPlane& bps = (*gepl)->surface();
121  bp = const_cast<BoundPlane *>(&bps);
122  }
123 
124  ReferenceCountingPointer<BoundPlane> surf(bp);
125  // Create the chamber
126  GEMChamber* ch = new GEMChamber (chid, surf);
127  // Add the etaps to rhe chamber
128  for(std::list<GEMEtaPartition *>::iterator gepl=gepls.begin();
129  gepl!=gepls.end(); gepl++){
130  ch->add(*gepl);
131  }
132  // Add the chamber to the geometry
133  geometry->add(ch);
134 
135  }
136  */
137  return geometry;
138 }
139 
140 
141 
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