test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ME0GeometryBuilderFromCondDB.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  ME0DetId me0id( detids[id]);
47 
48  tranStart = rgeo.tranStart(id);
49  shapeStart = rgeo.shapeStart(id);
50  rotStart = rgeo.rotStart(id);
51  strStart = rgeo.strStart(id);
52  name = *(strStart);
53 
54  Surface::PositionType pos(*(tranStart)/cm,*(tranStart+1)/cm, *(tranStart+2)/cm);
55  // CLHEP way
56  Surface::RotationType rot(*(rotStart+0), *(rotStart+1), *(rotStart+2),
57  *(rotStart+3), *(rotStart+4), *(rotStart+5),
58  *(rotStart+6), *(rotStart+7), *(rotStart+8));
59 
60  Bounds* bounds = 0;
61  float be = *(shapeStart+0)/cm;
62  float te = *(shapeStart+1)/cm;
63  float ap = *(shapeStart+2)/cm;
64  float ti = *(shapeStart+3)/cm;
65  // float nstrip = *(shapeStart+4);
66  //float npad = *(shapeStart+5);
67  // TrapezoidalPlaneBounds*
68  bounds = new TrapezoidalPlaneBounds(be, te, ap, ti);
69 
70  std::vector<float> pars;
71  pars.push_back(be); //b/2;
72  pars.push_back(te); //B/2;
73  pars.push_back(ap); //h/2;
74  float nstrip = -999.;
75  float npad = -999.;
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  BoundPlane* bp = new BoundPlane(pos, rot, bounds);
91  ME0EtaPartition* mep=new ME0EtaPartition(me0id, surf, e_p_specs);
92  geometry->add(mep);
93  }
94  return geometry;
95 }
96 
97 
98 
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
const std::vector< DetId > & detIds() const
ME0Geometry * build(const RecoIdealGeometry &rgeo)
ESHandle< TrackerGeometry > geometry
std::vector< double >::const_iterator shapeStart(size_t ind) const
Definition: Bounds.h:22